random-state.net

Curios, oddities, vagaries and anomalies -- all to amuse the old and delight the young. Lisp hacks sold during intermission.

files/  images/  tmp/  pubkey.asc  rss.xml

Log

...more at Flickr

Neat TYPEP Trick #
hacking, May 15th 2012

How do you test if an object is a cons that has the desired symbol in the car?

(typep x '(cons (eql :foo)))

Sure,

(and (consp x) (eq :foo (car x)))

is essentially just as short...

I still find cons types neat, even if they're a nightmare when it comes to type derivation, but that's a different matter. Some nightmares aren't all bad.

Nikodemus Siivola, <nikodemus@random-state.net>
Vaasankatu 6 C 49, 00500 Helsinki, Finland
+358 44 2727 526

Why Common Lisp?

Read all about the features of Common Lisp. Then get your bearings sorted out by having a look at the Nikodemus' Common Lisp FAQ.

Projects

I'm involved in more open source projects than I care to count. Here are the ones I think need more googlejuice.

Recommendations

If you are looking for lisp libraries, use Quicklisp and look no further.

Life

I practise historical fencing at School of European Swordmanship Helsinki, and keep a separate training diary about that.

...I do other stuff as well, but that's none of your business. :)

Creative Commons License Unless otherwise noted, contents of this website are licensed under a Creative Commons Attribution 2.5 License.