v6.3-exception
Matthew Butterick 7 years ago
parent 26f79d4776
commit 498a7b2fd0

@ -5,15 +5,15 @@
(define (tokenize ip)
(for/list ([tok (in-port read ip)])
tok))
tok))
(define (parse toks)
(for/list ([tok (in-list toks)])
(integer->char
(for/sum ([val (in-list tok)]
[power (in-naturals)]
#:when (eq? val 'taco))
(expt 2 power)))))
(integer->char
(for/sum ([val (in-list tok)]
[power (in-naturals)]
#:when (eq? val 'taco))
(expt 2 power)))))
(define (read-syntax src ip)
(define toks (tokenize ip))

@ -19,7 +19,7 @@
(integer->char
(for/sum ([taco-or-not (in-list pieces)]
[pow (in-naturals)])
(* taco-or-not (expt 2 pow)))))
(* taco-or-not (expt 2 pow)))))
(define (taco) 1)

@ -6,16 +6,16 @@
(define (tokenize ip)
(for/list ([tok (in-port read-char ip)])
tok))
tok))
(define (parse toks)
(define parse-tree-datum (parse-to-datum toks))
(for/list ([leaf (in-list (cdr parse-tree-datum))])
(integer->char
(for/sum ([val (in-list (cdr leaf))]
[power (in-naturals)]
#:when (equal? val '(taco)))
(expt 2 power)))))
(integer->char
(for/sum ([val (in-list (cdr leaf))]
[power (in-naturals)]
#:when (equal? val '(taco)))
(expt 2 power)))))
(define (read-syntax src ip)

@ -13,17 +13,17 @@
(define (tokenize ip)
(define toklets
(for/list ([toklet (in-port lex ip)])
toklet))
toklet))
(for/list ([tok (in-slice 7 toklets)])
tok))
tok))
(define (parse toks)
(for/list ([tok (in-list toks)])
(integer->char
(for/sum ([val (in-list tok)]
[power (in-naturals)]
#:when (eq? val 'taco))
(expt 2 power)))))
(integer->char
(for/sum ([val (in-list tok)]
[power (in-naturals)]
#:when (eq? val 'taco))
(expt 2 power)))))
(define (read-syntax src ip)
(define toks (tokenize ip))

Loading…
Cancel
Save