[plt-scheme] Lambda in a list
No, he didn't...
Both s-expressions are equivalent.
I think it's because he used Intermediate Student and not Intermediate
Student with Lambda
-----Original Message-----
From: Matthias Felleisen [mailto:matthias at ccs.neu.edu]
Sent: Tuesday, November 11, 2003 5:16 PM
To: Patricio Daniel Patrickson
Cc: plt-scheme at list.cs.brown.edu
Subject: Re: [plt-scheme] Lambda in a list
For list-related administrative tasks:
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
You had the parens at the wrong place:
Welcome to DrScheme, version 205.5-cvs5nov2003.
Language: Intermediate Student with lambda.
> (define a-thing
(list
"an-item"
12
(lambda (x y) (+ x y))
(lambda (x y) (- x y))))
> ((list-ref a-thing 2) 5 10)
15
>
On Tuesday, November 11, 2003, at 07:56 AM, Patricio Daniel Patrickson
wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> Hi!
>
> I am stuck on a problem.
>
> I am trying to create a list where two of the elements are lambda
> expressions? Some thing like "'("an-item" 12 a-lambda-expr
> another-lambda-expr)".
>
> Here is how I am defining it.
>
> (define a-thing
> (list
> "an-item"
> 12
> (lambda (x y) (+ x y))
> (lambda (x y) (- x y))
> )
> )
>
> What I want to do with this construct is to retrieve the third item
> from a-thing, and the execute it with two arguments. This is
> obvously not working, could anybody please tell me why?
>
> Best Regards!
> /Daniel Patrickson
>
> _____________________________________
> Patricio Daniel Patrickson
> http://ppatrickson.servehttp.com
> tel:0739848646