[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to switch to regular Scheme
- To: srfi-42@xxxxxxxxxxxxxxxxx
- Subject: How to switch to regular Scheme
- From: Amandeep Singh <varoadster@xxxxxxxxx>
- Date: Sun, 22 Jan 2006 21:45:02 -0500
- Delivered-to: srfi-42@xxxxxxxxxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Bka4QPV1ArNcJzqHIL5Fekc+pXyPado4+3W0lLo4f8DSSqnSz4RW1ZDNHnVh8H8ncfBzEyWdaXJtlkJb+VHEA7NDQCLvrTD2EyG2xkaHxvWoKf/dxF9fAlzIY5S+aegU4+mNyxWJAHcY7KNWRZLhGaI+DjNSFlZ8LnIx5ggvXeg=
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.