chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Re: crazy behaviour in csi!


From: Jens Axel Søgaard
Subject: [Chicken-users] Re: crazy behaviour in csi!
Date: Mon, 05 Dec 2005 23:54:53 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Sunnan wrote:
Thanks, I guess I was stressed, and forgot that unknown macros can
already be defined. The error message just looked so weird.

I was pretty sleep-deprived at the time.

I hadn't looked at srfi-31 before. I thought I knew most of the srfis.
This one was pretty disappointing.

(define (...) 10)
; They want to write:
((rec (F N) (if (zero? N) 1 (* N (F (- N 1))))) (...))

;; instead of:
(let f ((n (...)))
  (if (zero? n) 1
      (* n (f (- n 1)))))
;; it's the exact same number of characters!

Almost - note that REC returns the recursive
function, so you need to return the function
in the let:

  ((let f ((n (...)))
     (if (zero? n) 1
         (* n (f (- n 1))))
     f)
    (...))

--
Jens Axel Søgaard








reply via email to

[Prev in Thread] Current Thread [Next in Thread]