send from agent error handler does not work

2011-07-27 Thread abhi
I tested the following on clojure 1.2 and clojure 1.2.1 and it does not seem to work. (def foo (agent nil)) (def bar (agent nil :error-handler (fn [a e] (do (def called? true) (send foo (constantly e) (def called? false) (send bar inc) ; try incrementing nil (await error); wait for a

Re: problem with take-while

2011-07-27 Thread Michael Wood
On 27 July 2011 00:03, axyzxp wrote: > Hi, > experimenting with clojure API i had this: > > user=> (take-while #(= (mod 20 %) 0) (apply (fn [x y] (rest (range > (max x y [10 20])) > (1 2) > > but i expect to have (1 2 5 10) because of (apply (fn [x y] (rest > (range (max x y [10 20]) retur

Re: Invitation for Open Source Project

2011-07-27 Thread Vincent
right sir -- 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 emai

[ANN] cljs-devmode - A development mode for ClojureScript

2011-07-27 Thread Max Weber
Hello everyone, I like to introduce you to cljs-devmode, which is a "development mode" for ClojureScript. It is really a primitive prototype for a ClojureScript development mode, but it works for me so far. I only wrote it to get started with ClojureScript in one of my Clojure web applications. c

Re: cljs-devmode - A development mode for ClojureScript

2011-07-27 Thread Alen Ribic
Thanks Max. This is wonderful. I can throw my current hack-job out the window. -Alen PS. Should I encounter any issues, I'll post them via github. On Jul 27, 12:31 pm, Max Weber wrote: > Hello everyone, > > I like to introduce you to cljs-devmode, which is a "development mode" for > ClojureScr

Emacs, swank, leiningen repl-init and output to *out* getting lost...

2011-07-27 Thread kjeldahl
If that subject did not scare you off already you might be the right person to comment. To set the scene, I'm writing an application with an embedded web server (using ring and jetty), and my srv.core module has a log function defined as: (let [repl-out *out*] (defn log [msg & vals] (

Minimalist autocompile workflow for ClojureScript

2011-07-27 Thread Alex Osborne
Just sharing the stopgap method for "static HTML" (no server) ClojureScript development I'm using until someone cooks up a REPL that evals in the browser instead of Rhino. Nothing particularly exciting here, but really beats restarting the JVM on every compile. :-) This will only work on Linux as

How to write `when-lets`

2011-07-27 Thread Feng Shen
Clojure core.clj has a macro when-let, I am wondering how to write a macro `when-lets` (when-lets [symbol-1 test-1 symbol-2 test-2 ... ] body ) body only get evaluated when (and test-1 test-2 ) I am thinking about it, anybody ha

cake create project / setup instructions

2011-07-27 Thread octopusgrabbus
Before getting too far along, I'd like to set up my project the way I've seen other projects' configurations, like clj-http and clojure- csv. I can build my project, but it is not set up in the standard way. I am using cake, but cannot find instructions on configuring and then creating the project

I made you something.

2011-07-27 Thread Steven Deobald
http://groups.google.com/group/clojure-meta Big hugs to you all, from a tired old man. -steven -- 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 moderate

Code structure/design problems

2011-07-27 Thread Oskar
Hi! I'm making a game with Clojure. And I have a few code structure/design problems. I have an atom with characters (a map of maps) in my main file. But because I don't want to make that file too big I have, for example, a file called "ai.clj" with AI stuff, that I require from the main file. For

ClojureScript url path confusion

2011-07-27 Thread kjeldahl
I've set up my ring/jetty based application to dynamically compile any updated clojurescript source files, similar to the clojurescript devenv package recently announced. I'm having some trouble getting the paths correct though. My toplevel directory looks like this: mysoft srv src srv

Re: How to write `when-lets`

2011-07-27 Thread Dmitry Gutov
This would be a straightforward solution: (defmacro when-lets [bindings & body] `(let ~bindings (when (and ~@(map first (partition 2 2 bindings))) ~@body))) It works well in simple cases, but breaks e.g. in case of parameter destructuring. If you read `(source when-let)`, you'll see

Re: Code structure/design problems

2011-07-27 Thread Benny Tsai
Hi Oskar, I just came across this article yesterday, which I thought you may find useful. It's a 4-part series where the author discusses his experience implementing games in a functional style: http://prog21.dadgum.com/23.html He was using Erlang, but I think many of the same ideas apply her

Re: How to write `when-lets`

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 10:51 AM, Dmitry Gutov wrote: > This would be a straightforward solution: > > (defmacro when-lets [bindings & body] >  `(let ~bindings >     (when (and ~@(map first (partition 2 2 bindings))) >       ~@body))) > > It works well in simple cases, but breaks e.g. in case of pa

Re: Code structure/design problems

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 10:04 AM, Oskar wrote: > I have an atom with characters (a map of maps) in my main file. But > because I don't want to make that file too big I have, for example, a > file called "ai.clj" with AI stuff, that I require from the main file. > For the monsters' AI to work, the

Re: How to write `when-lets`

2011-07-27 Thread Oskar
I tried to solve this, and, having very litte macro-writing experience, just looked at when-let and tried to modify it to work with multiple binds. This is what I ended up with: (defmacro when-lets [bindings & body] (if-not (seq bindings) `(do ~@body) (let [form (bindings 0) tst (bindi

ClojureScript - why is javascript object array and not a map?

2011-07-27 Thread Marko Kocić
Note the following code that works: (defn ^:export displayPlain [id] (let [h (.getElementById window/document id) txt (aget h "innerText")] (window/alert (str "plain " txt)) (aset h "innerText" "here I am!"))) Here, javascript object "h" is treated as array, and I was able to get

Re: ClojureScript - why is javascript object array and not a map?

2011-07-27 Thread Stuart Halloway
> Note the following code that works: > > (defn ^:export displayPlain [id] > (let [h (.getElementById window/document id) > txt (aget h "innerText")] > (window/alert (str "plain " txt)) > (aset h "innerText" "here I am!"))) > Here, javascript object "h" is treated as array, and I

Additional delay after pcalls?

2011-07-27 Thread mc4924
Hello everyone, I am a beginner with clojure and I am playing around with pcalls (I am using clojure 1.2.1). I see different behavior if I run some code from inside the REPL or launching it "form the command line". I have the following code in a file called "test-pcalls.clj": (let [waste-time (fn

Re: cake create project / setup instructions

2011-07-27 Thread octopusgrabbus
I found the new command for cake, but I get this error, so I'm a little confused as to what's going on. cake builds otherwise. cnorton@steamboy:~/projects/clojure$ cake new addr_verify unknown task: new On Jul 27, 8:50 am, octopusgrabbus wrote: > Before getting too far along, I'd like to set up

Re: Additional delay after pcalls?

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 11:44 AM, mc4924 wrote: > Hello everyone, I am a beginner with clojure and I am playing around > with pcalls (I am using clojure 1.2.1). > I see different behavior if I run some code from inside the REPL or > launching it "form the command line". > > I have the following co

Re: Additional delay after pcalls?

2011-07-27 Thread Ben Mabey
On 7/27/11 11:19 AM, Ken Wesson wrote: On Wed, Jul 27, 2011 at 11:44 AM, mc4924 wrote: Hello everyone, I am a beginner with clojure and I am playing around with pcalls (I am using clojure 1.2.1). I see different behavior if I run some code from inside the REPL or launching it "form the command

Re: cake create project / setup instructions

2011-07-27 Thread octopusgrabbus
cake new does work. I had run cake new in the wrong place before, so I am rebuilding the tree. Problem solved for now. On Jul 27, 1:13 pm, octopusgrabbus wrote: > I found the new command for cake, but I get this error, so I'm a > little confused as to what's going on. cake builds otherwise. > > c

Re: Problem with ClojureScript and Node.js

2011-07-27 Thread Oliver Kaiser
I seem to have fixed this by editing closure/library/closure/goog/base.js and rebuilding lib/goog.jar. The relevant line is "goog.global = this;" somewhere at the top where "this" should be replaced by "(function(){return this})();"; the bootstrap script contains the command to create the jarfile.

Re: Alright, fess up, who's unhappy with clojurescript?

2011-07-27 Thread Daniel Werner
On 27 July 2011 01:43, Mark Derricutt wrote: > My unhappiness with it is more akin to my unhappiness with ANY language that > tries to target multiple VM platforms, and that's mostly due to the > -potential- to break the community. It may be helpful to approach the issue with the premise that Clo

Re: problem with take-while

2011-07-27 Thread axyzxp
thanks guys, now everything is clearer to me. I really apreciate your help -- 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

Re: problem with take-while

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 1:51 PM, axyzxp wrote: > thanks guys, now everything is clearer to me. > I really apreciate your help You're welcome. -- 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 a

Re: How to write `when-lets`

2011-07-27 Thread Alan Malloy
On Jul 27, 5:50 am, Feng Shen wrote: > Clojure core.clj has a macro when-let, > I am wondering how to write a macro `when-lets` > > (when-lets [symbol-1 test-1 >                    symbol-2 test-2 >             ... >             ] >            body >            ) > > body only get evaluated when (

Re: How to write `when-lets`

2011-07-27 Thread Alan Malloy
On Jul 27, 11:11 am, Alan Malloy wrote: > On Jul 27, 5:50 am, Feng Shen wrote: > > > Clojure core.clj has a macro when-let, > > I am wondering how to write a macro `when-lets` > > > (when-lets [symbol-1 test-1 > >                    symbol-2 test-2 > >             ... > >             ] > >      

Re: How to write `when-lets`

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 2:13 PM, Alan Malloy wrote: > On Jul 27, 11:11 am, Alan Malloy wrote: >> On Jul 27, 5:50 am, Feng Shen wrote: >> >> > Clojure core.clj has a macro when-let, >> > I am wondering how to write a macro `when-lets` >> >> > (when-lets [symbol-1 test-1 >> >                    sy

Re: How to write `when-lets`

2011-07-27 Thread Aaron Cohen
On Wed, Jul 27, 2011 at 2:15 PM, Ken Wesson wrote: > On Wed, Jul 27, 2011 at 2:13 PM, Alan Malloy wrote: > > On Jul 27, 11:11 am, Alan Malloy wrote: > >> On Jul 27, 5:50 am, Feng Shen wrote: > >> > > (defn foldr > ([f coll] >(reduce f (reverse coll))) > ([f init coll] >(reduce f init

Re: How to write `when-lets`

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote: > I may be wrong, but don't you need to swap the order of the arguments to f? You can do that by writing f itself appropriately. Usually either it will be a closure or it won't matter (core +, etc.). -- Protege: What is this seething mass of p

Cake CLASSPATH Error

2011-07-27 Thread octopusgrabbus
I originally had a project set up that built correctly, but the project directories had not been set up with cake new. I saved my project and main files; created a new project tree with cake new addr_verify; and then replaced project.clj and addr_verify.clj with the working files. Before, addr_ver

format and printf can't be used with BigInt

2011-07-27 Thread Andrea Tortorella
Hi everyone, I don't know where to post about bugs (if this is a bug). Anyway in clojure 1.3 with the new numerics: (format "%d" 2N) throws IllegalFormatConversionException, is it a bug? are there any workarounds? -- You received this message because you are subscribed to the Google Groups "Clo

Re: How to write `when-lets`

2011-07-27 Thread Dmitry Gutov
> First: Why doesn't macroexpand expand the inner when-lets? It's not supposed to, see the doc. To do full expansion, you can use `clojure.walk/macroexpand-all`. > Is the gensym in the two expands the same thing, or do "they" get the > same name? That was surprising to me. I can't think of any re

Re: How to write `when-lets`

2011-07-27 Thread Aaron Cohen
On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson wrote: > On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote: > > I may be wrong, but don't you need to swap the order of the arguments to > f? > > You can do that by writing f itself appropriately. Usually either it > will be a closure or it won't matt

Re: Cake CLASSPATH Error

2011-07-27 Thread Mark Rathwell
Namespace file locations start from the src directory, in your project directory. So, a file that declares namespace addr-verify should be located in src/addr_verify.clj. A file that declares namespace addr-verify.addr-verify would be found in src/addr_verify/addr_verify.clj. On Wed, Jul 27, 20

Re: Cake CLASSPATH Error

2011-07-27 Thread octopusgrabbus
Thanks. It appears it was set up correctly all along, but didn't have the extra directories created by cake new. On Jul 27, 3:09 pm, Mark Rathwell wrote: > Namespace file locations start from the src directory, in your project > directory.  So, a file that declares namespace addr-verify should be

Re: How to write `when-lets`

2011-07-27 Thread Alan Malloy
On Jul 27, 11:57 am, Aaron Cohen wrote: > On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson wrote: > > On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote: > > > I may be wrong, but don't you need to swap the order of the arguments to > > f? > > > You can do that by writing f itself appropriately. Usua

Re: How to write `when-lets`

2011-07-27 Thread Alan Malloy
On Jul 27, 11:56 am, Dmitry Gutov wrote: > > First: Why doesn't macroexpand expand the inner when-lets? > > It's not supposed to, see the doc. To do full expansion, you can use > `clojure.walk/macroexpand-all`. > > > Is the gensym in the two expands the same thing, or do "they" get the > > same na

Re: format and printf can't be used with BigInt

2011-07-27 Thread Alan Malloy
On Jul 27, 11:45 am, Andrea Tortorella wrote: > Hi everyone, > I don't know where to post about bugs (if this is a bug). > Anyway in clojure 1.3 with the new numerics: > > (format "%d" 2N) > > throws IllegalFormatConversionException, is it a bug? are there any > workarounds? Unlikely to change an

Re: How to write `when-lets`

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 2:57 PM, Aaron Cohen wrote: > On Wed, Jul 27, 2011 at 2:39 PM, Ken Wesson wrote: >> >> On Wed, Jul 27, 2011 at 2:35 PM, Aaron Cohen wrote: >> > I may be wrong, but don't you need to swap the order of the arguments to >> > f? >> >> You can do that by writing f itself appro

Re: How to write `when-lets`

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 3:23 PM, Alan Malloy wrote: > On Jul 27, 11:56 am, Dmitry Gutov wrote: >> > First: Why doesn't macroexpand expand the inner when-lets? >> >> It's not supposed to, see the doc. To do full expansion, you can use >> `clojure.walk/macroexpand-all`. >> >> > Is the gensym in the

Re: format and printf can't be used with BigInt

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 4:33 PM, Alan Malloy wrote: > On Jul 27, 11:45 am, Andrea Tortorella wrote: >> Hi everyone, >> I don't know where to post about bugs (if this is a bug). >> Anyway in clojure 1.3 with the new numerics: >> >> (format "%d" 2N) >> >> throws IllegalFormatConversionException, is

Re: format and printf can't be used with BigInt

2011-07-27 Thread Sean Corfield
On Wed, Jul 27, 2011 at 4:32 PM, Ken Wesson wrote: > => (.format (java.util.Formatter.) "%d" (into-array Object [(bigint 2)])) > # > > (2N isn't recognized as a BigInteger literal by Clojure 1.2, it seems.) > > In my copy of Clojure 1.2, format also seems to work: > > => (format "%d" (bigint 2)) >

ClojureQL: debugging generated SQL / Dates

2011-07-27 Thread Brian Marick
I'm trying to figure out how to send a jodatime date into Postgres, for example to generate this SQL: SELECT animals.* FROM animals WHERE removed_from_service = '2001-11-11' Along the way, I've discovered that the SQL queries ClojureQL prints out can't be the ones it actually sends. Consider, f

Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
Sorry for the terrible subject line. I couldn't think of an easy way to describe the problem in a single line. (def net (node/require "net")) (defn portal [port host] (.createConnection net port host)) (defn -main [& args] ; Note that only one of these -main functions is in the file at any g

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
"It's odd that it works fine in the first one but no the second." You'd think with that post button being so small that it'd be difficult to... yeah. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@google

Re: Bizarre ClojureScript issue

2011-07-27 Thread Kevin Downey
are you sure you don't have an extra space in there? (. createConnection net …) vs. (.createConnection net …) On Wed, Jul 27, 2011 at 5:38 PM, Anthony Grimes wrote: > Sorry for the terrible subject line. I couldn't think of an easy way to > describe the problem in a single line. > (def net (node/

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
Yep, just double checked. No extra spaces. -- 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 unsub

Re: Bizarre ClojureScript issue

2011-07-27 Thread Kevin Downey
have you looked at the generated javascript? On Wed, Jul 27, 2011 at 5:44 PM, Anthony Grimes wrote: > Yep, just double checked. No extra spaces. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@goo

Re: format and printf can't be used with BigInt

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 8:25 PM, Sean Corfield wrote: > On Wed, Jul 27, 2011 at 4:32 PM, Ken Wesson wrote: >> => (.format (java.util.Formatter.) "%d" (into-array Object [(bigint 2)])) >> # >> >> (2N isn't recognized as a BigInteger literal by Clojure 1.2, it seems.) >> >> In my copy of Clojure 1.

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
Yeah. To the extent that I can read Javascript, the calls look exactly the same and it looks fine. -- 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 mod

Re: Bizarre ClojureScript issue

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 8:38 PM, Anthony Grimes wrote: > Sorry for the terrible subject line. I couldn't think of an easy way to > describe the problem in a single line. > (def net (node/require "net")) > (defn portal >   [port host] (.createConnection net port host)) > (defn -main [& args] ; Note

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
That's actually what I thought at first, but the node example that ships with ClojureScript actually does the same thing (uses a node function outside of -main and then calls that function from -main) I did and it works fine. Here is the generated JavaScript for the failing -main and such: por

Re: Bizarre ClojureScript issue

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 9:05 PM, Anthony Grimes wrote: > That's actually what I thought at first, but the node example that ships > with ClojureScript actually does the same thing (uses a node function > outside of -main and then calls that function from -main) I did and it works > fine. > Here is

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
The first argument to Javascript's 'call' is a 'this' argument. All generated functions are called like this. -- 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 membe

Re: Bizarre ClojureScript issue

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 9:21 PM, Anthony Grimes wrote: > The first argument to Javascript's 'call' is a 'this' argument. All > generated functions are called like this. If portal.core.net is an instance rather than a class variable then a null "this" would explain it not resolving. Is "_main" cal

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
It looks like main is called the same way. Like I said, my example is not much different than the one that comes with cljs. (ns nodels (:require [cljs.nodejs :as nodejs])) (def fs (nodejs/require "fs")) (def path (nodejs/require "path")) (defn file-seq [dir] (tree-seq (fn [f] (.isDirect

Re: Bizarre ClojureScript issue

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 9:30 PM, Anthony Grimes wrote: > It looks like main is called the same way. Like I said, my example is not > much different than the one that comes with cljs. > > (ns nodels >   (:require [cljs.nodejs :as nodejs])) > (def fs (nodejs/require "fs")) > (def path (nodejs/requir

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
Right, I have an ns form. I just didn't post it. (ns portal.core (:require [cljs.nodejs :as node] [clojure.string :as string] [goog.date.DateTime :as time])) This is all part of a bigger application. I just pulled stuff out to make a minimal example (that does fail, by

Re: Bizarre ClojureScript issue

2011-07-27 Thread Asim Jalis
Is it possible that the new function called portal is overwriting the namespace called portal? Could you try renaming the function called portal to something else? Like portal2? On Wed, Jul 27, 2011 at 6:05 PM, Anthony Grimes wrote: > That's actually what I thought at first, but the node example

Re: Bizarre ClojureScript issue

2011-07-27 Thread Anthony Grimes
Hah! That was it! You, sir, are one clever fellow. Thank you very much. -- 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 wi

Re: format and printf can't be used with BigInt

2011-07-27 Thread Chas Emerick
On Jul 27, 2011, at 8:56 PM, Ken Wesson wrote: >> In Clojure 1.2: >> >> (type (bigint 2)) => java.math.BigInteger >> >> In Clojure 1.3: >> >> (type (bigint 2)) => clojure.lang.BigInt >> (type 2N) => clojure.lang.BigInt > > What the devil? Why was this done? Seems like wheel reinvention to me.

Re: Bizarre ClojureScript issue

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 9:48 PM, Anthony Grimes wrote: > Hah! That was it! You, sir, are one clever fellow. Thank you very much. Damn. I didn't think of that. In normal Clojure, defn'ing x.y/x doesn't clobber the Java package named x with a function named x. But it looks like in JS packages and f

Generated nodejs code from ClojureScript doesn't include some functions

2011-07-27 Thread Anthony Grimes
This is an odd one. It seems that, when new functions are added to cljs.core, the code generated when you compile targeting nodejs doesn't include them. I noticed this initially when I pulled this commit https://github.com/clojure/clojurescript/commit/3b3ed7783ebbd07fec6772b6a1bca4ed32924fb8

Re: Generated nodejs code from ClojureScript doesn't include some functions

2011-07-27 Thread Anthony Grimes
I guess I should have added that it's not just rand that isn't being included. It's all of the recently added functions. Check the commit log. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Basic Data Structure Question

2011-07-27 Thread semperos
Let's say I have a nested map-like structure: { :a { :id "foo", -- 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

Re: Basic Data Structure Question

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 11:07 PM, semperos wrote: > Let's say I have a nested map-like structure: > { :a >     { :id "foo", OK ... ... and then what? -- 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 o

Re: Basic Data Structure Question

2011-07-27 Thread semperos
Darn tabbing...apologies for the previous post. Here's my full question: I have a map of maps, arbitrarily nested. Every individual map has a key/value entry that acts as a unique identifier for that map. I need to be able to write a function that, given the whole map of maps and the value of

Re: Basic Data Structure Question

2011-07-27 Thread Ken Wesson
On Wed, Jul 27, 2011 at 11:15 PM, semperos wrote: > Darn tabbing...apologies for the previous post. > Here's my full question: > I have a map of maps, arbitrarily nested. Every individual map has a > key/value entry that acts as a unique identifier for that map. I need to be > able to write a func

Re: Basic Data Structure Question

2011-07-27 Thread Alan Malloy
On Jul 27, 8:15 pm, semperos wrote: > Darn tabbing...apologies for the previous post. > > Here's my full question: > > I have a map of maps, arbitrarily nested. Every individual map has a > key/value entry that acts as a unique identifier for that map. I need to be > able to write a function that,

Re: Basic Data Structure Question

2011-07-27 Thread Alex Miller
You're basically building a tree. I find clojure.walk or clojure.zip are helpful for applying changes to a tree of maps like this. On Jul 27, 10:15 pm, semperos wrote: > Darn tabbing...apologies for the previous post. > > Here's my full question: > > I have a map of maps, arbitrarily nested. Ev

Re: How to write `when-lets`

2011-07-27 Thread Oskar
On Jul 27, 8:56 pm, Dmitry Gutov wrote: > > First: Why doesn't macroexpand expand the inner when-lets? > > It's not supposed to, see the doc. To do full expansion, you can use > `clojure.walk/macroexpand-all`. Oh, yeah. Thanks! > > Is the gensym in the two expands the same thing, or do "they"

Re: How to write `when-lets`

2011-07-27 Thread Oskar
On Jul 27, 9:23 pm, Alan Malloy wrote: > On Jul 27, 11:56 am, Dmitry Gutov wrote: > > > > First: Why doesn't macroexpand expand the inner when-lets? > > > It's not supposed to, see the doc. To do full expansion, you can use > > `clojure.walk/macroexpand-all`. > > > > Is the gensym in the two ex

Re: Code structure/design problems

2011-07-27 Thread Oskar
On Jul 27, 5:07 pm, Benny Tsai wrote: > Hi Oskar, > > I just came across this article yesterday, which I thought you may find > useful. It's a 4-part series where the author discusses his experience > implementing games in a functional style: > > http://prog21.dadgum.com/23.html > > He was using

Re: format and printf can't be used with BigInt

2011-07-27 Thread Tom Faulhaber
FWIW, clojure.pprint.cl-format handles this fine in 1.3: (cl-format nil "~d" 2N) => "2" On Jul 27, 11:45 am, Andrea Tortorella wrote: > Hi everyone, > I don't know where to post about bugs (if this is a bug). > Anyway in clojure 1.3 with the new numerics: > > (format "%d" 2N) > > throws IllegalF