История изменений
Исправление x4DA, (текущая версия) :
#lang racket
(define-syntax (at-least-two stx)
(syntax-case stx ()
[(_ args ...)
#'(eq? 2 (for/fold ([c 0]) ([x (syntax->list #'(args ...))]
#:break (eq? c 2))
(if (eval (syntax->datum x))
(+ c 1) c)))]))
(printf "first: ~a\n" (at-least-two
(eq? 1 1)
(eq? 3 2)
(eq? 2 5)
(eq? 2 20)))
(printf "second: ~a\n" (at-least-two
(eq? 1 1)
(eq? 3 2)
(eq? 5 5)
(eq? 2 20)))
Исправление x4DA, :
#lang racket
(define-syntax (at-least-two stx)
(syntax-case stx ()
[(_ args ...)
#'(eq? 2 (for/fold ([c 0]) ([x (syntax->list #'(args ...))]
#:break (eq? c 2))
(if (eval (syntax->datum x))
(+ c 1) c)))]))
(printf "first: ~a\n" (at-least-two (eq? 1 1)
(eq? 3 2)
(eq? 2 5)
(eq? 2 20)))
(printf "second: ~a\n" (at-least-two (eq? 1 1)
(eq? 3 2)
(eq? 5 5)
(eq? 2 20)))
Исходная версия x4DA, :
#lang racket
(define-syntax (at-least-two stx)
(syntax-case stx ()
[(_ args ...)
#'(eq? 2 (for/fold ([c 0]) ([x (syntax->list #'(args ...))]
#:break (eq? c 2))
(if (eval (syntax->datum x))
(+ c 1) c)))]))
(printf "first: ~a\n" (at-least-two
(eq? 1 1)
(eq? 3 2)
(eq? 2 5)
(eq? 2 20)))
(printf "second: ~a\n" (at-least-two (eq? 1 1)
(eq? 3 2)
(eq? 5 5)
(eq? 2 20)))