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
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,
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
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
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