Re: [Chicken-users] Defining defmacro using define-syntax

2019-05-14 Thread Juergen Lorenz
Hi all,

yes, there is a simple way: (import procedural-macros) and you'll have
not only a hygienic (if you want so) define-macro, but other procedural
macros and macro creators as well.

Cheers Juergen
> 
> The FermaT program transformation system is implemented in WSL
> and translated to Scheme for compiling or interpreting.
> 
> It was originally developed using SCM scheme which uses defmacro
> to define macros, eg:
> 
> (defmacro floop (name . body)
>   `(call-with-current-continuation
>  (lambda (,name)
>(do () (#f #t)
>   ,@body
> 
> (defmacro pop (v1 v2)
>   `(begin
>  (set! ,v1 (car ,v2))
>  (set! ,v2 (cdr ,v2
> 
> (defmacro push (v e)
>   `(set! ,v (cons ,e ,v)))
> 
> I am trying to port it to other Scheme versions. For bigloo
> I can use define-macro to define defmacro as a macro:
> 
> (define-macro (defmacro name . forms)
>   \`(define-macro (,name . ,(car forms)) ,\@(cdr forms)))
> 
> Chicken scheme does not appear to have defmacro or define-macro
> but does have define-syntax.
> 
> Is there a way to define defmacro using define-syntax?
> 
> -- 
>   Martin
> 
> Dr Martin Ward | Email: mar...@gkc.org.uk | http://www.gkc.org.uk
> G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4
> 
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users

-- 

Dr. Juergen Lorenz
Gruener Weg 27
29471 Gartow



signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] what does "##core#check" do?

2019-05-14 Thread Peter Bex
On Tue, May 14, 2019 at 07:05:41AM +0200, Marco Maggi wrote:
> Ciao,
> 
>   in the "record-variants" egg there is:
> 
>(##core#check (##sys#check-structure x ',original-name))
> 
> I understand what:
> 
>(##sys#check-structure x ',original-name)
> 
> does,  but  what  is  the  "##core#check" for?   In  other  code  I  see
> "##sys#check-structure" uses without it.

It's an annotation in the core language (see core.scm) that causes the
expression inside to be eliminated in unsafe mode.  In normal mode, it
will just walk the expression as if the ##core#check wasn't there.

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users