[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] 4.8.0.5 syntax weirdness
From: |
Sandra Snan |
Subject: |
Re: [Chicken-users] 4.8.0.5 syntax weirdness |
Date: |
Mon, 10 Mar 2014 19:37:36 +0100 |
I couldn't quite get this to work:
ticket-stub.scm
----8<----
(use s (srfi 1))
(begin-for-syntax
(import chicken)
(use s (srfi)))
(define-syntax create-tickets
(ir-macro-transformer
(lambda (f i c)
`(list
,@(filter-map
(lambda (x)
(if (s-contains? "enemy-" x)
#f
(s-prepend "friendly-" x)))
cells)))))
(print (first (create-tickets)))
---->8----
ticket-stub-compilation.scm
----8<----
(use s (srfi 1) anaphora)
(define (gen-cells)
;; In the real version of this, this is not only an expensive
;; operation but it's also dependent on io and data that I only want
;; to read at compile time.
;; For the purposes of this stub, it's simply some strings.
(let ((n (random 10)))
(if (zero? n)
'()
(cons (if (odd? n) "enemy-horse" "horse") (gen-cells)))))
(define cells (cons "horse" (gen-cells)))
---->8----
It still can't find s-contains.
If I move the entire (define-syntax create-tickets ...) sexp to the end
of begin-for-syntax, it can't find create-tickets when called later.
- [Chicken-users] 4.8.0.5 syntax weirdness, Sandra Snan, 2014/03/10
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Peter Bex, 2014/03/10
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Sandra Snan, 2014/03/10
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Peter Bex, 2014/03/10
- Re: [Chicken-users] 4.8.0.5 syntax weirdness,
Sandra Snan <=
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Peter Bex, 2014/03/10
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Jim Ursetto, 2014/03/11
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Peter Bex, 2014/03/11
- Re: [Chicken-users] 4.8.0.5 syntax weirdness, Jim Ursetto, 2014/03/12