[plt-scheme] Let, cond and local
Hi All,
I'm getting a little confused, in the Revised5 Report on the Algorithmic
Language Scheme, on section 4.2.2 the constructs let, let* and letrec
are described. But in the first line of my "homework" already in the
first line I get the error msg:
function call: expected a defined name or a primitive operation name
after an open parenthesis, but found something else in: (m (cond (((<=
1800 j 1899) 23) ((<= 1900 j 2199) 24) (else (error "falsches Jahr")))))
Then consulting one of the resources listed by Ferguson and Jim
(www.htdp.org) in the index of the book there is no mention of the let,
let* and letrec, but I found something similar: local, which I cannot
find any reference to it in the Revised5 Report, btw the construct cond
uses "(" in the Revised5 Report while in the htdp.org it uses "[", does
it matter??
Then:
- Aren't the Revised5 Report and the htdp.org talking about the same
Scheme?
- Why did I get this error-msg using let?
(I'm using DrScheme Beginning Student)
-----------
I guess that the nested let* is wrong, but I cannot pass through the
first...
(define (oster j) (let* ((m (cond (((<= 1800 j 1899) 23)
((<= 1900 j 2199) 24)
(else (error "falsches Jahr")))))
(n (cond (((<= 1800 j 1899) 4)
((<= 1900 j 2099) 5)
((<= 2100 j 2199) 6))))
(a (modulo j 19))
(b (modulo j 4))
(c (modulo j 7))
(d (modulo (+ (* 19 a) m) 30))
(e (modulo (+ (* 2 b) (* 4 c) (* 6 d) n) 7)))
(let* (tag (if (> (+ d e) 9) (+ d e -9) (+ 22 d e)))
(monat (if (> (+ d e) 9) 'April 'Maerz))))
(if (= monat 'April) (cond ((= tag 26) (list 19 monat j))
((and (= tag 25) (= d 28) (= e 6) (> a 9))
(list 18 monat j)) (list tag monat j))))
----------------
TIA,
________________ _..----====~~~~====--,
===== (______________I_)'- = ,~~----===*===----~~~~
===== / /__..---=='---./
----- `---'---._________.' Ricardo Massamitsu Nonomura
E-Mail: massamitsu_nonomura at hotmail.com
nonomura at moimeichego.de
Homepage: www.moimeichego.de
ICQ: 7234230
PGP: Oxo70F0B5C