[plt-scheme] List Manipulation

From: Dr. Peter Lane (P.C.Lane at herts.ac.uk)
Date: Wed Jan 7 05:09:18 EST 2004

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



-----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:

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

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

Posted on the users mailing list.