Re: Help with primer on maps, lists or vectors

2011-06-02 Thread MohanR

Those were useful ideas. I will read up more.

But the thread got hijacked.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Announcement: stockings clojure library for easy access to financial data

2011-06-02 Thread MohanR
Is that something like a mashup ?

Thanks,
Mohan

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Stout

2011-06-02 Thread David Jagoe
Well I like the name!

On 2 June 2011 06:21, Andreas Kostler andreas.koestler.le...@gmail.com wrote:
 Hi All,

 Stout is a porter stemmer implemention using a snowball-like syntax for 
 defining rules.
 Rules are of the form {:c? condition :s1 abc :s2 efg :a action}
 reading if condition is met, replace s1 with s2 and execute action.

 ## Usage

 (use 'stout.porter-stemmer)
 (map porter-stemmer coll)

 Where coll is a collection of terms you intend to stem. Stemming output is a 
 list of stemmed terms (stems).


 You can find stout on my github: g...@github.com:AndreasKostler/Stout.git

 Criticism is of all sorts is very welcome.

 Kind Regards
 Andreas


 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Help with primer on maps, lists or vectors

2011-06-02 Thread Stuart Halloway
Sean,

Well said. Just bought my subscription.

Stu

 On Wed, Jun 1, 2011 at 5:51 PM, Ken Wesson kwess...@gmail.com wrote:
 On Wed, Jun 1, 2011 at 10:06 AM, Ambrose Bonnaire-Sergeant
 abonnaireserge...@gmail.com wrote:
 Just to be clear, I linked to an unlimited time, free (cost), non-crippled
 demo.
 Er, if such a thing exists, why would anyone pay at the tollbooth?
 
 As if we haven't spent enough time discussing the Atlas in other threads...
 
 I bought lifetime access to support the project, get discounted access
 to the Clojure 1.3.0 atlas (coming soon) and to stop the popup nag box
 appearing while I use the atlas. And, frankly, I was spurred into
 buying it as a matter of principle because you were complaining so
 much about paying for information (the atlas contains a lot of
 metadata that is curated by hand - and therefore a value add over
 the raw data which is freely available elsewhere). So Chas has you to
 thank for the $40 I paid him :)
 -- 
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/
 
 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Stout

2011-06-02 Thread Andreas Kostler
Yes, soon programming clojure will be like a night out in town...
On 02/06/2011, at 4:31 PM, David Jagoe wrote:

 Well I like the name!
 
 On 2 June 2011 06:21, Andreas Kostler andreas.koestler.le...@gmail.com 
 wrote:
 Hi All,
 
 Stout is a porter stemmer implemention using a snowball-like syntax for 
 defining rules.
 Rules are of the form {:c? condition :s1 abc :s2 efg :a action}
 reading if condition is met, replace s1 with s2 and execute action.
 
 ## Usage
 
 (use 'stout.porter-stemmer)
 (map porter-stemmer coll)
 
 Where coll is a collection of terms you intend to stem. Stemming output is a 
 list of stemmed terms (stems).
 
 
 You can find stout on my github: g...@github.com:AndreasKostler/Stout.git
 
 Criticism is of all sorts is very welcome.
 
 Kind Regards
 Andreas
 
 
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


library or namespace doc helper function from repl?

2011-06-02 Thread Avram

Apologies for a silly question, there must be a simple way to do this
from the repl, but I can't seem to find it…

Is there a way from the repl to view all available functions in the
library or namespace?

It often happens that I know a library contains functionality I seek,
but I don't yet know the name.  I realize that I can try to use the
Atlas url (which is awesome) or an IDE or check github, but it would
be really nice not to have to leave the repl.
In R I would do:  library(help=libname)


Thanks in advance,
Avram

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: library or namespace doc helper function from repl?

2011-06-02 Thread Alex Robbins
(ns-publics 'namespace) will show all the publicly defined things in a
namespace.

On Thu, Jun 2, 2011 at 11:51 AM, Avram aav...@me.com wrote:

 Apologies for a silly question, there must be a simple way to do this
 from the repl, but I can't seem to find it…

 Is there a way from the repl to view all available functions in the
 library or namespace?

 It often happens that I know a library contains functionality I seek,
 but I don't yet know the name.  I realize that I can try to use the
 Atlas url (which is awesome) or an IDE or check github, but it would
 be really nice not to have to leave the repl.
 In R I would do:  library(help=libname)


 Thanks in advance,
 Avram

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: library or namespace doc helper function from repl?

2011-06-02 Thread Avram
That's perfect.  Thank-you!
-A

On Jun 2, 10:15 am, Alex Robbins alexander.j.robb...@gmail.com
wrote:
 (ns-publics 'namespace) will show all the publicly defined things in a
 namespace.



 On Thu, Jun 2, 2011 at 11:51 AM, Avram aav...@me.com wrote:

  Apologies for a silly question, there must be a simple way to do this
  from the repl, but I can't seem to find it…

  Is there a way from the repl to view all available functions in the
  library or namespace?

  It often happens that I know a library contains functionality I seek,
  but I don't yet know the name.  I realize that I can try to use the
  Atlas url (which is awesome) or an IDE or check github, but it would
  be really nice not to have to leave the repl.
  In R I would do:  library(help=libname)

  Thanks in advance,
  Avram

  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


update xml attribute value

2011-06-02 Thread siyu798
Hi,
  Does anyone know how to update xml element attribute value on the zipper 
data structure?

I have something like

root
element1 name=x1 description=d1/
element2 name=x2 description=d2/
/root

(:require (clojure [xml :as xml] [zip :as zip]) 
 [clojure.contrib.zip-filter.xml :as zf])

(let
  [src (- c:/my.xml io/file xml/parse zip/xml-zip)
   edf (zf/xml1- src :root :element1)
   n(- (zf/attr :description) (zip/replace ))])

and this is giving me java.lang.ClassCastException: java.lang.Character 
cannot be cast to clojure.lang.Associative (test-xml-zip.clj:0)

Thanks,

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: library or namespace doc helper function from repl?

2011-06-02 Thread James Estes
You could also try
(find-doc libname)

On Thu, Jun 2, 2011 at 11:15 AM, Alex Robbins
alexander.j.robb...@gmail.com wrote:
 (ns-publics 'namespace) will show all the publicly defined things in a
 namespace.

 On Thu, Jun 2, 2011 at 11:51 AM, Avram aav...@me.com wrote:

 Apologies for a silly question, there must be a simple way to do this
 from the repl, but I can't seem to find it…

 Is there a way from the repl to view all available functions in the
 library or namespace?

 It often happens that I know a library contains functionality I seek,
 but I don't yet know the name.  I realize that I can try to use the
 Atlas url (which is awesome) or an IDE or check github, but it would
 be really nice not to have to leave the repl.
 In R I would do:  library(help=libname)


 Thanks in advance,
 Avram

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: library or namespace doc helper function from repl?

2011-06-02 Thread Avram
find-doc retrieves too other things though.

For example, I'm exploring a bunch of libs now (including crane and
fs) but even if I ask only for just fs I get the kitchen sink:

user= (find-doc fs)
-
crane.ec2/cluster-confs
([cluster base-conf])
  Return a sequence of confs for each machine in the cluster.
-
clojure.contrib.pprint/add-english-scales
([parts offset])
  Take a sequence of parts, add scale numbers (e.g., million) and
combine into a string
offset is a factor of 10^3 to multiply by
-
clojure.contrib.pprint/cl-format
([writer format-in  args])
  An implementation of a Common Lisp compatible format function. cl-
format formats its
arguments to an output stream or string based on the format control
string given. It
supports sophisticated formatting of structured data.

etc…

(ns-publics 'lib) works best for me.
-A


On Jun 2, 10:22 am, James Estes james.es...@gmail.com wrote:
 You could also try
 (find-doc libname)

 On Thu, Jun 2, 2011 at 11:15 AM, Alex Robbins



 alexander.j.robb...@gmail.com wrote:
  (ns-publics 'namespace) will show all the publicly defined things in a
  namespace.

  On Thu, Jun 2, 2011 at 11:51 AM, Avram aav...@me.com wrote:

  Apologies for a silly question, there must be a simple way to do this
  from the repl, but I can't seem to find it…

  Is there a way from the repl to view all available functions in the
  library or namespace?

  It often happens that I know a library contains functionality I seek,
  but I don't yet know the name.  I realize that I can try to use the
  Atlas url (which is awesome) or an IDE or check github, but it would
  be really nice not to have to leave the repl.
  In R I would do:  library(help=libname)

  Thanks in advance,
  Avram

  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: update xml attribute value

2011-06-02 Thread Allen Johnson
 Does anyone know how to update xml element attribute value on the zipper
 data structure?
 I have something like
 root
     element1 name=x1 description=d1/
     element2 name=x2 description=d2/
 /root
 (:require (clojure [xml :as xml] [zip :as zip])
      [clojure.contrib.zip-filter.xml :as zf])
 (let
   [src (- c:/my.xml io/file xml/parse zip/xml-zip)
    edf (zf/xml1- src :root :element1)
    n    (- (zf/attr :description) (zip/replace ))])
 and this is giving me java.lang.ClassCastException: java.lang.Character
 cannot be cast to clojure.lang.Associative (test-xml-zip.clj:0)

Given that 'loc is the proper location in your zipper:

(zip/edit loc assoc-in [:attrs :description] new value)

Allen

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: update xml attribute value

2011-06-02 Thread siyu798
Thanks Allen, it works, I did not know the loc can be treated like a hash.

siyu

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: library or namespace doc helper function from repl?

2011-06-02 Thread Alex Robbins
Ironically, I found out about ns-publics from (find-doc ns-)

On Thu, Jun 2, 2011 at 12:57 PM, Avram aav...@me.com wrote:
 find-doc retrieves too other things though.

 For example, I'm exploring a bunch of libs now (including crane and
 fs) but even if I ask only for just fs I get the kitchen sink:

 user= (find-doc fs)
 -
 crane.ec2/cluster-confs
 ([cluster base-conf])
  Return a sequence of confs for each machine in the cluster.
 -
 clojure.contrib.pprint/add-english-scales
 ([parts offset])
  Take a sequence of parts, add scale numbers (e.g., million) and
 combine into a string
 offset is a factor of 10^3 to multiply by
 -
 clojure.contrib.pprint/cl-format
 ([writer format-in  args])
  An implementation of a Common Lisp compatible format function. cl-
 format formats its
 arguments to an output stream or string based on the format control
 string given. It
 supports sophisticated formatting of structured data.

 etc…

 (ns-publics 'lib) works best for me.
 -A


 On Jun 2, 10:22 am, James Estes james.es...@gmail.com wrote:
 You could also try
 (find-doc libname)

 On Thu, Jun 2, 2011 at 11:15 AM, Alex Robbins



 alexander.j.robb...@gmail.com wrote:
  (ns-publics 'namespace) will show all the publicly defined things in a
  namespace.

  On Thu, Jun 2, 2011 at 11:51 AM, Avram aav...@me.com wrote:

  Apologies for a silly question, there must be a simple way to do this
  from the repl, but I can't seem to find it…

  Is there a way from the repl to view all available functions in the
  library or namespace?

  It often happens that I know a library contains functionality I seek,
  but I don't yet know the name.  I realize that I can try to use the
  Atlas url (which is awesome) or an IDE or check github, but it would
  be really nice not to have to leave the repl.
  In R I would do:  library(help=libname)

  Thanks in advance,
  Avram

  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clojure@googlegroups.com
  Note that posts from new members are moderated - please be patient with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: update xml attribute value

2011-06-02 Thread Allen Johnson
 Thanks Allen, it works, I did not know the loc can be treated like a hash.

'loc itself isn't a map even though zip/edit makes it seem that way.
Behind the scenes zip/edit calls (zip/node loc) which will return a
map, at least in the case of this xml example. zip/edit then applies
the function you provided (assoc-in) to this map plus any supplied
args. The result of this replaces the node at loc.

https://github.com/clojure/clojure/blob/59b65669860a1f33825775494809e5d500c19c63/src/clj/clojure/zip.clj#L210

Allen

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


possible bug in cl-format (rounding floating-point number)

2011-06-02 Thread Travis Treseder
I didn't see this as an open issue on the JIRA bug list, so I thought
I would ask about it here.

 (cl-format nil ~,5f -434343.867071)
-434343.86707
 (cl-format nil ~,5f -434343.867072)
-434343.86707
 (cl-format nil ~,5f -434343.867075)

For input string: 43434386707
  [Thrown class java.lang.NumberFormatException]

Backtrace:
  0: 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  1: java.lang.Integer.parseInt(Integer.java:461)
  2: java.lang.Integer.valueOf(Integer.java:554)
  3: clojure.pprint$round_str.invoke(cl_format.clj:585)


After looking at the round-str function, it appears that if round-char
= 5, then result is parsed by Integer.valueOf(result), which causes
an exception if result is too large.  I rewrote part of it to use
BigInteger, and it seemed to fix the problem, but I didn't test it
extensively.  It might be a valid solution in any case.

Incidentally, I love using clojure.pprint.  It's powerful, and after
diving into the CLM spec I have new appreciation for the daunting task
it must be to test it.

-Travis

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Best/Idiomatic way of managing data that changes

2011-06-02 Thread yair
Hmm, I posted replies to the previous posters but I might have sent
them directly.  Apologies.  Thanks everyone for the replies, in terms
of the game loop itself, it is more or less dictated by using
processing, so basically there're callbacks for mouse events and for
re-drawing the screen so that's taken care of.

In terms of the data itself, I was a bit wary of using the ID approach
instead of a big massive data structure with everything in it.  I
somehow felt this was making things mutable in a way, but I am
convinced by the replies.  In terms of code elegance, I overlooked how
elegant update-in can be, as opposed to assoc-in, and using a set in
conjunction with judicious structuring of the data, as Meikel and Jeff
suggested, will definitely make things far far more elegant.

Thanks for the replies, this is a great group!

On Jun 2, 10:10 am, Jeff Rose ros...@gmail.com wrote:
 I think the type of data structures you use will depend on how you
 need to access the data.  For a GUI it's nice to be able to lookup a
 unit by ID, for example when it's clicked on, so I would probably
 store all units in a map by ID, and then have a separate location to
 ID map as you described.  They could be together in an atom, or
 separate in refs if you want more concurrency.  Using immutable data
 structures you just have to get used to creating new versions every
 time you modify data, but using functions like update-in and assoc-in
 you can probably get at your data pretty easily.  Create a couple
 functions to handle moving location, updating properties, etc., and
 you might find that it isn't ugliness that you are hiding :-)

 On Jun 1, 11:12 am, yair yair@gmail.com wrote:







  Hi,

  I am writing a little board game in clojure, mostly to educate myself
  about how to organise and implement a larger-scale program than my
  usual tiny little snippets.  The program has a central data structure
  of units which are placed on a map.  Each unit has some information
  like a name, movement points left, strength, and it's current location
  on a 2D hex-map.  Units are implemented as maps, so a unit can look
  like
  {:name Fighter 1 :movement [3 12] :strength [4 4] :location [1 2]}.
  I hold the units in a map from locations to the sequence of units on
  that location.  There is an atom that holds this map, so any change to
  the data means basically creating a new map and resetting the atom.

  So, when a unit moves, for example, I need to remove it from the
  sequence at it's old location, and add it to the sequence in the new
  location, and change it's location value and it's movement points
  value.  In Java, this would be pretty straightforward.  But with
  immutable data structures, it is quite clunky.  I have thought of some
  alternatives:

  1. Continue doing what I already am, perhaps write some functions that
  hide the ugliness and get on with it.
  2. Give each unit object an ID and hold a map from location to unit
  IDs and from ID to the actual unit object, but that is kinda like
  making immutable objects all over again.
  3. Using mutable data, like Java's lists, maps, etc.  This is of
  course extremely ugly and I would have to be strongly persuaded to go
  down this route.

  So, does anyone have any better ideas or is this type of program
  always going to have some impedance with FP and immutable data?

  Thanks

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Help with primer on maps, lists or vectors

2011-06-02 Thread Devin Walters
+1 on the atlas. It's a great way to surf clojure.

I paid for it not knowing if I'd use it, but the organization is great and 
would feel comfortable recommending it to a wide range of people interested in 
clojure.

Sent via mobile

On Jun 1, 2011, at 6:44 AM, Ambrose Bonnaire-Sergeant 
abonnaireserge...@gmail.com wrote:

 Hi Mohan,
 
 If you are exploring the Clojure landscape may I recommend Clojure Atlas.
 
 http://www.clojureatlas.com/org.clojure:clojure:1.2.0?guest=t#ds/maps
 
 The core functions provided with Clojure are grouped by concept. Just type
 a new subject into the search box.
 
 If you are trying to find a particular functionality, the Atlas is usually 
 pretty
 helpful in pointing you in the right direction.
 
 Of course for further details feel free to post on the group as you already 
 have done!
 
 Thanks,
 Ambrose
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Strange Loop 2011 - St. Louis - Sept 18-20

2011-06-02 Thread Martin Kielhorn
2011/3/18 Alex Miller a...@puredanger.com

 We do intend to record some or all of the talks.


Hi,
Are recordings available?

Regards, Martin

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Announcement: stockings clojure library for easy access to financial data

2011-06-02 Thread fxt
Not exactly. It is more a client API that exposes data from different
web services in a consistent way. It takes care of all the tedious
stuff: figuring out the right URL and query parameters, parsing the
JSON, XML, or CSV responses, handling errors, fixing quirks (e.g.
inconsistent time zones in date and time fields or stock symbols that
do not allow for a stock exchange prefix); that kind of stuff.

Try it out; the README.rst file is full of examples.

fxt


On Jun 2, 2:30 am, MohanR radhakrishnan.mo...@gmail.com wrote:
 Is that something like a mashup ?

 Thanks,
 Mohan

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


another question on macros defining functions

2011-06-02 Thread nil
Hi

Here's another macro-noob question. (Thanks for the help on the
previous question and please do let me know if stackoverflow is a more
appropriate place to ask noob questions.)

I'm trying to write a macro (or a function) that defines/declares
specifically named functions. In (let [eff gee] (foo eff)) I want
the macro foo to define/declare a function called foo-gee, not foo-
eff. What should I do differently?

First attempt:

(defmacro foo [x]
  (let [name# (symbol (str foo- x))]
`(defn ~name# [] (

(let [eff gee] (foo eff))
= #'user/foo-eff

Second attempt:

(defmacro foo [x]
  `(let [name# (symbol (str foo- ~x))]
 (defn name# [] (

(let [eff gee] (foo eff))
= #'user/name__4807__auto__

Third attempt:

(defmacro foo [x]
  `(let [name# (symbol (str foo- ~x))]
 (defn ~name# [] (

(let [eff gee] (foo eff))
= First argument to def must be a Symbol
   [Thrown class java.lang.Exception]

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: another question on macros defining functions

2011-06-02 Thread Ken Wesson
On Thu, Jun 2, 2011 at 10:06 PM, nil ache...@gmail.com wrote:
 Hi

 Here's another macro-noob question. (Thanks for the help on the
 previous question and please do let me know if stackoverflow is a more
 appropriate place to ask noob questions.)

 I'm trying to write a macro (or a function) that defines/declares
 specifically named functions. In (let [eff gee] (foo eff)) I want
 the macro foo to define/declare a function called foo-gee, not foo-
 eff. What should I do differently?

The problem here is that macros run at compile time, but let bindings
exist at run time.

If you need the name to be determined at run time you will need to use eval.

If you don't need the name at run time, why are you using (let [eff
gee] (foo eff)) and not simply (foo gee)?

Please state your requirements clearly.
-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: another question on macros defining functions

2011-06-02 Thread Daniel Renfer
You don't need to use eval to create a function dynamically in a macro.

For an example, take a look at:
https://github.com/duck1123/ciste/blob/master/src/main/clojure/ciste/sections.clj#L34

On Thu, Jun 2, 2011 at 10:34 PM, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Jun 2, 2011 at 10:06 PM, nil ache...@gmail.com wrote:
 Hi

 Here's another macro-noob question. (Thanks for the help on the
 previous question and please do let me know if stackoverflow is a more
 appropriate place to ask noob questions.)

 I'm trying to write a macro (or a function) that defines/declares
 specifically named functions. In (let [eff gee] (foo eff)) I want
 the macro foo to define/declare a function called foo-gee, not foo-
 eff. What should I do differently?

 The problem here is that macros run at compile time, but let bindings
 exist at run time.

 If you need the name to be determined at run time you will need to use eval.

 If you don't need the name at run time, why are you using (let [eff
 gee] (foo eff)) and not simply (foo gee)?

 Please state your requirements clearly.
 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Help with primer on maps, lists or vectors

2011-06-02 Thread MohanR
Atlas is a really useful way to look up information. It even shows the
source !!

Thanks,
Mohan

On Jun 1, 4:44 pm, Ambrose Bonnaire-Sergeant
abonnaireserge...@gmail.com wrote:
 Hi Mohan,

 If you are exploring the Clojure landscape may I recommend Clojure Atlas.

 http://www.clojureatlas.com/org.clojure:clojure:1.2.0?guest=t#ds/maps

 The core functions provided with Clojure are grouped by concept. Just type
 a new subject into the search box.

 If you are trying to find a particular functionality, the Atlas is usually
 pretty
 helpful in pointing you in the right direction.

 Of course for further details feel free to post on the group as you already
 have done!

 Thanks,
 Ambrose

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: another question on macros defining functions

2011-06-02 Thread Ken Wesson
On Thu, Jun 2, 2011 at 11:07 PM, Daniel Renfer d...@kronkltd.net wrote:
 You don't need to use eval to create a function dynamically in a macro.

You don't need to use eval to create a function via a macro at compile
time. But to create a function and intern it in a var whose name is
not known until run time is quite another matter.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: another question on macros defining functions

2011-06-02 Thread Daniel Renfer
user (defmacro foo [x]
(let [name# (symbol (str foo- x))]
  `(defn ~name# [] (
#'user/foo
user (let [eff gee] (foo eff))
#'user/foo-eff


On Fri, Jun 3, 2011 at 12:13 AM, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Jun 2, 2011 at 11:07 PM, Daniel Renfer d...@kronkltd.net wrote:
 You don't need to use eval to create a function dynamically in a macro.

 You don't need to use eval to create a function via a macro at compile
 time. But to create a function and intern it in a var whose name is
 not known until run time is quite another matter.

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: another question on macros defining functions

2011-06-02 Thread Daniel Renfer
I'm sorry. I misread something in the OP.

ignore me, I got nothing.

On Fri, Jun 3, 2011 at 1:16 AM, Daniel Renfer d...@kronkltd.net wrote:
 user (defmacro foo [x]
        (let [name# (symbol (str foo- x))]
          `(defn ~name# [] (
 #'user/foo
 user (let [eff gee] (foo eff))
 #'user/foo-eff


 On Fri, Jun 3, 2011 at 12:13 AM, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Jun 2, 2011 at 11:07 PM, Daniel Renfer d...@kronkltd.net wrote:
 You don't need to use eval to create a function dynamically in a macro.

 You don't need to use eval to create a function via a macro at compile
 time. But to create a function and intern it in a var whose name is
 not known until run time is quite another matter.

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en