[plt-scheme] List Manipulation
Ricardo-
You want to write instead:
>
> (define (wertVonBetrag aValue)
> (car aValue))
(note that I have removed a pair of parentheses that were wrapped
around aValue).
In what you had written, you were trying to apply aValue **as a
procedure** to zero arguments. That is why the error message says it
expected a procedure but was given a list -- specifically, (list 2.0
euro)
If you are using DrScheme, I recommend that you change your language
level to Beginning Student. That way, you will get error messages that
are more informative for bugs like this.
-Felix
On Jan 7, 2004, at 4:51 AM, Ricardo Massamitsu Nonomura wrote:
> 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
>
>