[plt-scheme] List Manipulation
Hi All,
Thank you all for the help... Now I'm beginning to get a feeling about
Scheme and could finish my 'homework' without bothering you again ;-)
I hope that my next questions may be less elementary...
It's really a bliss to have people like you around the corner ;-)
[]
________________ _..----====~~~~====--,
===== (______________I_)'- = ,~~----===*===----~~~~
===== / /__..---=='---./
----- `---'---._________.' Ricardo Massamitsu Nonomura
E-Mail: massamitsu_nonomura at hotmail.com
nonomura at moimeichego.de
Homepage: www.moimeichego.de
ICQ: 7234230
PGP: Oxo70F0B5C
> -----Original Message-----
> From: Dr. Peter Lane [mailto:P.C.Lane at herts.ac.uk]
> Sent: Wednesday, January 07, 2004 11:09 AM
> To: 'Ricardo Massamitsu Nonomura'
> Cc: plt-scheme at list.cs.brown.edu
> Subject: RE: [plt-scheme] List Manipulation
>
>
>
> Hi Ricardo,
>
> The mistake is the set of brackets around aValue, which makes
> Scheme think you want to call a function, whose name is the
> value of aValue
>
> > (define (wertVonBetrag aValue)
> > (car (aValue)))
>
> Instead, you want:
>
> (define (wertVonBetrag aValue)
> (car aValue))
>
> The value of aValue is a list, and car is the function
> operating on that list.
>
> HTH,
>
> Peter.
>
> -----Original Message-----
> From: plt-scheme-admin at list.cs.brown.edu
> [mailto:plt-scheme-admin at list.cs.brown.edu] On Behalf Of
> Ricardo Massamitsu Nonomura
> Sent: 07 January 2004 09:52
> To: plt-scheme at list.cs.brown.edu
> Subject: [plt-scheme] List Manipulation
>
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> Hi All,
>
> I defined a procedure that will take 2 parameters and return
> a list where value is a number and currency is the name of
> the currency :
>
> (define (neuerGeldbetrag value currency)
> (list (* value 1.0) currency))
>
> Therefore (neuerGeldbetrag 2 'Euro) => (2.0 euro)
>
> Then I want a new procedure with 1 parameter that will give
> me the value of the currency:
>
> (define (wertVonBetrag aValue)
> (car (aValue)))
>
> Therefore I was expecting that
>
> (wertVonBetrag (neuerGeldbetrag 2 'Euro)) => 2.0
>
> I tested the result from neuerGeldbetrag with length, which
> returns 2, so the result is a list. Why car cannot take the
> head of that list, but instead send me the following error msg:
>
> procedure application: expected procedure, given: (2.0 euro) (no
> arguments)
>
>
> Is (2.0 euro) not a list that car can handle???
>
> []
>
> ________________ _..----====~~~~====--,
> ===== (______________I_)'- = ,~~----===*===----~~~~
> ===== / /__..---=='---./
> ----- `---'---._________.' Ricardo Massamitsu Nonomura
> E-Mail: massamitsu_nonomura at hotmail.com
> nonomura at moimeichego.de
> Homepage: www.moimeichego.de
> ICQ: 7234230
> PGP: Oxo70F0B5C
>
>
>
>
>