with a long counter it needs slightly longer (216 microseconds in
average instead of 196)!
any other ideas?
On 02/07/13 19:11, Leon Barrett wrote:
Try longs instead of ints? Clojure doesn't support local ints, so you
may be casting longs to ints a lot.
On Tue, Jul 2, 2013 at 11:05 AM
getting ridiculous but I'm preparing a presentation and
I was sort of counting on this example...Of course, it goes without
saying that I'm using unchecked-math and :jvm-opts ^replace[] .
am I doing something wrong?
thanks for your time
Jim
On Fri, 14 Jun 2013 00:11:52 -0700 (PDT)
J
On 02/07/13 15:41, Dmitry Groshev wrote:
(let […
#^"[Ljava.lang.Object;" data (.data m)
…]
(aset data idx v
that is exactly how you type-hint non-primitive arrays...agreed it's
ugly but there is no other way :)
Jim
--
--
You received this mess
h the actual concrete types. you can
see the approach here:
https://github.com/jimpil/hotel-nlp/blob/master/src/hotel_nlp/tools/normalito/core.clj
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cl
what is 'clear' ? cannot find it anywhere...
Jim
On 02/07/13 12:03, dennis zhuang wrote:
Maybe he means clear?
2013/7/2 Jim mailto:jimpil1...@gmail.com>>
No merge will not work with transients because it uses conj
instead of conj!
If you absolutely have to do
On 02/07/13 11:48, David Powell wrote:
If you really need to write functions that are polymorphic on
collections type, then you can use the idiom:
(defn some-fn
[xs]
(into (empty xs)
...
))
hehe :) good one!
...in other words you can piggyback 'conj'...
Jim
--
--
Yo
No merge will not work with transients because it uses conj instead of
conj!
If you absolutely have to do this define your own 'merge!' that uses conj!.
I'm not sure what you mean by reset! for transients...reset! is an
operation on reference types (atom, ref, agent etc)
Jim
ction. conj
is polymorphic and will do its best to provide the most efficient way to
add something to a collection.
I guess the philosophical reason is that 'concrete types don't really
matter'...
Jim
--
--
You received this message because you are subscribed to the Google
Grou
forgot the ordering issue...
Jim
--
--
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 unsu
;less is more' cases...
Jim
--
--
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 unsu
7;t behave like sets...
in order to get what you want you need:
(clojure.set/union (set (keys {:a 1 :b 2 :c 3})) (set (keys {:a 1 :b 2
:c 3})))
hope that helps,
Jim
On 01/07/13 19:05, Goldritter wrote:
I wanted to create a union of the keys from two maps.
When I write
(clojure.set/union (
rite factorial I
can't write a proper timing function!!! (fail...)
not bad at all in my opinion... :)
generally, even with leiningen I find that once the vm is up and as long
as I don't use concurrency, the experience is very smooth...
now if only there was an editor to sup
condly, he said they are not good practice because they require 2 GC
cyclesbut why do they require 2 GC cycles?
Did anyone else watch this presentation yet? Any clues?
thanks,
Jim
ps: I seriously hope he didn't mean the try/finally idiom because
clojure makes significant use of it...
On 29/06/13 12:07, Peter Taoussanis wrote:
I honestly feel like I'm witnessing history being made.
Thank you Rich Hickey, and everyone else in this community for making
my work every day so enjoyable.
+100! that makes 2 of us :)
Thanks indeed Rich (and everyone else of course)...
consume whatever he needs, but if you consider it
nitpicking, well, I can see your point... :)
this is all in the spirit of wanting to help...
Jim
On 27/06/13 10:55, Jim wrote:
Hi Smit,
I hope you don't mind a couple of comments :)
I had a look at your edit-distance implementat
nge that to be more evident...
even without memoization, the dynamic-programming solution can do two
16-character-long strings in just over 1ms which is pretty sweet... :)
hope that helps,
Jim
On 27/06/13 05:59, Smit Shah wrote:
Hey folks,
This is my first post on the mailing list, I would
lly...it's just that your error you
reported earlier is very weird...
Jim
--
--
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
On 22/06/13 15:16, Dennis Haupt wrote:
i don't know what "properly set up the environment" means exactly, but
i can run my script in the repl
what repl? intelliJ's repl? or a bare repl from your terminal?
do you want to use Clojure JVM or Clojure CLR?
Jim
--
--
You r
lojure and properly set up
your environment?
Jim
--
--
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
meant the guys from Prismatic not the OP on this
thread. Yes, this doesn't apply to Colin...
my bad...I'm really sorry...
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googleg
ly
accomplishes what you want.
that does sound more work but I'll look into it anyway...:)
David
thanks a lot,
Jim
On Fri, Jun 21, 2013 at 9:32 AM, Jim - FooBar(); <mailto:jimpil1...@gmail.com>> wrote:
On 21/06/13 14:08, Philip Potter wrote:
Your logic here is incorr
fact as fast as Java -- I apologize for the false statement (I was
unaware that new versions of leiningen disable advanced JIT
optimizations by default, which lead to the numbers I reported).
Jim
On 21/06/13 14:54, Michael Klishin wrote:
2013/6/21 Jim - FooBar(); <mailto:jimpil1...@g
uded
that Clojure does indeed match java's performance. The specific use-case
actually was summing up primitive arrays. I encourage you read it...In a
nutshell, If you're using leiningen, add this entry to your project.clj
and rerun your benchmarks.
:jvm-opts ^replace []
Jim
[
stest way...if that's not
fast-enough then the consumer can choose not to use it...but I do want
to offer the fastest way to do it by default (should the user choose
it)...much like 'conj' works polymorphically
regards,
Jim
--
--
You received this message because you are s
'for' accepts a :when clause which will get you even further :)
Jim
ps: it also accepts a :let clause if you find it useful
On 21/06/13 14:06, Jay C wrote:
Thanks for all the input. Using for as in Phillip's suggestion seems
to have gotten me somewhere, but now the function
sequence
exactly! also, that's why macros are for...every time I think "I wish
there was X in clojure.core...", the next thought is macros :)
what you wish is rather trivial to implement and it doesn't even have to
be a macro...
Jim
--
--
You received this message be
aaa yes, of course! :)
Jim
On 21/06/13 13:47, John D. Hume wrote:
If you use for, which is lazy, wrap it in a doall to force it to do
its work before with-open closes your reader.
On Jun 21, 2013 6:52 AM, "Jim" <mailto:jimpil1...@gmail.com>> wrote:
Only use
s. It should
always return the same type and do the mapping in the most efficient
manner...
(apply list (map f the-seq)) does work but is not very efficient and I
think you will get the results reversed...
Jim
--
--
You received this message because you are subscribed to the Google
Groups &qu
machine and don't forget that we 're counting the time it takes to
populate the array as well...
(defn- array-sum-ints [n]
(let [^ints a (int-array n)]
(dotimes [n n] (aset a n 1))
(areduce a i ret 0
(+ ret (aget a i)
Jim
On 21/06/13 13:36, Colin Yates wro
that lists do not have transient counterparts.
Therefore, the call to 'into' will be slow...in addition, I'm performing
2 passes with this...
any ideas?
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
Only use 'doseq' when you don't care about the reuturn value. In other
words only for side-effect-y code. Use 'for' instead...
Jim
On 21/06/13 11:17, Jay C wrote:
Hi, I'm fairly new to Clojure and need help with a problem. The
following function always returns
p the behaviour is different because ` & ' are used to achieve
different tasks. It often helps me to think of ` as resolving the symbol
whereas ' doesn't do anything to it.
hope this is clearer now...
this is nice video http://www.infoq.com/presentations/Clojure-Macro
sions of the same class lying around
because of what you said about compiling and recompiling...
Jim
--
--
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 m
There is already a symbol? predicate in core. Why are you defining your
own? Does your problem disappear when you use the one from core?
What exactly are you trying to do? I use definline quite frequently and
have never encountered such problems...
Jim
On 20/06/13 10:35, Colin Fleming wrote
nding to object-arrays,
thinking that the outer array is an Object[], fails miserably. How on
earth am I supposed to handle nesting in a general way?
thanks in advance...
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to
e people... I cannot express any opinions about vetting or
quality control as I didn't go forward with this for the reasons
mentioned earlier.
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to
now anyone from this list personally (I feel
like I know many people but I 've never actually met anyone in person!),
but I trust there will be at least some interest...
cheers,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" gro
ou be able to write macros without ` ?
Vars needs to resolve to something eventually...
Jim
--
--
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
On 19/06/13 11:15, Jim wrote:
After letting the jvm warm up a bit I am getting:
"Elapsed time: 68.498756 msecs" for mapv
"Elapsed time: 49.066978 msecs" for foldcat (!!!)
HmmI think I see what was happening 2 days ago...when measuring
'mapv' I'
appens serially
(no danger). However when measuring foldcat I must create a new stemmer
object for every single word and then throw it out because there is
parallelism.
I tried foldcat with the same stemmer-object and everything went fine!
I'm pretty sure the stemmer objects are not thread
as Cedric pointed out, it means the java.lang.Object class...not any object
Jim
On 18/06/13 12:47, Cedric Greevey wrote:
That's the *class* Object, with a capital O. It's the one concrete
class that can be extended and its methods overridden using reify (or
deftype).
On Tue, Ju
; CompilerException java.lang.IllegalArgumentException: only
interfaces are supported, had: java.lang.String,
compiling:(NO_SOURCE_PATH:1:1)
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cloju
ete objects.
hope that helps, :)
Jim
--
--
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 un
Yes , coll is a vector...I can provide the actual code as soon as I get
home this afternoon :)
Jim
On 18/06/13 02:01, Herwig Hochleitner wrote:
Interesting. A possibly stupid question: the input coll is a vector,
right?
Can you provide a representative example?
2013/6/17 Jim - FooBar
OK now I'm confused! If you are using an unnamed fn form there is only
one place to put the return type-hin,t and that is between the 'fn' and
the '[...]'
...but, you've just demonstrated that this causes reflection...where
else can we put it?
Jim
On 17
uit)
user=> (set! *warn-on-reflection* true)
true
user=> (defn foo [^String s] (.substring s 0 (.length s)))
#'user/foo
user=> (foo "jim")
"jim"
user=> (.length (foo "jim"))
*Reflection warning, NO_SOURCE_PATH:1:1 - reference to field length
c
away any time soon.
-S
I see...
thanks Stuart :)
Jim
--
--
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 w
ge or am I missing something?
Jim
--
--
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 u
Windows 7 at work, Ubuntu at home.
Both have good and bad points, I'm quite happy coding in either (once
properly set up).
On Friday, 14 June 2013 15:46:37 UTC+2, Erlis Vidal wrote:
>
> Hi,
>
> I'm a bit curious to know in what OS do you code. Do you prefer iOS,
> Linux, Windows? Why is tha
or(s)
put the type hint right after 'defn' (before the var about to be
defined) and again it gets rid of reflection! Which one is it? both are
acceptable?
thanks in advance,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" grou
r/foldcat but the same error appears after a
while.
Of course now someone is going to say that this is not the right
approach for password cracking. Ideally you want to stop searching as
soon as you find a match. But that approach is not really parallelisable.
I thought that laziness would save me
hehe :) does this mean that apple is the new Microsoft ? this can't be
good...
Jim
On 14/06/13 19:18, Clinton Dreisbach wrote:
I think that's more like "Linux is the predominant OS among people who
love to talk about their OS." In my experience, there's a lot more
I use GNU/Linux exclusively as well...no other OS makes me feel in
control :)
Jim
On 14/06/13 18:57, Mikhail Kryshen wrote:
I use GNU/Linux (specifically, Fedora at home and openSUSE, which I don't
like much compared to other distros, at work):
- I do not trust proprietary software ve
properly stupid now!
thanks all of you who bothered responding...
Jim
On 13/06/13 21:03, Jim - FooBar(); wrote:
I wish I could...if I do that I can't call amap on any other primitive
array but the first extended - I get the exception I posted earlier
and it has nothing to do with
eflector.invokeMatchingMethod (Reflector.java:80)
any other type I try from now onwards will fail with the same exception.
Could it be because Clojure changes the types internally to longs?
I don't understand!forgive me but I'm a bit annoyed with this...
Jim
On 13/06/13 19:02, A
On 13/06/13 18:52, Jim - FooBar(); wrote:
On 13/06/13 18:47, Jim - FooBar(); wrote:
On 13/06/13 18:28, Leon Barrett wrote:
It shouldn't be necessary to examine the source to know what's going
on in a builtin, really, but I also encountered this one recently.
The way the extend-prot
On 13/06/13 18:47, Jim - FooBar(); wrote:
On 13/06/13 18:28, Leon Barrett wrote:
It shouldn't be necessary to examine the source to know what's going
on in a builtin, really, but I also encountered this one recently.
The way the extend-protocol macro finds which entries are types
o the macro definitely
receives a Class?
You say you've encountered this a lot...can you elaborate? what did you do?
many many thanks,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojur
On 13/06/13 18:16, Marshall Bockrath-Vandegrift wrote:
"Jim - FooBar();" writes:
CompilerException java.lang.UnsupportedOperationException: nth not
supported on this type: Character, compiling:(NO_SOURCE_PATH:1:1)
If you examine the implementation of `extend-protocol` and
case that would be doubles. If we extended the protocol to longs
then only longs would work and so forth...
I'm almost certain that this is not intentional...any opinions?
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To pos
ass/forName "[F")
(bar
([_ a] a)
([_ a b] (+ a b))) )
CompilerException java.lang.UnsupportedOperationException: nth not
supported on this type: Character, compiling:(NO_SOURCE_PATH:1:1)
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
T
I do the following in a separate namespace, it compiles just fine!
(defprotocol FOO
(bar [this a] [this a b]))
(extend-protocol FOO
(Class/forName "[D")
(bar
([this a] 1)
([this transform limits] 2)))
thanks in advance :)
Jim
--
--
You received this message because you are subscr
On 06/06/13 20:23, JvJ wrote:
Is there a shorter form of [&{:keys [] :as m}]?
if you don't care about the actual keys just do this:
[& {:as m}]
HTH,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to th
! I'm still not
quite sure what happened but I can reload my namespace just fine!
thanks! :)
Jim
--
--
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
you ever had that? what do you do when one of your java sources
delegates back to a namespace of yours? is that completely bad design
perhaps?
thanks for your time,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group,
ulate + (range 100))
4950
user=> (calculate * (range 100))
0
user=> (calculate * (range 1 100))
ArithmeticException integer overflow
clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)
user=> (calculate * (range 1 10))
362880
Jim
ps: another nice and functional approach would be t
x27;re
eventually calling expects variadic args (from hiccup I guess).
(apply hiccup/widget* attrs contents)
Jim
--
--
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
No
you quite a
bit of hassle and make the code more evident...
(defn my-widget
[& {:keys [attrs contents]}]
...
or if you don't know exactly what keys will come in you can relax it a
bit with (defn my-widget [& {:as opts]}] ...
HTH,
Jim
ps: assuming there is no constrain I&
clj it seems that cat uses an ArrayList
underneath...is this why it's considered high-performance? I also see
there is 'foldcat' which is (foldcatappend!coll) - exacly what you 're
sugegsting! interesting stuff...I'll try it now :)
Jim
--
--
You received this message bec
ppend! (r/map f (vec coll)))
hmmm...I'll have to think about that for a while...
thanks a lot James :)
I was suspecting it can be simplified...
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, s
e)
(pmap (fn [p] (reduce #(conj %1 (f %2)) [] p)) )
(apply concat)) ) ;;concat the inner vectors that represent the
partitions
([f coll]
(mapr f coll (+ 2 cpu-no
thanks,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure"
post back
with the "solution"...but of course nothing is secret, as you
demonstrated :)
btw, the commit you're showing is not exactly what fixed it...that was
before my post I think...
Jim
On 30/05/13 22:58, atkaaz wrote:
looks like you found it:
https://github.co
chess.clj...
any ideas guys? I've had this error before but it was pretty obvious
where the cycle was...Here, I'm very confused! core.clj and util.clj are
the lowest level code and thus depend on nothing from the same project!
thanks in advance for your time,
Jim
--
--
You receiv
On 30/05/13 13:17, Benjamin R. Haskell wrote:
On Thu, 30 May 2013, Jim - FooBar(); wrote:
Hi all,
I just stumbled upon this:
http://clojurewest.org/news/2013/5/29/clojurewest-2013-videos-1.html
but I have a question! Can anyone clarify (maybe Alex?) what the
dates right next to the
g yes?... :-(
thanks in advance,
Jim
--
--
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.
ntal complexity in
real-world applications. It provides support for Ring handlers,
asynchronous messaging, caching, scheduled jobs, XA transactions,
clustering, and highly-available "daemon" services.
Thanks,
Jim
--
--
You received this message because you are subscribed to the Google
Group
)
true
user=> (acmp (double-array [0.01 0.7 2.2])
(double-array [0.011 0.695 2.199])
0.005)
false
user=>
Will work on any seqables of float/double.
On Tue, May 28, 2013 at 12:57 PM, Jim - FooBar();
mailto:jimpil1...@gmail.com>> wrote:
ooo thanks Chris
*)
(-0.5345224838248488 0.2672612419124244
0.801783725737273*2*)))
observe the last digit of the 3rd number (the bold ones)! This is why
the test fails in Clojure...
thanks again :)
Jim
On 28/05/13 17:42, Jim - FooBar(); wrote:
Hi everyone,
sometimes I feel really stupid
!! In
fact the only methods that take 3 args expect a String as the first
argwhat is happening? can anyone shine some light please? I am
utterly confused...
thanks in advance,
Jim
[1]http://junit.sourceforge.net/javadoc/org/junit/Assert.html
--
--
You received this message because you ar
On 28/05/13 11:10, atkaaz wrote:
Jim, that is in project.clj right?
aaa yes :exclusions is for project.clj! I've still not fully waken up...
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send e
I think it is :exclusions not :exclude...
example:
[uk.ac.gate/gate-core "7.1" :exclusions
[[org.springframework/spring-beans]]]
Jim
On 28/05/13 10:42, ru wrote:
Dear clojure-users,
Loading a file with such content:
(ns ru.rules
(:use
protege.core
rete.core :exclu
(rpred obj) tf)) ;;if false do the transformation
Jim
On 25/05/13 14:29, atkaaz wrote:
yep that was interesting thanks btw; it was a function that was acting
like a macro, how odd
On Sat, May 25, 2013 at 4:26 PM, Jim - FooBar(); <mailto:jimpil1...@gmail.com>> wrote:
so maybe a let + gensym would be in order?
yes that is what you do to avoid double-evaluation...:) I was making a
different point though, the fact that definline produces a first class
fn which still expands like a macro.
Jim
--
--
You received this message because you are subscribed to
no need for macros... :)
(definline safe-assoc [m k v]
`(if (contains? ~m ~k) ~m
(assoc ~m ~k ~v)))
(definline pred-transform [obj pred tf]
`(if ~(pred obj) ~obj
~(tf obj)))
Jim
On 25/05/13 12:44, atkaaz wrote:
may I see the macro for the latter, if you decide to go that way ? thx
tains? obj :attr) obj
(assoc obj :attr something))
it's more evident now, but you still mention obj 3 times...
your second example seems just fine to me...if you have to test for
something, well, you have to test for something!!!
Jim
--
--
You received this message because you are su
thanks a lot guys :) Both solutions work!
Jim
On 24/05/13 20:42, Andy Fingerhut wrote:
Try adding (flush) after the print call.
On Fri, May 24, 2013 at 12:35 PM, Jim - FooBar();
mailto:jimpil1...@gmail.com>> wrote:
Hi everyone,
I am trying to do something very simple like
Proceed? (y/n):")
(when (-> *in*
(java.util.Scanner.)
.next
(.charAt 0)
(= \y))
any ideas?
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
in a 'boolean' call (e.g. (boolean (or ...))) and you got
your true/false result :)
Jim
--
--
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 member
r way to get the same
information via deep-parsing. A syntactic parser like stanford's or enju
will give you back the nodes (tokens) and their dependencies
(relations). You can shove that into a (directed & acyclic) graph
structure and you're ready to query/navigate it as you lik
well no it doesn't descent into directories...I just tried it...
Jim
On 20/05/13 21:39, Jim - FooBar(); wrote:
actually yes it is! :) I thought file-seq was going down one level
only but looking at the implementation it seems it goes down all
levels...I'm trying it out now
Jim
O
actually yes it is! :) I thought file-seq was going down one level only
but looking at the implementation it seems it goes down all levels...I'm
trying it out now
Jim
On 20/05/13 21:31, Gary Trakhman wrote:
Is this not sufficient? file-seq
https://github.com/clojure/clojure/blob/maste
directories
Jim
ps: I tried this on my 2T external drive which is almost full and I got
tired of waiting after 15 minutes! No overflow, but no answer either... :)
On 20/05/13 21:12, Ramesh wrote:
Hi all,
I have the following function to list all the files recursively under
a directory
remember the 32-chunked model... :)
Jim
On 19/05/13 15:54, Jim - FooBar(); wrote:
ha! you cheated with iterate...
try this which is closer to the example...
(first (filter odd? (map #(do (println "realized " %) %) [2 4 6 7 8 9])))
realized 2
realized 4
realized 6
realized 7
r
ha! you cheated with iterate...
try this which is closer to the example...
(first (filter odd? (map #(do (println "realized " %) %) [2 4 6 7 8 9])))
realized 2
realized 4
realized 6
realized 7
realized 8
realized 9
7
Jim
On 19/05/13 15:31, Cedric Greevey wrote:
On Sun, Ma
no need to traverse the entire seq with 'filter' if you only want the
1st match...
(some #(when (odd? %) %) [2 4 6 7 8 9])
=> 7
Jim
On 19/05/13 13:42, Thumbnail wrote:
... or just (comp first filter)
((comp first filter) odd? [2 4 6 7 8 9])
=> 7
--
--
You recei
ooo thanks a lot :)
quick question...how did you tell sublime to use lein2 instead of lein ?
Jim
On 18/05/13 21:36, James MacAulay wrote:
This is a little show-and-tell I recorded today:
http://www.youtube.com/watch?v=wBl0rYXQdGg
Hopefully it's useful for some of you. Feedback we
ve the original
values
_ (doseq [[b v] pairs] (reset! b v)) ;;introduce the new values
restore (fn [] (map #(reset! (first %1) %2) pairs
old-values))] ;;define the restoring fn
`(try
~@body
(finally (restore))) ))
Jim
--
--
You received this message because you
ogress-monitor-silent} tests))
...shorter, same behaviour and as a bonus you're not limited to vars
declared as dynamic. This should work with vanilla 'def' too :)
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
iles in leiningen is what
you need...since you can't avoid this particular type of
'deployment-specific' state, a config-map wrapped in an atom would
suffice I think.
HTH,
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
be in favour of atoms (including myself) or in fact any
reference-type depending on your use-case semanticsIt just is more
transparent... :)
that said, I think the OP is not looking for state but for polymorphic
behavior...hence, my previous suggestion.
Jim
--
--
You received this messa
201 - 300 of 1184 matches
Mail list logo