[ / / / / / / / / ] [ b / news+ / boards ] [ operate / meta ] [ ]

/gentoo/ - Technology

Install gentoo.

Catalog

Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Options
Password (For file and post deletion.)

Allowed file types: jpg, jpeg, gif, png, webm, mp4
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


File: 1411383373103.png (22.33 KB, 614x1023, 614:1023, 614px-Greek_lc_lamda_thin.….png)

 No.229

Noob question here :
In lisp, I understand let is only syntactic sugar for an underlying lambda expression. But what about let*?

 No.231

Probably syntactic sugar for layers of lambdas.

I don't know what the inner workings of it is, but it allows you to reference variables that are also defined in the let* statement.
eg:

(let* ((a 1) (b (* a 5)))
…)

 No.233

>>231
That makes sense.


(let* ((a 1) (b (* a 5)))
(print b))


becomes



(let ((a 1))
(let ((b (* a 5))
(print b)))


becomes



(funcall (lambda (a)
(funcall (lambda (b)
(print b))
(* a 5)))
1)


Or something along those lines.
Though, I believe if it were scheme, you could remove "funcall" and just 'call' the result of lambda.

 No.248

>>233
You don't need funcall in Scheme, using the lambda expression as a function will work. Like this:
((lambda (x) (+ x 1)) 1)

This will evaluate to 2.

 No.251

>>248
Someone needs to either clean up Common Lisp, or beef up Scheme.

 No.261

What I'm personally more intrigued with is letrec. How would letrec be represented using lambda expressions?



Delete Post [ ]
[]
[Return][Go to top][Catalog]
[ / / / / / / / / ] [ b / news+ / boards ] [ operate / meta ] [ ]