Hi Kashyap,

> I was trying to follow through what happens when I run (de f (x y) (+ x y))
> using printf debugging in minipicolisp.
> 
> If I understand correctly, "de" is read in at io.c:385 if (x =
> isIntern(tail(y),
> Intern))

Correct. Here the symbol 'de' is read - and thus either found in the internals,
or created as a new internal symbol (which will not happen here, as 'de' is a
built-in symbol and exists always when the reader runs).


> However, what I am having some trouble understanding is - when does the
> mapping to doDe happen?

The symbol 'de' has a pointer to the code doDe() in its value.


> I mean, when I look at  evList and try to follow it
> - I notice that  if (isNum(foo = val(foo))) is already true "de". Why was

val(foo) is the function pointer. In case of Lisp-level functions (EXPRs and
FEXPRs) this would be a list instead of a number.


> the value of "de" set to num type and when did it get set to the function
> that maps to doDe (flow.c:207).

This is a bit tricky in miniPicoLisp.

In "normal" PicoLisp the values for built-in symbols is set in src64/glob.l:251

   initFun NIL       "de"        doDe

or in src/tab.c:98

   {doDe, "de"},

But in mini the ROM contents are pre-built with gen3m.c, ending up as encoded C
structures in rom.d

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to