Re: ANN: Onyx Dashboard 0.5.2.1

2015-02-19 Thread Colin Yates
Thanks Mike

On 18 February 2015 at 22:44, Michael Drogalis  wrote:
> Hi Colin,
>
> This is well supported within Onyx, and has seen recent progress
> (http://yuppiechef.github.io/cqrs-server/)
> The examples should give you a good indication if it's a fit for your
> problem (https://github.com/MichaelDrogalis/onyx-examples).
>
> We hang out in Gitter if you have any questions:
> https://gitter.im/MichaelDrogalis/onyx
>
> -- Mike
>
> On Wednesday, February 18, 2015 at 10:22:07 AM UTC-8, Colin Yates wrote:
>>
>> Hi Lucas,
>>
>> This looks great - thanks.
>>
>> [off topic]
>> I don't know much about Onyx but I am just about to start committing
>> code for server app which is going to use a CQRS design. It doesn't
>> need to be internet scale at all, will be a single machine, and spend
>> all of its time taking a command, executing it, persisting the events
>> which a number of views will then respond to. It is all very trivial
>> stuff. Would Onyx be a good fit here?
>>
>> It looks pretty lightweight and I was jumping for joy as I was reading
>> the "persistent data over API" and general design rationale, so my 30
>> second investigation says yes, but what do you think?
>>
>> Thanks,
>>
>> Colin
>> [/off topic]
>>
>> On 18 February 2015 at 18:12, Lucas Bradstreet
>>  wrote:
>> > Onyx is a batch/stream processing hybrid, written in Clojure, for
>> > Clojure. https://github.com/MichaelDrogalis/onyx
>> >
>> > Today I released a dashboard for Onyx, that leverages Onyx's
>> > information model to provide some nifty monitoring and job management
>> > features. You can read about its use of its information model, and
>> > view some nice screen shots at
>> >
>> > http://lbradstreet.github.io/clojure/onyx/distributed-systems/2015/02/18/onyx-dashboard.html.
>> >
>> > You can find the code and uberjar release at
>> > https://github.com/lbradstreet/onyx-dashboard.
>> >
>> > Cheers
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clo...@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> > your first post.
>> > To unsubscribe from this group, send email to
>> > clojure+u...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to clojure+u...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Michael Griffiths
Clojure and Clojure contrib libraries are uploaded to Sonatype when 
released. e.g. 
https://oss.sonatype.org/content/groups/public/org/clojure/data.int-map/
 
There should be both a jar with sources and jar without sources for each 
released version of each lib.
 
Michael

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Cecil Westerhof
2015-02-19 11:58 GMT+01:00 Michael Griffiths :

> Clojure and Clojure contrib libraries are uploaded to Sonatype when
> released. e.g.
> https://oss.sonatype.org/content/groups/public/org/clojure/data.int-map/
>
> There should be both a jar with sources and jar without sources for each
> released version of each lib.
>

​Thanks. I think information like this should be easier to find. I like
Clojure, but sometimes it is difficult to find things.

>
-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using type to change the behaviour of a function

2015-02-19 Thread Cecil Westerhof
I have the following function:
(defn lucky-numbers
  "Lucky numbers from 1 up-to upto-value.
  1 <= upto-value <= 10.000.000
  http://en.wikipedia.org/wiki/Lucky_number";
  ; doc-string and pre-condition should match
  [upto]
  {:pre [(>= upto 1)
 (<= upto (* 10 1000 1000))]}
  (if (< upto 3)
  ; for 1 and 2 the algorithm does not work, so return value
manually
  (list 1)
(loop [coll (range 1 (inc upto) 2), survivor-idx 1]
  (let [i (nth coll survivor-idx)]
(if (> (count coll) i)
(recur (drop-every-nth coll i) (inc survivor-idx))
  coll)

​In this function I limit the maximum value that ​can be given to the
function. But this is pure for performance reasons. So I would like to have
the possibility to disable it. I read somewhere that you can use types for
this. Sadly I do not remember where.

At the moment the following:
(lucky-numbers 1001)
gives:
AssertionError Assert failed: (<= upto (* 10 1000 1000))
user/lucky-numbers

But I would like the following to be executed:
(lucky-numbers :no-max-check 1001)

​How would I implement that?

-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


core.async why 42 extra threads?

2015-02-19 Thread Robin Heggelund Hansen
>From the source of core.async, I see that it is started with a threadpool 
of *2 + 42.

I can understand the number of processors * 2 part, erlang does the same 
thing. But Hitchicker's references aside, why add 42 to this? Won't that 
many threads do more harm than good, in terms of overhead related to 
context switching?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Side Effects and compiler optimzation

2015-02-19 Thread Ashish Negi
I tried to find old threads for my question but could not find any suitable 
answer.

My question is that unlike haskell, which separates I/O side effect code 
from pure code, and hence can easily do other optimizations
like auto-caching results, out of flow execution etc, what is the clojure 
way of doing these optimizations ?

I ponder over that since one can call side-effecting-functions any where in 
clojure code, How is it possible to do all those optimizations that we talk 
about in case of FP ?

Thanks

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Generalisation of pre-conditions

2015-02-19 Thread Cecil Westerhof
I have two different functions for the same functionality. I would like to
share the pre-conditions between them.

The general function is:
(defn test-lucky-numbers-general
  "Performance test of lucky numbers general"
  [fn desc nr]
  {:pre [(>= nr 1)
 (<= nr 7)]}
  (println desc)
  (dotimes [i 25]
(let [lucky (time (fn 10))]))
  (println)
  (dotimes [i nr]
(time
  (let [upto (int (Math/pow 10 (inc i)))]
(printf "With upto %d there are %d lucky numbers\n" upto (count
(fn upto)
(println)))


The functions themselves are:
​(defn test-lucky-numbers
  "Performance test of lucky numbers"
  ([]
   (test-lucky-numbers 6))
  ([nr]
   (test-lucky-numbers-general lucky-numbers "Testing performance
lucky-numbers" nr)))
and:
(defn test-lucky-numbers-3
  "Performance test of lucky numbers (3)"
  ([]
   (test-lucky-numbers-3 6))
  ([nr]
   (test-lucky-numbers-general lucky-numbers-3 "Testing performance
lucky-numbers-3" nr)))
​

And to call all test functions I have:
(defn test-lucky-numbers-all
  "Test all lucky number performance"
  ([]
   (test-lucky-numbers-all 6))
  ([nr]
   (test-lucky-numbers nr)
   (test-lucky-numbers-3 nr)))


When I call a function with the wrong parameter, I get an error from
test-lucky-numbers-general, but I need it from the calling function. I
could copy the pre-condition to all functions, but that is not really DRY.
Is there a way I can share the pre-conditions with all (at this moment)
four functions?


The first dotimes in test-lucky-numbers-general is to warm-up the JVM. Is
there a way to know if this is already done for the function that is given?
Then it could be done only when necessary.

-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] clean-blog @ modularity.org

2015-02-19 Thread danle...@gmail.com
I enjoy your blog.  It's like my morning cup of British.  It really takes 
the biscuit.  :)

Best,
Dan

On Wednesday, February 18, 2015 at 9:28:57 PM UTC-5, Malcolm Sparks wrote:
>
> I've added a blog-site template called 'clean-blog' to the collection at 
> http://modularity.org - documented here: 
> http://modularity.org/templates/clean-blog.html
>
> clean-blog is intended as a live site, rather than a static site generator 
> like Cryogen: https://github.com/cryogen-project/cryogen , although it 
> does have a site-generation option via lein gen.
>
> It could be that you want to add a blog section to an existing website, 
> and clean-blog provides those modules.
>
> But mostly it's another demonstration of a working project using Stuart 
> Sierra's component library, showing how to compose applications from 
> components, bespoke and pre-existing ones.
>
> If you want to build your own blog-site in Clojure, and have ideas for 
> custom features you might want to add, clean-blog might give you the 
> jump-start you need.
>
> You can see an example of clean-blog (which I'm using to run my own blog) 
> at http://malcolmsparks.com
>
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with Liberator POST route

2015-02-19 Thread Jonathan Barber
On 18 February 2015 at 22:35, gvim  wrote:

> On 18/02/2015 15:32, Andy- wrote:
>
>> Without having tested it: I think you're "curl -d" format is wrong. It's
>> not semicolon separated:
>> http://superuser.com/questions/149329/what-is-the-
>> curl-command-line-syntax-to-do-a-post-request
>>
>> HTH
>>
>>
> That solved the curl data submission problem but I'm still getting errors
> and suspect the POST defroute isn't correct. 'Trouble all the examples of
> :post submissions in the docs are mixed up with other factors so it's
> difficult to isolate the correct information.


Replace "min" with "minute" in the route (or change "minute" in the curl
POST to "min"). Because the field names don't agree, the compojure
destructing doesn't match and you end up trying to parseInt nil.

Cheers


>
> gvim
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jonathan Barber 

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async why 42 extra threads?

2015-02-19 Thread Timothy Baldridge
The  number of threads is meant to be semi-tolerant to usage of blocking IO
in go blocks. You can't be certain that some go block won't call a function
that calls a function in some library that blocks for just a few
milliseconds. So we tried to make it high enough to be tolerant of mis-use,
but low enough to be bounded somewhat.

So yes, the number + 42 is arbitrary (and somewhat of a joke) but the fact
that it's more than 2 * CPUs is intentional.

Timothy

On Thu, Feb 19, 2015 at 5:02 AM, Robin Heggelund Hansen <
skinney...@gmail.com> wrote:

> From the source of core.async, I see that it is started with a threadpool
> of *2 + 42.
>
> I can understand the number of processors * 2 part, erlang does the same
> thing. But Hitchicker's references aside, why add 42 to this? Won't that
> many threads do more harm than good, in terms of overhead related to
> context switching?
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generalisation of pre-conditions

2015-02-19 Thread Justin Smith
People complain about stack traces, but precisely the point of having stack 
traces is that if a pre-condition fails, you don't look at the function 
with the pre-condition, you look at the function that was calling it. 
Duplicating pre-conditions to callers, as a general pattern, would scale 
very badly.

On Thursday, February 19, 2015 at 4:35:54 AM UTC-8, Cecil Westerhof wrote:
>
> I have two different functions for the same functionality. I would like to 
> share the pre-conditions between them.
>
> The general function is:
> (defn test-lucky-numbers-general
>   "Performance test of lucky numbers general"
>   [fn desc nr]
>   {:pre [(>= nr 1)
>  (<= nr 7)]}
>   (println desc)
>   (dotimes [i 25]
> (let [lucky (time (fn 10))]))
>   (println)
>   (dotimes [i nr]
> (time
>   (let [upto (int (Math/pow 10 (inc i)))]
> (printf "With upto %d there are %d lucky numbers\n" upto 
> (count (fn upto)
> (println)))
>
>
> The functions themselves are:
> ​(defn test-lucky-numbers
>   "Performance test of lucky numbers"
>   ([]
>(test-lucky-numbers 6))
>   ([nr]
>(test-lucky-numbers-general lucky-numbers "Testing performance 
> lucky-numbers" nr)))
> and:
> (defn test-lucky-numbers-3
>   "Performance test of lucky numbers (3)"
>   ([]
>(test-lucky-numbers-3 6))
>   ([nr]
>(test-lucky-numbers-general lucky-numbers-3 "Testing performance 
> lucky-numbers-3" nr)))
> ​
>
> And to call all test functions I have:
> (defn test-lucky-numbers-all
>   "Test all lucky number performance"
>   ([]
>(test-lucky-numbers-all 6))
>   ([nr]
>(test-lucky-numbers nr)
>(test-lucky-numbers-3 nr)))
>
>
> When I call a function with the wrong parameter, I get an error from 
> test-lucky-numbers-general, but I need it from the calling function. I 
> could copy the pre-condition to all functions, but that is not really DRY. 
> Is there a way I can share the pre-conditions with all (at this moment) 
> four functions?
>
>
> The first dotimes in test-lucky-numbers-general is to warm-up the JVM. Is 
> there a way to know if this is already done for the function that is given? 
> Then it could be done only when necessary.
>
> -- 
> Cecil Westerhof
>  

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async why 42 extra threads?

2015-02-19 Thread Robin Heggelund Hansen
 Ahh ok, makes sense :)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Side Effects and compiler optimzation

2015-02-19 Thread Timothy Baldridge
In short, it doesn't. And I think the fact that Clojure is as fast as it is
is testament to how little of an impact many of these optimizations have.

But also, don't assume that Clojure doesn't get many of these optimizations
for free from the JVM. Auto-caching is a weird one,  I think most people
just don't compute the same thing twice. But out-of-order execution is an
optimization performed by both the JVM and x86 CPUs. If a given line of
code doesn't call a native (non-JVM) function and if a given bit of code
doesn't depend on another bit of code, those two bits may be reordered or
executed in a different way. And modern CPUs may actually execute those
bits in parallel if given conditions are met.

So it's true, the Clojure compiler isn't that sophisticated, but combined
with the JVM it's optimizations are actually quite powerful.

Timothy

On Thu, Feb 19, 2015 at 5:11 AM, Ashish Negi 
wrote:

> I tried to find old threads for my question but could not find any
> suitable answer.
>
> My question is that unlike haskell, which separates I/O side effect code
> from pure code, and hence can easily do other optimizations
> like auto-caching results, out of flow execution etc, what is the clojure
> way of doing these optimizations ?
>
> I ponder over that since one can call side-effecting-functions any where
> in clojure code, How is it possible to do all those optimizations that we
> talk
> about in case of FP ?
>
> Thanks
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using type to change the behaviour of a function

2015-02-19 Thread Justin Smith
one approach would be a multi-method for the condition check that doesn't 
enforce the limit on BigInt

user=> (defmulti lucky-numbers-limit type)
#'user/lucky-numbers-limit
user=> (defmethod lucky-numbers-limit :default [n] (< 0 n 1001))
#
user=> (defmethod lucky-numbers-limit clojure.lang.BigInt [n] true)
#
user=> (lucky-numbers-limit 2)
false
user=> (lucky-numbers-limit 2)
true
user=> (lucky-numbers-limit 2N)
true




On Thursday, February 19, 2015 at 3:52:38 AM UTC-8, Cecil Westerhof wrote:
>
> I have the following function:
> (defn lucky-numbers
>   "Lucky numbers from 1 up-to upto-value.
>   1 <= upto-value <= 10.000.000
>   http://en.wikipedia.org/wiki/Lucky_number";
>   ; doc-string and pre-condition should match
>   [upto]
>   {:pre [(>= upto 1)
>  (<= upto (* 10 1000 1000))]}
>   (if (< upto 3)
>   ; for 1 and 2 the algorithm does not work, so return value 
> manually
>   (list 1)
> (loop [coll (range 1 (inc upto) 2), survivor-idx 1]
>   (let [i (nth coll survivor-idx)]
> (if (> (count coll) i)
> (recur (drop-every-nth coll i) (inc survivor-idx))
>   coll)
>
> ​In this function I limit the maximum value that ​can be given to the 
> function. But this is pure for performance reasons. So I would like to have 
> the possibility to disable it. I read somewhere that you can use types for 
> this. Sadly I do not remember where.
>
> At the moment the following:
> (lucky-numbers 1001)
> gives:
> AssertionError Assert failed: (<= upto (* 10 1000 1000))  
> user/lucky-numbers
>
> But I would like the following to be executed:
> (lucky-numbers :no-max-check 1001)
>
> ​How would I implement that?
>
> -- 
> Cecil Westerhof
>  

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] clj-uuid: thread-safe, performant unique identifiers

2015-02-19 Thread Avi Avicenna
Thank you for providing sequential UUID. Looking forward to uuid library 
that provides squuid.

Yours,
Avicenna

On Tuesday, 17 February 2015 08:25:17 UTC+7, danl...@gmail.com wrote:
>
> Hello Clojurians,
>
> I've just been polishing my modest library, clj-uuid <
> http://danlentz.github.io/clj-uuid/> and would like to invite everyone to 
> have a look if such a thing might be of interest. 
>
> What is it?
>
> clj-uuid is a Clojure library for generation and utilization of UUIDs 
> (Universally Unique Identifiers) as described by RFC-4122. This library 
> extends the standard Java UUID class to provide true v1 (time based) and 
> v3/v5 (namespace based) identifier generation. Additionally, a number of 
> useful supporting utilities are provided to support serialization and 
> manipulation of these UUIDs in a simple, efficient manner.
>
> Why is it useful?
>
> The JVM UUID class only provides a constructor for random (v4) and 
> (non-namespaced) pseudo-v3 UUID's. Where appropriate, this library does use 
> the internal JVM UUID implementation. The benefit with this library is that 
> clj-uuid provides an easy way to get v1 and true namespaced v3 and v5 
> UUIDs.  v1 UUIDs are really useful because they can be generated faster 
> than v4's as they don't need to call a cryptographic random number 
> generator.  v5 UUID's are necessary because many of the interesting 
> things that you can do with UUID's require namespaced identifiers.
> http://danlentz.github.io/clj-uuid/
> http://github.com/danlentz/clj-uuid/
>
>
> Best,
> Dan Lentz
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using type to change the behaviour of a function

2015-02-19 Thread Tassilo Horn
Cecil Westerhof  writes:

Hi!

> At the moment the following:
> (lucky-numbers 1001)
> gives:
> AssertionError Assert failed: (<= upto (* 10 1000 1000)) user/lucky-numbers
>
> But I would like the following to be executed:
> (lucky-numbers :no-max-check 1001)
>
> ​How would I implement that?

Just make an optional argument, e.g.,

(defn lucky-numbers
 ([upto]
  (lucky-numbers false upto))
 ([no-max-check upto]
  {:pre [(if no-max-check true (<= upto (* 10 1000 1000)))]}
  ;; code as before
  ))

Bye,
Tassilo

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generalisation of pre-conditions

2015-02-19 Thread Cecil Westerhof
2015-02-19 15:11 GMT+01:00 Justin Smith :

> People complain about stack traces, but precisely the point of having
> stack traces is that if a pre-condition fails, you don't look at the
> function with the pre-condition, you look at the function that was calling
> it. Duplicating pre-conditions to callers, as a general pattern, would
> scale very badly.
>

​I found the stack-trace functions. I should get an end with those. And
of-course: exceptions should not happen often.​


-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with Liberator POST route

2015-02-19 Thread gvim

On 19/02/2015 12:56, Jonathan Barber wrote:


Replace "min" with "minute" in the route (or change "minute" in the curl
POST to "min"). Because the field names don't agree, the compojure
destructing doesn't match and you end up trying to parseInt nil.

Cheers



Thanks for spotting that one :). Still not there, though. Now getting 
simply "Method not allowed".


gvim

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: datomic <-> datascript transfers

2015-02-19 Thread Dave Dixon
We're having success with the Datomic <-> Datascript scenario by treating 
the Datascript DB as an immutable value, rather than a ref + transactor, at 
least in the case for user's interactively changing data. When the user 
loads the data required for a scenario (e.g. editing an entity), we hold 
the value as obtained from datomic and the updated value used by applying 
user changes through the with or with-db functions. When the user chooses 
to commit, we essentially diff the sets of datoms between the original and 
changed Datascript values (twice - once to get adds and once for retracts), 
as well as identify the Datascript id's of added entities. On the server, 
the new Datascript id's are converted into Datomic temp id's, and we just 
transact the transformed diff. 

There are some differences in behavior which need to be worked around, 
particularly the behavior of :db/ident. We strictly use :db/ident only for 
attribute names and enums. This allows us to do the appropriate 
transformations to the data and pull patterns so that the differences 
between Datascript and Datomic are more or less hidden.

Works very well for editing hierarchical entities. The parent can simply 
pass it's Datascript value and the appropriate child id to the child 
editor. If the user commits the child changes, the parent simply takes the 
updated value of the db; if the user cancels, the parent doesn't need to do 
anything, as it is already holding the unchanged value.

On Tuesday, February 17, 2015 at 2:00:03 AM UTC-8, henry w wrote:
>
> For anyone else looking at this option, here is some code which is doing 
> the work on the cljs side.
>
> https://gist.github.com/henryw-erudine/73cbcdea1eda150e78da
>
> The server code is straightforward so not included. 
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Alex Miller
The first line of the readme for the project 
(https://github.com/clojure/data.int-map) has the Leiningen jar dependency 
info on it:

[org.clojure/data.int-map "0.1.0"]

Also, the 'mvn package' command should have worked since that's how 
releases get built. That was a bug in the pom dependencies and I have 
updated it to match the version in project.clj.




On Thursday, February 19, 2015 at 5:39:22 AM UTC-6, Cecil Westerhof wrote:
>
> 2015-02-19 11:58 GMT+01:00 Michael Griffiths  >:
>
>> Clojure and Clojure contrib libraries are uploaded to Sonatype when 
>> released. e.g. 
>> https://oss.sonatype.org/content/groups/public/org/clojure/data.int-map/
>>  
>> There should be both a jar with sources and jar without sources for each 
>> released version of each lib.
>>
>  
> ​Thanks. I think information like this should be easier to find. I like 
> Clojure, but sometimes it is difficult to find things.
>
>>
> -- 
> Cecil Westerhof
>  

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Sam Raker
@Cecil: while it's a little irritating that there's not more centralization 
of third-party Clojure libs, I've found that Leiningen + some googling 
solves the problem like 99% of the time.

On Thursday, February 19, 2015 at 10:42:43 AM UTC-5, Alex Miller wrote:
>
> The first line of the readme for the project (
> https://github.com/clojure/data.int-map) has the Leiningen jar dependency 
> info on it:
>
> [org.clojure/data.int-map "0.1.0"]
>
> Also, the 'mvn package' command should have worked since that's how 
> releases get built. That was a bug in the pom dependencies and I have 
> updated it to match the version in project.clj.
>
>
>
>
> On Thursday, February 19, 2015 at 5:39:22 AM UTC-6, Cecil Westerhof wrote:
>>
>> 2015-02-19 11:58 GMT+01:00 Michael Griffiths :
>>
>>> Clojure and Clojure contrib libraries are uploaded to Sonatype when 
>>> released. e.g. 
>>> https://oss.sonatype.org/content/groups/public/org/clojure/data.int-map/
>>>  
>>> There should be both a jar with sources and jar without sources for each 
>>> released version of each lib.
>>>
>>  
>> ​Thanks. I think information like this should be easier to find. I like 
>> Clojure, but sometimes it is difficult to find things.
>>
>>>
>> -- 
>> Cecil Westerhof
>>  
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Cecil Westerhof
2015-02-19 16:42 GMT+01:00 Alex Miller :

> The first line of the readme for the project (
> https://github.com/clojure/data.int-map) has the Leiningen jar dependency
> info on it:
>
> [org.clojure/data.int-map "0.1.0"]
>

​But if you do not know that this is mend for Leiningen …

Just adding: You can build with 'mvn package' or 'lein jar' would help a
lot.
​



> Also, the 'mvn package' command should have worked since that's how
> releases get built. That was a bug in the pom dependencies and I have
> updated it to match the version in project.clj.
>

​That works now.

By the way the jar build with Maven differs from the jar build with
Leiningen.​




> On Thursday, February 19, 2015 at 5:39:22 AM UTC-6, Cecil Westerhof wrote:
>>
>> 2015-02-19 11:58 GMT+01:00 Michael Griffiths :
>>
>>> Clojure and Clojure contrib libraries are uploaded to Sonatype when
>>> released. e.g. https://oss.sonatype.org/content/groups/public/org/
>>> clojure/data.int-map/
>>>
>>> There should be both a jar with sources and jar without sources for each
>>> released version of each lib.
>>>
>>
>> ​Thanks. I think information like this should be easier to find. I like
>> Clojure, but sometimes it is difficult to find things.
>>
>
-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Cecil Westerhof
2015-02-19 17:00 GMT+01:00 Sam Raker :

> @Cecil: while it's a little irritating that there's not more
> centralization of third-party Clojure libs, I've found that Leiningen +
> some googling solves the problem like 99% of the time.
>

​I did come quit an end with Google, but then I was bitten by a broken pom
file.
I think I like Leiningen better as Maven, so I should invest some time in
Leiningen.
​With Google I only found build information about Maven, not about
Leiningen. But I am enlightened now. :-D
​


> On Thursday, February 19, 2015 at 10:42:43 AM UTC-5, Alex Miller wrote:
>>
>> The first line of the readme for the project (https://github.com/clojure/
>> data.int-map) has the Leiningen jar dependency info on it:
>>
>> [org.clojure/data.int-map "0.1.0"]
>>
>> Also, the 'mvn package' command should have worked since that's how
>> releases get built. That was a bug in the pom dependencies and I have
>> updated it to match the version in project.clj.
>>
>>
>>
>>
>> On Thursday, February 19, 2015 at 5:39:22 AM UTC-6, Cecil Westerhof wrote:
>>>
>>> 2015-02-19 11:58 GMT+01:00 Michael Griffiths :
>>>
 Clojure and Clojure contrib libraries are uploaded to Sonatype when
 released. e.g. https://oss.sonatype.org/content/groups/public/org/
 clojure/data.int-map/

 There should be both a jar with sources and jar without sources for
 each released version of each lib.

>>>
>>> ​Thanks. I think information like this should be easier to find. I like
>>> Clojure, but sometimes it is difficult to find things.
>>>
>>
-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with Liberator POST route

2015-02-19 Thread Sam Ritchie

Try adding

:allowed-methods [:get :post]

to your resource.

You'll want to use "ANY" for all liberator routes, since they manage the 
responses for incorrect content types internally. If you specify GET or 
POST, it's up to you to return the proper responses if the methods 
aren't supported (since Compojure will return nil and try to match 
further down your list of routes.



gvim 
February 19, 2015 at 8:48 AM


Thanks for spotting that one :). Still not there, though. Now getting 
simply "Method not allowed".


gvim

Jonathan Barber 
February 19, 2015 at 5:56 AM
On 18 February 2015 at 22:35, gvim > wrote:


On 18/02/2015 15:32, Andy- wrote:

Without having tested it: I think you're "curl -d" format is
wrong. It's
not semicolon separated:

http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request

HTH


That solved the curl data submission problem but I'm still getting
errors and suspect the POST defroute isn't correct. 'Trouble all
the examples of :post submissions in the docs are mixed up with
other factors so it's difficult to isolate the correct information.


Replace "min" with "minute" in the route (or change "minute" in the 
curl POST to "min"). Because the field names don't agree, the 
compojure destructing doesn't match and you end up trying to parseInt nil.


Cheers



gvim

-- 
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 to
clojure+unsubscr...@googlegroups.com

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the
Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.




--
Jonathan Barber >

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.
gvim 
February 18, 2015 at 3:35 PM


That solved the curl data submission problem but I'm still getting 
errors and suspect the POST defroute isn't correct. 'Trouble all the 
examples of :post submissions in the docs are mixed up with other 
factors so it's difficult to isolate the correct information.


gvim

Andy- 
February 18, 2015 at 8:32 AM
Without having tested it: I think you're "curl -d" format is wrong. 
It's not semicolon separated:

http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request

HTH

On Wednesday, February 18, 2015 at 7:09:19 AM UTC-5, g vim wrote:
--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.
gvim 
February 18, 2015 at 5:07 AM
I have a Liberator app which works with this:

(defresource user [day month year hour min region location]
  :available-media-types ["application/json"]
  :handle-ok (generate-string (clc/calc day month year hour min 0 (str 
region "/" location


(defroutes app-routes
  (GET "/user/:day/:month/:year/:hour/:min/:region/:location" [day 
mon

Re: Help with Liberator POST route

2015-02-19 Thread gvim

On 19/02/2015 16:20, Sam Ritchie wrote:

Try adding

:allowed-methods [:get :post]

to your resource.

You'll want to use "ANY" for all liberator routes, since they manage the
responses for incorrect content types internally. If you specify GET or
POST, it's up to you to return the proper responses if the methods
aren't supported (since Compojure will return nil and try to match
further down your list of routes.



OK, will use ANY. Still puzzled, though, as to why "Method not allowed" 
was returned when I clearly specifed POST.


gvim

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create jar for data.int-map

2015-02-19 Thread Sam Raker
I guess by "google" I really meant "using google to search github." AFAICT,
there's 0 reason to opt for anything other than Leiningen when given the
choice. It makes things astonishingly easy, and nearly every
more-than-alpha library has lein dependency info right up near the top. If
they don't, clojars or maven should have it.

On Thu, Feb 19, 2015 at 11:19 AM, Cecil Westerhof 
wrote:

>
>
> 2015-02-19 17:00 GMT+01:00 Sam Raker :
>
>> @Cecil: while it's a little irritating that there's not more
>> centralization of third-party Clojure libs, I've found that Leiningen +
>> some googling solves the problem like 99% of the time.
>>
>
> ​I did come quit an end with Google, but then I was bitten by a broken pom
> file.
> I think I like Leiningen better as Maven, so I should invest some time in
> Leiningen.
> ​With Google I only found build information about Maven, not about
> Leiningen. But I am enlightened now. :-D
> ​
>
>
>> On Thursday, February 19, 2015 at 10:42:43 AM UTC-5, Alex Miller wrote:
>>>
>>> The first line of the readme for the project (
>>> https://github.com/clojure/data.int-map) has the Leiningen jar
>>> dependency info on it:
>>>
>>> [org.clojure/data.int-map "0.1.0"]
>>>
>>> Also, the 'mvn package' command should have worked since that's how
>>> releases get built. That was a bug in the pom dependencies and I have
>>> updated it to match the version in project.clj.
>>>
>>>
>>>
>>>
>>> On Thursday, February 19, 2015 at 5:39:22 AM UTC-6, Cecil Westerhof
>>> wrote:

 2015-02-19 11:58 GMT+01:00 Michael Griffiths :

> Clojure and Clojure contrib libraries are uploaded to Sonatype when
> released. e.g. https://oss.sonatype.org/content/groups/public/org/
> clojure/data.int-map/
>
> There should be both a jar with sources and jar without sources for
> each released version of each lib.
>

 ​Thanks. I think information like this should be easier to find. I like
 Clojure, but sometimes it is difficult to find things.

>>>
> --
> Cecil Westerhof
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/cDNGgpTeAcc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async: "Deprecated - this function will be removed. Use transducer instead"

2015-02-19 Thread Ben Smith-Mannschott
I'm unclear on one thing: what's the purpose of core.async/pipe? In your
blog article, you write:

(-> source (pipe (chan)) payload-decoder payload-json-decoder)

(pipe source destination) just copies elements from source to destination.
How is that any different than just using source here directly?:

(-> source payload-decoder payload-json-decoder)

What have I missed?

// Ben

On Thu, Feb 19, 2015 at 3:06 AM, Malcolm Sparks  wrote:

> I have recently written a blog article which explains how to use
> transducers with core.async.
>
> You can find it here: http://malcolmsparks.com/posts/transducers.html
>
>
> On Wednesday, 18 February 2015 21:48:05 UTC, bsmith.occs wrote:
>>
>> I'm probably just especially dense today, but perhaps someone can give me
>> a poke in the right direction.
>>
>> I'm trying to wrap my head around transducers.
>>
>> (1) For debugging purposes I'd like to be able to consume the values on a
>> channel and put them in a collection to be printed.
>>
>> I'm doing this at the REPL:
>>
>> (async/>
>> This seems needlessly clunky. Is this really the best way to accomplish
>> this?
>>
>> (2) async/map> is deprecated, what's the alternative, exactly?
>>
>> (let [ch (async/to-chan [1 2 3])]
>>   (async/map> inc ch))
>>
>> AFAICT this would produce a channel, which when consumed would yield the
>> values 2 3 4, correct?
>>
>> Now I suppose if I didn't already have the channel ch, I could create one
>> with an associated transformation function, and then stuff the values 1 2 3
>> into it somehow, right?
>>
>> (let [ch (async/chan nil (map inc))]
>>   (async/onto-chan ch [1 2 3])
>>   ch)
>> ;; returns a channel yielding items 2, 3, 4
>>
>> But, I'm not clear at all how I can apply the operation (inc) to the all
>> values yielded by a channel I already have in my hand.
>>
>> Any help would be appreciated. I feel like I'm missing some critical bit
>> of insight and that async and transducers might just fall into place for me
>> if I could only find out what that bit is.
>>
>> // Ben
>>
>  --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] Introducing pulley.cps

2015-02-19 Thread Nathan Davis


Dear Fellow Clojurians, 

I'm pleased to annouce release 0.1.0 of pulley.cps, a tool for transforming 
Clojure code into Continuation-Passing-Style. You can find it at 
http://github.com/positronic-solutions/pulley.cps. 

While this is not the first attempt at such a tool, to the best of my 
knowledge it is the most complete to date. The rather lengthy Readme (which 
for now also doubles as User Guide, API Documentation, and design document) 
goes into more detail, but here's a quick run-down of features: 

   - Two macros, cps and cps-fn, serve as primary entry points for 
   transforming code. 
   - Transformed code can call native code (non-transformed functions and 
   Java methods) and vice versa. 
   - Due to the nature of CPS, we get tail-call optimization for free 
   (i.e., all tail-calls within transformed code are naturally TCO'd). Of 
   course, calls from CPS to native code still consume Java stack space, and 
   non-tail calls within transformed code will consume *heap* space. 
   - Dynamic bindings are fully supported, and do not interfere with TCO (
   binding is fully tail-call optimizable). set! is not currently implement 
   for dynamic vars, but due to some recent changes to the way dynamic 
   environments are implemented should be trivial to support. 
   - Since with CPS we explicitly pass the continuation around, it is easy 
   to expose the current continuation to the user. This is accomplished via 
   the function call-cc and its macro analog let-cc. 
   - Exceptions are not currently implemented. However, they are actively 
   being worked on. The expectation here is that exceptions will work pretty 
   much seamlessly with native exceptions, and you will be able to use the 
   same forms (throw, try, catch, finally) as you would in regular Clojure 
   code. 
   - The ability to override native functions with a CPS implementation, in 
   order to provide an optimal experience. For example, clojure.core/apply 
   is overridden to provide an optimized implementation when invoked from CPS 
   code. So if you call apply with a CPS function, continuations, TCO, etc. 
   will still work. 

 Overall, the goal is to be able to automatically transform as much 
"regular clojure code" into CPS while maintaining seamless interoperation 
with "native" Clojure code. The one area I don't think we'll manage to do a 
satisfactory job on are forms that create Java types (reify, deftype, 
genclass, etc.). These forms are currently completely unsupported, and any 
potential future support will most likely consist of simply escaping the 
transformation process when these forms are encountered. Other than that, 
once exception support is completed, I think this goal will be within 
reach. 

Near-term development goals are first to implement exceptions. Then I'd 
like to explore expanding platform support beyond the JVM, namely 
ClojureCLR and ClojureScript. 

Anyway, feel free to give things a try. I greatly treasure your feedback, 
including bug reports and if you have trouble navigating the documentation. 

Have fun, 

Nathan Davis 

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async: "Deprecated - this function will be removed. Use transducer instead"

2015-02-19 Thread Malcolm Sparks
You're right - thanks for that! I've updated the blog article to remove it.

On 19 February 2015 at 17:37, Ben Smith-Mannschott 
wrote:

> I'm unclear on one thing: what's the purpose of core.async/pipe? In your
> blog article, you write:
>
> (-> source (pipe (chan)) payload-decoder payload-json-decoder)
>
> (pipe source destination) just copies elements from source to destination.
> How is that any different than just using source here directly?:
>
> (-> source payload-decoder payload-json-decoder)
>
> What have I missed?
>
> // Ben
>
> On Thu, Feb 19, 2015 at 3:06 AM, Malcolm Sparks  wrote:
>
>> I have recently written a blog article which explains how to use
>> transducers with core.async.
>>
>> You can find it here: http://malcolmsparks.com/posts/transducers.html
>>
>>
>> On Wednesday, 18 February 2015 21:48:05 UTC, bsmith.occs wrote:
>>>
>>> I'm probably just especially dense today, but perhaps someone can give
>>> me a poke in the right direction.
>>>
>>> I'm trying to wrap my head around transducers.
>>>
>>> (1) For debugging purposes I'd like to be able to consume the values on
>>> a channel and put them in a collection to be printed.
>>>
>>> I'm doing this at the REPL:
>>>
>>> (async/>>
>>> This seems needlessly clunky. Is this really the best way to accomplish
>>> this?
>>>
>>> (2) async/map> is deprecated, what's the alternative, exactly?
>>>
>>> (let [ch (async/to-chan [1 2 3])]
>>>   (async/map> inc ch))
>>>
>>> AFAICT this would produce a channel, which when consumed would yield the
>>> values 2 3 4, correct?
>>>
>>> Now I suppose if I didn't already have the channel ch, I could create
>>> one with an associated transformation function, and then stuff the values 1
>>> 2 3 into it somehow, right?
>>>
>>> (let [ch (async/chan nil (map inc))]
>>>   (async/onto-chan ch [1 2 3])
>>>   ch)
>>> ;; returns a channel yielding items 2, 3, 4
>>>
>>> But, I'm not clear at all how I can apply the operation (inc) to the all
>>> values yielded by a channel I already have in my hand.
>>>
>>> Any help would be appreciated. I feel like I'm missing some critical bit
>>> of insight and that async and transducers might just fall into place for me
>>> if I could only find out what that bit is.
>>>
>>> // Ben
>>>
>>  --
>> 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 to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/z1B-42npgaI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


core.async, System/currentTimeMillis, and leap seconds

2015-02-19 Thread Matt Havener
I was talking to a coworker about the implementation of core.async timers 
[0], and he mentioned it uses System/currentTimeMillis. I'm not a Java 
expert, but I believe currentTimeMillis can be affected by a leap second in 
some implementations of the JVM. If so, is it possible that a timeout 
channel could produce a value significantly later than expected?

- Matt

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing branches in PersistentTreeMap / sorted-map / CLJ-1008

2015-02-19 Thread Andy Fingerhut
I haven't checked carefully, but from at least a quick look it appears that
implementing the NavigableMap and NavigableSet interfaces could be done by
using the existing subseq and rsubseq functions in clojure.core?

It doesn't give you access to subtree nodes directly, but perhaps it is
sufficient for your purposes?

Andy

On Wed, Feb 18, 2015 at 6:04 PM, David James  wrote:

> Summary: I'd like to find a public API to work with the underlying tree of
> a sorted-map.
>
> For example:
>
> (def t (sorted-map 1 :a 2 :b 3 :c 4 :d 5 :e 6 :f))
>
> The underlying implementation of sorted-map uses a PersistentTreeMap,
> which can be accessed with `tree`:
>
> (.tree t) ;=> [2 :b]
>
> I have not found a way to access the left and right branches, since
> calling `left` fails:
>
> (.left (.tree t))
>
> IllegalArgumentException Can't call public method of non-public class:
> public clojure.lang.PersistentTreeMap$Node
> clojure.lang.PersistentTreeMap$BlackBranch.left()
> clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)
>
> Perhaps it would be reasonable to make such calls possible, at least from
> the Java API (without reflection)?
>
> CLJ-1008 (http://dev.clojure.org/jira/browse/CLJ-1008) offers one
> possible way to support a public API. It was created in 2012. Perhaps it
> could use another look. Thoughts?
>
>  --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Library (or libraries) for translating REST queries to database queries?

2015-02-19 Thread Bill Piel
Sooo.. it's been a while, but my team finally got around to open sourcing 
the library we've built to address this need. We've been using it for 
several months with much success.

Github repo is here: https://github.com/RJMetrics/sweet-liberty/

On Tuesday, September 24, 2013 at 9:35:38 AM UTC-4, Bill Piel wrote:
>
> I want to use clojure to build a web service with a RESTful API that 
> exposes resources stored in a relational database (mysql in this case). I'd 
> like to use a library that, given a specification of the db schema, would 
> translate incoming requests to db queries, or korma constructs.
>
> Examples might be:
>
> GET /users?status=4
>
> translates to something like:
>
> SELECT * FROM `users` WHERE `status` = 4;
>
> or:
>
> PUT /users/12
>
> would be:
>
> UPDATE `users` SET ... WHERE `id` = 12
>
> Is there anything out there that would facilitate this?
>
> thanks
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help with Liberator POST route

2015-02-19 Thread Sam Ritchie
Specifying POST tells Compojure that you only want to pass POST requests 
on to your liberator resource. That part worked. Liberator then received 
the request and passed it through its workflow.


At the "allowed-method?" decision point, liberator checked your 
declaration and saw only the default entry of [:get]. It short circuited 
and returned a "Method Not Allowed" response, as stated in the 
documentation.


Think of the "POST" wrapper as a middleware that only matches against 
POST requests. Liberator and Compojure are different libs with slightly 
overlapping functionality here. Using "ANY" disables Compojure's request 
type matching, allowing liberator to take care of it exclusively.



gvim 
February 19, 2015 at 9:41 AM


OK, will use ANY. Still puzzled, though, as to why "Method not 
allowed" was returned when I clearly specifed POST.


gvim

Sam Ritchie 
February 19, 2015 at 9:20 AM
Try adding

:allowed-methods [:get :post]

to your resource.

You'll want to use "ANY" for all liberator routes, since they manage 
the responses for incorrect content types internally. If you specify 
GET or POST, it's up to you to return the proper responses if the 
methods aren't supported (since Compojure will return nil and try to 
match further down your list of routes.



gvim 
February 19, 2015 at 8:48 AM


Thanks for spotting that one :). Still not there, though. Now getting 
simply "Method not allowed".


gvim

Jonathan Barber 
February 19, 2015 at 5:56 AM
On 18 February 2015 at 22:35, gvim > wrote:


On 18/02/2015 15:32, Andy- wrote:

Without having tested it: I think you're "curl -d" format is
wrong. It's
not semicolon separated:

http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request

HTH


That solved the curl data submission problem but I'm still getting
errors and suspect the POST defroute isn't correct. 'Trouble all
the examples of :post submissions in the docs are mixed up with
other factors so it's difficult to isolate the correct information.


Replace "min" with "minute" in the route (or change "minute" in the 
curl POST to "min"). Because the field names don't agree, the 
compojure destructing doesn't match and you end up trying to parseInt nil.


Cheers



gvim

-- 
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 to
clojure+unsubscr...@googlegroups.com

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the
Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.




--
Jonathan Barber >

--
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.
gvim 
February 18, 2015 at 3:35 PM


That solved the curl data submission problem but I'm still getting 
errors and suspect the POST defroute isn't correct. 'Trouble all the 
examples of :post submissions in the docs are mixed up with other 
factors so it's difficult to isolate the correct information.


gvim



--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
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 to
clojure+unsubscr...@goog

Re: Accessing branches in PersistentTreeMap / sorted-map / CLJ-1008

2015-02-19 Thread David James
Andy, to take advantage of the Red-Black Tree, I'm looking for public API 
access to the branches. (I'm not looking for a work-around.)

More discussion on this at 
SO: 
http://stackoverflow.com/questions/1981859/finding-keys-closest-to-a-given-value-for-clojure-sorted-maps

Thanks to both Michał Marczyk and Andy for commenting on CLJ-1008 (
http://dev.clojure.org/jira/browse/CLJ-1008).

On Thursday, February 19, 2015 at 1:02:53 PM UTC-5, Andy Fingerhut wrote:
>
> I haven't checked carefully, but from at least a quick look it appears 
> that implementing the NavigableMap and NavigableSet interfaces could be 
> done by using the existing subseq and rsubseq functions in clojure.core?
>
> It doesn't give you access to subtree nodes directly, but perhaps it is 
> sufficient for your purposes?
>
> Andy
>
> On Wed, Feb 18, 2015 at 6:04 PM, David James  > wrote:
>
>> Summary: I'd like to find a public API to work with the underlying tree 
>> of a sorted-map.
>>
>> For example:
>>
>> (def t (sorted-map 1 :a 2 :b 3 :c 4 :d 5 :e 6 :f)) 
>>
>> The underlying implementation of sorted-map uses a PersistentTreeMap, 
>> which can be accessed with `tree`:
>>
>> (.tree t) ;=> [2 :b]
>>
>> I have not found a way to access the left and right branches, since 
>> calling `left` fails:
>>
>> (.left (.tree t))
>>
>> IllegalArgumentException Can't call public method of non-public class: 
>> public clojure.lang.PersistentTreeMap$Node 
>> clojure.lang.PersistentTreeMap$BlackBranch.left()  
>> clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)
>>
>> Perhaps it would be reasonable to make such calls possible, at least from 
>> the Java API (without reflection)?
>>
>> CLJ-1008 (http://dev.clojure.org/jira/browse/CLJ-1008) offers one 
>> possible way to support a public API. It was created in 2012. Perhaps it 
>> could use another look. Thoughts? 
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] rete4frames, v. 5.2.2 - CLIPS-like expert system shell

2015-02-19 Thread ru
Hello all,

New version 5.2.2 of rete4frames CLIPS-like expert system shell is 
published on https://github.com/rururu/rete4frames.

News:

1. Fixed several bugs.
2. Added several utility functions: load-facts, save-facts, slot-value, 
facts-with-slot-value.
3. Allowed comments in rules and facts files.
4. Added "Sudoku" game example (from CLIPS heritage)
5. Added "Hypertension" doctor's expert system example (The idea of this 
example was inspired by screencast of Ryan Brush on StrangeLoop 2014: 
(https://www.youtube.com/watch?v=Z6oVuYmRgkk))

Enjoy!

Sincerely,
  Ru

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing branches in PersistentTreeMap / sorted-map / CLJ-1008

2015-02-19 Thread Andy Fingerhut
David:

I see why you would want that.

If you want this soon, I would recommend using data.avl as suggested by Michał,
or copy the parts of the sorted-set/map implementation from Clojure and
implement it yourself.

If you don't want it soon, you could try persuading a few dozen people to
vote on CLJ-1008, and hope the Clojure developers also want this change.
No guarantees there.

Andy

On Thu, Feb 19, 2015 at 12:18 PM, David James  wrote:

> Andy, to take advantage of the Red-Black Tree, I'm looking for public API
> access to the branches. (I'm not looking for a work-around.)
>
> More discussion on this at SO:
> http://stackoverflow.com/questions/1981859/finding-keys-closest-to-a-given-value-for-clojure-sorted-maps
>
> Thanks to both Michał Marczyk and Andy for commenting on CLJ-1008 (
> http://dev.clojure.org/jira/browse/CLJ-1008).
>
> On Thursday, February 19, 2015 at 1:02:53 PM UTC-5, Andy Fingerhut wrote:
>>
>> I haven't checked carefully, but from at least a quick look it appears
>> that implementing the NavigableMap and NavigableSet interfaces could be
>> done by using the existing subseq and rsubseq functions in clojure.core?
>>
>> It doesn't give you access to subtree nodes directly, but perhaps it is
>> sufficient for your purposes?
>>
>> Andy
>>
>> On Wed, Feb 18, 2015 at 6:04 PM, David James  wrote:
>>
>>> Summary: I'd like to find a public API to work with the underlying tree
>>> of a sorted-map.
>>>
>>> For example:
>>>
>>> (def t (sorted-map 1 :a 2 :b 3 :c 4 :d 5 :e 6 :f))
>>>
>>> The underlying implementation of sorted-map uses a PersistentTreeMap,
>>> which can be accessed with `tree`:
>>>
>>> (.tree t) ;=> [2 :b]
>>>
>>> I have not found a way to access the left and right branches, since
>>> calling `left` fails:
>>>
>>> (.left (.tree t))
>>>
>>> IllegalArgumentException Can't call public method of non-public class:
>>> public clojure.lang.PersistentTreeMap$Node clojure.lang.
>>> PersistentTreeMap$BlackBranch.left()  
>>> clojure.lang.Reflector.invokeMatchingMethod
>>> (Reflector.java:88)
>>>
>>> Perhaps it would be reasonable to make such calls possible, at least
>>> from the Java API (without reflection)?
>>>
>>> CLJ-1008 (http://dev.clojure.org/jira/browse/CLJ-1008) offers one
>>> possible way to support a public API. It was created in 2012. Perhaps it
>>> could use another look. Thoughts?
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


javac-options are ignored

2015-02-19 Thread Felipe Gerard
When you set:

:javac-options ["-target" "1.6" "-source" "1.6" ] 

and


:profiles {:uberjar {:aot :all

   :dependencies [[org.clojure/clojure "1.6.0"]]}

 }

On the project.clj 


When I execute:

lein uberjar

The classes that are generated in de target/classes path when you examin 
the bytes the Java version (with: xxd target/classes/xxx/core.class | less) 
you can see:

000: cafe babe  0031 0075 0100 0878 7878  ...1.u...xxx

   this  31^ idicates that this clas is 
java 1.5 not 1.6

I think this is a bug. Any help please?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing branches in PersistentTreeMap / sorted-map / CLJ-1008

2015-02-19 Thread David James
Yes, we're on the same page here. I'm very glad Michał has done great work 
in this Clojure data structure space.

Of course, I wouldn't mind if dozens of people agreed, but I'm more 
interested in the pros/cons before I try to mobilize support. So, to those 
reading this, I'd be interested to hear if:

(a) you agree with CLJ-1008 (or some friendly amendment to it)
(b) you disagree with CLJ-1008 for some principled or philosophical reason 
(not just because you think other things are more pressing or you wouldn't 
personally use a a RB-Tree API right away)
(c) you think more exploration is needed

Some observations and context:

* I find it curious that `tree` is public but `left` and `right` are not. 
Perhaps this was just historical accident?

* Exposing the API for PersistentTreeMaps opens up a lot of useful 
possibilities for derivative data structures. (This is what led me to this 
question.) See, for example, interval trees, in particular ones with 
non-overlapping intervals: http://en.wikipedia.org/wiki/Interval_tree, 
which could be naively implemented with a PersistentTreeMap if it had 
public API access.

On Thursday, February 19, 2015 at 3:37:46 PM UTC-5, Andy Fingerhut wrote:
>
> David:
>
> I see why you would want that.
>
> If you want this soon, I would recommend using data.avl as suggested by 
> Michał, 
> or copy the parts of the sorted-set/map implementation from Clojure and 
> implement it yourself.
>
> If you don't want it soon, you could try persuading a few dozen people to 
> vote on CLJ-1008, and hope the Clojure developers also want this change.  
> No guarantees there.
>
> Andy
>
> On Thu, Feb 19, 2015 at 12:18 PM, David James  > wrote:
>
>> Andy, to take advantage of the Red-Black Tree, I'm looking for public API 
>> access to the branches. (I'm not looking for a work-around.)
>>
>> More discussion on this at SO: 
>> http://stackoverflow.com/questions/1981859/finding-keys-closest-to-a-given-value-for-clojure-sorted-maps
>>
>> Thanks to both Michał Marczyk and Andy for commenting on CLJ-1008 (
>> http://dev.clojure.org/jira/browse/CLJ-1008).
>>
>> On Thursday, February 19, 2015 at 1:02:53 PM UTC-5, Andy Fingerhut wrote:
>>>
>>> I haven't checked carefully, but from at least a quick look it appears 
>>> that implementing the NavigableMap and NavigableSet interfaces could be 
>>> done by using the existing subseq and rsubseq functions in clojure.core?
>>>
>>> It doesn't give you access to subtree nodes directly, but perhaps it is 
>>> sufficient for your purposes?
>>>
>>> Andy
>>>
>>> On Wed, Feb 18, 2015 at 6:04 PM, David James  wrote:
>>>
 Summary: I'd like to find a public API to work with the underlying tree 
 of a sorted-map.

 For example:

 (def t (sorted-map 1 :a 2 :b 3 :c 4 :d 5 :e 6 :f)) 

 The underlying implementation of sorted-map uses a PersistentTreeMap, 
 which can be accessed with `tree`:

 (.tree t) ;=> [2 :b]

 I have not found a way to access the left and right branches, since 
 calling `left` fails:

 (.left (.tree t))

 IllegalArgumentException Can't call public method of non-public class: 
 public clojure.lang.PersistentTreeMap$Node clojure.lang.
 PersistentTreeMap$BlackBranch.left()  
 clojure.lang.Reflector.invokeMatchingMethod 
 (Reflector.java:88)

 Perhaps it would be reasonable to make such calls possible, at least 
 from the Java API (without reflection)?

 CLJ-1008 (http://dev.clojure.org/jira/browse/CLJ-1008) offers one 
 possible way to support a public API. It was created in 2012. Perhaps it 
 could use another look. Thoughts? 

  -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscr

Re: Lucky Numbers again

2015-02-19 Thread Steve Miner
I found a better data structure for calculating lucky numbers.  The contrib 
library data.avl (from Michał Marczyk) has a persistent sorted-set that 
supports nth.  This runs much faster than my previous attempts.

(require '[clojure.data.avl :as avl])

(defn lucky-avl
 ([max] (lucky-avl 1 (apply avl/sorted-set (range 1 max 2
 ([i avl]
  (let [n (nth avl i nil)]
(if (and n (<= n (count avl)))
  (recur (inc i) (reduce (fn [sss m] (disj sss (nth avl m)))
 avl
 (range (dec n) (count avl) n)))
  (sequence avl)

(time (count (lucky-avl 1e6)))
"Elapsed time: 2396.158435 msecs"
71918

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Injecting html code into selmer

2015-02-19 Thread Sven Richter
Hi,

I wonder if this is even possible.
I have a string :foo-string "foo" and I pass this string to selmer:
(render "templ.html" {foo-string "foo"})

Now in the templ.html I do this:
{{foo-string|safe}} which injects this into the html:
"foo" 

But what I need is plain html like this inside the template:
foo

Is that even possible?

Thanks,
Sven

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Lucky Numbers again

2015-02-19 Thread Cecil Westerhof
2015-02-19 23:25 GMT+01:00 Steve Miner :

> I found a better data structure for calculating lucky numbers.  The
> contrib library data.avl (from Michał Marczyk) has a persistent sorted-set
> that supports nth.  This runs much faster than my previous attempts.
>
> (require '[clojure.data.avl :as avl])
>
> (defn lucky-avl
>  ([max] (lucky-avl 1 (apply avl/sorted-set (range 1 max 2
>  ([i avl]
>   (let [n (nth avl i nil)]
> (if (and n (<= n (count avl)))
>   (recur (inc i) (reduce (fn [sss m] (disj sss (nth avl m)))
>  avl
>  (range (dec n) (count avl) n)))
>   (sequence avl)
>
> (time (count (lucky-avl 1e6)))
> "Elapsed time: 2396.158435 msecs"
> 71918
>

​It works especially well for bigger values. With 1e7 I got with the old
version:
"Elapsed time: 3924244.877112 msecs"
and with this version:
"Elapsed time: 14863.904489 msecs"

More as 250 times as fast.​


-- 
Cecil Westerhof

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using type to change the behaviour of a function

2015-02-19 Thread Fluid Dynamics
On Thursday, February 19, 2015 at 9:54:21 AM UTC-5, Tassilo Horn wrote:
>
> Cecil Westerhof > writes: 
>
> Hi! 
>
> > At the moment the following: 
> > (lucky-numbers 1001) 
> > gives: 
> > AssertionError Assert failed: (<= upto (* 10 1000 1000)) 
> user/lucky-numbers 
> > 
> > But I would like the following to be executed: 
> > (lucky-numbers :no-max-check 1001) 
> > 
> > ​How would I implement that? 
>
> Just make an optional argument, e.g., 
>
> (defn lucky-numbers 
>  ([upto] 
>   (lucky-numbers false upto)) 
>  ([no-max-check upto] 
>   {:pre [(if no-max-check true (<= upto (* 10 1000 1000)))]} 
>   ;; code as before 
>   )) 
>

Why not (or no-max-check (<= upto (* 10 1000 1000)))? 

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: javac-options are ignored

2015-02-19 Thread Jeremy Heiler
On February 19, 2015 at 4:40:16 PM, Felipe Gerard (fger...@interware.com.mx) 
wrote:
> When you set:
>  
> :javac-options ["-target" "1.6" "-source" "1.6” ]

This option is only for when you are compiling Java source.

https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L249:L251

> I think this is a bug. Any help please?

It looks like that 1.5 is hardcoded in the Clojure compiler.

See: 
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java

And search for “V1_5”.

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Workaround for CLJ-1604?

2015-02-19 Thread Adam Krieg
I'm running into what appears to be the same issue described in CLJ-1604 
, where a library that I'm 
using (Korma) has a function that clashes with a new function in Clojure 
core with 1.7, update.

At the point of invocation, I get the compilation exception:
Exception in thread "main" java.lang.RuntimeException: No such var: 
korma.core/update, 

Other than ripping out Korma or downgrading to 1.6, is there anything I can 
do to avoid this issue?

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Workaround for CLJ-1604?

2015-02-19 Thread Andy Fingerhut
You could build your own patched version of Clojure, with the proposed
patch from the ticket, and use that.  If you try that, it would be good to
add a comment to the ticket of whether it fixed the problem for you, too.

Note: I fully understand if you'd prefer not to do this.  Simply giving
another alternative to the ones you mentioned.

Andy

On Thu, Feb 19, 2015 at 8:10 PM, Adam Krieg  wrote:

> I'm running into what appears to be the same issue described in CLJ-1604
> , where a library that I'm
> using (Korma) has a function that clashes with a new function in Clojure
> core with 1.7, update.
>
> At the point of invocation, I get the compilation exception:
> Exception in thread "main" java.lang.RuntimeException: No such var:
> korma.core/update,
>
> Other than ripping out Korma or downgrading to 1.6, is there anything I
> can do to avoid this issue?
>
> --
> 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 to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using type to change the behaviour of a function

2015-02-19 Thread Tassilo Horn
Fluid Dynamics  writes:

> (defn lucky-numbers 
> ([upto] 
> (lucky-numbers false upto)) 
> ([no-max-check upto] 
> {:pre [(if no-max-check true (<= upto (* 10 1000 1000)))]} 
> ;; code as before 
> )) 
>
>
> Why not (or no-max-check (<= upto (* 10 1000 1000)))? 

Because I started with an inverse max-check argument where you needed
the

  (if max-check (<= upto (* 10 1000 1000)) true)

before I saw that a negated version of the arg complies better with
Cecil's expectation.

Bye,
Tassilo

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing branches in PersistentTreeMap / sorted-map / CLJ-1008

2015-02-19 Thread Michał Marczyk
Hi David,

data.avl trees and maps offer navigable map / set functionality out of the
box (with a Clojure API – as mentioned in my comment on CLJ-1008,
implementing the "reverse" methods would be straightforward in itself, but
problematic due to interactions with other functionality I'd like to have
the option to implement; I might eventually come up with a clean way of
making it all work together, but for now I'd like to keep my options open):

  (avl/subrange (avl/sorted-set 0 1 2 3 4 5) >= 2 < 5)
  ;= #{2 3 4}

Adding them to PTM would be quite a bit trickier, because PTM doesn't store
rank metadata in nodes, and so after extracting a subrange from a PTM
instance we have no good answer to c.c/count, unless of course we're
willing to walk the entire subrange (but at this point it's simpler to just
combine (r)subseq with into to produce a new map; in fact there is a
function like this in data.avl's test suite for use as a sanity check on
the fast implementation – as you'd expect, it's *very* slow, whereas
data.avl/subrange is fast – O(log n) – and gives you first-class results
with O(1) count).

As I said in CLJ-1008, I'm not convinced we should change that – as of
right now, we have in Clojure a lean sorted map (c.l.PTM with basic sorted
map / set functionality) and a more feature-rich sorted map (data.avl –
extra features, fatter nodes). Making c.l.PTM nodes fatter would remove the
lean & basic option, so we should only do it if there's a compelling
reason. Given data.avl's performance – totally on a par with c.l.PTM
(sometimes faster, largely due to AVL trees being shallower, sometimes
slower where they do a measurable amount of extra work) – I'm not sure
there really is a compelling reason. Do you feel otherwise?

(I can see other "feature packages" being useful for various use cases…
I've been thinking about how best to support them without reimplementing
too much of the basic stuff.)

Going back to the original question, data.avl trees and maps make no
attempt to hide the internal structure of their nodes (although you'll have
to access the fields through clojure.data.avl.IAVLNode method calls and not
direct field access; the fields need to be mutable for data.avl to support
transients, and deftype-introduced mutable fields are always private):

  ;; reflection removable with appropriate hints
  (.. (avl/sorted-set 0 0 1 1 2 2 3 3 4 4) (getTree) (getLeft))
  ;= #

As for interval trees, that's one data structure that I've been meaning to
add to data.avl for a long time, and I'm fairly close to releasing a first
cut. Currently I'm aiming at sets of intervals with some overlap queries
("find intervals overlapping this one", "find intervals which include this
point"). I'm not planning to support all data.avl features for interval
sets in the initial alpha – the purpose of that will be to hash out a good
API for the new stuff – but I'll be happy to add in whatever makes sense in
a future release. (In particular, map-like interval trees in which you
could associate values with the stored intervals are a possibility.)

In any case, whatever your use case is, I'd be very interested to learn
more about it and see if data.avl could provide a useful solution.

Cheers,
Michał


On 19 February 2015 at 23:12, David James  wrote:

> Yes, we're on the same page here. I'm very glad Michał has done great work
> in this Clojure data structure space.
>
> Of course, I wouldn't mind if dozens of people agreed, but I'm more
> interested in the pros/cons before I try to mobilize support. So, to those
> reading this, I'd be interested to hear if:
>
> (a) you agree with CLJ-1008 (or some friendly amendment to it)
> (b) you disagree with CLJ-1008 for some principled or philosophical reason
> (not just because you think other things are more pressing or you wouldn't
> personally use a a RB-Tree API right away)
> (c) you think more exploration is needed
>
> Some observations and context:
>
> * I find it curious that `tree` is public but `left` and `right` are not.
> Perhaps this was just historical accident?
>
> * Exposing the API for PersistentTreeMaps opens up a lot of useful
> possibilities for derivative data structures. (This is what led me to this
> question.) See, for example, interval trees, in particular ones with
> non-overlapping intervals: http://en.wikipedia.org/wiki/Interval_tree,
> which could be naively implemented with a PersistentTreeMap if it had
> public API access.
>
> On Thursday, February 19, 2015 at 3:37:46 PM UTC-5, Andy Fingerhut wrote:
>>
>> David:
>>
>> I see why you would want that.
>>
>> If you want this soon, I would recommend using data.avl as suggested by 
>> Michał,
>> or copy the parts of the sorted-set/map implementation from Clojure and
>> implement it yourself.
>>
>> If you don't want it soon, you could try persuading a few dozen people to
>> vote on CLJ-1008, and hope the Clojure developers also want this change.
>> No guarantees there.
>>
>> Andy
>>
>> On Thu, Feb 19, 2015 at 12:18 PM, D

Re: Workaround for CLJ-1604?

2015-02-19 Thread coltnz
I had a similar problem where I patched it back it in :

https://gist.github.com/coltnz/4818581be0231207a046



On Friday, February 20, 2015 at 5:10:50 PM UTC+13, Adam Krieg wrote:
>
> I'm running into what appears to be the same issue described in CLJ-1604 
> , where a library that I'm 
> using (Korma) has a function that clashes with a new function in Clojure 
> core with 1.7, update.
>
> At the point of invocation, I get the compilation exception:
> Exception in thread "main" java.lang.RuntimeException: No such var: 
> korma.core/update, 
>
> Other than ripping out Korma or downgrading to 1.6, is there anything I 
> can do to avoid this issue?
>

-- 
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 to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.