chicken-users
[Top][All Lists]
Advanced

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

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


From: Sunnan
Subject: Re: [Chicken-users] crazy behaviour in csi!
Date: Mon, 05 Dec 2005 23:24:21 +0100

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!

;;; you could argue that want to do:
(let ((foo (rec (F N) 
                (if (zero? N) 1 
                    (* N (F (- N 1))))))
      (bar (...))) ;and more
  (...) ;and more
  (+ (foo bar)
     (foo 3)))

;; but this doesn't save much compared to:
(let ((foo (lambda (n)
             (let f ((n n))
               (if (zero? n) 1
                   (* n (f (- n 1)))))))
      (bar (...))) ; and more
  (...) ; and more
  (+ (foo bar)
     (foo 3)))

;; well... as always with scheme, we've got
;; a lambda-n construct that some people want to
;; shave away. shaving away is always a good thing,
;; but in this case the gain was so small
;; for such a high price.

;;; this is nothing but a named let and a lambda
;;; rolled into one.

;; gah! knowing myself, I'll maybe end up using
;; this some day. but I still don't like it.

;; for factorials, I prefer
(product-ec (: n 1 (+ (...) 1)) n) ;srfi-42
;; or even the APL-inspired:
(apply * (iota (...) 1)) ;srfi-1







reply via email to

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