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

How to switch to regular Scheme



Hi,

I'm new to all this SRFI stuff and I don't understand how I would implement this into Scheme.

I have this code:

(require (lib "42.ss" "srfi"))

(define (two-power n)
   (max-ec (:while (: i n)
                   (zero? (remainder n (expt 2 i))))
           i))

(define (hanoi m)
   (list-ec (: n 1 (expt 2 m))
            (+ (two-power n) 1)))

this is an iterative version of the hanoi towers. Sorry if this is an easy question but how do I get this to work in Scheme without getting a *define* errors.

if anyone can rewrite this procedure without the SRFI syntax, it will be very helpful. I want to see how it would look without the simple one line but instead seeing the entire procedure instead of just max-ec and list-ec.

By the way, the extra procedures are very helpful but I just want to see the difference between the SRFI syntax and the procedure with the regular Scheme language.