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 mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users