So I have a little challenge.
I'm trying to program this here:
Which with lambda calculus simplifies to 12.
I have the following Scheme script:
(
define double (
lambda x (
+ (car x) (car x)
)
)
)
(display 'Debug)
(newline)
(display (double 6))
(newline)
(
define getTwelve (
((
(lambda x (
lambda y (
(display y)
(newline)
(x (x y))
)
))
double
) 3)
)
)
(display getTwelve)
(newline)
(newline)
Which corresponds to this terminal output:
Debug
12
(3)
application: not a procedure;
expected a procedure that can be applied to arguments
given: '(#<procedure:double>)
arguments...:
'(3)
So of course I thought 'it's because the parameter of double is a list instead of a number' but car y just changes the last line of the terminal output to 3.
I think I'm interpreting the Racket terminal output wrong, but I don't know in which way. There is however the other possibility that passing a lambda function into a lambda function as a parameter is not allowed.
So my question is: Which one is it?

(. It's very unusual Scheme style.