Re: [ANN] Jig

2014-02-06 Thread Joachim De Beule
Thanks so much for your suggestions Malcolm, very helpful and illuminating! Joachim. -- 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: NoClassDefFoundError after I import with "use" on the repl?

2014-02-06 Thread Andy Fingerhut
I tried to reproduce this behavior with the following environment, and didn't get this error. You may want to provide similar information for your environment in case it helps someone else track down the problem: Mac OS X 10.8.5 Oracle Java 1.7.0_15 Clojure 1.5.1 Leiningen 2.3.4 The following in

Parsing Clojure with instaparse: how to handle special forms?

2014-02-06 Thread Travis Moy
I'm trying to use instaparse to parse Clojure code so that I can reformat it, but I'm having an issue with how to handle special forms. Should I attempt to parse special forms such as let and defn into their own rules, or should I rely instead on the actual content of the terminal to determine

NoClassDefFoundError after I import with "use" on the repl?

2014-02-06 Thread larry google groups
I imagine this question has been asked a million times before, but I can not find the answer. I was looking at Raynes/fs library: https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj I wanted to check and see if "iterate-dir" returned a seq of strings (paths) or a seq of File objects

[ANN] clara-rules 0.4 released

2014-02-06 Thread Ryan Brush
The 0.4.0 release of Clara is up on Clojars. The github page is at [1]. The theme of this release is "rules as data", which I wrote about at [2]. In a nutshell, all rules and the Rete network itself are defined by well-defined data structures (via Prismatic Schema), which opens a lot of doors:

Re: stch.schema a Prismatic Schema fork

2014-02-06 Thread Leif
fn* and letfn* are special forms. I would double-check that things work as you expect if you (use 'stch.schema). E.g.: > (use 'stch.schema) > (macroexpand '(fn* simple-fn :- Int [x :- Int] (inc x))) ; => (fn* simple-fn :- Int [x :- Int] (inc x)) ; nope, can't expand special form > (macroexpand

Re: Lessons Learned from Adopting Clojure

2014-02-06 Thread Sean Corfield
On Feb 6, 2014, at 4:49 AM, Jay Fields wrote: > I'm glad it works well for you Sean; hopefully your team is just as happy. =) Yup, they love Expectations. Whenever we have to work on our WebDriver tests we always grumble because they are much more imperative and side-effecty so they are not rea

Re: range-sum

2014-02-06 Thread Sean Corfield
On Feb 6, 2014, at 12:58 PM, Stuart Sierra wrote: > I think (reduce + (range N)) is commonly used in *examples*, not necessarily > in real applications. I'd have to agree: I don't see anything like that in our 20kloc at World Singles. I see a handful of (reduce + data) for arbitrary series of d

[ANN] durable-queue: an in-process disk-backed queue

2014-02-06 Thread Zach Tellman
At Factual we get a lot of data thrown at us, and often don't have control over the rate at which it comes in. As such, it's preferable that our buffer isn't bounded by the process' memory, since a temporary blip in throughput may cause GC pauses, OOM exceptions, and other things that will onl

Re: range-sum

2014-02-06 Thread Stuart Sierra
I think (reduce + (range N)) is commonly used in **examples**, not necessarily in real applications. -S On Thursday, February 6, 2014 5:59:43 AM UTC-5, Jim foo.bar wrote: > > Hi all, > > I often see this code for summing up a range from 0-N : `(reduce + > (range N))` > > However there is a m

Re: set vs hash-set

2014-02-06 Thread Gal Dolber
One takes a coll and the other a list of arguments user=> (set [1 1]) #{1} user=> (hash-set 1 1) #{1} On Thu, Feb 6, 2014 at 4:49 PM, Alan Thompson wrote: > OK, this one has me stumped. What is the difference between > clojure.core/set and clojure.core/hash-set ??? The source code is alm

set vs hash-set

2014-02-06 Thread Alan Thompson
OK, this one has me stumped. What is the difference between clojure.core/set and clojure.core/hash-set ??? The source code is almost identical. Is one to be preferred over the other depending on circumstances? Alan (defn set "Returns a set of the distinct elements of coll." {:added "1.0"

stch.schema a Prismatic Schema fork

2014-02-06 Thread david
Please check out the repo README page for motivations and differences. Thanks so much to the Prismatic people for open sourcing Schema. It's awesome and I love it. Some of my changes seemed too different to even consider a pull request, so I decided to create my own fork. All feedback is we

Re: Alternative ->> macro for threading sequences?

2014-02-06 Thread Jozef Wagner
I agree with Colin, the cognitive load is greater than benefits of such approach. BTW you can use comp to chain consecutive map transformation functions. (map (comp pacify wrangle) things) JW On Thu, Feb 6, 2014 at 3:40 PM, Korny Sietsma wrote: > Hi folks, > > I seem to regularly find myself w

Re: having trouble with lein-ring :auto-refresh?

2014-02-06 Thread boz
Just realized I had name changes ... correction ... changed original to ... (defn ring-handler [request] {:status 200 :headers {"Content-Type" "text/html"} :body (str "" x "change this text" "")}) And. Of course. I'll change those string tags to hiccup asap :) On Thursday, February 6

Re: having trouble with lein-ring :auto-refresh?

2014-02-06 Thread boz
Thanks James! That was it. Changed my original handler to this and it works perfectly (defn ring-handler [request] {:status 200 :headers {"Content-Type" "text/html"} :body (str "" header "change this text" "")}) On Thursday, February 6, 2014 9:03:25 AM UTC-8, James Reeves wrote:

Re: having trouble with lein-ring :auto-refresh?

2014-02-06 Thread James Reeves
The :auto-refresh option adds in the ring-refresh middleware, which injects Javascript into HTML pages to automatically refresh the page when notified. The HTML page needs to be of content-type "text/html", and should be well-formed with a element. Try checking the source code of the HTML page b

Re: having trouble with lein-ring :auto-refresh?

2014-02-06 Thread boz
I'm starting to think my expectations are wrong and the :auto-refresh? doesn't make the browser refresh. I've never seen it work so what do I know. :) I tried making a new project using the compojure template... $ lein new compojure godoggo I then changed its project.clj to include the :auto-

Re: range-sum

2014-02-06 Thread Karsten Schmidt
Agreed, but this could be a nice rule for https://github.com/jonase/kibit, maybe? On 6 February 2014 12:42, James Reeves wrote: > This seems way too specialised to be in Clojure core. > > - James > > > On 6 February 2014 10:59, Jim - FooBar(); wrote: >> >> Hi all, >> >> I often see this code for

Re: Alternative ->> macro for threading sequences?

2014-02-06 Thread Colin Yates
To be honest I prefer the first although I get your point about the over simplification. If I were going anywhere with this it would be to generalise it into a provided processor, something like: (->> :processor map things wrangle ... ) but I am not sure the cognitive load of the extra s

Re: [ANN] Jig

2014-02-06 Thread Malcolm Sparks
Hi Joachim, I suggest you create a component, C, that assocs a channel in the system map. Now create a component, A that depends on C. A should start and stop a thread in the usual start/stop Lifecycle. The component should get the channel from the system map. The thread should check the resource

Alternative ->> macro for threading sequences?

2014-02-06 Thread Korny Sietsma
Hi folks, I seem to regularly find myself writing ->> threaded code that follows similar patterns: (->> things (map wrangle) (map pacify) (filter effable) (map #(aggravate % :bees :sharks)) (reduce mapinate {}) i.e. all stages of the code actually operate on a collection rath

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Glen Fraser
Probably because you're using 0 through 3 as the arguments to fesetround(), rather than the proper #defined values: (e.g. on my Mac, from fenv.h) #define FE_TONEAREST0x #define FE_DOWNWARD 0x0400 #define FE_UPWARD 0x0800 #define FE_TOWARDZERO 0x0c00 You shoul

Re: [ANN] garden-watch

2014-02-06 Thread Timothy Washington
Lol, fair enough :) On Wed, Feb 5, 2014 at 11:44 PM, Joel Holdbrooks wrote: > Clojure. > > On Feb 5, 2014, at 8:42 PM, Timothy Washington wrote: > > Ok, that's fine. Definitely good to have both ways to tackle the problem. > But I'm curious. What do you feel is being given up by watching garden

Re: Lessons Learned from Adopting Clojure

2014-02-06 Thread Korny Sietsma
I've been doing something very similar, but using IntelliJ + Cursive Clojure - run Midje autotest inside the IDE for running tests, and also for manually evaluating snippets of code. Cursive gives me a lot of what I had from Emacs - paredit editing, tight repl integration (alt-enter mapped to "ev

Re: Lessons Learned from Adopting Clojure

2014-02-06 Thread Jay Fields
On Wed, Feb 5, 2014 at 10:40 PM, Sean Corfield wrote: > FWIW, I find the language of Expectations to be much better suited to > describing the desired behaviors of a system I want to build than the > assertion-based language of clojure.test - so for me it's about > test-before, not test-after. Th

Re: range-sum

2014-02-06 Thread James Reeves
This seems way too specialised to be in Clojure core. - James On 6 February 2014 10:59, Jim - FooBar(); wrote: > Hi all, > > I often see this code for summing up a range from 0-N : `(reduce + (range > N))` > > However there is a much faster way for this : `(/ (* N (dec N)) 2)` > > Do you thi

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Bruno Kim Medeiros Cesar
Also, I've made a test for this function for all float values in C: https://gist.github.com/brunokim/8843039 Unfortunetely it doesn't work in my system, as it does not have other rounding modes available besides the default. If anyone suceeds in running it, please report. On Thursday, February

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Bruno Kim Medeiros Cesar
Just to add a bit to the thread: the Java compiler treats java.lang.Math differently when more efficient alternatives are available. StrictMath is used only as a fallback. >From the java.lang.Math >javadoc : > By default many of the

Re: Confused by Clojure floating-point differences (compared to other languages)

2014-02-06 Thread Bruno Kim Medeiros Cesar
Just to add a bit to the thread: the Java compiler treats java.lang.Math differently when more efficient alternatives are available. StrictMath is used only as a fallback. >From the java.lang.Math >javadoc : > By default many of the

range-sum

2014-02-06 Thread Jim - FooBar();
Hi all, I often see this code for summing up a range from 0-N : `(reduce + (range N))` However there is a much faster way for this : `(/ (* N (dec N)) 2)` Do you think this should be in the language so that people do not use the slow version? Jim -- You received this message because you

use/require/import and quoted form

2014-02-06 Thread Andy Smith
Hi, I was wondering why use/require and import take quoted forms as their arguments, other alternatives could be strings or keywords, so what is special about the choice of quoted form here? Andy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To