Hi,
Am 02.09.2009 um 01:44 schrieb Richard Newman:
(into {}
(filter (fn [[key val]]
(even? val))
{:dog 5 :cat 4 :mouse 7 :cow 6}))
And to show one more road to Rome (where all roads lead to):
(into {} (for [[k v] the-map :when (even? v)] [k v]))
Sincerely
Meikel
s
On Tue, Sep 1, 2009 at 4:43 PM, Luc
Prefontaine wrote:
> Hi John,
>
> Clj-record will make its way into production in a couple of weeks.
>
> It's been working flawlessly in high volume tests here.
Hi Luc,
That's great to hear. I recently set up a Google Group for clj-record,
so you may want to si
On Sep 1, 7:35 pm, Conrad wrote:
> Hi everyone! I was wondering if there was a better idiom in Clojure
> for filtering items from a map... Suppose we want to remove all items
> from a map that have an odd number as a value. Here's how I'd write
> it:
I like to use "reduce" for processing maps:
I've been fiddling with the LWJGL [1] with a view to making a game for my
children. It's slow going because when I learn more about Clojure I end up
changing my mind about how I want things structured. OpenGL is all new to
me as well - as is game programming in general.
As part of my exploration
Thanks for the info- Using "into" definitely cuts down a lot on the
ugliness.
--~--~-~--~~~---~--~~
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 pos
Hi Conrad,
I find this an interesting question because there is already a select
function in clojure.set, but it only works on sets. Why shouldn't it
work on maps? To make select work with maps we just replace disj with
dissoc:
(defn select
"Returns a set of the elements for which pred is true
It's currently being discussed in contrib, but noting is final yet.
On Sep 1, 7:44 pm, Richard Newman wrote:
> Conrad,
>
> (into {}
> (filter (fn [[key val]]
> (even? val))
> {:dog 5 :cat 4 :mouse 7 :cow 6}))
>
> =>
> {:cat 4, :cow 6}
>
> There's probably also a
Conrad,
(into {}
(filter (fn [[key val]]
(even? val))
{:dog 5 :cat 4 :mouse 7 :cow 6}))
=>
{:cat 4, :cow 6}
There's probably also a higher-order function that does what you want
in contrib, something like
(defn filter-map-v [f m]
(into {}
(fil
Hi everyone! I was wondering if there was a better idiom in Clojure
for filtering items from a map... Suppose we want to remove all items
from a map that have an odd number as a value. Here's how I'd write
it:
=> (apply hash-map
(apply concat
(filter (fn [[key val]]
Hello,
I'm a clojure newbie, with little java experience.
I've been skimming the net the last few days trying to solve my
problem.
Could anyone help?
Here it is:
I followed the instructions given by Rich on how to use JSwat with
Clojure.
The only difference is I'm using JSwat 4.5, the latest of
Hi John,
Clj-record will make its way into production in a couple of weeks.
It's been working flawlessly in high volume tests here.
We added an adapter on our medical message bus to capture historical
census data in messages. It records patient visits, employees dealing
with patients, service r
Thanks for the link. I've tried and tried to understand monads, with
little success. It's lead me to the conclusion that monads won't
easily become one of the dominating approaches to program
organization. This is because, as the document says, without an
understanding of category theory, "it's li
you could try running this test script:
http://gist.github.com/179346
the script downloads clojure and does a test aot compile.
if everything works the only output you should see is "Hello World"
example:
hiredman rincewind ~% sh ./clojure-aot-test.sh
Hello World
On Tue, Sep 1, 2009 at 11:3
Just build it :-)
I used the source at http://github.com/richhickey/clojure/tree/master to
build the clojure.jar Now everything works fine.
Terrance Davis wrote:
> The details help a lot. I was able to ensure I am doing the same steps
> with a file not found exception instead of a working file
Journal of Universal Computer Science (J.UCS)
http://www.jucs.org
Special Issue on Lisp: Research and Experience
Call for Papers
The Lisp family of languages is a driving force both in the
programming language research field and in the software industry
field. Lisp dialects have been us
As, Patrick Sullivan, said, the built-in sorted-map guarantees that
the keys will be in order. I'm probably missing something here, but
wouldn't that fit the bill?
http://clojure.org/api#sorted-map
Rob Lachlan
On Aug 27, 12:35 pm, Howard Lewis Ship wrote:
> Is the order of keys in a map predi
Ah,
thanks to both of you for the fast reply - as always, the problem's to
be found between chair and keyboard. ;)
Greetings from Germany,
Sir Diddymus
P.S.: Btw, great props to Meikel for vimclojure - now I can use the
world's best editor with nice Clojure integration. 8)
--~--~-~--
The details help a lot. I was able to ensure I am doing the same steps
with a file not found exception instead of a working file.
I notice that the you used 'clojure.jar' whereas I am using
'clojure-1.0.0.jar'. Did you happen to compile your clojure.jar from
source? I used the current release dow
On Tue, Sep 1, 2009 at 1:36 PM, John Harrop wrote:
> On Tue, Sep 1, 2009 at 10:40 AM, Rich Hickey wrote:
>>
>> On Mon, Aug 31, 2009 at 10:55 AM, Krukow wrote:
>> >
>> >
>> > user> (macroexpand ' (.getResourceAsStream java.lang.String s))
>> > (. (clojure.core/identity java.lang.String) getResourc
On Sep 1, 7:36 pm, John Harrop wrote:
> Why is there a call to identity at all? Why not just (. java.lang.String
> getResourceAsStream s)?
If I understand correctly this is because there is only one special
form for Java access called "dot", written: .
At http://clojure.org/java_interop it i
Hi,
Am 01.09.2009 um 17:44 schrieb Sir Diddymus:
(defmacro RunQt [args & body]
`(
(try
(QApplication/initialize (into-array [~args]))
(catch RuntimeException e# (println e#)))
~...@body
(QApplication/exec)))
You have to wrap the try and QApplication/exec call into a `do`:
On Sep 1, 5:03 pm, Terrance Davis wrote:
> Okay. Here's some additional information.
>
> I have tried on OS X 10.6 and Vista and no dice either place. I am NOT
This works for me on Mac:
krukow:~/examples$ ls -R
classes clojure.jar src
./classes:
./src:
clojure
./src/clojure:
exampl
On Tue, Sep 1, 2009 at 10:40 AM, Rich Hickey wrote:
> On Mon, Aug 31, 2009 at 10:55 AM, Krukow wrote:
> >
> > I have two minor minor suggestions for Clojure changes.
> >
> > 1) Consider this function:
> > user> (set! *warn-on-reflection* true)
> > true
> > user> (defn reader-from-classpath [s]
>
Hello!
On Tue, Sep 1, 2009 at 5:44 PM, Sir Diddymus wrote:
> Hi all,
>
>> (defmacro RunQt [args & body]
>> `(
>> (try
>> (QApplication/initialize (into-array [~args]))
>> (catch RuntimeException e# (println e#)))
>> ~...@body
>> (QApplication/exec)))
(defmacro RunQt [ar
Hi all,
I'm new to Clojure and I'm playing around with Qt Jambi, which works
as expected, until I started to use a self written macro. Now I don't
know if this is just a problem I don't see (probably) or if it is a
bug in Clojure. I have the following sample code (I hope this is
readable when pos
Okay. Here's some additional information.
I have tried on OS X 10.6 and Vista and no dice either place. I am NOT
placing the AOT classes in the system classpath. I am intentionally
using only the -cp command line argument. Also, I make sure the *.clj
scripts are NOT in the path after compiling as
On Mon, Aug 31, 2009 at 10:55 AM, Krukow wrote:
>
> I have two minor minor suggestions for Clojure changes.
>
> 1) Consider this function:
> user> (set! *warn-on-reflection* true)
> true
> user> (defn reader-from-classpath [s]
> (-> (.getResourceAsStream java.lang.String s)
> (java.io.InputS
Hi,
sorry. I'm off. Your example works for me on 1.5 on Windows as it does
work for me on Mac with 1.5 and 1.6.
Sincerely
Meikel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group
I've been casually interested in game development for a while. I
haven't done anything exciting, but I've been researching available
libraries and surveying the landscape. I haven't checked out JOGL, so
I'm not sure how it compares, but from what I've seen JMonkey looks
like a pretty nice game eng
Thanks. I should probably clarify.
I have managed to compile the classes using (add-classpath ""). My
problem is using the compiled classes. The example code is here:
http://clojure.org/compilation
Namely...
(ns clojure.examples.hello
(:gen-class))
(defn -main
[greetee]
(println (str "
Hi,
On Sep 1, 6:58 am, Terrance Davis wrote:
> It seems like every path I set from "java -cp" is ignored from inside
> of REPL, main or calling AOT classes. In fact, when I start Clojure
> from a directory, I have to explicitly (add-classpath
> "file:///some/path/") from REPL to compile clj fi
Clojure is great. I have begun integrating Clojure v1.0 into my
current project. I seem to be missing something real easy, ...
It seems like every path I set from "java -cp" is ignored from inside
of REPL, main or calling AOT classes. In fact, when I start Clojure
from a directory, I have to exp
Thanks a lot, Timothy, you're right.
Sam
On Aug 31, 7:12 pm, Timothy Pratley wrote:
> The reason your byte-seq fails is because you coerce the int result to
> a byte before comparing to -1. You should compare the int result to -1
> and coerce to a byte after:
> (defn byte-seq [rdr]
> (let [re
On Sep 1, 11:10 am, Lauri Pesonen wrote:
> I just wanted to point out that the Java Properties class inherits
> Hashtable which is already (into) compatible, i.e.
>
> user> (let [props (. System getProperties)]
> ((into {} props) "os.arch"))
> "x86"
Ok. That is certainly a more concis
Hi Karl,
2009/8/31 Krukow :
> 2) I can do:
> user> (into {} '([:k :v]))
> {:k :v}
>
> This works for two-element vectors. However, I cannot do the same for
> two-element arrays:
>
> user> (def str_array (.split "k=v" "="))
> #'user/str_array
> user> (into {} (list str_array))
> ; Evaluation abor
35 matches
Mail list logo