LINUX.ORG.RU

История изменений

Исправление monk, (текущая версия) :

Держи: https://github.com/Kalimehtar/cl-loop

От jphelps/loop добавил макрос acond и в тексте loop.rkt в двух местах заменил cond на acond.

Множественный collect не реализовывал

#lang racket
(require "loop.rkt")

(define-syntax (aif x)
  (syntax-case x ()
    ((aif cond then else)
     (with-syntax ((it (datum->syntax x 'it)))
       (syntax
        (let ((it cond))
          (if it then else)))))))

(aif (+ 5 15) (loop for i from 1 to it when (and (odd? i) i) collect it) #f)
----------
'(1 3 5 7 9 11 13 15 17 19)

Исходная версия monk, :

Держи: https://github.com/Kalimehtar/cl-loop

От jphelps/loop добавил макрос acond и в тексте loop.rkt в двух местах заменил cond на acond.


Множественный collect не реализовывал

#lang racket (require «loop.rkt»)

(define-syntax (aif x) (syntax-case x () ((aif cond then else) (with-syntax ((it (datum->syntax x ’it))) (syntax (let ((it cond)) (if it then else)))))))

(aif (+ 5 15) (loop for i from 1 to it when (and (odd? i) i) collect it) #f)

’(1 3 5 7 9 11 13 15 17 19)