Re: xslt extension functions in clojure

2013-05-15 Thread Jim
Thread.currentThread().getContextClassloader(), assuming of course that you're working on a Clojure project... Jim ps: I have no idea what Xalan Saxon are and what your code is trying to do, but this particular paragraph of yours screams class - loading issues... -- -- You received this message

Re: confused on set!

2013-05-15 Thread Jim - FooBar();
On 15/05/13 17:23, Phillip Lord wrote: I cannot do (set!*my-test* true) (alter-var-root #'*my-test* (constantly true)) 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

Re: confused on set!

2013-05-15 Thread Jim - FooBar();
On 15/05/13 17:28, Jim - FooBar(); wrote: On 15/05/13 17:23, Phillip Lord wrote: I cannot do (set!*my-test* true) (alter-var-root #'*my-test* (constantly true)) Jim here explains what you're asking: http://clojure.org/Vars scroll down to until you see (*set!*var-symbol expr

Re: [ANN] Incremental Vectors

2013-05-14 Thread Jim
many thanks for this! :) btw, is there any place where one can find your discussion between you and Christophe? I'd love to know more about equiv...alternatively, do you plan on making public what you've learned in some sort of demo/tutorial? Jim On 14/05/13 09:29, Mark Engelberg wrote

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Jim
So the following is not encouraged because we disregard the result of calling seq? (def dummy {:a [1 2 3] :b [4 5 6] :c [] }) =(every? seq (vals dummy)) ;make sure all values are non-empty false Jim On 13/05/13 15:08, Meikel Brandmeyer (kotarak) wrote: Hi, Am Montag, 13. Mai 2013

Re: Struggling with encapsulation

2013-05-10 Thread Jim - FooBar();
' etc. claws into me though, so it is with trepidation I set out on this gloriously liberating new path :). the mindset you're describing is a direct consequence of unrestrained mutability ...nothing bad can happen to your *immutable* clojure data :)... very liberating indeed! Jim -- -- You

Re: More idiomatic way to use map like this?

2013-05-03 Thread Jim - FooBar();
not to use any reference types. 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 unsubscribe

Re: More idiomatic way to use map like this?

2013-05-03 Thread Jim - FooBar();
something like this perhaps? (loop [[c more]] cards res [] due 100] (if-not c res (recur more (conj res (doto c (.setAppliedBalance (max 0 (- due ) (- due (.getBalance c ) Jim ps: haven't got a clue what objects you're working with so I'm

Re: More idiomatic way to use map like this?

2013-05-03 Thread Jim - FooBar();
oops there is a typo! line 6 should be: (conj res (doto c (.setAppliedBalance (max 0 (- due (.getBalance c)) On 03/05/13 15:22, Jim - FooBar(); wrote: something like this perhaps? (loop [[c more]] cards res [] due 100] (if-not c res (recur more (conj res

Re: More idiomatic way to use map like this?

2013-05-03 Thread Jim - FooBar();
I Just realised you've many responses and that you've already solved your problem...sorry for the noise people. Jim On 03/05/13 15:38, Jim - FooBar(); wrote: oops there is a typo! line 6 should be: (conj res (doto c (.setAppliedBalance (max 0 (- due (.getBalance c)) On 03/05/13 15:22

fast numerics in Scala...

2013-05-01 Thread Jim
I enjoyed watching this so I thought I'd share... http://www.infoq.com/presentations/Scala-Spire 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

Re: Now *there*'s a machine made for Clojure.

2013-04-29 Thread Jim
you need, have been implemented/ported to clojure-py...My guess would be not all of them have... 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

Re: testing for nil may not be enough

2013-04-29 Thread Jim - FooBar();
I 've found that whenever I get a var-unbound exception it is almost always my fault and my fault only...why would you do (def a) anyway? Jim On 29/04/13 16:32, AtKaaZ wrote: How do you guys handle the cases when the var is unbound? I mean specifically in the cases where you just test

Re: testing for nil may not be enough

2013-04-29 Thread Jim - FooBar();
funny you should mention that!!! that is exactly what I meant by 'my fault'...I've come to realise that dynamic scope is almost evil, thus I go to great lengths to avoid it completely...in the rare cases where I do use it I always make sure it is bound to a init/default value :) Jim On 29

Re: Reducers newbie question

2013-04-26 Thread Jim - FooBar();
+1 ! I use 'fold-into-vec' regularly :) Jim On 26/04/13 18:07, Alan Busby wrote: Some additional pointers here (this is a little old though); http://www.thebusby.com/2012/07/tips-tricks-with-clojure-reducers.html On Fri, Apr 26, 2013 at 11:51 PM, László Török ltoro...@gmail.com

cannot read foo.xml from the top level of a jar!

2013-04-26 Thread Jim - FooBar();
from the classloader + the Class object... any ideas? 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 new members are moderated - please be patient

Re: cannot read foo.xml from the top level of a jar!

2013-04-26 Thread Jim - FooBar();
tried both... nothing worked... :( Jim On 26/04/13 20:16, Jonathan Fischer Friberg wrote: Did you put / at the beginning of the string to resource? Because you shouldn't. You should call it like this: (resource foo.xml). Jonathan On Fri, Apr 26, 2013 at 8:47 PM, Jim - FooBar(); jimpil1

[ANN] Immutant 0.10.0 released

2013-04-26 Thread Jim Crossley
to reduce the incidental 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

Re: How to import classes from a runtime-defined ClassLoader?

2013-04-24 Thread Jim
I've also had problems passing classes that reside to memory to apache UIMA or instantiation. What worked for me is this: (def dynamic-classloader (. (Thread/currentThread) getContextClassLoader)) (Class/forName mypackage.myclass true dynamic-classloader) Jim On 24/04/13 13:39, Gary

Re: Performance of calling primitive type hinted functions passed as arguments

2013-04-24 Thread Jim
very similar timings from these 2 versions as the type-hinted arg 'l' is never used anywhere - you're just returning nil... 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

Re: Why is the compiler more strict on one of my machines?

2013-04-16 Thread Jim foo.bar
It sounds to me that you forgot to run 'lein clean' at work, leaving certain classfiles present in 'target'. This would explain why you got your uberjar at work but not at home (presumably .class files are being ignored by git) Jim On 16/04/13 13:59, larry google groups wrote: I have a Mac

proxy doesn't care about type hints?

2013-04-15 Thread Jim - FooBar();
the types does nothing - it seems proxy only cares about arity void bar(InterfaceX ix); //*not *supposed to be overriden abstract void bar(InterfaceY iy); //but this is indeed supposed to be overriden Should I just give up? Jim -- -- You received this message because you are subscribed

Re: proxy doesn't care about type hints?

2013-04-15 Thread Jim - FooBar();
use it!)... 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 unsubscribe from this group

Re: proxy doesn't care about type hints?

2013-04-15 Thread Jim - FooBar();
On 15/04/13 21:37, Meikel Brandmeyer (kotarak) wrote: (proxy [YourClass BarInterface] [] (bar [x-or-y] (if (instance? InterfaceY x-or-y) (override x-or-y) (proxy-super x-or-y I'm sorry I forgot...what is 'override' above? what fn is this? I cannot find docs... Jim

Re: proxy doesn't care about type hints?

2013-04-15 Thread Jim - FooBar();
aaa ok sorry... proxy-super is a no-no in this case...I think at this point my best bet is to write a macro that will expand into a gen-class skeleton form...there is no other way I'm afraid...the proxy approach would be so elegant if it worked! Jim On 15/04/13 22:17, Meikel Brandmeyer

nice Clojure at Nokia talk

2013-04-12 Thread Jim foo.bar
Nice talk :) http://skillsmatter.com/podcast/scala/clojure-at-nokia-entertainment/wd-23 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

classloader and proxied classes issue

2013-04-11 Thread Jim - FooBar();
!))** ** ** =hotel_nlp.externals.uima.proxy$org.uimafit.component.JCasAnnotator_ImplBase$0* What on earthis happening? How am I able to get the class Object back but the ClassLoader couldn't? This is very weird isn't it? any insights would be great! :) Jim -- -- You received this message because you

Re: classloader and proxied classes issue

2013-04-11 Thread Jim - FooBar();
I found this on SO which seems to be related but the answer proposes deftype which is not an option for me as I need to extend a particular class with proxy... I'm completely stuck... Jim On 11/04/13 14:10, Jim - FooBar(); wrote: Hi all, I'm writing a tiny wrapper around apache UIMA

Re: classloader and proxied classes issue

2013-04-11 Thread Jim - FooBar();
classloader and even if I could who knows what kind of problems that would bring... Jim On 11/04/13 16:36, Jim - FooBar(); wrote: I found this on SO which seems to be related but the answer proposes deftype which is not an option for me as I need to extend a particular class with proxy... I'm

loading proxied classes outside of clojure

2013-04-11 Thread Jim - FooBar();
since classes generated by proxy reside on memory how would the standard java.net.URLClassolader find them? is there a way to emit the class on disk? Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: defrecord and namespace-qualified symbols

2013-04-10 Thread Jim foo.bar
... 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 unsubscribe from this group, send email

Re: Something goofy you can do in Clojure.

2013-04-09 Thread Jim foo.bar
Hey Mark, don't get paranoid :)... this is all Cedric did! user= (def .3 0.4) #'user/.3 user= (+ .3 1.7) 2.1 Jim On 09/04/13 10:46, Mark Engelberg wrote: What version are you running? As far as I know, .3 isn't even a valid representation for a number -- you'd have to write it as 0.3. So

Re: Using update-in to produce vectors from nothing

2013-04-05 Thread Jim foo.bar
if I understood correctly you're looking for 'fnil' : =(update-in {} [:foo :bar] (fnil conj []) :a :b :c) {:foo {:bar [:a :b :c]}} Jim On 05/04/13 12:25, Simon Katz wrote: Hi. Is there an idiomatic way to have update-in create a vector when the supplied keys do not already exist? (Or maybe

Re: Using update-in to produce vectors from nothing

2013-04-05 Thread Jim foo.bar
aaa Laurent beat me to it! :) it seems we both understood the same thing so fnil is indeed your friend... Jim On 05/04/13 12:29, Jim foo.bar wrote: if I understood correctly you're looking for 'fnil' : =(update-in {} [:foo :bar] (fnil conj []) :a :b :c) {:foo {:bar [:a :b :c]}} Jim On 05

Re: nested reduce/reduce-kv idiom

2013-04-04 Thread Jim - FooBar();
Thanks John, I came up with this, which uses destructuring quite heavily and might slow things down... (reduce (fn [s [t1 t2 w3 v]] (assoc-in s [t1 t2 w3] (/ (count v) all))) {} (for [[k1 v1] ems [k2 v2] v1 [k3 v3] v2] [k1 k2 k3 v3])) is this what you meant? Jim On 03/04/13 19:54, John D

Re: Analog to Scheme's partition in Clojure?

2013-04-04 Thread Jim - FooBar();
! both))) Jim On 04/04/13 13:16, Christian Romney wrote: Hi all, I was wondering if something in core (or new contrib) like this exists already... (defn segregate Takes a predicate, p, and a collection, coll, and separates the items in coll into matching and non-matching subsets. Like Scheme

Re: Analog to Scheme's partition in Clojure?

2013-04-04 Thread Jim - FooBar();
want go parallel... you asked where to find this funciton... a couple of places actually :) http://clojuredocs.org/clojure_contrib/clojure.contrib.seq-utils/separate http://richhickey.github.com/clojure-contrib/seq-utils-api.html HTH, Jim On 04/04/13 19:12, Christian Romney wrote

Re: Getting the right Clojure version with dependencies

2013-04-04 Thread Jim - FooBar();
[ghostandthemachine/seesaw1.4.3-SNAPSHOT:exclusions[org.clojure/clojure]] Jim ps: maybe the actual coordinate for clojure is wrong but I can On 05/04/13 00:32, Mark Engelberg wrote: Right now, I'm experimenting with seesaw. In Clojars, it appears the latest version is 1.4.2. When I

nested reduce/reduce-kv idiom

2013-04-03 Thread Jim - FooBar();
work...has anyone done this already? It comes down to 'seq' returning a [k,v] vector when called on a map so the second nesting level will break because it will find a keyword or something similar. any ideas? Jim -- -- You received this message because you are subscribed to the Google Groups

Re: why can I re-use local variables if Clojure is immutable?

2013-04-02 Thread Jim - FooBar();
All you're doing is re-let(ing) the same name using the value with which it'd been previously 'let'. It has nothing to do with mutability...if you used a different name you'd see that nothing would happen to the 'first' mega value. Yes I'd say this is badly articulated Clojure... Jim On 02

Re: why can I re-use local variables if Clojure is immutable?

2013-04-02 Thread Jim - FooBar();
) and using dynamic vars heavily... Jim On 02/04/13 20:19, Jim - FooBar(); wrote: All you're doing is re-let(ing) the same name using the value with which it'd been previously 'let'. It has nothing to do with mutability...if you used a different name you'd see that nothing would happen

Re: Fastest way to generate comma-separated list

2013-04-02 Thread Jim - FooBar();
I'm sorry, I've not followed this discussion - what is wrong with user=(apply str (interpose \, (list 1 2 3 4 5))) 1,2,3,4,5 the problem is strings where you want to preserve each string...you can special case that and avoid the (apply str...) bit.. user= (interpose \, (list jim jon chris

Re: Problem with map (only when running on browser)

2013-03-30 Thread Jim - FooBar();
Clojurescript is Clojure...you may be able to skip some JVM idiosyncrasies but it's the same language - no way around that! Jim On 30/03/13 14:09, Nico wrote: Thank you very much sw1nn and John, both worked great. This goes to show how much of a newb I am. Sorry if this is the wrong group

Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Jim - FooBar();
imagine it shouldn't be too hard to do the same on the threading macros, cond etc. Also if I face any problems there is always your code to guide me... Jim On 28/03/13 05:42, Alex Baranosky wrote: print-foo is a small library useful when debugging code, or at the REPL when writing your code

Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Jim - FooBar();
On 28/03/13 18:39, Alex Baranosky wrote: Jim, I'm interested in that idea definitely, but perhaps we should just create another open source project for time.foo? Ok cool, I'll do that over the weekend and poke you sometime next week to have a look...also, have you deliberately left out

Re: core.logic : In one list but not in another

2013-03-28 Thread Jim - FooBar();
clojure.set/difference 'membero' combined with its negated form? Jim On 28/03/13 18:47, JvJ wrote: In core.logic, how do the following: Give me everything that is a member of list A and not a member of list B? -- -- You received this message because you are subscribed to the Google Groups

Re: Apply elements in a vector as arguments to function

2013-03-27 Thread Jim foo.bar
(at least for me)... Jim ps: by no means I meant read the source before posting here...my comment was closer to read the sources - it's good for you - you'll learn stuff and potentially save time effort :) -- -- You received this message because you are subscribed to the Google Groups Clojure

Re: Apply elements in a vector as arguments to function

2013-03-26 Thread Jim - FooBar();
On 26/03/13 19:28, Ryan wrote: apply the elements of my vector as arguments to the function you said it yourself in your first post... :) 'apply' is what you're looking for! Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Apply elements in a vector as arguments to function

2013-03-26 Thread Jim - FooBar();
:address.state] or in your case exactly: [:id] [[:id :identity]] ;;with aliasing is this how your 'fields-vector' looks like? Jim ps: I've not looked at the source of 'fields', I may be wrong... On 26/03/13 20:12, Ryan wrote: Thank you guys for your answer. apply was the first thing I used

Re: Apply elements in a vector as arguments to function

2013-03-26 Thread Jim - FooBar();
aaa see? always check the docs first and the sources second (if available)...I should have done that as well :) Jim On 26/03/13 20:28, Ryan wrote: Ah damn, you are right! Sorry if I wasted anyone's time :) At least I learned that apply was the way to go in my original post On Tuesday

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
play nicely... I feel slightly 'betrayed' now...ok 'betrayed' may be a bit of a stretch but you get the idea...I can no longer claim that Clojure's collections are values, can I? Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
- not by convention... 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 unsubscribe from this group

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
final within a class, is there a way to mutate it? I do find this very scary, even in Java as it contradicts certain things we take for granted... Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
://www.azulsystems.com/blog/cliff/2011-10-17-writing-to-final-fields-via-reflection 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

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:50, Shantanu Kumar wrote: However, I'd consider they are just implementation details and intended for idiomatic use from within the Clojure language. I think you meant *not* intended for idiomatic use from within the Clojure language. Jim -- -- You received this message

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:55, Michael Klishin wrote: Take a look at https://blogs.oracle.com/jrose/entry/value_types_in_the_vm, it indicates that there is interest in true value types on the JVM but at best they will make it in JDK 9 in 2015. thanks for thisvery interesting stuff indeed... :) Jim

cannot get more than 94 fibonacci numbers - integer overflow

2013-03-25 Thread Jim foo.bar
understand why I get an integer overflow... any ideas? Jim ps: this is not 'important', I'm just messing about... -- -- 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

Re: cannot get more than 94 fibonacci numbers - integer overflow

2013-03-25 Thread Jim foo.bar
On 25/03/13 15:22, Ben Wolfson wrote: The 94th fibonacci number is greater than Long/MAX_VALUE, so it overflows. It is using longs. I seeshouldn't Clojure auto-promote it to a BigInt then? Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group

Re: cannot get more than 94 fibonacci numbers - integer overflow

2013-03-25 Thread Jim foo.bar
Cool, thanks guys :) Jim On 25/03/13 15:34, David Powell wrote: On Mon, Mar 25, 2013 at 3:24 PM, Jim foo.bar jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: On 25/03/13 15:22, Ben Wolfson wrote: The 94th fibonacci number is greater than Long/MAX_VALUE, so

Re: let-timed macro...any suggestions/corrections?

2013-03-24 Thread Jim - FooBar();
)] `(let ~(vec (interleave names results)) ~@body))) 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

strange behaviour

2013-03-24 Thread Jim - FooBar();
is that 'tags' contains String objects whereas 'tt-pairs' contains TokenTagPair objects... weird stuff, yes? any ideas anyone? 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

Re: strange behaviour

2013-03-24 Thread Jim - FooBar();
and should terminate in the same time... Jim On 24/03/13 13:22, Marko Topolnik wrote: What do you mean by performing the same operation? How can you perform the same operation on completely different objects? Do you mean that you don't have the exact same /ngrams*/ in the first and second

Re: strange behaviour

2013-03-24 Thread Jim - FooBar();
ntt-pairs) (#hotel_nlp.algorithms.viterbi.TokenTagPair{:token Fulton, :tag NP} #hotel_nlp.algorithms.viterbi.TokenTagPair{:token County, :tag N}) so this proves it works as expected...the weirdness is that it takes more than forever whereas with strings it finishes quickly! Jim On 24/03

Re: strange behaviour

2013-03-24 Thread Jim - FooBar();
wow! this is even stranger now!!! I removed the call to count from ngrams* and now the same thing happens but all 4 cpus are busy!!! I don't understand... Jim On 24/03/13 13:54, Marko Topolnik wrote: May or may not be related, but calling /count/ on a lazy sequence eagerly consumes

Re: strange behaviour

2013-03-24 Thread Jim - FooBar();
(ngrams* Dtags 2)));;all good (def pair-ngrams (doall (ngrams* Dpairs 2)));;this hangs now redefine ngrams* without the 'count' and try the last 2 statements...check your cpus... Jim On 24/03/13 14:04, Jim - FooBar(); wrote: wow! this is even stranger now!!! I removed the call to count from

Re: strange behaviour

2013-03-24 Thread Jim - FooBar();
ooo I found this: http://stackoverflow.com/questions/10565874/non-linear-slowdown-creating-a-lazy-seq-in-clojure I did not post this but this guy came up with the same solution... Jim ps: the 'partition' solution does seem much better... On 24/03/13 14:17, Jim - FooBar(); wrote: i'm getting

Re: Concurrency and custom types.

2013-03-24 Thread Jim - FooBar();
of course you can... however be careful of what you mean immutable in Java. Declaring fields as final doesn't make them immutable unless they point to something immutable (a value). if they do, make sure you override .equals() appropriately and you're good to go... :) Jim On 24/03/13 16

Re: Concurrency and custom types.

2013-03-24 Thread Jim - FooBar();
with something mutable? there is nothing to be gained from that, is there? the indirection of vars/refs only makes true sense when dealing with values and pure functions... Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

let-timed macro...any suggestions/corrections?

2013-03-23 Thread Jim - FooBar();
'time (second %)) parts)] ;;don't time at compile-time, just build the timing expression for later use `(let ~(vec (interleave names results)) ;;the new bindings ~@code))) Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: doing a Google search from Clojure?

2013-03-22 Thread Jim - FooBar();
On 22/03/13 15:00, juan.facorro wrote: (do (.append sb (char c)) do you really need the 'do'? 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

Re: doing a Google search from Clojure?

2013-03-22 Thread Jim - FooBar();
On 22/03/13 15:20, Jim - FooBar(); wrote: On 22/03/13 15:00, juan.facorro wrote: (do (.append sb (char c)) do you really need the 'do'? Jim ooops! I'm really sorry! my bad! JIm -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: LoL which style for Clojure

2013-03-22 Thread Jim - FooBar();
def/defn et. al are top-level form definitions...very rarely (I'd say never) you'd have a def/defn inside a 'let' or inside anything for that matter...The 1st one looks good :) Jim On 22/03/13 18:59, jamieorc wrote: Curious which style is preferred in Clojure and why: (defn f1 [] (let [x

Re: ANN: Illegal Argument podcast on Typed Clojure

2013-03-21 Thread Jim foo.bar
thanks guys! I enjoyed this.. :) Jim On 21/03/13 08:32, Mark Derricutt wrote: Hey all, We couldn't let everyone at Clojure/West have all the fun so our latest podcast is an awesome chat with Ambrose Bonnaire Sergeant all about Typed Clojure. http://illegalargument.com/illegal-argument

nested map destructuring

2013-03-19 Thread Jim - FooBar();
Hello all, can anyone help me destructure the following map in order to access directly w1 w2 w3 ? I've been trying for 20 minutes now! (how useless am I? :( ) {:weights {:w1 0.2 :w2 0.3 :w3 0.5} :uni-probs {...} :bi-probs {...} :tri-probs {...}} thanks, Jim -- -- You received

Re: nested map destructuring

2013-03-19 Thread Jim - FooBar();
On 19/03/13 19:49, Marko Topolnik wrote: {{:keys [w1 w2 w3]} :weights} awsome!...the full thing actually is {{:keys [w1 w2 w3]} :weights u :uni-probs b :bi-probs t :tri-probs} I always get confused when the order changes like that...thanks for unblocking me Marko :) Jim -- -- You

Re: nested map destructuring

2013-03-19 Thread Jim - FooBar();
nice one...when thinking like there is literally no confusion. thank you thank you thank you :) Jim On 19/03/13 20:05, Marko Topolnik wrote: Think of it in layers, like this---layer 1: {w :weigths, u :uni-probs, b :bi-probs, t :tri-probs} Then, instead of an atomic w, recursively

contrib.monads doesn't compile?

2013-03-18 Thread Jim - FooBar();
you should know... 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 unsubscribe from

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread Jim - FooBar();
On 17/03/13 18:42, larry google groups wrote: (st/replace (str (:name item)) #: ) #(apply str (next %)) 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

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread Jim - FooBar();
aaa of course, if you do want to *read* the keyword in, use read-string...there is no point in getting rid of the ':' and then essentially re-inserting it! Jim On 17/03/13 18:51, JvJ wrote: Use read-string. user (read-string :cities) :cities On Sunday, 17 March 2013 14:42:38 UTC-4, larry

Re: Apparent interaction of libraries with lein

2013-03-14 Thread Jim foo.bar
Could it be that you're using lein1 instead of lein2? Is lein1 still actively maintained? In any case I suggest you upgrade to lein2... Jim On 14/03/13 12:48, Nico Swart wrote: The Leiningen project file I use include these dependancies: (defproject fb20try 1.0.0-SNAPSHOT :description

Re: fold over a sequence

2013-03-13 Thread Jim foo.bar
how come your project depends on the problematic version 1.5.0? Jim On 13/03/13 14:03, Paul Butcher wrote: Thanks Stuart - my Contributor Agreement is on its way. In the meantime, I've published foldable-seq as a library: https://clojars.org/foldable-seq I'd be very interested in any

Re: fold over a sequence

2013-03-13 Thread Jim foo.bar
there was a memory leak hence the 1.5.1 release the next day... Jim On 13/03/13 14:12, Paul Butcher wrote: On 13 Mar 2013, at 14:05, Jim foo.bar jimpil1...@gmail.com mailto:jimpil1...@gmail.com wrote: how come your project depends on the problematic version 1.5.0? 1.5.0 is problematic

strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
, the correct method is invoked (the first which calls the second)...why can't Clojure find the second overload and goes for the 3rd? any ideas? Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
) and the method that takes 2 arrays as args does exist both in the interface and the concrete implementation (POSTagger POSTaggerME respectively) how on earth can that be? any ideas anyone? this seems utterly odd to me! Jim On 12/03/13 13:26, Jim - FooBar(); wrote: Hi all, I came back

someClass.getMethods() misses 2 public methods! how is that even possible?

2013-03-12 Thread Jim - FooBar();
the title says it all...I'm left speechless! see my previous post for details (strange interop behaviour/issue) thanks in advance for any insight... Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
though they are both public! Having decompiled the jar I can confirm that the 2 methods are indeed present! In fact I was using them a week ago! I'm at a loss here...any help will be greatly appreciated... Jim -- -- You received this message because you are subscribed to the Google Groups Clojure

Re: Model-View-Controller in Clojure?

2013-03-12 Thread Jim - FooBar();
)) (realized? curr-game)) (canva-react @curr-game e)))] )) If your state transformation doesn't depend on user input then your watch-approach is fine... :) Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
... Jim On 12/03/13 14:49, David Powell wrote: It looks like: public String[] tag(String[] sentence, Object[] additionaContext); wasn't originally present in the API, and was added in: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/postag

Re: strange interop behaviour/issue

2013-03-12 Thread Jim - FooBar();
David you are a genious!!! thank you thank you very much!!! one of my dependencies was pulling in opennlp/tools 1.5.0 which is a 2 year old jar!!! added :exclusions and now I'm back in the game If you're in Manchester Uk I'm buying beer... :) Jim On 12/03/13 14:49, David Powell wrote

Re: fold over a sequence

2013-03-11 Thread Jim foo.bar
and then use fold on that? Is it a massive seq? Jim On 11/03/13 00:40, Paul Butcher wrote: As things currently stand, fold can be used on a sequence-based reducible collection, but won't be parallel. I'm currently working on code that processes XML generated by clojure.data.xml/parse, and would

Re: What's the point of - ?

2013-03-11 Thread Jim foo.bar
(+ 1))). I guess for such occasions it is purely a mater of taste... 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

Re: Get difference between two lists with java objects of same class

2013-03-11 Thread Jim - FooBar();
to find the difference. alternatively, you can pour the lists into 2 clojure sets and take their proper difference (but this will remove duplicates as well)... I'm not sure what you mean 'compare those lists based on a key' though... Jim On 11/03/13 18:15, Ryan wrote: Hello, I have two lists

Re: Get difference between two lists with java objects of same class

2013-03-11 Thread Jim - FooBar();
On 11/03/13 18:35, Jim - FooBar(); wrote: Well, java.util.List specifies a retainAll(Collection c) method which is basically the intersection between the 2 collections (the Collection this is called on and the argument). You are actually looking for the 'difference' but if you have

Re: Get difference between two lists with java objects of same class

2013-03-11 Thread Jim - FooBar();
to java's broken equality semantics? If you use removeAll() you automatically lose the ability to make such decisions for yourself... :-) Jim On 11/03/13 19:35, Ryan wrote: Hey Jim, Thanks for your replies for starters. Indeed I do not care what will happen to the original lists, i only care

Re: Get difference between two lists with java objects of same class

2013-03-11 Thread Jim - FooBar();
)) (set (map #(TEMP. (.getId %) {:ob %} nil) java-util-list-with-objects2)) ) ) ;;half way there (def step2 (for [t step1] (- t meta :ob))) ;;not tested but seems reasonable doesn't it? hope that helps... Jim ps: now that I look at it maybe a map (with 2 keys :id :ob) seems a simpler

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-10 Thread Jim - FooBar();
no I don't have to :import them...I need the namespace loaded and then I need access to all the protocol vars (both can be achieved with :require)...The concrete records need importing by the consumer, if that's what you mean... Jim On 10/03/13 11:18, Marko Topolnik wrote: Isn't it true

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-10 Thread Jim - FooBar();
any insight about what is being brought in...my understanding is that since they do the same (bad) thing, let's stop using one of them... so given this, my question can be re-phrased as :use/[:require :refer:all] an entire namespace full of protocols or stick with [:require :as]?... Jim

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-10 Thread Jim - FooBar();
better than :require :refer :allin other words, burying :use doesn't mean that suddenly :require :refer :all is good...it is equally bad as a bare :use... in my case though, I will most likely use all the vars (eventually), hence my question... Jim -- -- You received this message because

Re: :use an entire namespace full of protocols or stick with :require?

2013-03-10 Thread Jim - FooBar();
of places, mainly in the 'concretions' namespace...to be honest, at the moment I'm using :refer :all simply because I'd need the characters 'pro/' more than 300 times in that namespace...it would actually make readability worse in my opinion... Jim -- -- You received this message because you

Re: Model-View-Controller in Clojure?

2013-03-10 Thread Jim - FooBar();
with an average branching factor of 26. In the best case, pruning can cut this down in half which sounds pretty impressive if I ever manage it! 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

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