2010/12/3 Andreas Kostler andreas.koestler.le...@gmail.com:
Hi All,
May I cite an Author of a populer Clojure book:
If you find yourself wishing yourself to repeatedly check a work queue to
see if there's an item of work to be popped off,
or if you want to use a queue to send a task to
patrickdlogan patrickdlo...@gmail.com writes:
Java has a file watch API to avoid polling.
I assume you're talking about the NIO 2 watch service? That's not
yet in a released version of Java, it's coming in Java 7.
Stuart Sierra uses it to good effect in lazytest.
It looks to me like
Hi,
I have a string of data and I would like to get a map {:key
value, :key value, …}
How could I do that?
I've got:
user (split (slurp data) #,)
[0 2 1 5 2 8 3 15 4 9]
And I would like:
{:0 2, :1 5, :2 8, :3 15, :4 9}
Any idea?
Thanks.
--
You received this message because you are
He may have some interesting points but...
Anyone who makes grandiose claims and can't bother to give credit to
the people who have helped them along the way deserves to be ignored.
My feelings exactly. His perception of himself seems self-aggrandizing as well.
Why is John Carmack the only
Hi,
2010/12/3 Anclj anb...@gmail.com
Hi,
I have a string of data and I would like to get a map {:key
value, :key value, …}
How could I do that?
I've got:
user (split (slurp data) #,)
[0 2 1 5 2 8 3 15 4 9]
And I would like:
{:0 2, :1 5, :2 8, :3 15, :4 9}
Any idea?
(let [s
Here is what I came up with ...
(let [d (split (slurp data) #,)]
(- d
(apply hash-map)
(clojure.walk/keywordize-keys)
(clojure.contrib.generic.functor/fmap read-string)))
Sunil.
On Fri, Dec 3, 2010 at 7:52 PM, Anclj anb...@gmail.com wrote:
Hi,
I have a
2010/12/3 Laurent PETIT laurent.pe...@gmail.com
Hi,
2010/12/3 Anclj anb...@gmail.com
Hi,
I have a string of data and I would like to get a map {:key
value, :key value, …}
How could I do that?
I've got:
user (split (slurp data) #,)
[0 2 1 5 2 8 3 15 4 9]
And I would like:
{:0 2,
thanks Rayne.
On Fri, Dec 3, 2010 at 4:02 PM, Rayne disciplera...@gmail.com wrote:
Here is what I came up with.
(let [d [#{#{1 2} #{3 4}} #{#{5 6} #{7 8}}]]
(reduce
(fn [mp nd]
(apply merge
(for [nd-pair nd face nd-pair] (update-in mp [face] #(conj
% nd) {} d))
On
Hello everybody,
I would like to know if any of you are using any outlining mode in
emacs+slime.. if so how?
Thanks,
Sunil.
--
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
On Fri, Dec 3, 2010 at 2:27 AM, Sunil S Nandihalli
sunil.nandiha...@gmail.com wrote:
Right now I am just seq ing it before using nth
Sunil.
The real oddity here is that nth doesn't seem to call seq on its
argument. It probably should (for non-vector arguments).
--
You received this message
On Fri, Dec 3, 2010 at 10:08 AM, Laurent PETIT laurent.pe...@gmail.com wrote:
2010/12/3 Laurent PETIT laurent.pe...@gmail.com
2010/12/3 Anclj anb...@gmail.com
I've got:
user (split (slurp data) #,)
[0 2 1 5 2 8 3 15 4 9]
And I would like:
{:0 2, :1 5, :2 8, :3 15, :4 9}
Any idea?
As a general rule, if you have something that has the semantics of a
pure function, and you can see how to implement it by banging on an
atom with swap! in a loop that consumes a sequence, then you can
transform it to use reduce.
If you have:
(defn foo [coll]
(let [x (atom bar)]
(dorun [y
On Dec 2, 10:55 pm, patrickdlogan patrickdlo...@gmail.com wrote:
Java has a file watch API to avoid polling. Stuart Sierra uses it to
good effect in lazytest.
No, there is no such Java API that I am aware of. Lazytest watches
the filesystem by polling.
-S
--
You received this message
2010/12/3 Ken Wesson kwess...@gmail.com
On Fri, Dec 3, 2010 at 10:08 AM, Laurent PETIT laurent.pe...@gmail.com
wrote:
2010/12/3 Laurent PETIT laurent.pe...@gmail.com
2010/12/3 Anclj anb...@gmail.com
I've got:
user (split (slurp data) #,)
[0 2 1 5 2 8 3 15 4 9]
And I would like:
This is being added with JSR 203 in Java 7:
- http://java.dzone.com/articles/introducing-nio2-jsr-203-part-2
There was a backport for JDK 6 started:
http://code.google.com/p/jsr203-backport/
but I don't think it's been touched in a couple years.
On Dec 3, 1:20 pm, Stuart Sierra
Object creation wasn't my concern -- modern JVMs are very efficient in
that regard -- just traversals.
--
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
(apply
merge-with
conj
{}
(for [nd d nd-pair nd face nd-pair]
{face nd}))
I like to use into for cases like this:
(into {} (for [nd d nd-pair nd face nd-pair] [face nd]))
seems clearer to me.
g
--
You received this message because you are subscribed to the Google
Yes,
though I've always found 'into a little bit too magical for me.
For example, I find it hard to follow the doc to see what 'adding' will mean
for maps.
2010/12/3 George Jahad cloj...@blackbirdsystems.net
(apply
merge-with
conj
{}
(for [nd d nd-pair nd face nd-pair]
2010/12/3 Ken Wesson kwess...@gmail.com
Object creation wasn't my concern -- modern JVMs are very efficient in
that regard -- just traversals.
Ken,
I've done my homework, and of course you were right, and me wrong. At some
point in my reasoning I've conflated number of object allocations
Actually my solution is wrong! It works for this particular example,
but not if there are nodes with overlapping values.
Doh!
My main point was just that into is a under used gem, that I wanted
to publicize a bit. Next time I'll try to find an example that is
actually correct!
On Dec 3, 12:46
Hi All,
May I cite an Author of a populer Clojure book:
If you find yourself wishing yourself to repeatedly check a work
queue to see if there's an item of work to be popped off,
or if you want to use a queue to send a task to another thread, you do
*not* want the PersistenQueue discussed in this
It is not a shared, concurrent data structure. In and of itself it can
not be used to mutate a shared collection of data.
You could use something like Java's ConcurrentLinkedQueue.
On Dec 3, 2:17 pm, Andreas Kostler andreas.koestler.le...@gmail.com
wrote:
Hi All,
May I cite an Author of a
On Dec 3, 4:42 am, Alex Osborne a...@meshy.org wrote:
patrickdlogan patrickdlo...@gmail.com writes:
Java has a file watch API to avoid polling.
I assume you're talking about the NIO 2 watch service? That's not
yet in a released version of Java, it's coming in Java 7.
oh I see.
--
You
Is there an easy way to download Clojure libraries from Git and to
play with them in the repl?
It looks like all of them expect to be downloaded using leiningen, and
leiningen requires creating a project, with dependencies on specific
libraries.
It would be nice if I could do something like:
Hi Asim,
just do
lein new
and add
[clojureql 1.0.0-beta2-SNAPSHOT] to your dependencies in project.clj
and run
lein deps
it will automatically download all the necessary dependencies.
If you directly want to do it from github .. I don't know how to do that.
Sunil.
On Sat, Dec 4, 2010 at 6:23
(defn dec-or-dissoc! [key]
(dosync
(let [n (@*counts* key)]
(if ( 1 n)
(alter *counts* assoc key (dec n))
(alter *counts* dissoc key)
Is it true that in that case, one would have to use ensure to make the
operation correct?
I don't think ensure is necessary
I second the recommendation to use leiningen.
I can relate to your position of just wanting to play with the libraries and
not being ready to create projects.
But I'm not a classpath ninja of epic proportions. Really, I don't have a
desire to be that. If you aren't either, you will want to
Hi,
David Liebke's cljr may meet your needs: https://github.com/liebke/cljr
I also maintain a fork over at https://github.com/alandipert/cljr that
runs Clojure 1.3-alpha3.
HTH,
Alan
On Fri, Dec 3, 2010 at 9:04 PM, buckmeist...@gmail.com wrote:
I second the recommendation to use leiningen.
I
Hi Tim,
How about compare?
user= (compare a b)
-1
user= (compare b b)
0
user= (compare b a)
1
user= (compare 1 2)
-1
user= (compare 2 2)
0
user= (compare 2 1)
1
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
This is a good question and I'm not sure of the right answer or if
there is one. Personally, if I were exposing an API I would use the
io! macro for sure. Even otherwise its a good convention to follow.
On Nov 30, 9:06 am, Alex Baranosky alexander.barano...@gmail.com
wrote:
Hi guys,
I've
Hello everybody,
I really like the env. It has saved a lot of tedious work a couple of times
.. but I have only found use for the keys of the map that gets passed like
in the following example.
(defmacro display-local-bindings []
`(do ~@(map (fn [x#] (list 'println [`'~x# x#])) (keys env
On 29 November 2010 16:33, Stuart Halloway stuart.hallo...@gmail.com wrote:
I must respectfully disagree with James's first point here. The first pattern
(read-ponder-update) is not concurrency-friendly. It isn't about atom vs.
ref, the important distinction is whether all the work can be
It gives a convenience macro which checks if there is a transaction running
when the following code block is called. The idea is that since the code in
a transaction could be called a multiple times, you should not do things
like sending things on to the network or writing to a file during a
What I said is purely from reading the documentation .. I have never ever
used it. Take it with a pinch of salt!
On Sat, Dec 4, 2010 at 8:40 AM, Sunil S Nandihalli
sunil.nandiha...@gmail.com wrote:
It gives a convenience macro which checks if there is a transaction running
when the following
Hi Michael,
We're in a very similar situation to yours. Here's what we did:
1. 2 back end storage impls rah.storage1, rah.storage2 - these are
private nses.
2. a single storage interface rah.storage for the rest of the business
code. At runtime this decides which of storage1 or 2 to call.
3. Now
I'm also stuck with the same issues: 1. no option to get string keys
2. I don't understand, why do libs go through the trouble of
downcasing ?
Having said that I totally agree with the point Ryan makes: A
greater feature of clojure is its extensibility. What I am after is a
generalization of
Sunil S Nandihalli sunil.nandiha...@gmail.com writes:
I really like the env. It has saved a lot of tedious work a couple of
times .. but I have only found use for the keys of the map that gets
passed like in the following example.
I don't understand what the val part of the map contains? I
Hi ka,
I do already use compare in my functions, but compare alone is costly
to performance and isn't as meaningful given it doesn't evaluate true/
false.
It's really just about convenience and code-readability while trying
not to sacrifice too much speed.
To give you an example here's my
Thanks Alex. I asked because I thought it might be part of stable API.
Thanks for your tip on slime (I do use slime) also. I will wait for it to
become part of stable api.
Sunil.
On Sat, Dec 4, 2010 at 9:29 AM, Alex Osborne a...@meshy.org wrote:
Sunil S Nandihalli sunil.nandiha...@gmail.com
I feel they could add a flag to indicate if it was obtained via gensym or
not.. I would have liked to have it in the past. It can help in writing
debug macros .. may be give better debug messages etc.
Sunil
On Sat, Dec 4, 2010 at 9:29 AM, Alex Osborne a...@meshy.org wrote:
Sunil S Nandihalli
Thanks! This is exactly what I was looking for.
On Fri, Dec 3, 2010 at 6:12 PM, Alan Dipert a...@dipert.org wrote:
Hi,
David Liebke's cljr may meet your needs: https://github.com/liebke/cljr
I also maintain a fork over at https://github.com/alandipert/cljr that
runs Clojure 1.3-alpha3.
Hello everybody,
I would like to know as to how I would write the following code in a
more idiomatic way.
(let [mp (atom {})
d [#{#{1 2}
#{3 4}} ;node1
#{#{5 6}
#{7 8}} ;node2]]
(dorun (for [nd d nd-pair nd face nd-pair]
(swap! mp update-in
Hello,
one way:
(apply
merge-with
conj
{}
(for [nd d nd-pair nd face nd-pair]
{face nd}))
The idea is (as is generally the case for me when trying to move from
imperative code to functional), is to try not to do too many things in a
single step.
So here, first I extract from the for
Here is what I came up with.
(let [d [#{#{1 2} #{3 4}} #{#{5 6} #{7 8}}]]
(reduce
(fn [mp nd]
(apply merge
(for [nd-pair nd face nd-pair] (update-in mp [face] #(conj
% nd) {} d))
On Dec 3, 3:42 am, Sunil S Nandihalli sunil.nandiha...@gmail.com
wrote:
Hello everybody,
Hi All,
May I cite an Author of a populer Clojure book:
If you find yourself wishing yourself to repeatedly check a work queue to see
if there's an item of work to be popped off,
or if you want to use a queue to send a task to another thread, you do *not*
want the PersistenQueue discussed in
On Dec 2, 8:53 am, viksit vik...@gmail.com wrote:
Hi all,
What would you recommend as the best method to tail a file using
Clojure? Are there any built in functions in contrib or core that
allow a program to read the last line of a file as it is appended to?
If not - how do people solve a
46 matches
Mail list logo