Re: Clojure generates unnecessary and slow type-checks

2013-07-02 Thread Jim - FooBar();
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

Re: Clojure generates unnecessary and slow type-checks

2013-07-02 Thread Jim - FooBar();
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

Re: Casting to Object[]

2013-07-02 Thread Jim
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

Re: Functions that return seqs

2013-07-02 Thread Jim
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

Re: reset! and merge for (transient {})

2013-07-02 Thread Jim
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

Re: Functions that return seqs

2013-07-02 Thread Jim
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

Re: reset! and merge for (transient {})

2013-07-02 Thread Jim
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

Re: Functions that return seqs

2013-07-02 Thread 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

Re: clojure.set/union bug?

2013-07-01 Thread Jim - FooBar();
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

Re: clojure.set/union bug?

2013-07-01 Thread Jim - FooBar();
;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

Re: clojure.set/union bug?

2013-07-01 Thread Jim - FooBar();
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 (

clojure on raspberry pi looks decent

2013-06-30 Thread Jim - FooBar();
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

question about java 'finalizers' (Charlie's Hunt talk)

2013-06-29 Thread Jim - FooBar();
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...

Re: core.async

2013-06-29 Thread Jim - FooBar();
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)...

Re: New Fuzzy Matching Library - Fuzzy Matcher

2013-06-27 Thread Jim - FooBar();
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

Re: New Fuzzy Matching Library - Fuzzy Matcher

2013-06-27 Thread Jim
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

Re: can't compile anything except "def"

2013-06-22 Thread Jim - FooBar();
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

Re: can't compile anything except "def"

2013-06-22 Thread Jim - FooBar();
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

Re: can't compile anything except "def"

2013-06-22 Thread Jim - FooBar();
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

Re: (clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Jim - FooBar();
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

Re: fastest way to produce a PersistentList

2013-06-21 Thread Jim - FooBar();
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

Re: (clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Jim - FooBar();
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

Re: (clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Jim - FooBar();
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 [

Re: fastest way to produce a PersistentList

2013-06-21 Thread Jim - FooBar();
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

Re: Function returns nil

2013-06-21 Thread Jim - FooBar();
'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

Re: Function returns nil

2013-06-21 Thread Jim - FooBar();
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

Re: Function returns nil

2013-06-21 Thread Jim - FooBar();
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 &#x

Re: fastest way to produce a PersistentList

2013-06-21 Thread Jim - FooBar();
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

Re: (clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Jim - FooBar();
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

fastest way to produce a PersistentList

2013-06-21 Thread Jim - FooBar();
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

Re: Function returns nil

2013-06-21 Thread Jim
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

Re: Namespace qualification of symbols

2013-06-20 Thread Jim - FooBar();
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

Re: Problem filtering with definline'd function

2013-06-20 Thread Jim - FooBar();
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

Re: Problem filtering with definline'd function

2013-06-20 Thread Jim - FooBar();
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

extending a protocol to arrays and handle nesting too

2013-06-19 Thread Jim - FooBar();
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

Re: anyone interested in authoring a book on "Clojure for machine-learning" ?

2013-06-19 Thread Jim
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

anyone interested in authoring a book on "Clojure for machine-learning" ?

2013-06-19 Thread Jim
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

Re: Namespace qualification of symbols

2013-06-19 Thread Jim
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

Re: 'foldcat' slower than 'mapv' even for 10,000 elements

2013-06-19 Thread Jim
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'

Re: 'foldcat' slower than 'mapv' even for 10,000 elements

2013-06-19 Thread Jim
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

Re: What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Jim
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

Re: What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Jim
; 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

Re: What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Jim
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

Re: 'foldcat' slower than 'mapv' even for 10,000 elements

2013-06-18 Thread Jim
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

Re: type-hints positioning convention?

2013-06-17 Thread 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

Re: type-hints positioning convention?

2013-06-17 Thread Jim - FooBar();
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

Re: type-hints positioning convention?

2013-06-17 Thread Jim - FooBar();
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

'foldcat' slower than 'mapv' even for 10,000 elements

2013-06-17 Thread Jim - FooBar();
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

Re: In what OS do you code?

2013-06-17 Thread Jim Cheesman
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

type-hints positioning convention?

2013-06-17 Thread Jim - FooBar();
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

simple brute-force password cracker runs out of memory

2013-06-16 Thread Jim - FooBar();
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

Re: In what OS do you code?

2013-06-14 Thread Jim - FooBar();
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

Re: In what OS do you code?

2013-06-14 Thread Jim - FooBar();
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

Re: bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

Re: bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

Re: bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

Re: bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

Re: bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

Re: bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

'amap' issue after extending a protocol to a primitive array type

2013-06-13 Thread Jim - FooBar();
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

bug in 'extend-protocol' ???

2013-06-13 Thread Jim - FooBar();
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

extending a protocol to primitive arrays strange problem

2013-06-13 Thread Jim - FooBar();
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

Re: Shortcut for variadic map destructuring?

2013-06-06 Thread Jim - FooBar();
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

Re: importing a java class which 'requires' your namespace in a static block

2013-06-05 Thread Jim - FooBar();
! 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

importing a java class which 'requires' your namespace in a static block

2013-06-05 Thread Jim - FooBar();
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,

Re: Is it good functional style to use a protocol to create a plugin point?

2013-06-05 Thread Jim
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

Re: optional first map argument

2013-06-03 Thread Jim - FooBar();
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

Re: optional first map argument

2013-06-03 Thread Jim - FooBar();
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&

Re: how would you improve this map-reduce style fn?

2013-06-01 Thread Jim - FooBar();
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

Re: how would you improve this map-reduce style fn?

2013-06-01 Thread Jim - FooBar();
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

how would you improve this map-reduce style fn?

2013-06-01 Thread Jim - FooBar();
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"

Re: cyclic dependencies out of nowhere?

2013-05-30 Thread Jim - FooBar();
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

cyclic dependencies out of nowhere?

2013-05-30 Thread Jim - FooBar();
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

Re: clojure-west videos clarification

2013-05-30 Thread Jim - FooBar();
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

clojure-west videos clarification

2013-05-30 Thread Jim - FooBar();
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.

[ANN] Immutant is now officially in beta!

2013-05-29 Thread Jim Crossley
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

Re: org.junit.Assert/assertArrayEquals massive confusion!

2013-05-28 Thread Jim - FooBar();
) 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

Re: org.junit.Assert/assertArrayEquals massive confusion!

2013-05-28 Thread Jim - FooBar();
*) (-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

org.junit.Assert/assertArrayEquals massive confusion!

2013-05-28 Thread Jim - FooBar();
!! 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

Re: java.lang.Exception: Unsupported option(s) supplied: :exclude

2013-05-28 Thread Jim
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

Re: java.lang.Exception: Unsupported option(s) supplied: :exclude

2013-05-28 Thread Jim
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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
(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:

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
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

Re: Any alternatives for these two ugly patterns?

2013-05-25 Thread Jim - FooBar();
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

Re: why is this behaving badly?

2013-05-24 Thread Jim - FooBar();
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

why is this behaving badly?

2013-05-24 Thread Jim - FooBar();
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

Re: How to: reduce boolean operations?

2013-05-22 Thread Jim
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

Re: [ANN] tawny-owl 0.11

2013-05-22 Thread Jim
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

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Jim - FooBar();
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

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Jim - FooBar();
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

Re: Stackoverflow on a function listing files in a directory recursively

2013-05-20 Thread Jim - FooBar();
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

Re: find first match in a sequence

2013-05-19 Thread Jim - FooBar();
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

Re: find first match in a sequence

2013-05-19 Thread Jim - FooBar();
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

Re: find first match in a sequence

2013-05-19 Thread Jim - FooBar();
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

Re: Screencast: Clojure development with Sublime Text 2

2013-05-19 Thread Jim - FooBar();
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

Re: confused on set!

2013-05-17 Thread Jim
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

Re: confused on set!

2013-05-16 Thread Jim - FooBar();
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.

Re: confused on set!

2013-05-16 Thread Jim
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.

Re: confused on set!

2013-05-16 Thread Jim
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

<    1   2   3   4   5   6   7   8   9   10   >