Re: A question about the definition of tail in miniPicoLisp

2020-08-27 Thread C K Kashyap
Thank you Alex and AlexG, The definition of tail was the only thing I had to change in order to make mPL work after expanding the cell to 4 words :) (ofcourse, I had to change gen3m as well). Using an index into an array to encode the function pointer seems like an interesting idea. Although I th

Re: A question about the definition of tail in miniPicoLisp

2020-08-27 Thread Alex Gilding
One technique in C for mapping incompatible pointer or alignment sizes (for when you can't, or don't want to, convert directly between pointer and `intptr_t`) is to use an intermediate array, and instead of storing native pointers, store indexes into this array. For your case you could put all the

Re: A question about the definition of tail in miniPicoLisp

2020-08-27 Thread Alexander Burger
On Wed, Aug 26, 2020 at 11:16:48PM -0700, C K Kashyap wrote: > About why I am trying it - it's primarily just a learning exercise for me. > What I am trying is expanding the cell to 4 words instead of two and use > the extra words as the meta data and not require tagged pointers. This way I see.

Re: A question about the definition of tail in miniPicoLisp

2020-08-26 Thread C K Kashyap
Thanks Alex, About why I am trying it - it's primarily just a learning exercise for me. What I am trying is expanding the cell to 4 words instead of two and use the extra words as the meta data and not require tagged pointers. This way I could even build it with TCC that does not seem to align func

Re: A question about the definition of tail in miniPicoLisp

2020-08-26 Thread Alexander Burger
Hi Kashyap, > I am still working on the idea of using non-tagged pointers in miniPicoLisp > - in order to get rid of the requirement that function pointers be word > aligned. Why would you want to do that? The concept of encoding the tags in the lowest bits of a pointer is the core idea of PicoLi

A question about the definition of tail in miniPicoLisp

2020-08-26 Thread C K Kashyap
Hi Alex, I am still working on the idea of using non-tagged pointers in miniPicoLisp - in order to get rid of the requirement that function pointers be word aligned. In the process I noticed that the definition of tail is as follows - #define tail(x) (((x)-1)->cdr) Does this not result in