Clojure pre assertion functions does not work with keyword?

2014-02-13 Thread Mamun
Hi I am just testing clojure :pre condition. But look like using keyword?, it is not working in clojure 1.5.1. (defn check-keyword [v] {:pre [keyword? v]} v) (defn check-nil [v] {:pre [nil? v]} v) (check-keyword “sdf”) ;Not throwing exception here (check-nil nil) ;Throwing exception Br,

Re: Clojure pre assertion functions does not work with keyword?

2014-02-13 Thread Ambrose Bonnaire-Sergeant
Hi Mamun, This is the correct syntax (you're missing some parens). (defn check-keyword [v] {:pre [(keyword? v)]} v) Thanks, Ambrose On Thu, Feb 13, 2014 at 6:47 PM, Mamun mamuni...@gmail.com wrote: Hi I am just testing clojure :pre condition. But look like using keyword?, it is not

Re: Keyword equality check

2014-02-13 Thread Arkadiusz Komarzewski
Guys, thank you all for input. I found that both keywords were (as you expected) loaded by same classloader (same parent was used in both). After fixing that the assert indeed fails. Cheers! On Thursday, 13 February 2014 00:41:12 UTC+1, Alex Miller wrote: Reading a little more closely,

CLJX CLJS problem

2014-02-13 Thread Karsten Schmidt
I've been busy working on a few libraries targetting both Clojure ClojureScript, however so far have only tested the CLJ side and now that it comes to addressing CLJS am running in circles (and on fumes) unsuccessfully trying to tweak my project settings to make things work. All my source is

Re: How to invoke java method obtained using clojure.reflect

2014-02-13 Thread zcaudate
Try my new library. It makes reflection really easy to use http://github.com/zcaudate/iroh -- 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: Clojure pre assertion functions does not work with keyword?

2014-02-13 Thread Mamun
HI Ambrose, Thanks for your reply. But why this one is working? (defn check-nil [v] {:pre [nil? v]} v) Br, Mamun On Thursday, February 13, 2014 11:51:31 AM UTC+1, Ambrose Bonnaire-Sergeant wrote: Hi Mamun, This is the correct syntax (you're missing some parens).

Re: Clojure pre assertion functions does not work with keyword?

2014-02-13 Thread Ambrose Bonnaire-Sergeant
It doesn't work, in your OP it incorrectly throws an exception when you pass it nil. :pre just takes a sequence of expressions which are executed like `do`, and throws an exception if any expression returns a false value. Thanks, Ambrose On Thu, Feb 13, 2014 at 7:53 PM, Mamun

clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Joachim De Beule
Dear list, [Sorry if this may be a bit of topic, but I don't know much about php and http, and I'm not sure where else to turn] I'm trying to port a working php api client implementation to clojure. So on the one hand, I've got the following working php code for performing a signed post

Re: meta circular clojure

2014-02-13 Thread Di Xu
2014-02-13 1:05 GMT+08:00 Herwig Hochleitner hhochleit...@gmail.com: 2014-02-12 5:36 GMT+01:00 Di Xu xudi...@gmail.com: all lisp dialect provide `read` function, so if you want to build an evaluator, you could just use this function and don't need to do lexical and syntax analysis.

Re: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Gijs S.
Untested of course, but I think you need to use either :body or :form-params rather than :query-params to put the query-params data into the body of the post request. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Kevin Ilchmann Jørgensen
They return identical data if you use http://httpbin.org/post as url ? /Kevin On Thu, Feb 13, 2014 at 1:35 PM, Gijs S. gijsstuur...@gmail.com wrote: Untested of course, but I think you need to use either :body or :form-params rather than :query-params to put the query-params data into the

Re: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Joachim De Beule
That did the trick! Thanks!! Op donderdag 13 februari 2014 13:35:46 UTC+1 schreef Gijs S.: Untested of course, but I think you need to use either :body or :form-params rather than :query-params to put the query-params data into the body of the post request. -- You received this message

Re: clj-http client translated from php/curl implementation fails, why?

2014-02-13 Thread Joachim De Beule
Solved by Gijs S., but thanks anyway, I didn't know about httpbin.org. Op donderdag 13 februari 2014 14:03:18 UTC+1 schreef Kevin Ilchmann Jørgensen: They return identical data if you use http://httpbin.org/post as url ? /Kevin -- You received this message because you are subscribed to

Re: OT: Enterprise Schedulers

2014-02-13 Thread icamts
Hi Adrian, I've been discovered :) I enjoyed exploring a ESB scenario. In abstract you may go along the lines of any of ESB solutions this way: 1) Any task is performed by suitably configured components 2) componets live in a container 3) components communicate through a message router 4)

[GSoC]: Need help? Add your project to the ideas page. (deadline tomorrow)

2014-02-13 Thread Daniel Solano Gómez
Hello, all, Would you like help in growing your Clojure project? Please add it to the Project Ideas page [1] and help Clojure get accepted into the Google Summer of Code. Clojure has benefited from its involvement in GSoC in past years. It has helped projects like Typed Clojure, Clojure in

Re: range-sum

2014-02-13 Thread Stuart Sierra
In the olden lisp days, reduce was often preferred to apply because apply could hit limits on the number of arguments that could be passed to a function. Is that a potential issue with clojure? No. Clojure's `apply` is lazy. Varargs are passed to the function as a lazy sequence, and it's up

Re: range-sum

2014-02-13 Thread Michał Marczyk
str is much faster with apply than with reduce; in fact, with reduce it is O(n^2), whereas with apply it is O(n). (The constants are better with apply too.) In general, (apply foo ...) takes advantage of any optimizations the author of foo might be aware of for speeding up its operation when

why my java code (call clojure from java ) run spend so much loooooog time .

2014-02-13 Thread Xiaojun Weng
I am a new clojure player,but i have wrote java code by few years. when i use emacs run my clojure code (read a big file 50M ) , nrepl run over use 30 second. but i use lein uberjar clojure to jar .and i use it jar in eclipse , this jar import in a embeded jetty when it started, some time

pretty-exception middleware for ring

2014-02-13 Thread bob
Hey, a simple exception middle-ware for ring, maybe useful for some,maybe none. it catch exceptions and print, meanwhile the source code produced the exception will be print as well. - The demo will stay here (click me)http://red-raiseup.rhcloud.com/notes/abc . - The source code is

Re: pretty-exception middleware for ring

2014-02-13 Thread Herwig Hochleitner
Looks great. I've incorporated this into my debug configuration. 2014-02-13 17:39 GMT+01:00 bob wee@gmail.com: Hey, a simple exception middle-ware for ring, maybe useful for some,maybe none. it catch exceptions and print, meanwhile the source code produced the exception will be print

Re: range-sum

2014-02-13 Thread Jozef Wagner
I would say that with good reducers, the reduce approach can eliminate seq creation and thus be at least a bit faster and less demanding for GC. On Thu, Feb 13, 2014 at 4:16 PM, Michał Marczyk michal.marc...@gmail.comwrote: str is much faster with apply than with reduce; in fact, with reduce

Re: GSoC 2014: org applications now open

2014-02-13 Thread A
I think this is a great discussion, and there are myriad ways to get there. I haven't settled my own opinions firmly enough to advocate for one implementation over another at this point, but I do think that Incanter could become a killer toolbox (even more than now) with the additon of...:

Re: Monkey-patching in Clojure

2014-02-13 Thread juan.facorro
You can also use the intern function to chamge the value of a any var in any namespace. Hope it helps -- 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

Re: range-sum

2014-02-13 Thread Michael Gardner
On Feb 13, 2014, at 08:56 , Stuart Sierra the.stuart.sie...@gmail.com wrote: No. Clojure's `apply` is lazy. Varargs are passed to the function as a lazy sequence, and it's up to the function to realize them or not. It's worth noting (for people who might try to rely on that laziness) that

Re: GSoC 2014: org applications now open

2014-02-13 Thread Jony Hudson
Hi, I'm a bit late to the party here (and very new to the party - this being my first post to the group) but maybe this of interest: I've been working on number 1 and sort of number 2 since the start of the year, and have something pretty solid working now. It's a browser based REPL, in the

Re: range-sum

2014-02-13 Thread Michael Gardner
On Feb 13, 2014, at 14:31 , Michael Gardner gardne...@gmail.com wrote: On Feb 13, 2014, at 08:56 , Stuart Sierra the.stuart.sie...@gmail.com wrote: No. Clojure's `apply` is lazy. Varargs are passed to the function as a lazy sequence, and it's up to the function to realize them or not.

Re: range-sum

2014-02-13 Thread Mauricio Aldazosa
My guess is that when using a rest-param a call to next is involved thus realizing two elements of the sequence. A call to rest only realizes the first element: user (defn f [x] (println x) x) #'user/f user (defn s [n] (lazy-seq (cons (f n) (s (inc n) #'user/s user (def t (rest (s 0))) 0

Re: why my java code (call clojure from java ) run spend so much loooooog time .

2014-02-13 Thread Andy-
FYI: http://stackoverflow.com/questions/21759848/ On Thursday, February 13, 2014 11:02:07 AM UTC-5, Xiaojun Weng wrote: I am a new clojure player,but i have wrote java code by few years. when i use emacs run my clojure code (read a big file 50M ) , nrepl run over use 30 second. but i

Re: [ANN] iroh 0.1.5 - Simple Java Reflection (Still SNAPSHOT but comments would be welcome)

2014-02-13 Thread zcaudate
Okay, v0.1.5 is out: http://z.caudate.me/jvm-class-reflection-made-simple/ -- 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

Re: [ANN] iroh 0.1.5 - Simple Java Reflection (Still SNAPSHOT but comments would be welcome)

2014-02-13 Thread kovas boguta
On Wed, Feb 12, 2014 at 10:55 PM, zcaudate z...@caudate.me wrote: Iroh is a library for jvm reflection. It is designed to be used for testing, repl based development, and blantant hacks bypassing the jvm security This is pretty cool. Will give it a shot next time I'm trying to tame a java

Clojure code for detecting overlap of 3d shapes (specifically tetrahedra)?

2014-02-13 Thread Lee Spector
Can anyone point to Clojure code for detecting when two 3d shapes overlap, when given the [x y z] vertices of the two shapes? The specific case I care about will always involve two regular tetrahedra (each of which is specified by 4 vertices), which may allow for special simplifications or

Re: range-sum

2014-02-13 Thread Michael Gardner
On Feb 13, 2014, at 15:17 , Mauricio Aldazosa mauricio.aldaz...@ciencias.unam.mx wrote: My guess is that when using a rest-param a call to next is involved thus realizing two elements of the sequence. A destructured vararg is nil when there are no more items, which indeed requires realizing

Re: GSoC 2014: org applications now open

2014-02-13 Thread Christopher Small
@Jony This is very exciting. Is this on github or somewhere else public? Would love to take a look at what you are doing. The snapshot looks awesome :-) Chris On Thursday, February 13, 2014 12:15:11 PM UTC-8, Jony Hudson wrote: Hi, I'm a bit late to the party here (and very new to the

query on clojure maps / vectors

2014-02-13 Thread t x
Hi, Preemptive: :-) * I'm not looking for datomic. * I'm also not looking for sqlkorma. * An in-memory data-log might be what I'm after. Context: I'm reading: http://code.kx.com/wiki/JB:QforMortals2/tables and it struck me -- why can't I view a clojure {vector,list} of maps as

Re: CLJX CLJS problem

2014-02-13 Thread Kevin Lynagh
It sounds like you have everything setup correctly---nothing stands out to me as being a problem. I can't tell for sure without the project source code, though. Take a look at Prismatic Schema's project.clj: https://github.com/Prismatic/schema/blob/master/project.clj they have the same use

Re: query on clojure maps / vectors

2014-02-13 Thread Jeb Beich
You sure this isn't what you're looking for? https://gist.github.com/stuarthalloway/2645453 On Thu, Feb 13, 2014 at 8:34 PM, David Jagoe davidja...@gmail.com wrote: Here's an example: http://www.bagdemir.com/2013/07/30/implementing-relational-algebra-in-clojure/ On 13 February 2014

ANN: om-sync

2014-02-13 Thread David Nolen
I've been banging the drum about Om modularity for a while now and I've come up with the very beginning of a simple reusable component that I think demonstrates the power of Om's emphasis on modularity and application wide state management: http://github.com/swannodette/om-sync The whole point

Re: CLJX CLJS problem

2014-02-13 Thread Dave Della Costa
Hi Karsten, Strangely, I was doing the exact same thing as you yesterday and struggled for a bit until I found settings that work. I achieved success when I used the configuration from Cornice as a template: https://github.com/rkneufeld/cornice/blob/master/project.clj ...with one exception, my

ANN: Om 0.4.0

2014-02-13 Thread David Nolen
Happy to announce a new release of Om. There are some breaking changes mostly to make the API more uniform - om.core/root was needlessly different from om.core/build. The biggest and most exciting change is the inclusion of the :tx-listen option to om.core/root. This will setup a callback which

Re: query on clojure maps / vectors

2014-02-13 Thread t x
@David: * set operations is not what I'm looking for * the relational algebra blog was very useful @Jeb: * Ha! I didn't know that q could be used separate of datomic. I might just use datomic after all. Thanks! On Thu, Feb 13, 2014 at 6:43 PM, Jeb Beich jebbe...@gmail.com wrote: You sure