> I think you misread the source of fnmap. Of course it creates a new
> map in the beginning just as hash-map does. Then assoc/dissoc/etc.
> just delegates to the underlying map with the appropriate fiddling
> with the setter/getter.
>
> If you already have a map you can do something like:
>
> (req
> There's a library in clojure.contrib which allows to create your own
> getters / setters for maps :
>
> http://richhickey.github.com/clojure-contrib/fnmap-api.html
This is actually a very cool approach and it fits my ideas quite well.
The only problem I have with it is that it constructs a whole
>> Is there a good way to make a map case-insensitive for string keys? I
>> first thought just wrapping some function around it would be it, but
>> when I try it, it is really a bit more involved. Has anyone done this,
>> or is there a recommended way?
>
> Do you want real case-insensitivity (i.e.,
Is there a good way to make a map case-insensitive for string keys? I
first thought just wrapping some function around it would be it, but
when I try it, it is really a bit more involved. Has anyone done this,
or is there a recommended way?
Florian
--
Florian Ebeling
florian.ebel...@gmail.com
--
> What do you think should be the boolean result of (> nil 1)?
>
> Since the inequality functions only work with Numbers, and nil is not
> a Number. The only way to make that work would be to impute some
> default numerical value to nil, which would probably introduce more
> problems than it solve
Hi,
out of curiosity, what is the reasoning behind this behavior (I'm
pretty sure it is intended):
(= nil 1)
=> false
(> nil 1) ;; NullPointerException
Same behavior for >= <= etc.
Florian
--
Florian Ebeling
florian.ebel...@gmail.com
--
You received this message because you are subscribed
> AFAIK, such a function is still not in clojure core because it's not clear
> to Rich whether f should have one argument (the value), or 2 arguments (key
> + value).
That is a good question. But I thought if the key makes a difference,
then one could use standard map and rely on map's collection
I was just wondering how a #'map for maps could be done most
succinctly. Came up with this:
(defn mapmap
"Map values of map m using function f."
[f m]
(reduce (fn [m [k v]]
(assoc m k (f v))) {} m))
But there is probably a more straightforward way. What do you use?
Florian
--
>> Neither gen-class nor proxy seem to mention how one can access or
>> mutate member variables. I would have thought instance variables
>> would be accessible and mutatable within some kind of binding...
>
> gen-class has an :exposes option that allows you to create
> getter and setter methods f
> In Java I'd just have an interface
> with two implementations, and bootstrap the tests with a different
> implementation, in clojure I guess I'd do something like:
> (in-ns `some.thing)
> (defn foo [] nil)
> or something?
That would consitute a root binding because of the 'defn, but you need
a
+1
Coming across that problem just yesterday.
On Fri, Aug 28, 2009 at 3:54 PM, Sean Devlin wrote:
>
> +1
>
> On Aug 28, 9:41 am, Chas Emerick wrote:
>> Definitely +1, yes.
>>
>> - Chas
>>
>> On Aug 28, 2009, at 4:27 AM, Mike Hinchey wrote:
>>
>> > I have a suggestion for the with-open macro. I
>>> And might it be a
>>> good idea to be able to name .clj files instead of namespaces as an
>>> option? Then one could use regular ant filesets constucted
>>> automatically from expressions, instead of naming namespaces
>>> individually.
>
> And now this has also been added. Both the compile and
Thanks for sharing this. What I miss a bit is the ability to set the
*compile-path* to something other than "classes". And might it be a
good idea to be able to name .clj files instead of namespaces as an
option? Then one could use regular ant filesets constucted
automatically from expressions, in
>>> I randomly get ClassNotFoundExceptions when I try to compile a file.
>>> This is a paste from the repl:
>>>
>>> Clojure 1.0.0-
>>> user=> (compile 'app.hello)
>>> java.lang.RuntimeException: java.lang.ClassNotFoundException:
>>> app.hello$exec__4 (NO_SOURCE_FILE:0)
It doesn't happen under lin
>> I randomly get ClassNotFoundExceptions when I try to compile a file.
>> This is a paste from the repl:
>>
>> Clojure 1.0.0-
>> user=> (compile 'app.hello)
>> java.lang.RuntimeException: java.lang.ClassNotFoundException:
>> app.hello$exec__4 (NO_SOURCE_FILE:0)
>> user=> (compile 'app.hello)
>> a
Hi,
I randomly get ClassNotFoundExceptions when I try to compile a file.
This is a paste from the repl:
Clojure 1.0.0-
user=> (compile 'app.hello)
java.lang.RuntimeException: java.lang.ClassNotFoundException:
app.hello$exec__4 (NO_SOURCE_FILE:0)
user=> (compile 'app.hello)
app.hello
I'm really
> I randomly get ClassNotFoundExceptions when I try to compile a file.
> I'm running the MacPorts packaged version 1.0.0 of Clojure on OS X
> 10.5.7. (With JLine support.)
I should probably mention the java version as well:
Apple-bundled 1.6.0_13-b03-211 (64 bit)
--
Florian Ebeling
Twitter:
17 matches
Mail list logo