Re: Need help to understand a macro

2010-03-22 Thread Neil Jerram
Josef Wolf writes: > BTW: While we're at the docs, what I find confusing about guile documentation > is that it talks extensively about the C bindings, but has not much to say > about the language itself and how guile differs from the standard (extensions, > limitations). But maybe I've just not

Re: Need help to understand a macro

2010-03-22 Thread Andreas Rottmann
Josef Wolf writes: > On Fri, Mar 19, 2010 at 05:15:57PM +0100, Andreas Rottmann wrote: >> defmacros are bound to bite you in the proverbial ass real hard when you >> combine them with modules, so it's best to avoid them like the >> plague. At least that's my experience, FWIW. > > Thanks for the w

Re: Need help to understand a macro

2010-03-22 Thread Josef Wolf
On Mon, Mar 22, 2010 at 09:36:16PM +0100, Andy Wingo wrote: > Hi Josef, > > On Mon 22 Mar 2010 20:50, Josef Wolf writes: > > >> http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=doc/ref/api-macros.texi;h=51f54ed070af453a138282f61e7cd8dbbddc53a3;hb=HEAD > > > > Where can I find a version t

Re: Need help to understand a macro

2010-03-22 Thread Josef Wolf
On Sat, Mar 20, 2010 at 03:13:45PM +0100, szgyg wrote: > Josef Wolf wrote: > >I am trying to understand the defstruct macro from the "teach yourself > >scheme in fixnum days" tutorial, which can be found in chapter 9 at > >http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-11.html#node_cha

Re: Need help to understand a macro

2010-03-22 Thread Josef Wolf
On Mon, Mar 22, 2010 at 09:16:34PM +0100, Andy Wingo wrote: > Hi Josef, > > I seem to be the negative guy in replies to you. Uh? I did not notice anything negative? > Apologies for that! I don't see any reason for you to apologize... > On Mon 22 Mar 2010 20:25, Josef Wolf writes: > > > On Fr

Re: Need help to understand a macro

2010-03-22 Thread Andy Wingo
Hi Josef, On Mon 22 Mar 2010 20:50, Josef Wolf writes: >> http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=doc/ref/api-macros.texi;h=51f54ed070af453a138282f61e7cd8dbbddc53a3;hb=HEAD > > Where can I find a version translated in pdf or html or something? http://hydra.nixos.org/build/32939

Re: Need help to understand a macro

2010-03-22 Thread Andy Wingo
Hi Josef, I seem to be the negative guy in replies to you. Apologies for that! On Mon 22 Mar 2010 20:25, Josef Wolf writes: > On Fri, Mar 19, 2010 at 08:54:02AM -0400, Ken Raeburn wrote: >> >> The result of (if #f #f) is unspecified, not #f, according to r5rs. >> That means an implementation c

Re: Need help to understand a macro

2010-03-22 Thread Josef Wolf
On Fri, Mar 19, 2010 at 03:28:39PM +0100, Andy Wingo wrote: > Hi, > > On Fri 19 Mar 2010 09:57, Josef Wolf writes: > > > (show-expansion (defstruct tree height girth age leaf-shape leaf-color)) > > (macroexpand '(defstruct ...)) > > You might want to surround that with (pretty-print ...) from

Re: Need help to understand a macro

2010-03-22 Thread Josef Wolf
On Fri, Mar 19, 2010 at 05:15:57PM +0100, Andreas Rottmann wrote: > defmacros are bound to bite you in the proverbial ass real hard when you > combine them with modules, so it's best to avoid them like the > plague. At least that's my experience, FWIW. Thanks for the warning. I'd like to understan

Re: Need help to understand a macro

2010-03-22 Thread Josef Wolf
On Fri, Mar 19, 2010 at 08:54:02AM -0400, Ken Raeburn wrote: > On Mar 19, 2010, at 04:57, Josef Wolf wrote: > > My next question is more related to the defstruct macro. > > In line 11, defstruct stores the default initializers into the vv vector: > > > > (if (pair? f) (cadr f) '(if #f #f))) > >

Re: Need help to understand a macro

2010-03-20 Thread szgyg
Josef Wolf wrote: I am trying to understand the defstruct macro from the "teach yourself scheme in fixnum days" tutorial, which can be found in chapter 9 at http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-11.html#node_chap_9 My first question is of a more generic type. For a better u

Re: Need help to understand a macro

2010-03-19 Thread Andreas Rottmann
Andy Wingo writes: > Hi, > > On Fri 19 Mar 2010 09:57, Josef Wolf writes: > >> (show-expansion (defstruct tree height girth age leaf-shape leaf-color)) > > (macroexpand '(defstruct ...)) > > You might want to surround that with (pretty-print ...) from (ice-9 > pretty-print). > >> Of course this

Re: Need help to understand a macro

2010-03-19 Thread Andy Wingo
Hi, On Fri 19 Mar 2010 09:57, Josef Wolf writes: > (show-expansion (defstruct tree height girth age leaf-shape leaf-color)) (macroexpand '(defstruct ...)) You might want to surround that with (pretty-print ...) from (ice-9 pretty-print). > Of course this is possible. After all, code is data

Re: Need help to understand a macro

2010-03-19 Thread Ken Raeburn
On Mar 19, 2010, at 04:57, Josef Wolf wrote: > My next question is more related to the defstruct macro. > In line 11, defstruct stores the default initializers into the vv vector: > > (if (pair? f) (cadr f) '(if #f #f))) > > So if the field is a pair, the initializer is stored in vv. That's eas

Need help to understand a macro

2010-03-19 Thread Josef Wolf
Hello, I am trying to understand the defstruct macro from the "teach yourself scheme in fixnum days" tutorial, which can be found in chapter 9 at http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-11.html#node_chap_9 My first question is of a more generic type. For a better understanding