Thanks Ken,
I guess sorted-map and sorted-set are the solution for a problem like this.
Sunil.
On Wed, Dec 1, 2010 at 12:11 PM, Ken Wesson wrote:
> I don't think you should be relying on anything like this. I would
> expect, but not want to rely on, two hashsets or hashmaps with the
> same cont
I don't think you should be relying on anything like this. I would
expect, but not want to rely on, two hashsets or hashmaps with the
same contents generating same-order seqs. It definitely fails for
PersistentArrayMaps:
user=> (seq {1 1 2 2 4 4})
([1 1] [2 2] [4 4])
user=> (seq {4 4 2 2 1 1})
([4
On Wed, Dec 1, 2010 at 12:55 AM, Alex Osborne wrote:
> Ken Wesson writes:
>
>> I put a println in a swap! function once and the world didn't end.
>
> For a println retries are usually harmless
Retries? We were discussing an atom here, not a ref. A dosync
transaction may be retried. The obvious i
I want to add one more thing to what I said before ..
(identical? s1 s2)
would return false...
Sunil.
On Wed, Dec 1, 2010 at 11:26 AM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:
> Thanks ken for your response .. I think I completely misrepresented my
> question in my previous email .
Thanks Ken that was a very detailed teardown and so fast .. Now it makes
sense.
Sunil.
On Wed, Dec 1, 2010 at 11:29 AM, Ken Wesson wrote:
> On Wed, Dec 1, 2010 at 12:45 AM, Sunil S Nandihalli
> wrote:
> > Hello everybody,
> > Out of curiosity I tried the following
> > user> (let [x {:a 10}
>
On Wed, Dec 1, 2010 at 12:45 AM, Sunil S Nandihalli
wrote:
> Hello everybody,
> Out of curiosity I tried the following
> user> (let [x {:a 10}
>
>
> y (update-in x [:a] identity)]
>
>
> [(identical? x y)
>
>
> (= x y)])
> [true true]
>
>
> user>
> and was very pl
Thanks ken for your response .. I think I completely misrepresented my
question in my previous email . What i want to know is suppose I have two
sets s1,s2 and
(= s1 s2)
returns true which means I can definitely find pairs of values v1 from s1
and v2 from s2 where
(= v1 v2)
would be true. Now my
Ken Wesson writes:
> I put a println in a swap! function once and the world didn't end.
For a println retries are usually harmless, it just means you'll
occasionally get doubled output. But it's not a good thing for a
general-purpose runonce fn whose entire reason for existence is to
ensure som
Hello everybody,
Out of curiosity I tried the following
user> (let [x {:a 10}
y (update-in x [:a] identity)]
[(identical? x y)
(= x y)])
[true true]
user>
and was very pleasantly surprised with the findings...
I was expecting the result to be [false tru
On Wed, Dec 1, 2010 at 12:35 AM, Sunil S Nandihalli
wrote:
> Hello everybody,
> I would like to know as to what I can assume about order of the elements
> when I do a seq on hash-map or a set?
Absolutely nothing. If you want arbitrary but controlled ordering, use
a vector or a seq. If you want t
Hello everybody,
I would like to know as to what I can assume about order of the elements
when I do a seq on hash-map or a set? Am I guaranteed to get the same
ordering if the elements are equal or would they have to be identical.
I know I can actually verify these at the repl .. but that definit
On Tue, Nov 30, 2010 at 7:23 PM, Alex Osborne wrote:
>> Eww. Why (locking ...)? Why not just (swap! result #(if (= % sentinel)
>> (function) %))?
>
> From the doc string: "The function can have side effects."
>
> Sometimes a lock is the right tool for the job.
I put a println in a swap! function
Hey guys,
I know it's not directly related to Clojure, but I'm in a start-up
with some friends and I'll be working on a website that would
seriously benefit from graph DBs. I've checked out Neo4J (and found it
quite nice), but OrientDB also seems really cool and it sports a more
flexible license (
+1, I surprised a video from the conference hasn't been posted yet.
Are there legal restrictions involved?
On Nov 30, 3:42 pm, László Török wrote:
> +1, there is an other popular conference called QCon and I many of us
> appreciate the videos released on infoq.com. :)
>
> 2010/11/30 cej38
>
>
>
On Tue, Nov 30, 2010 at 8:01 PM, Chris Riddoch wrote:
> On Mon, Nov 29, 2010 at 7:09 PM, David Nolen
> wrote:
> > However from
> > what I've seen the past couple of years, Clojure tends to emphasize
> > performance while providing acceptable fallbacks for those cases where
> > people want someth
Then I would need to place the call within Ring... I tried to do what I
need in middle ware but it's simply impossible. What I need to init is
related to how routes are dispatched by Ring and needs to be done outside
of Ring.
I need the servlet context, I have to get the container call me with the
On Mon, Nov 29, 2010 at 7:09 PM, David Nolen wrote:
> However from
> what I've seen the past couple of years, Clojure tends to emphasize
> performance while providing acceptable fallbacks for those cases where
> people want something more flexible / dynamic. And things are continuing to
> move in
Ken Wesson writes:
> On Tue, Nov 30, 2010 at 5:27 PM, Robert McIntyre wrote:
>> (defn runonce
>> "Create a function that will only run once. All other invocations
>> return the first calculated value. The function can have side effects.
>> Returns a [has-run-predicate, reset-fn, once-fn]"
>>
On Tue, Nov 30, 2010 at 6:08 PM, wrote:
> For my part, I need stuff done prior to anything being done including
> routing a request and I need to access the servlet context.
Given any of the many singleton/runonce implementations that have been
posted, you just need to make sure that everything
On Tue, Nov 30, 2010 at 5:27 PM, Robert McIntyre wrote:
> Why not use good old runonce from lancet?
>
> (defn runonce
> "Create a function that will only run once. All other invocations
> return the first calculated value. The function can have side effects.
> Returns a [has-run-predicate, rese
For my part, I need stuff done prior to anything being done including
routing a request and I need to access the servlet context.
I'll explain this in a couple of days, it's related to a deployment problem.
I am in it right now.
Robert McIntyre wrote ..
> Why not use good old runonce from lancet?
Why not use good old runonce from lancet?
(defn runonce
"Create a function that will only run once. All other invocations
return the first calculated value. The function can have side effects.
Returns a [has-run-predicate, reset-fn, once-fn]"
[function]
(let [sentinel (Object.)
res
+1, there is an other popular conference called QCon and I many of us
appreciate the videos released on infoq.com. :)
2010/11/30 cej38
> I would also like to watch the videos of the presentations. Even if I
> had to pay for them.
>
>
--
You received this message because you are subscribed to
I would also like to watch the videos of the presentations. Even if I
had to pay for them.
On Oct 24, 1:40 pm, Saul Hazledine wrote:
> On Oct 24, 6:03 pm, Stuart Halloway wrote:
>
> > It was terrific meeting so many of you for the first time. Thanks again to
> > all the attendees, speakers, sp
> > I've tried some namespace hacking to allow the user to define the
> > namespace, but couldn't make it work
> > (there's a FIXME in the code about that).
>
> > Currently I using names with namespace - (cv-test-1.core/some-func
> > arg1 arg2). Will try to fix that soon.
>
> Could (eval (read-st
Thanks Sean!
I've come up with this variation:
(def ascending compare)
(def descending #(compare %2 %1))
(defn compare-by [& key-cmp-pairs]
(fn [x y]
(loop [[k cmp & more] key-cmp-pairs]
{:pre [(keyword? k), (fn? cmp), (even? (count more))]}
(let [result (cmp (k x) (k y))]
On Tue, Nov 30, 2010 at 12:00 PM, LauJensen wrote:
> @Janico:
>
> Since we allow strings as arguments to most functions, I think you
> could simple express it like so:
>
> clojureql.core> (defn st-intersects [loc poly]
> (format "ST_Intersects(%s,
> ST_GeographyFromText('SRID=
On Nov 29, 2:25 pm, Miki wrote:
> Yeah, it uses "load-string" which IMO default to clojure.core
> namespace.
> I've tried some namespace hacking to allow the user to define the
> namespace, but couldn't make it work
> (there's a FIXME in the code about that).
>
> Currently I using names with names
If you like assert args, you should check out pre & post conditions
for your functions. They're built in to Clojure since 1.1
The official docs:
http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20%28[params*%20]%20condition-map?%20exprs*%29+%29
Video Tutorial:
http://vimeo.com/839
@Brenton,
Thanks a lot for the vote of confidence :) I will do my best to try
and make some kind of elegant design solution for this. Your
suggestions are great!
@Janico:
Since we allow strings as arguments to most functions, I think you
could simple express it like so:
clojureql.core> (defn st
30 matches
Mail list logo