|
From: Timothy J. H. <ti...@cs...> - 2009-05-05 23:07:00
|
Hi Andreas,
On May 5, 2009, at 6:10 PM, Andreas Røsdal wrote:
> Hello!
>
> I'm trying to port some scheme code from guile to jscheme, and have
> run
> into som problems with macros.
>
> This is the function that I would like to port to jscheme:
> (defmacro def-save-var (nm value)
> `(begin (define ,nm ,value)
> (set! variable-list (cons ',nm variable-list))))
Here's the way to do this in Jscheme ...
> (define-macro (def-save-var nm value)
`(begin (define ,nm ,value)
(set! variable-list (cons ',nm variable-list))))
$1 = (macro def-save-var (nm value)...)
> (define variable-list ())
$2 = ()
> (def-save-var a 5)
$3 = (a)
> (def-save-var b '(1 2 3))
$4 = (b a)
> variable-list
$5 = (b a)
> a
$6 = 5
> b
$7 = (1 2 3)
Is this part of a web-based card game?
Best,
---Tim---
>
>
> The code can be found in context here (commented out in lines 94 -
> 96):
> http://code.google.com/p/aisleriot-web-client/source/browse/trunk/src/main/resources/scheme/sol.scm
>
> This is a description I have found about jscheme macros:
> "This syntax is defined so that (define name (macro (args) body)) is
> just
> like Common Lisp's (defmacro name (args) body). I realize I should
> add a
> mode where this syntax is not used."
>
> Could anyone please help me getting this macro correct in jscheme?
> You can see my attempt in lines 100-102, but it doesn't seem to work
> correctly.
>
>
> - Andreas
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances!
> Your
> production scanning environment may not be a perfect world - but
> thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW
> KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Jscheme-user mailing list
> Jsc...@li...
> https://lists.sourceforge.net/lists/listinfo/jscheme-user
|