[ / / / / / / / / / ] [ dir / ask / dcaco / fur / hypno / o / sl / ttgg / u ][Options][ watchlist ]

/prog/ - Programming

Programming board

Catalog

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 1444613302638.png (7.45 KB, 375x375, 1:1, lambda.png) (h) (u)

[–]

3fc87d (2) No.3417[Watch Thread][Show All Posts]

Hey /prog/, I'm building a language. Here's an example, its the factorial function:


def is-zero [id, #0] =
def decr [id, #1] -
def ! is-zero -> #1 ; [id, decr!]

This should give you a feel for the syntax of the language. All of it. There are no variables, everything is a function application. Tuples, denoted [a,b … z] provide a way of destructing and restructuring data without explicit variables. Here's the basic evaluation rules:

[f1, f2, … fn] applied to a is equal to [f1 applied to a, f2 applied to a, … fn applied to a]

f g applied to a is g applied to f applied to a (composition)

Elements are accessed through the 1, 2, 3 … n functions.

When # is before a constant it is interpreted as a function that when given any argument will return that constant.

Here's paul graham's make-adder function in this language, which makes use of the postpone operator (^) that is used to make closures/delay evaluation:


def make-adder [id, ^id] +

That's basically the whole language.

000000 (1) No.3419>>3420

So do you have a goal with this? Any specific situations where this language will be practical?


3fc87d (2) No.3420

>>3419

The goal is to move away from von-nuemann computing. I imagine that in the finicial sector there will be some use of the language, since it is very similar to J/K/Q/APL.

http://lpaste.net/7859265693223485440

is a more involved example


3e741f (1) No.3460

^ reminds me of call by push value

#k syntax for accessing tuples means you're just programming in desugared arrow notation, it's meaningless.


30cf4c (1) No.4628

Backus's FP is a scam. You got trolled, goy.


d00871 (1) No.4629

It looks interesting, that's as much as I can say. Reminds me of some ideas I've had for a programming language, I like the ^ for higher order fucntions.

One of my ideas was something where every function would just take one argument, in a way your language is reminiscent of the ideas I had, even if your functions are n-ary.

The point is, it is nice to see other interesting lambda-inspired languages




[Return][Go to top][Catalog][Screencap][Update] ( Scroll to new posts) ( Auto) 5
5 replies | 0 images | 5 UIDs | Page ?
[Post a Reply]
[ / / / / / / / / / ] [ dir / ask / dcaco / fur / hypno / o / sl / ttgg / u ][ watchlist ]