[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme] Few basics...
From: |
Gilles THIBAULT |
Subject: |
Re: [Scheme] Few basics... |
Date: |
Sat, 22 Nov 2008 00:52:01 +0100 |
Scheme hackers, [..]
I am far from a Scheme hacker, and i cannot certify that is "good
programmation", but the following seems to work.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (addlist i nr)
(let ((local-list (list 0 1 2 3 4 5 6 7)))
(define (local-addlist i)
(cons (list-ref local-list i) (if (= (+ i 1) nr) '()
(local-addlist (+ i 1)))))
(local-addlist i)
))
(display (addlist 0 6))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Is it what you wanted ?
Gilles