[gambit-list] define-syntax in Gambit-C mode

James Long longster at gmail.com
Thu Mar 5 01:41:10 EST 2009


The LOAD procedure doesn't execute until run-time.  Macros are  
expanded before then.  The command line parameter is meant to address  
this.  It's essentially the same as doing:

gsi -e '(load "~~/lib/syntax-case")' file.scm

What is the problem you are having with the -:s option and open-process?

You might be able to get away with something like this:

(define-macro (load-at-expand-time name)
    (load name))

(load-at-expand-time "~~/lib/syntax-case")

On Mar 5, 2009, at 1:18 AM, Nguyen Thai Ngoc Duy wrote:

> On 3/5/09, Pavel Dudrenov <dudrenov at gmail.com> wrote:
>> Really? That's odd. On mine it works fine. Here is an example with
>> define-syntax straight from the gambit docs.
>
> Umm... I tried again. It worked on REPL, but not from command line. Is
> there any difference between the two ways?
>
> pclouds at dektop ~/w/chandai/tests $ gsi
> Gambit v4.4.1
>
>> (load "~~/lib/syntax-case")
> "/usr/lib/syntax-case.scm"
>> (load "srfi-64")
> "/home/pclouds/w/chandai/tests/srfi-64.scm"
>>
> *** EOF again to exit
> pclouds at dektop ~/w/chandai/tests $ gsi  srfi-64
> *** ERROR IN "srfi-64.scm"@95.1 -- Ill-formed expression
>
> There is (load "~~/lib/syntax-case") near the top of srfi-64.scm.
>
>>
>> pavel at dudrenov:~$ gsi
>> Gambit v4.4.1
>>
>>> (load "~~/lib/syntax-case")
>> "/usr/local/Gambit-C/lib/syntax-case.scm"
>>> (define-syntax unless
>>  (syntax-rules ()
>>    ((unless test body ...)
>>     (if test #f (begin body ...)))))
>>> (let ((test 111)) (unless (= 1 2) (list test test)))
>> (111 111)
>>
>>>
>>
>>
>>
>>
>> On Wed, Mar 4, 2009 at 8:38 PM, Nguyen Thai Ngoc Duy <pclouds at gmail.com 
>> > wrote:
>>> On 3/5/09, Pavel Dudrenov <dudrenov at gmail.com> wrote:
>>>> hmm what gambit specific features are broken with -:s?
>>>
>>> open-process
>>>
>>>> Also can't you:
>>>> (load "~~lib/syntax-case")
>>>> for whatever program needs syntax-case?
>>>
>>> Won't work. I get ill-formed expression on define-syntax. Forgot to
>>> mention I'm using Gambit-C 4.4.1.
>>> --
>>> Duy
>>>
>>
>
>
> -- 
> Duy
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list