Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Graham Fawcett
On Sat, Mar 15, 2008 at 8:14 PM, Kon Lovett <[EMAIL PROTECTED]> wrote:
> In release/3 is hart 1.3.0 which supports syntax-case.

Nicely done, Kon. For those who haven't seen Kon's modification yet,
it uses cond-expand to see if syntax-case is installed when hart is
loaded: if so, it provides high-level versions of the macros instead
of low-level ones.

Thanks very much for this.

Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Kon Lovett

In release/3 is hart 1.3.0 which supports syntax-case.

Best Wishes,
Kon




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Robin Lee Powell
On Sun, Mar 16, 2008 at 12:56:06AM +0100, Leonardo Valeri Manera
wrote:
> On 16/03/2008, Robin Lee Powell <[EMAIL PROTECTED]>
> wrote:
> > Should I just use one of those, then?  Do they define
> > syntax-rules?
> 
> Yup. Any one of those 3 defines syntax-rules.

Ha!  That does it.  (use hart), then (use riaxpander), then:

(define-syntax p-tr
  (syntax-rules
()
[(p-tr stuff)
 (p (@ (class "foo")) (text: (ctr stuff)))]))

then my code with p-tr in it works fine.

Thanks all!

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Felix Winkelmann
From: John Cowan <[EMAIL PROTECTED]>
Subject: Re: [Chicken-users] hart and syntax-case won't play nice. :(
Date: Sat, 15 Mar 2008 19:07:47 -0400

> Felix Winkelmann scripsit:
> 
> > Actually not quite. Low-level macros are still seen, as the low-level
> > expander is used by default - high-level expanders just pre-expand
> > all macros usually.
> 
> Well, it's true that define-macro definitions made after you (use syntax-case)
> expander are correctly processed, but older ones seem to be hidden:

You are right. That was an incorrect assumption of me. The exact
implemetation details of how syntax-case hooks into the macro
expansion process elude me right now. 

> 
> However, this is not true of syntactic-closures, alexpander, or
> riaxpander.  Those cope with both previously-defined and newly defined
> low-level macros.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Leonardo Valeri Manera
On 16/03/2008, Robin Lee Powell <[EMAIL PROTECTED]> wrote:
> Should I just use one of those, then?  Do they define syntax-rules?

Yup. Any one of those 3 defines syntax-rules.

Leo


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Robin Lee Powell
On Sat, Mar 15, 2008 at 07:07:47PM -0400, John Cowan wrote:
> Felix Winkelmann scripsit:
> 
> > Actually not quite. Low-level macros are still seen, as the
> > low-level expander is used by default - high-level expanders
> > just pre-expand all macros usually.
> 
> Well, it's true that define-macro definitions made after you (use
> syntax-case) expander are correctly processed, 

This would explain why the order matter in the case of the hart bug,
but it doesn't explain why *both* orders fail.

> However, this is not true of syntactic-closures, alexpander, or
> riaxpander.  Those cope with both previously-defined and newly
> defined low-level macros.

Should I just use one of those, then?  Do they define syntax-rules?

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread John Cowan
Felix Winkelmann scripsit:

> Actually not quite. Low-level macros are still seen, as the low-level
> expander is used by default - high-level expanders just pre-expand
> all macros usually.

Well, it's true that define-macro definitions made after you (use syntax-case)
expander are correctly processed, but older ones seem to be hidden:

CHICKEN
(c)2008 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 3.0.6 - linux-unix-gnu-x86  [ manyargs dload ptables applyhook ]
SVN rev. 9408   compiled 2008-03-11 on skunk (Linux)

#;1> (define-macro (foo) 32)
#;2> (foo)
32
#;3> (use syntax-case)
; loading /usr/local/lib/chicken/3/syntax-case.so ...
; loading /usr/local/lib/chicken/3/syntax-case-chicken-macros.scm ...
#;4> (foo)
Error: unbound variable: foo

Call history:

(foo)
  (foo)   <--
#;4> (define-macro (bar) 45)
#;5> (bar)
45
#;6>

However, this is not true of syntactic-closures, alexpander, or
riaxpander.  Those cope with both previously-defined and newly defined
low-level macros.

-- 
John Cowan  [EMAIL PROTECTED]  http://ccil.org/~cowan
If I have not seen as far as others, it is because giants were standing
on my shoulders.
--Hal Abelson


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Felix Winkelmann
From: John Cowan <[EMAIL PROTECTED]>
Subject: Re: [Chicken-users] hart and syntax-case won't play nice. :(
Date: Sat, 15 Mar 2008 15:21:41 -0400

> Robin Lee Powell scripsit:
> 
> > Are you saying that all things that use low-level macros die when you
> > load syntax-case?  So if I want to use high-level macros with hart,
> > I'm just screwed?
> 
> Essentially yes.  Native Chicken and Chicken-with-a-syntax-expander
> are two different and incompatible dialects: the first supports only
> low-level macros defined with define-macro, whereas the second supports
> only high-level macros defined with define-syntax. 

That is not quite correct. Syntax-case supports define-macro.

> 
> Chicken starts out in its native dialect, and then switches to an expander
> dialect as soon as you load an expander with use or require-extension
> (same thing, by the way).  After that, any macros that had been defined
> by define-macro are hidden and inaccessible. 

Actually not quite. Low-level macros are still seen, as the low-level
expander is used by default - high-level expanders just pre-expand
all macros usually.

> Yes, this sucks; it's
> a consequence of the way syntax-expanders work -- they preprocess all
> incoming code and remove all macro definitions and uses.

Agreed.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Tobia Conforto

Robin Lee Powell wrote:

Anybody got a good define-macro tutorial?



This is not bad:
http://www.gigamonkeys.com/book/macros-defining-your-own.html#defmacro

It's CL, not Scheme, but I believe define-macro comes from CL anyways.
You can ignore the part before the anchor that link goes to.

If you have never seen CL, you can either read the previous chapters  
of that book, or pretend it's just Scheme with a different syntax:


(defun name (args ...) body ...)
=> (define (name args ...) body ...)

(defmacro name (args ...) body ...)
=> (define-macro (name args ...) body ...)

IIRC (do) is the same as in Scheme.  If you encounter (loop) just  
treat it intuitively (and watch your back ;-)  This should be enough  
to get through that chapter.



Tobia


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Kon Lovett


On Mar 15, 2008, at 12:43 PM, John Cowan wrote:


Graham Fawcett scripsit:


 (define-macro (hart . forms)
  `(noop ,(apply hart-parse forms)))

 That should be trivial to translate into any macro system.


Hm, on second thought, I probably shouldn't assume that just  
because a

macro is short, it would be trivial to translate into another system.


This one is, though:

(define-syntax hart (syntax-rules ()
((hart . forms) (noop (hart-parse . forms)

(Untested, of course)


I am working on a hygienic version of hart.

(define-syntax (hart X)
  (syntax-case X ()
[(K FORM0 ...)
	 (with-syntax ([EXP (datum->syntax-object #'K (apply hart-parse  
(syntax-object->datum #'(FORM0 ...])

   #'(noop EXP) ) ] ) )

since the semantic is to do the parse at expansion time then execute  
at runtime.





--
The man that wanders far[EMAIL PROTECTED]
from the walking tree   http://www.ccil.org/ 
~cowan

--first line of a non-existent poem by: John Cowan


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Best Wishes,
Kon




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread John Cowan
Graham Fawcett scripsit:

> >  (define-macro (hart . forms)
> >   `(noop ,(apply hart-parse forms)))
> >
> >  That should be trivial to translate into any macro system.
> 
> Hm, on second thought, I probably shouldn't assume that just because a
> macro is short, it would be trivial to translate into another system.

This one is, though:

(define-syntax hart (syntax-rules ()
((hart . forms) (noop (hart-parse . forms)

(Untested, of course)


-- 
The man that wanders far[EMAIL PROTECTED]
from the walking tree   http://www.ccil.org/~cowan
--first line of a non-existent poem by: John Cowan


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Robin Lee Powell
On Sat, Mar 15, 2008 at 03:37:20PM -0400, Graham Fawcett wrote:
> On Sat, Mar 15, 2008 at 3:24 PM, Graham Fawcett
> <[EMAIL PROTECTED]> wrote:
> >  The main macro in Hart is ridiculously small. Hart-support (the
> >  non-macro code) does all the work:
> >
> >  (define-macro (hart . forms)
> >   `(noop ,(apply hart-parse forms)))
> >
> >  That should be trivial to translate into any macro system.
> 
> Hm, on second thought, I probably shouldn't assume that just
> because a macro is short, it would be trivial to translate into
> another system.

Well, the macro *I'm* working with is short *and* simple, so I might
just try making it low-level.  Anybody got a good define-macro
tutorial?

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Graham Fawcett
On Sat, Mar 15, 2008 at 3:24 PM, Graham Fawcett
<[EMAIL PROTECTED]> wrote:
>  The main macro in Hart is ridiculously small. Hart-support (the
>  non-macro code) does all the work:
>
>  (define-macro (hart . forms)
>   `(noop ,(apply hart-parse forms)))
>
>  That should be trivial to translate into any macro system.

Hm, on second thought, I probably shouldn't assume that just because a
macro is short, it would be trivial to translate into another system.

Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Graham Fawcett
On Sat, Mar 15, 2008 at 2:49 PM, Robin Lee Powell
<[EMAIL PROTECTED]> wrote:
>
> On Sat, Mar 15, 2008 at 02:48:01PM -0400, Graham Fawcett wrote:
>  > On Sat, Mar 15, 2008 at 1:26 PM, Kon Lovett <[EMAIL PROTECTED]>
>  > wrote:
>  > > hart uses low-level macros only.
>  >
>  > Is there a way I can alter hart so that it will play better with
>  > code that uses higher-level macro systems? I'd rather not rewrite
>  > it in syntax-case (though it's really not very much macro code;
>  > perhaps a syntax-case version wouldn't be that hard).
>  >
>  > I confess to being an unhygienic, low-level macro user, and have
>  > to scratch my head whenever I encounter syntax-case code.
>
>  What about define-syntax, rather than syntax-case?  That's the only
>  thing I'm importing syntax-case for anyways.  (Yes, I'm friends with
>  John Cowan :)

Lucky you! :-) I guessed, from the Lojban .sigs.

The main macro in Hart is ridiculously small. Hart-support (the
non-macro code) does all the work:

(define-macro (hart . forms)
  `(noop ,(apply hart-parse forms)))

That should be trivial to translate into any macro system.

The trickiest macro is hart-for, which provides some polymorphism
(iteration over both lists and vectors) and destructuring for the
(for: ...) construct.

(define-macro (hart-for args . body)
  (let ((real-iter (gensym 'iter))
(foreach (gensym 'foreach))
(lst (gensym 'list)))
(match-let (((iter the-lst) args))
   `(let* ((,lst ,the-lst)
   (,foreach (if (list? ,lst)
 for-each
 hart-vector-for-each*)))
  (,foreach (lambda (,real-iter)
  (match-let ((,iter ,real-iter))
 ,@body))
,lst)

That too could be simplified. There's no real need to choose for-each
vs. hart-vector-for-each* at the macro-level, since really the
decision between the two is made at runtime. So we could add a generic
hart-for-each* support procedure that takes either:

(define (hart-for-each* proc lst)
  (cond ((list? lst)
 (for-each proc lst))
((vector? lst)
 (hart-vector-for-each* proc lst))
(#t (error "not a list or vector"

and simplify the macro down to this (totally untested):

(define-macro (hart-for args . body)
  (let ((real-iter (gensym 'iter))
(foreach (gensym 'foreach))
(lst (gensym 'list)))
(match-let (((iter the-lst) args))
  `(hart-for-each* (lambda (,real-iter)
  (match-let ((,iter ,real-iter))
,@body))
,lst

which *might* be easier to write in higher-level macro systems. It
might be hard to do the variable capture though.

Ignoring (for: ...) for the moment, just (use hart) and then use
(define-syntax) to define your own high-level version of:

(define-macro (hart . forms)
  `(noop ,(apply hart-parse forms)))

and you should be good to go.

Sorry, I don't have more time for a tested solution today...

Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Tobia Conforto

Robin Lee Powell wrote:

Kon Lovett wrote:

hart uses low-level macros only.


I'm afraid that means very little to me.  Are you saying that all  
things that use low-level macros die when you load syntax-case?


I'd like to understand this too, even if the hart problem is solved  
another way.


I'm a define-macro user, for now, probably because I come from CL.   
I'm just now starting to read up on hygienic macros and I still don't  
fully understand the role of syntax-case (the egg) and what do macros  
have to do with module systems.


Is there a wiki page with an introduction to macros in Chicken (and  
eggs)?



Tobia


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread John Cowan
Robin Lee Powell scripsit:

> Are you saying that all things that use low-level macros die when you
> load syntax-case?  So if I want to use high-level macros with hart,
> I'm just screwed?

Essentially yes.  Native Chicken and Chicken-with-a-syntax-expander
are two different and incompatible dialects: the first supports only
low-level macros defined with define-macro, whereas the second supports
only high-level macros defined with define-syntax.  Exactly what is
allowed to go in a define-syntax depends on the particular expander you
use (currently we have syntax-case, syntactic-closures, alexpander, and
riaxpander), except that all of them support syntax-rules as required
by R5RS.

Chicken starts out in its native dialect, and then switches to an expander
dialect as soon as you load an expander with use or require-extension
(same thing, by the way).  After that, any macros that had been defined
by define-macro are hidden and inaccessible.  Yes, this sucks; it's
a consequence of the way syntax-expanders work -- they preprocess all
incoming code and remove all macro definitions and uses.

The good news is that because syntax-expanders run at compile time, you
can mix and match modules that are separately compiled with different
expanders.  However, a module that *exports* macros has to be available
in source form at compile time (or at least the macros do), so the
conflict arises again.  Hart, in particular, contains *only* macros,
so it is never compiled into object code.

> What about define-syntax, rather than syntax-case?  That's the only
> thing I'm importing syntax-case for anyways.  (Yes, I'm friends with
> John Cowan :)

You mean syntax-rules, not define-syntax; define-syntax is the
universal wrapper for every type of high-level syntax definition, not
just syntax-rules.  As noted above, syntax-rules is provided only by an
expander, so it's incompatible with low-level macros.

> I really have *no* interest in learning low-level macros.

Life sucks and then you die (probably).

-- 
John Cowan[EMAIL PROTECTED]
I amar prestar aen, han mathon ne nen,http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, LOTR:FOTR


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Robin Lee Powell
On Sat, Mar 15, 2008 at 02:48:01PM -0400, Graham Fawcett wrote:
> On Sat, Mar 15, 2008 at 1:26 PM, Kon Lovett <[EMAIL PROTECTED]>
> wrote:
> > hart uses low-level macros only.
> 
> Is there a way I can alter hart so that it will play better with
> code that uses higher-level macro systems? I'd rather not rewrite
> it in syntax-case (though it's really not very much macro code;
> perhaps a syntax-case version wouldn't be that hard).
> 
> I confess to being an unhygienic, low-level macro user, and have
> to scratch my head whenever I encounter syntax-case code.

What about define-syntax, rather than syntax-case?  That's the only
thing I'm importing syntax-case for anyways.  (Yes, I'm friends with
John Cowan :)

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Graham Fawcett
On Sat, Mar 15, 2008 at 1:26 PM, Kon Lovett <[EMAIL PROTECTED]> wrote:
> hart uses low-level macros only.

Is there a way I can alter hart so that it will play better with code
that uses higher-level macro systems? I'd rather not rewrite it in
syntax-case (though it's really not very much macro code; perhaps a
syntax-case version wouldn't be that hard).

I confess to being an unhygienic, low-level macro user, and have to
scratch my head whenever I encounter syntax-case code.

Graham


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Robin Lee Powell
On Sat, Mar 15, 2008 at 10:26:28AM -0700, Kon Lovett wrote:
> hart uses low-level macros only.

I'm afraid that means very little to me.  Are you saying that all
things that use low-level macros die when you load syntax-case?  So
if I want to use high-level macros with hart, I'm just screwed?

I really have *no* interest in learning low-level macros.

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Kon Lovett

hart uses low-level macros only.

klovett ~ #204
$ csi

CHICKEN
(c)2008 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 3.0.8 - macosx-unix-gnu-ppc [ manyargs dload ptables  
applyhook ]

SVN rev. 9145   compiled 2008-03-01 on Nikko.local (Darwin)

; loading ./.csirc ...
#;1> (use hart)
; loading /usr/local/lib/chicken/3/hart.scm ...
; loading /usr/local/lib/chicken/3/hart-support.so ...
; loading /usr/local/lib/chicken/3/vector-lib.so ...
#;2> (hart (html))
#;3> ,q

klovett ~ #205
$ csi

CHICKEN
(c)2008 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 3.0.8 - macosx-unix-gnu-ppc [ manyargs dload ptables  
applyhook ]

SVN rev. 9145   compiled 2008-03-01 on Nikko.local (Darwin)

; loading ./.csirc ...
#;1> (use syntax-case)
; loading /usr/local/lib/chicken/3/syntax-case.so ...
; loading /usr/local/lib/chicken/3/syntax-case-chicken-macros.scm ...
#;2> (use hart)
; loading /usr/local/lib/chicken/3/hart.scm ...
; loading /usr/local/lib/chicken/3/hart-support.so ...
; loading /usr/local/lib/chicken/3/vector-lib.so ...
Error: invalid syntax: hart

Call history:

  (list (quote #(syntax-object (k . args)  
((top) #(ribcage #(_ name transformer) #((top) (top) (top)) #(...
  (list (quote #(syntax-object datum->syntax- 
object ((top) #(ribcage #(_ name transformer) #((top) (top...
  (cons (quote #(syntax-object apply ((top) # 
(ribcage #(_ name transformer) #((top) (top) (top)) #("i"...
  (cons transformer.479 (quote #(syntax-object  
((syntax-object->datum (syntax args))) ((top) #(ribcage..
  ((lambda (tmp.1322) ((lambda (tmp.1323) (if  
tmp.1323 (##sys#apply (lambda (k.1324 args.1325) (datum-..
  ((lambda (tmp.1323) (if tmp.1323  
(##sys#apply (lambda (k.1324 args.1325) (datum->syntax-object k. 
132..

  ($syntax-dispatch tmp.1322 (quote (any . any)))
  (##syncase#syntax-error tmp.1322)   <--

On Mar 15, 2008, at 10:04 AM, Robin Lee Powell wrote:


On Sat, Mar 15, 2008 at 05:38:51PM +0100, Felix Winkelmann wrote:

From: Robin Lee Powell <[EMAIL PROTECTED]>

csi's "-e" is implemented by wrapping the forms into a "(begin
...)". Due to the way toplevel expressions are macroexpanded (and
details that you don't want to know about), "(use syntax-case)"
will override the main macro-expansion mechanism starting with the
next toplevel expression. The begin-form is one toplevel
expression. What could possibly work is use another "-e" option to
run the "(hart ...)" expression.






-Robin

--
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Best Wishes,
Kon




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Robin Lee Powell
On Sat, Mar 15, 2008 at 05:38:51PM +0100, Felix Winkelmann wrote:
> From: Robin Lee Powell <[EMAIL PROTECTED]>
> 
> csi's "-e" is implemented by wrapping the forms into a "(begin
> ...)". Due to the way toplevel expressions are macroexpanded (and
> details that you don't want to know about), "(use syntax-case)"
> will override the main macro-expansion mechanism starting with the
> next toplevel expression. The begin-form is one toplevel
> expression. What could possibly work is use another "-e" option to
> run the "(hart ...)" expression.

First of all, that was just to simplify; the actual code was being
run with "csi [file]".

Secondly, no help:

$ csi -e "(use hart)" -e "(require-extension syntax-case)" -e "(hart (html))"
Error: unbound variable: html

Call history:

(##sys#void)
  (##sys#void)
(##core#undefined)
(##core#undefined)
(hart (html))
(html)
  (hart (html))
  (html)  <--

$ csi -e "(require-extension syntax-case)" -e "(use hart)" -e "(hart (html))"
Error: invalid syntax: hart

Call history:

  (list (quote #(syntax-object (k . args) ((top) 
#(ribcage #(_ name transformer) #((top) (top) (top)) #(...
  (list (quote #(syntax-object datum->syntax-object 
((top) #(ribcage #(_ name transformer) #((top) (top...
  (cons (quote #(syntax-object apply ((top) #(ribcage #(_ 
name transformer) #((top) (top) (top)) #("i"...
  (cons transformer.479 (quote #(syntax-object 
((syntax-object->datum (syntax args))) ((top) #(ribcage..
  ((lambda (tmp.1322) ((lambda (tmp.1323) (if tmp.1323 
(##sys#apply (lambda (k.1324 args.1325) (datum-..
  ((lambda (tmp.1323) (if tmp.1323 (##sys#apply (lambda 
(k.1324 args.1325) (datum->syntax-object k.132..
  ($syntax-dispatch tmp.1322 (quote (any . any)))
  (##syncase#syntax-error tmp.1322)   <--

-Robin

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] hart and syntax-case won't play nice. :(

2008-03-15 Thread Felix Winkelmann
From: Robin Lee Powell <[EMAIL PROTECTED]>
Subject: [Chicken-users] hart and syntax-case won't play nice. :(
Date: Sat, 15 Mar 2008 02:02:50 -0700

> 
> 
> $ csi -e "(use hart) (hart (html))"
> 
> 
> $ csi -e "(use syntax-case) (use hart) (hart (html))"
> Error: invalid syntax: hart
> 
> Call history:
> 
>   (list (quote #(syntax-object (k . args) ((top) 
> #(ribcage #(_ name transformer) #((top) (top) (top)) #(...
>   (list (quote #(syntax-object datum->syntax-object 
> ((top) #(ribcage #(_ name transformer) #((top) (top...
>   (cons (quote #(syntax-object apply ((top) #(ribcage 
> #(_ name transformer) #((top) (top) (top)) #("i"...
>   (cons transformer.479 (quote #(syntax-object 
> ((syntax-object->datum (syntax args))) ((top) #(ribcage..
>   ((lambda (tmp.1322) ((lambda (tmp.1323) (if tmp.1323 
> (##sys#apply (lambda (k.1324 args.1325) (datum-..
>   ((lambda (tmp.1323) (if tmp.1323 (##sys#apply (lambda 
> (k.1324 args.1325) (datum->syntax-object k.132..
>   ($syntax-dispatch tmp.1322 (quote (any . any)))
>   (##syncase#syntax-error tmp.1322)   <--
> 
> $ csi -e "(use hart) (use syntax-case) (hart (html))"
> Error: unbound variable: html
> 
> Call history:
> 
> (##sys#void)
>   (##sys#void)
> (##core#undefined)
> (##core#undefined)
> (hart (html))
> (html)
>   (hart (html))
>   (html)  <--
> 
> All I want out of syntax-case is syntax-rules; can I get that
> without doing whatever is breaking hart?

csi's "-e" is implemented by wrapping the forms into
a "(begin ...)". Due to the way toplevel expressions
are macroexpanded (and details that you don't want to
know about), "(use syntax-case)" will override the
main macro-expansion mechanism starting with the next
toplevel expression. The begin-form is one toplevel
expression. What could possibly work is use another "-e"
option to run the "(hart ...)" expression.


cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users