Re: Pareto's Clojure

2015-11-12 Thread Sayth Renshaw
Thank you Eric that does really look like you have nailed a good core of clojure. Thank you also for providing the references I really think it will help. Excited to see how many solutions I can make using these. Sayth -- You received this message because you are subscribed to the Google Gro

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread reborgml
Hello, the following stops executing on 1.8.0-rc1 or current master-head (9448d627e091bc010e68e05a5669c134cd715a98, 1.8-RC1 plus Rich fix for CLJ-1846): [/Users/reborg]$ repl Clojure 1.8.0-master-SNAPSHOT user=> (defn ^double timespi [^double x] (* x 3.14)) #'user/timespi user=> (timespi 2) Abs

Re: [ANN] Let's make clojure.org better!

2015-11-12 Thread Nando Breiter
Expanding on the content idea for new-comers *to Clojure*, like me, (but not necessarily to programming in general), I've found the approachs taken by Living Clojure and PurelyFunctional.tv to be really helpful. Both Carin Meier and Eric Normand (for example) take a relatively shallow angle of atta

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Alex Miller
That's not a valid type hint. Var meta is evaluated, in this case to the double function object. You really want: (defn timespi ^double [^double x] (* x 3.14)) On Thursday, November 12, 2015 at 3:57:44 AM UTC-6, rebor...@gmail.com wrote: > > Hello, > > the following stops executing on 1.8.0-rc

Re: [ANN] Let's make clojure.org better!

2015-11-12 Thread Leon Grapenthin
I'd like to say that as a Clojure programmer I really like the current page. The reference documentation is an excellent resource. It does not answer all questions, but it answers the most critical ones very concisely and I hope that you intend to keep it like that. If one thing about the pa

Re: [ANN] 0.3.0 HugSQL release

2015-11-12 Thread Curtis Summers
Colin, I've added an issue to explore composable features for a future HugSQL release: https://github.com/layerware/hugsql/issues/12 All ideas welcome! Thanks! On Wed, Nov 11, 2015 at 11:40 PM, Robin Heggelund Hansen < skinney...@gmail.com> wrote: > Fantastic release Curtis. This is an awesom

Re: Style, Efficiency, and updating nested structure

2015-11-12 Thread Dave Tenny
Thanks for the replies, as always lots of interesting ways to do it in clojure. No zipper sugestions? For my own take, I happen to like the last suggestion (Gareth's) the most I think, of the ones offered so far. It has a lispy elegance and is still relatively efficient in traversals and memory

Re: Style, Efficiency, and updating nested structure

2015-11-12 Thread Erik Assum
I would like to argue that your code has to be pretty inefficient if it's creating a bigger performance impact than fetching from the database. Erik. -- i farta > Den 12. nov. 2015 kl. 15.36 skrev Dave Tenny : > > Thanks for the replies, as always lots of interesting ways to do it in > cloj

aatree release 0.5.1--Bugs fixed!

2015-11-12 Thread William la Forge
The aatree project provides fully compatible alternatives to Clojure sorted-map, sorted-set and vector, with several extensions: - AAVector supports add/drop at any point using addn and dropn. - AAMap and AASet implement Reversible, Counted, Indexed and Sorted - CountedSequence implements Co

[ANN] Onyx 0.8.0: Automatic State Management

2015-11-12 Thread Michael Drogalis
We're pleased to release Onyx version 0.8.0, which brings with it primitives for automatic state management, failure recovery, windowed computations, and triggers. Onyx is a scalable, distributed, fault tolerant, high performance data processing platform for handling batch and streaming workloa

Help with idiomatic clojure.

2015-11-12 Thread Brian Forester
I'm writing a very small REST application in clojure using compojure and ring. One problem is that I don't have anyone who can review my work or provide feedback. I've written a small function to validate a simple JSON request. I'm validating the three values that are in the post and colle

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Nicola Mometto
This is :rettag in action. Any reason why this error should be acceptable while the CLJ-1846 one isn't? > On 12 Nov 2015, at 12:55, Alex Miller wrote: > > That's not a valid type hint. Var meta is evaluated, in this case to the > double function object. You really want: > > (defn timespi ^doub

Re: Help with idiomatic clojure.

2015-11-12 Thread Colin Yates
A nicer equivalent form would be: (cond-> [] this-error? (conj “It failed with this error”) that-error? (conj “It failed with that error”)) However, purely for validation there are a few utilities out there already. Checkout the ‘Validation’ section on http://www.clojure-toolbox.com

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Nicola Mometto
Given the number of bytecode/type hinting issues we've seen caused by direct linking and the lack of real benchmarks demonstrating its benefits, I'm also wondering what's the rationale between including it in the current release. > On 10 Nov 2015, at 18:15, Ghadi Shayban wrote: > > Two points

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Renzo Borgatti
Thanks Alex, I’ve missed the wrong type hint in that line. Now 1.8 is even telling me! Cheers Renzo > On 12 Nov 2015, at 12:55, Alex Miller wrote: > > That's not a valid type hint. Var meta is evaluated, in this case to the > double function object. You really want: > > (defn timespi ^double

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Alex Miller
Neither is acceptable, so I either misunderstand or disagree with your question. :) The code below is an invalid type hint at that location. Are you maybe saying this should throw an error on definition? CLJ-1846 is instead a valid type hint that is in conflict with the call. Which now throws

Re: Help with idiomatic clojure.

2015-11-12 Thread Erik Assum
There is also https://github.com/logaan/vlad which helps with validation. Erik. -- i farta > Den 12. nov. 2015 kl. 17.12 skrev Colin Yates : > > A nicer equivalent form would be: > > (cond-> [] > this-error? (conj “It failed with this error”) > that-error? (conj “It failed with that erro

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Nicola Mometto
Depends on how you look at it. >From my point of view, both examples are using an otherwise valid type hint, >at an invalid location, and in both cases the emitted code is nonsensical. So I'd say that if the decision for the CLJ-1846 issue was to handle that with a compile time error, this one s

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Nicola Mometto
Also just like the CLJ-1846 issue, this bit of code was valid pre 1.8 > On 12 Nov 2015, at 19:14, Nicola Mometto wrote: > > > Depends on how you look at it. > From my point of view, both examples are using an otherwise valid type hint, > at an invalid location, and in both cases the emitted co

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Michael Blume
Sorry, I'm confused now -- is the appropriate place to give a return type hint for a function the arg list and not the function name? I've always seen the function name hinted. On Thu, Nov 12, 2015 at 11:20 AM Nicola Mometto wrote: > Also just like the CLJ-1846 issue, this bit of code was valid

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Nicola Mometto
It.. depends :( If your type hint is a *primitive* then you want to put it in the arglist. If you put it in the Var, the best case scenario is that you'll get either reflection warnings or boxed maths, and the worst case scenario is a Compiler/bytecode error. If your type hint is an array type

Re: Help with idiomatic clojure.

2015-11-12 Thread Brian
Thanks Colin, Thanks Erik Exactly what I was looking for. I've updated the gist with Colin's suggestion and a bit of destructuring. If this project gets any bigger I will definitely look at vlad and Prismatic Schema . BDF. On

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Leon Grapenthin
Does this mean putting it in the arglist always works and there is rarely a practical reason to do anything else? On Thursday, November 12, 2015 at 8:36:20 PM UTC+1, Nicola Mometto wrote: > > It.. depends :( > > If your type hint is a *primitive* then you want to put it in the arglist. > If you

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Nicola Mometto
*mostly* works, and since 1.8 only. The issue pre 1.8 is that since metadata on arglist is not evaluated, the type hint wasn't a fully qualified classname, forcing the user namespaces to import that Class. Scenarios like this would break: (ns foo (:import my.Klass)) (defn foo ^Klass [] (Klass.)

Re: [ANN] Clojure 1.8.0-RC1 is now available

2015-11-12 Thread Sean Corfield
Nicola Mometto wrote on Thursday, November 12, 2015 at 11:52 AM: *mostly* works, and since 1.8 only. The issue pre 1.8 is that since metadata on arglist is not evaluated, the type hint wasn't a fully qualified classname, forcing the user namespaces to import that Class. Scenarios like this would

Re: Help with idiomatic clojure.

2015-11-12 Thread Colin Yates
One other minor point (if (seq some-sequence) true false) is preferred by some (I won’t say more idiomatic) than (if (empty? some-sequence) true false). Also, in no-errors branch you probably want to return status: 200? > On 12 Nov 2015, at 19:44, Brian wrote: > > Thanks Colin, Thanks Erik >

Re: Help with idiomatic clojure.

2015-11-12 Thread Alex Baranosky
The main thing to note is to not use atoms for things like this. Colin's cond-> approach is a good idea. On Thu, Nov 12, 2015 at 4:08 PM, Colin Yates wrote: > One other minor point (if (seq some-sequence) true false) is preferred by > some (I won’t say more idiomatic) than (if (empty? some-seque

Re: Help with idiomatic clojure.

2015-11-12 Thread Chris Murphy
I think true and false should be swapped around, because seq and empty? are opposites, seq meaning it is not empty. On 13/11/2015 8:08 AM, Colin Yates wrote: One other minor point (if (seq some-sequence) true false) is preferred by some (I won’t say more idiomatic) than (if (empty? some-seque

[ANN] clj-fakes 0.3.0 - an isolation framework for Clojure and ClojureScript

2015-11-12 Thread Yuri Govorushchenko
Hi! This is the first public release of my lib for mocking and stubbing in unit tests, I would greatly appreciate any feedback. GitHub: https://github.com/metametadata/clj-fakes Documentation: http://metametadata.github.io/clj-fakes/ *Features* - All test doubles are named "fakes" to simp

Re: JDBC Rollbacks and Exceptions

2015-11-12 Thread Andy Chambers
On Friday, October 30, 2015 at 5:22:40 PM UTC-7, Sean Corfield wrote: > > Could you provide a bit more context? > > We’re using clojure.java.jdbc very heavily in production and we don’t see > any problems with exceptions. > Hi Sean, I threw up an example repo demonstrating the type of test I'd l

Re: JDBC Rollbacks and Exceptions

2015-11-12 Thread Andrey Antukh
If I understand it properly, this is a expected behavior in most databases. The common way for solve this, is wrapping the expected to fail code in a sub-transaction (or savepoint in database words). If that code fails, the sub-transaction will be aborted, but the main transaction will continue to