Welcome to the CHICKEN Scheme pasting service

list-comprehension added by john00 on Fri Feb 7 23:44:09 2020

(define-syntax let-zip
  (syntax-rules ()
    ((let-zip (var var* ...) (val val* ...)
              body ...)
     (let ((var val)
           (var* val*) ...)
       body ...))))

(define-syntax list-comprehension
  (syntax-rules (for in if)
    ((_ expression for symbols in lst)
     (map (lambda (values)
            (let-zip symbols values
                     expression))
          lst))))

(define L '((0 0) (1 11) (2 22) (3 33) (4 44) (5 55)))
(list-comprehension (* x y) for (x y) in L)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the CHICKEN interpreter:
Visually impaired? Let me spell it for you (wav file) download WAV