[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] 4.8.0.5 syntax weirdness
From: |
Sandra Snan |
Subject: |
[Chicken-users] 4.8.0.5 syntax weirdness |
Date: |
Mon, 10 Mar 2014 13:26:08 +0100 |
Dear chicken-users;
I have a simple program that does most of its heavy lifting at compile
time.
To demonstrate the issue, I've written two stubs (as simple as I could
make them but still show the issue I'm having).
File number one is called ticket-stub.scm:
-----8<----
(use s (srfi 1))
(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----
It should print out the word "friendly-horse" after this:
csc -extend ticket-stub-compilation.scm ticket-stub.scm && ./ticket_stub
Here is its sister file, 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. (It's going through a large collection of
;; XML files and selecting a small subset of that for this program.)
;; 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
(let big-cells ((cells (gen-cells)))
(if (> (length cells) 3)
cells
(big-cells (gen-cells)))))
----->8----
When compiled with this version of Chicken:
CHICKEN
(c) 2008-2013, The Chicken Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.8.0.5 (stability/4.8.0) (rev 5bd53ac)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2013-10-03 on aeryn.xorinia.dim (Darwin)
I get this error:
Error: during expansion of (create-tickets ...) - unbound variable: s-contains?
followed by the call history, and then
Error: shell command terminated with non-zero exit status 17920:
'/usr/bin/chicken' 'ticket-stub.scm' -output-file 'ticket-stub.c' -extend
ticket-stub-compilation.scm
However, when compiled with this version of Chicken:
CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.0
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2011-09-05 on gladstone.duckburg.org (Linux)
We get our friendly-horse.
Am I doing something wrong or have I found a bug?
(Weird that there’s an EOL space on the line “Version 4.7.0 ” but I
guess that’s some Debian quirk.)
4.7.0 is the version that’s in Debian Stable.
Sandra
- [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, 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, 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