Multi-field sorting: juxt and sort-by

2010-08-18 Thread luskwater
This is a helpful hint, and probably one that others are already using, but seemed good to share. If you're sorting a list of maps on one field, you can use (sort-by :community list-of-residents) But sorting on two (or more) fields seems to require a little more coding: (sort-by :communit

Re: Is this the expected behavior related to agent options in action function?

2009-12-17 Thread luskwater
Try removing the colon from your ":meta" call in the action, so you don't invoke a map fetch, but call the #'meta function. user> (defn action2 [_] (meta *agent*)) ; call meta, not :meta user> (await (send agt action2)) user> @agt {"some" "data"} On Dec 17, 10:35 am, Carlos Moscoso wrote: > Hi,

Re: Performance tuning for a simple SLE solver

2009-11-23 Thread luskwater
I replaced the calls to get-in with a my-get-in macro that "compiled" them to nested calls on the map or vector: (my-get-in sle [:A 1 2]) => (((sle :A) 1) 2) The form (data key) seems to be about 10 to 15 times faster than the equivalent (get-in data [key]) on my laptop. It cut the runtime

Re: Modeling Data Associations in Clojure?

2009-09-16 Thread luskwater
You might also look at "Out of the Tar Pit" (http://web.mac.com/ ben_moseley/frp/paper-v1_01.pdf) by Mosely and Marks. It's an argument for the relational model that Stuart mentioned, with an example. (Warning: the example is a few pages out of the 60-odd pages of exposition and argument: great

Re: Parameterized query with clojure.contrib.sql

2009-01-27 Thread luskwater
I've put together two functions that handle this for me, and although I haven't looked at recent changes to clojure.contrib.sql (which sound interesting), perhaps there might be some interest in what I've got. The first function takes a database connection and a SELECT statement, returning a func