Re: Type hints inside generated code

2013-12-04 Thread dm3
Sorry for the confusion, type annotations do work in the evaluated code. I just didn't supply enough of them. Although I'm still not sure if they will work in all cases, as per http://stackoverflow.com/questions/11919602/generating-clojure-code-with-type-hints . On Wednesday, 4 December 2013 2

Re: Quick library status updates (logging, Redis, i18n, etc.)

2013-12-04 Thread Peter Taoussanis
Hi Colin, Timbre looks quite cool but just a bit surprised to see it using spit. > Surely thats not particularly performant or is there something I'm missing? > Spit does alright in a lot of cases (certainly for prototyping, etc.). The example appenders are there mostly to show how appenders are

Re: Quick library status updates (logging, Redis, i18n, etc.)

2013-12-04 Thread coltnz
Hi Peter, Timbre looks quite cool but just a bit surprised to see it using spit. Surely thats not particularly performant or is there something I'm missing? cheers Colin On Thursday, December 5, 2013 6:30:11 AM UTC+13, Peter Taoussanis wrote: > > Hi all, quick batched update on some libs that

Re: Quick library status updates (logging, Redis, i18n, etc.)

2013-12-04 Thread Peter Taoussanis
Thanks Baishampayan, Karsten - appreciate it! -- -- 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. T

Re: Advice on choosing the right data structure

2013-12-04 Thread dabd
Thanks I'll take a look at your libraries. One problem I found with the zipper API is that if you have a recursive function that takes a loc, when you call it on the clojure.zip/children of a given loc it won't work because this function returns a seq of nodes instead of a seq of locs. Shouldn'

Re: Quick library status updates (logging, Redis, i18n, etc.)

2013-12-04 Thread Karsten Schmidt
+1 Thanks, Peter! On 4 December 2013 18:12, Baishampayan Ghose wrote: > Fantastic stuff, Peter. Your projects are extremely useful, well designed > and have great docs. Your work is really inspiring. > ~BG > > Sent from phone. Please excuse brevity. > > On 4 Dec 2013 23:00, "Peter Taoussanis" wr

Re: Advice on choosing the right data structure

2013-12-04 Thread Alexander Hudek
Additionally, if you need more complex access patterns you could see if this helps: https://github.com/akhudek/zip-visit For performance, there is a fast-zip library that is api compatible with clojure.zip. You can just swap the clojure.zip namespace for the fast-zip namespace. Note that you'd

Re: Advice on choosing the right data structure

2013-12-04 Thread James Reeves
On 4 December 2013 21:09, dabd wrote: > I didn't get there because I ran into problems with the zipper API. When > you call 'children' on a loc you get a seq of nodes instead of a seq of > locs which causes me problems in a recursive algorithm operating on locs. > Have you tried using next and

Re: Type hints inside generated code

2013-12-04 Thread dm3
This would work if I knew the type of the function arguments. It doesn't seem to work when type-hinting on the constructor call. On Wednesday, 4 December 2013 22:31:53 UTC+2, James Reeves wrote: > > Try something like: > > (let [x (with-meta (gen-sym) {:tag String}] > (defn foo [~x] ...

Re: Advice on choosing the right data structure

2013-12-04 Thread Ben Wolfson
oh, I meant custom from the bottom up, without using clojure.zip at all (so your issue with the return value of children wouldn't come up). I realize this doesn't answer your question about alternatives. On Wed, Dec 4, 2013 at 1:15 PM, dabd wrote: > I had to implement a custom tree zipper as no

Re: Advice on choosing the right data structure

2013-12-04 Thread dabd
I had to implement a custom tree zipper as none of the existing zippers worked for me. My question is are there better alternatives when you want the best performance in clojure? On Wednesday, December 4, 2013 9:12:16 PM UTC, Ben wrote: > > it might be worthwhile to implement custom zippers for

Re: Advice on choosing the right data structure

2013-12-04 Thread Ben Wolfson
it might be worthwhile to implement custom zippers for your trees, without using clojure.zip. I've done this for navigating into json structures and it was relatively painless (admittedly I only needed a smallish subset of the functionality provided by clojure.zip). On Wed, Dec 4, 2013 at 1:09 PM

Re: Advice on choosing the right data structure

2013-12-04 Thread dabd
I didn't get there because I ran into problems with the zipper API. When you call 'children' on a loc you get a seq of nodes instead of a seq of locs which causes me problems in a recursive algorithm operating on locs. On Wednesday, December 4, 2013 8:38:17 PM UTC, James Reeves wrote: > > On 4

Re: Advice on choosing the right data structure

2013-12-04 Thread James Reeves
On 4 December 2013 20:27, dabd wrote: > > I tried a purely functional approach with zippers but ran into some > trouble with the zipper API. I also think I will would have performance > problems too as there is a lot of bookkeeping in a zipper (paths, parents > associated with a loc). > You thin

Re: Type hints inside generated code

2013-12-04 Thread James Reeves
Try something like: (let [x (with-meta (gen-sym) {:tag String}] (defn foo [~x] ...)) - James On 4 December 2013 19:55, dm3 wrote: > Hello, > > I've been having a little problem when trying to generate java interop > code and avoid reflection warnings. I have to generate a bunch of >

Advice on choosing the right data structure

2013-12-04 Thread dabd
I would like to implement an algorithm that works on trees (n-ary trees) where each node is a complex type. Aside from the usual tree traversals I will need to be able to access the parent of a node. Performance is important since the algorithm is going to traverse the tree several times and upd

Type hints inside generated code

2013-12-04 Thread dm3
Hello, I've been having a little problem when trying to generate java interop code and avoid reflection warnings. I have to generate a bunch of functions which delegate to java constructors, like this: (defn mk-a [x y z] (A. x y z)) (defn mk-b [x y z] (B. x y z)) The main reason here is to be

Re: ClassCastException on second pass of loop, works fine during the first.

2013-12-04 Thread Sean Chalmers
Hrmm, I'll give that a try and see what I come up with. Thanks for the pointer about others, that makes sense. > wrote: > I would expect others to be either nil or a non-empty seq (never empty) but > empty? will return true on a nil, so that still works. I would have swapped > the cases and use

Re: contains? and transient set

2013-12-04 Thread Alex Miller
It is not currently in the list for 1.6. At some point, we have to draw a line and bear down on some set of tickets - this ticket is currently behind that line. We will be more regularly moving patches through the system, getting them reviewed and included in master, and releasing new versions

Re: ClassCastException on second pass of loop, works fine during the first.

2013-12-04 Thread Alex Miller
I would expect others to be either nil or a non-empty seq (never empty) but empty? will return true on a nil, so that still works. I would have swapped the cases and used seq as the test. However, without really reading this too closely, I'd guess the real problem is that you want to (apply mer

Re: Quick library status updates (logging, Redis, i18n, etc.)

2013-12-04 Thread Baishampayan Ghose
Fantastic stuff, Peter. Your projects are extremely useful, well designed and have great docs. Your work is really inspiring. ~BG Sent from phone. Please excuse brevity. On 4 Dec 2013 23:00, "Peter Taoussanis" wrote: > Hi all, quick batched update on some libs that I'm maintaining: > > *Timbre -

Quick library status updates (logging, Redis, i18n, etc.)

2013-12-04 Thread Peter Taoussanis
Hi all, quick batched update on some libs that I'm maintaining: *Timbre - v3.0.0-RC2 - 2013-12-04* == Logging & profiling tools Major recent changes: * Carmine (Redis) appender that serializes log entries to length-limited, rotating lists by log level. Allows easy queryin

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 4 December 2013 14:04, James Laver wrote: > > I’m pretty sure that’s the behaviour I was already seeing. Imagine this > scenario: > - I access this route passing in the ID of the database record I wish to > modify > - I pass in a new value for it in the post data (okay, bad example, you’re > n

ClassCastException on second pass of loop, works fine during the first.

2013-12-04 Thread Sean Chalmers
Greetings ! I'm attempting to implement Othello in Clojure and I've run into a problem when actually running my game loop. On the first run through, everything works as expected, the black player can make their move, the board is updated and everything is awesome. However when the program loop

Re: contains? and transient set

2013-12-04 Thread László Török
cool! hope the patch is good for 1.6! :) 2013/12/4 Alex Miller > Both contains? and get should work with transient sets imo. > > This is already in jira: http://dev.clojure.org/jira/browse/CLJ-700. > > Alex > > On Wednesday, December 4, 2013 5:04:40 AM UTC-6, Burt wrote: >> >> Does contains? an

Re: contains? and transient set

2013-12-04 Thread Ben Wolfson
This is not a good way to check whether an *arbitrary* element is in a set: user=> (contains? #{nil} nil) true user=> (#{nil} nil) nil On Wed, Dec 4, 2013 at 3:35 AM, László Török wrote: > Hi, > > contains? is for checking whether a data structure contains the respective > key. > > A more idi

Re: contains? and transient set

2013-12-04 Thread Alex Miller
Both contains? and get should work with transient sets imo. This is already in jira: http://dev.clojure.org/jira/browse/CLJ-700. Alex On Wednesday, December 4, 2013 5:04:40 AM UTC-6, Burt wrote: > > Does contains? and get not work with transient sets? > > Examples: > (contains? #{1 2 3} 1) > ;

Re: contains? and transient set

2013-12-04 Thread Burt
Hi Stefan, I did not search in Jira, I don't know whether this is a known bug. I use the Lars' work-around in the context I need contains? with a transient set. Regards, Burt Am Mittwoch, 4. Dezember 2013 14:29:35 UTC+1 schrieb Stefan Kamphausen: > > It looks like you're onto something here >

Re: [ANN] Buffy The ByteBuffer Slayer, Clojure library to working with binary data

2013-12-04 Thread Rob Day
On 29 November 2013 22:15, Alex P wrote: > Buffy [1] is a Clojure library to work with Binary Data, write complete > binary protocol implementations > in clojure, store your complex data structures in an off-heap chache, read > binary files and do > everything you would usually do `ByteBuffer`. I

Re: [ANN] Buffy The ByteBuffer Slayer, Clojure library to working with binary data

2013-12-04 Thread Thomas
Thank you Alex, I have been paying around with Gloss for a while now and realised it is not quite suitable for the protocol I am trying to en/decode. I'll give Buffy a try and see whether it is a better fit for my problem domain. Thanks again, Thomas On Monday, December 2, 2013 9:09:48 PM UTC

Re: Am I missing something?

2013-12-04 Thread James Laver
On 4 Dec 2013, at 11:38, James Reeves wrote: > Compojure also adds to the :route-params key, so if you need to, you can > explicitly decide how you want maps of parameters to be merged. The :params > key is just there for the convenience of the majority of users. > > You could write something

Re: Clojure for the Brave and True, an online book for beginners

2013-12-04 Thread Paddy Gallagher
It definitely was Daniel. I will be sure to recommend it to anyone I know looking to learn Clojure in London. I look forward to reading more of your blog. Have a great Christmas and New Year :) Patrick On Monday, December 2, 2013 2:25:55 PM UTC, Daniel Higginbotham wrote: > > Thanks, Paddy! It

Re: contains? and transient set

2013-12-04 Thread Max Penet
Well not quite: > (contains? (transient #{1 2 3}) 1) false > *clojure-version* {:major 1, :minor 4, :incremental 0, :qualifier nil} > So it used not to throw but return a wrong value instead, which was worse. On Wednesday, December 4, 2013 2:50:19 PM UTC+1, Max Penet wrote: > > Also it seems

Re: contains? and transient set

2013-12-04 Thread Max Penet
Also it seems it used to work on clojure 1.4 On Wednesday, December 4, 2013 2:29:35 PM UTC+1, Stefan Kamphausen wrote: > > It looks like you're onto something here > > get works with transient maps: > > (get (transient {:a 1 :b 2}) :a) > ;=> 1 > > and with transient vectors, too: > > (get (transie

Re: contains? and transient set

2013-12-04 Thread Stefan Kamphausen
It looks like you're onto something here get works with transient maps: (get (transient {:a 1 :b 2}) :a) ;=> 1 and with transient vectors, too: (get (transient [1 2 3]) 0) ;=> 1 but not with transient sets: (get (transient #{1 2 3}) 2) ;=> nil And using contains? in a reduce with a transient

Re: contains? and transient set

2013-12-04 Thread Burt
Thanks, Burt > > -- -- 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 g

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 4 December 2013 10:37, James Laver wrote: > > On 4 Dec 2013, at 09:06, James Reeves wrote: > > > It sounds like part of the issue is with ring.middleware.format > overloading the :params key, but it also seems like you might have an > unusual set of requirements. > > Actually, my larger probl

Re: contains? and transient set

2013-12-04 Thread László Török
Hi, contains? is for checking whether a data structure contains the respective key. A more idiomatic way to check whether an element is in the set is (#{1 2 3} 1) ;; => returns 1 (#{1 2 3} 0) ;; => returns nil works for (transient #{1 2 3}) too. Las 2013/12/4 Burt > Does contains? and g

Re: Am I missing something?

2013-12-04 Thread James Laver
On 4 Dec 2013, at 11:00, Joshua Ballanco wrote: > Just a humble suggestion, but from a cursory glance at your tests, it seems > that something like simple-check might save you a lot of time in the future: > https://github.com/reiddraper/simple-check That’s a much valued suggestion actually. I

contains? and transient set

2013-12-04 Thread Burt
Does contains? and get not work with transient sets? Examples: (contains? #{1 2 3} 1) ; => true (contains? (transient #{1 2 3}) 1) ; => IllegalArgumentException contains? not supported on type: clojure.lang.PersistentHashSet$TransientHashSet (get #{1 2 3} 1) ; => 1 (get (transient #{1 2 3}) 1) ;

Re: Am I missing something?

2013-12-04 Thread Joshua Ballanco
On Wednesday, December 4, 2013 at 12:37, James Laver wrote: > Ring is really wonderfully simple. the two combined take up only a handful of > lines. Unfortunately, the tests take up rather a lot of lines (~140) and > since they helped squeeze out the bugs, it would be a poor argument to say > “d

Re: Am I missing something?

2013-12-04 Thread James Laver
On 4 Dec 2013, at 05:00, David Nolen wrote: > Did you look at Caribou? It seems more like a "complete" solution - > http://let-caribou.in I’ve now given this a look over. It seems insane. It makes quite a lot of (IMO) questionable choices and it doesn’t seem terribly pluggable. James -- --

Re: Am I missing something?

2013-12-04 Thread James Laver
On 4 Dec 2013, at 09:06, James Reeves wrote: > It sounds like part of the issue is with ring.middleware.format overloading > the :params key, but it also seems like you might have an unusual set of > requirements. Actually, my larger problem was with compojure doing it. I wanted a distinction

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 3 Dec 2013 23:28, "James Laver" wrote: > Some examples: > 1. The :params key is used by ring.middleware.params, compojure and ring.middleware.format so it's impossible to know where a given param is coming from > 2. ring.middleware.params does not provide a convenience map that merges :query-pa

Re: [ANN] Buffy The ByteBuffer Slayer, Clojure library to working with binary data

2013-12-04 Thread Ulises
While we're on the subject, I found no way of decoding/interpreting an already existing sequence (ByteBuffer) of bytes, but only one that had been created with compose-buff. Am I missing something? On 4 December 2013 07:28, Cesar Canassa wrote: > Hi, > > I see that the repeated-type requires a co

Re: Am I missing something?

2013-12-04 Thread Korny Sietsma
We had to tell Cheshire to always use bigdecimals - and I think there was something else, can't remember. Not all that advanced, really. On 4 Dec 2013 16:17, "Brian Craft" wrote: > > > On Tuesday, December 3, 2013 8:48:34 PM UTC-8, Korny wrote: >> >> * Compojure for routing, and static resources