Thanks Alex,

A follow up question - please excuse me if I am misreading here.
As per the doc, the third bit indicates sym - independent of the
architecture. So isSym should just have 4 in its logic - No?

Regards,
Kashyap

On Sat, Feb 23, 2019 at 1:40 AM Alexander Burger <a...@software-lab.de>
wrote:

> Hi Kashyap,
>
> > I am having some trouble understanding the predicates and would really
> > appreciate some explanation.
> >
> > /* Predicates */
> > #define isNil(x)        ((x)==Nil)
> > #define isTxt(x)        (num(x)&1)
> > #define isNum(x)        (num(x)&2)
> > #define isSym(x)        (num(x)&WORD)
> > #define isSymb(x)       ((num(x)&(WORD+2))==WORD)
> > #define isCell(x)       (!(num(x)&(2*WORD-1)))
>
> This is miniPicoLisp, right? Only there we have isTxt().
>
>
> > I can understand isTxt and isNum - bit 1 set means it's text and bit 2
> set
> > means its number.
>
> Correct. As you know, this is depicted in miniPicoLisp/doc/structures
>
>       Primary data types:
>          num      xxxxxx10
>          sym      xxxxx100
>          pair     xxxxx000
>
>       Raw data:
>          bin      xxxxxxxx
>          txt      xxxxxxx1
>
>
> > However, why is WORD used for isSym? Could it not have
> > been just 4 and why is does it have to be sizeof(long) - which is also 4
> on
> > 32bit
>
> The reason is that miniPicoLisp compiles both on 32- and 64-bit
> architectures,
> so sizeof(long) can be either 4 or 8. In that aspect it differs from the
> full
> PicoLisp versions, which are always specialized for one architecture.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to