Yes, I think you have it. In lisp, to evaluate a number is simply to return
that number. To evaluate a symbol is to return its value. Otherwise, it is a
procedure call. If you haven't read how picolisp handles procedures, you
should look into the documentation.

John

On Fri, Feb 25, 2011 at 3:01 PM, Ana Zgombic <morse...@nybl.info> wrote:

> Hi John,
>
> *thank you*.
>
> now things make more sense.
>
> next question:
>
> the EVAL C macro.
>
> #define EVAL(x)         (isNum(x)? x : isSym(x)? val(x) : evList(x))
>
> that's in src/pico.h:212
>
> my attempt:...
>
> i looked at isNum() and it calls num() and... i broke down after that.
>
> so, i'll try to put that into pseudocode first.
>
> if (isNum(x)) {
>    x
> } else {
>   if (isSym(x)) {
>      val(x)
>   } else {
>     evList(x)
>   }
> }
>
> again. try... if x is a number, then x.
> otherwise
> if x is a symbol, then get the value of x
> else... x is a list! phew. go forth and evaluate.
>
> now burn me.
>
> Ana
>
> On Sat, Feb 26, 2011 at 3:42 AM, John Duncan <duncan.j...@gmail.com>
> wrote:
> > "fun" is the name created by that typedef. It is the type of pointers to
> > functions from "any" to "any".
> >
> > "any" is defined on line 56 of pico.h as a pointer to struct cell.
> > John
> > On Fri, Feb 25, 2011 at 2:20 PM, Ana Zgombic <morse...@nybl.info> wrote:
> >>
> >> Hi list,
> >>
> >> i'm looking at the picolisp implementation in C. i hope you don't mind
> >> me asking here every so often since my C chops is only good for app
> >> development and not good enough for language implementations.
> >>
> >> here's the line:
> >>
> >> > typedef any (*fun)(any);
> >>
> >> as i understand it, it says typedef "any" to a "function returning a
> >> pointer which takes an argument 'any'". and "any" is defined as a
> >> typedef to a pointer to a"struct cell".
> >>
> >> did i get that one right?
> >>
> >> Ana
> >>
> >> --
> >> http://nybl.info
> >> --
> >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
> >
> >
> >
> > --
> > John Duncan
> > University of Georgia College of Veterinary Medicine
> > Class of 2012
> > SCAVMA Treasurer Emeritus
> > VBMA President Emeritus
> >
>
>
>
> --
> http://nybl.info
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>



-- 
John Duncan
University of Georgia College of Veterinary Medicine
Class of 2012
SCAVMA Treasurer Emeritus
VBMA President Emeritus

Reply via email to