3 ms·
third element in the list containing the data about a person Most people don't do that, except in throwaway code. In CL you can use an alist, a plist, a struct
by gruseom 16y ago
third element in the list containing the data about a person
Most people don't do that, except in throwaway code. In CL you can use an alist, a plist, a struct, or CLOS.
I've gotten used to thinking in terms of symbols so much that I find it hard to go back
Given that Lisp's history with symbolic computing goes back to the beginning, something about that doesn't sound right.
Your person->name comment reminds me of something, by the way. Portions of our app run in both CL and JS (via the Parenscript library). This is relatively easy, although there are a few disagreements between the two that you have to watch out for (such as how they handle null). Anyway, there are lots of CL features we've "ported" to JS via macros, but there is also one JS feature I found myself envying so much that I finally wrote a partial implementation of it in CL. That is JS's willingness to allow you to stick any property on any object just by setting it. It's a rather Lispy feature since it's maximally dynamic and maximally flexible. I find it handy for incremental development. When you have some data about a thing that you want to associate with it, but only some of the time, it's a real pain to have to make a separate data structure to hold it and then make sure it gets passed alongside the original thing to all the appropriate places. Our CL implementation of this is pretty crude but it allows the important thing, which is that you can write (@ something :some-data) and (setf (@ something :some-data) "blah") pretty much wherever you want. So we can be said to have Greenspunned a bit of JS in Lisp!