lisp - explanation of lambda expression in scheme -


i wondering if explain lambda expression , how output derived. put interpreter , getting ((2) 2). i'm not sure why it's giving me instead of (2 2).

 ((lambda x (cons x x)) 2) 

the expression (lambda x (cons x x)) produces function; function puts arguments list x; function returns (cons x x).

your expression calls above function argument of 2. in function x (2) (a list of arguments). function (cons '(2) '(2)) returns ((2) 2)


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -