Similar thing, not same

twitter logo github logo ・1 min read

Common Lisp has do syntax. And Scheme too.

They have same form, but different semantic.

;; Common Lisp
(do ((i 0 (+ i 1))
     (j '() (cons (lambda()i) j)))
    ((= i 3)
     (mapcar (lambda(x)(funcall x)) j)))
;; → (3 3 3)
;; Scheme
(do ((i 0 (+ i 1))
     (j '() (cons (lambda()i) j)))
    ((= i 3)
     (map (lambda(x)(x)) j)))
;; → (2 1 0)

Scheme's do make a new location every time for each loop. Common Lisp is not so.

twitter logo DISCUSS
Classic DEV Post from Dec 15 '18

The new MacBook Pros are overpriced

I've been a Mac user for over a decade but I'm lacking enthusiasm towards the r...

齊藤敦志 profile image