[Ecls-list] Accessing cons values in C

Chris Osborne chris.osborne at gmx.com
Wed Jul 29 22:39:55 UTC 2015

Well, I can understand the sentiment, but whilst I said C, it’s actually modern C++ which is approaching lisp with every new standard IMO. I’m using ECL in an *extremely* overkill capacity to to act as “smart” config files and to run a simple REPL for the user to play around with configuring the application’s output how they want (rather than being yet another application that defines a new language lacking in logic for its interactive interface), thus all major computations are passed back to C++, so I’d rather be able to rapidly traverse the trees to extract the commands input by the user.

Anyhow, here’s the solution:
I just found that enable-smallcons is on by default (for some major performance gains when I looked into it). In this scenario, there’s a set of macros ECL_CONS_PTR, ECL_CONS_CAR etc. defined in object.h to access the cons pointers directly, not sure how I missed this earlier, but at least I’ve found it now (hopefully the info will also show up in the mailing list archive in a web search if anyone else needs it).


> On 30 Jul 2015, at 00:11, Pascal J. Bourguignon <pjb at informatimago.com> wrote:
> Chris Osborne <chris.osborne at gmx.com> writes:
>> Am I missing something obvious here or do I just have to use the cl
>> functions in C to access elements of what is essentially lisp’s
>> simplest data type?
> You wouldn't want random C code to fuck with your data structures, would
> you?
> Don't write C code!
> -- 
> __Pascal Bourguignon__                 http://www.informatimago.com/
> “The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
> ------------------------------------------------------------------------------
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list

More information about the ecl-devel mailing list