Question

Is this a bug in Chicken Scheme?

#;1> (define (foo x . y) x)
#;2> (foo 1 2 3)
1
#;3> (module bar (import scheme chicken) (define (foo x . y) x))

Error: invalid syntax in macro form: (foo x . y)

        Call history:

        <syntax>                (module bar (import scheme chicken) (define (foo x . y) x))
        <syntax>                (##core#module bar (import scheme chicken) (define (foo x . y) x))
        <syntax>                (define (foo x . y) x)
        <syntax>                (foo x . y)     <--
Was it helpful?

Solution 2

The dot (.) syntax for variadic functions is not available across modules; it's inside the scheme module. When you create a custom module, you have to explicitly import the scheme module to reenable variadic functions.

#1;> (module bar (foo) (import scheme chicken) (define (foo x . y) x))
#2;> (import bar)
#3;> (foo 1 2 3)
1

OTHER TIPS

Your module syntax is missing the list of symbols to export from the module. Try this:

#1;> (module bar (foo) (import scheme chicken) (define (foo x . y) x))
#2;> (import bar)
#3;> (foo 1 2 3)
1

Notice the (foo) after declaring the module name.

I'll add that the mailing list and irc channel (#chicken on freenode) are very active. If you have questions about chicken they are the best places to get them answered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top