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 craft.br...@gmail.com wrote:



 On Tuesday, December 3, 2013 8:48:34 PM UTC-8, Korny wrote:

 * Compojure for routing, and static resources - the only middleware we
 had to write was for advanced json parsing


 What is advanced json parsing?

 --
 --
 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/groups/opt_out.


-- 
-- 
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/groups/opt_out.


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 cesar.cana...@gmail.com wrote:
 Hi,

 I see that the repeated-type requires a constant repeat count. Are you
 planning to include a more dynamic version à la Gloss prefixes/headers?

 The lib looks really nice. Binary handling libraries are really helpful.

 Thanks,
 Cesar Canassa



 On Mon, Dec 2, 2013 at 7:09 PM, Alex P oleksandr.pet...@gmail.com wrote:

 It's different in a way we manipulate the data:

 We've opted out for default-lazy way (you're getting and setting separate
 values instead of serialising/deserialising an entire payload).

 Another difference is that we don't have Lamina as a loaded artifact
 (which may not be an issue for majority of people, but was for us
 because of an internal version conflict with some other library).
 Obviously, there are ways around it, but we tried to bring in minimum
 possible amount of dependencies, and be able to use it with Netty4 (which
 is currently underrepresented in Clojure world).

 There are other subtle difference, but I don't think they're worth
 mentioning, Gloss is a great library, but Buffy is doing things in a subtly
 different way. Main purpose (as we're using it) - for off-heap storage /
 data structures, and for binary protocol implementations in Clojure
 (right now, we have a sketch of Cassandra binary protocol implemented on
 top of Buffy, although I'm not sure wether it's going to be
 production-ready any time soon).


 Thanks for props!

 On Saturday, November 30, 2013 10:33:31 PM UTC+1, Thomas wrote:

 Looks really really great and could you please explain how it differs
 from gloss [1]. Any advantages? Disadvantages?

 Thanks
 Thomas

 [1] https://github.com/ztellman/gloss

 On Friday, November 29, 2013 10:15:45 PM UTC, 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`.

 Main features  motivation to write it

   * partial deserialization (read and deserialise parts of a byte
 buffer)
   * named access (access parts of your buffer by names)
   * composing/decomposing from key/value pairs
   * pretty hexdump
   * many useful default types that you can combine and extend easily

 Data types include:

   * primitives, such as `int32`, `boolean`, `byte`, `short`, `medium`,
 `float`, `long`
   * arbitrary-length `string`
   * byte arrays
   * composite types (combine any of primitives together)
   * repeated type (repeat any primitive arbitrary amount of times in
 payload)
   * enum type (for mapping between human-readable and binary
 representation of constants)

 Buffy has been serving us well for recent time, and no major issues were
 revealed. However, until
 it reaches GA, we can't guarantee 100% backward compatibility, although
 we're thought it through
 very well and used our best knowledge to make it right.

 Buffy is a ClojureWerkz project, same as Monger, Elastisch, Cassaforte,
 Neocons, Meltdown and
 many others.

 [1] https://github.com/clojurewerkz/buffy
 [2] http://clojurewerkz.org

 --

 Alex P

 http://clojurewerkz.org

 http://twitter.com/ifesdjeen

 --
 --
 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/groups/opt_out.


 --
 --
 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/groups/opt_out.

-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to 

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 3 Dec 2013 23:28, James Laver james.la...@gmail.com 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-params and :form-params, despite being happy to stuff everything
into :params. At least ring.middleware.format adds :body-params here. I've
now written a middleware to do this.
 3. ring.middleware.keyword-params only keywordises the :params map, not
the other maps. There is no configurable behaviour to ask it to do other
maps. I've now written a middleware for this

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.

The custom middleware you describe sounds like one or two lines of code.
Did you find it took particularly long to write?

Others have mentioned Liberator, which I'd highly recommend using for
RESTful web services. It gets rid of a lot of the boilerplate required, at
least the parts that deal with HTTP.

- James

-- 
-- 
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/groups/opt_out.


Re: Am I missing something?

2013-12-04 Thread James Laver

On 4 Dec 2013, at 09:06, James Reeves ja...@booleanknot.com 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 
between data coming from the route and data coming from the form data, since 
after vaidation, that gets shoved straight into the database.

 The custom middleware you describe sounds like one or two lines of code. Did 
 you find it took particularly long to write?

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 “don’t 
write them”.

See the source here https://gist.github.com/jjl/7785497

 Others have mentioned Liberator, which I'd highly recommend using for RESTful 
 web services. It gets rid of a lot of the boilerplate required, at least the 
 parts that deal with HTTP.

I think I’m going to have to look into it more fully.

James

-- 
-- 
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/groups/opt_out.


Re: Am I missing something?

2013-12-04 Thread James Laver

On 4 Dec 2013, at 05:00, David Nolen dnolen.li...@gmail.com 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

-- 
-- 
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/groups/opt_out.


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 
 “don’t write them”.
  
 See the source here https://gist.github.com/jjl/7785497

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

Cheers,

Josh 

-- 
-- 
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/groups/opt_out.


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)
; = nil

How can I check whether an element is contained in a transient set?


-- 
-- 
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/groups/opt_out.


Re: Am I missing something?

2013-12-04 Thread James Laver

On 4 Dec 2013, at 11:00, Joshua Ballanco jball...@gmail.com 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 had been missing Haskell’s 
QuickCheck.

Cheers,
James

-- 
-- 
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/groups/opt_out.


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 burkhardt.r...@googlemail.com

 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)
 ; = nil

 How can I check whether an element is contained in a transient set?


  --
 --
 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/groups/opt_out.




-- 
László Török

-- 
-- 
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/groups/opt_out.


Re: Am I missing something?

2013-12-04 Thread James Reeves
On 4 December 2013 10:37, James Laver james.la...@gmail.com wrote:


 On 4 Dec 2013, at 09:06, James Reeves ja...@booleanknot.com 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 between data coming from the route and data coming from the
 form data, since after vaidation, that gets shoved straight into the
 database.


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 like:

(POST /blah/:id [id :as {params :form-params}] ...)

This would get the id from the routes (as they're always merged last), and
the parameters map from :form-params.

- James

-- 
-- 
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/groups/opt_out.


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 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/groups/opt_out.


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 accumulator does not seem 
too far fetched to me.

According to clojure.org/transients: Transients support the read-only 
interface of the source, i.e. you can call *nth*, *get*, *count* and 
fn-call a transient vector, just like a persistent vector.

Did you search in Jira whether this is a known issue?


Regards,
Stefan

-- 
-- 
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/groups/opt_out.


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 (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 accumulator does not seem 
 too far fetched to me.

 According to clojure.org/transients: Transients support the read-only 
 interface of the source, i.e. you can call *nth*, *get*, *count* and 
 fn-call a transient vector, just like a persistent vector.

 Did you search in Jira whether this is a known issue?


 Regards,
 Stefan


-- 
-- 
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/groups/opt_out.


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 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 (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 accumulator does not 
 seem too far fetched to me.

 According to clojure.org/transients: Transients support the read-only 
 interface of the source, i.e. you can call *nth*, *get*, *count* and 
 fn-call a transient vector, just like a persistent vector.

 Did you search in Jira whether this is a known issue?


 Regards,
 Stefan



-- 
-- 
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/groups/opt_out.


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's very encouraging to hear such positive feedback :) I'm 
 glad it was useful for you!

 Daniel


 On Sunday, December 1, 2013 7:51:35 PM UTC-5, Paddy Gallagher wrote:

 Daniel,

 I've just finished reading this series and thought it was superb. The 
 Emacs chapters in particular were a massive help. I'm a complete newbie 
 with Emacs and the detail here was pitched just perfectly. It got me 
 exactly what I needed to start to become productive very quickly. 

 I highly recommend it as a resource both for the excellent 
 content/philosophy and humour :)

 It personally made my introductory Clojure learning experience a very 
 enjoyable one. 

 Thanks Daniel and hello from London :)

 cheers

 Paddy

 On Monday, September 2, 2013 4:35:52 PM UTC+1, Daniel Higginbotham wrote:

 Hi all,

 I've been putting together http://www.braveclojure.com/ and would love 
 feedback. I've tried to make it entertaining and super beginner-friendly.

 Thanks!
 Daniel



-- 
-- 
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/groups/opt_out.


Re: Am I missing something?

2013-12-04 Thread James Laver
On 4 Dec 2013, at 11:38, James Reeves ja...@booleanknot.com 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 like:
 
 (POST /blah/:id [id :as {params :form-params}] ...)
 
 This would get the id from the routes (as they're always merged last), and 
 the parameters map from :form-params.

Hi James,

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 not 
likely to want to change an integer primary key, but bear with me)
- I then need access to not only the value of the id from the params but also 
the value from the post data, separately
- :form-params uses string keys not keywords so it then needs to be 
keywordified before it’s suitable for passing to the database layer (not to 
mention to make it significantly less of a pain to work with in userland code)

I think it’s mostly the effect of trying to use all of the pieces together 
that’s causing me some pain. I’ve now worked around it with the middleware I 
previously posted, but it was a little surprising that I had to.

Would you mind please explaining:
a: how that syntax deals with merges? I don’t quite understand what’s going on 
underneath. Does that actually bind to params?
b: how i could get those params extracted into a variable as well as access to 
the request map?

Cheers,
James

-- 
-- 
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/groups/opt_out.


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, Alex P wrote:

 It's different in a way we manipulate the data:

 We've opted out for default-lazy way (you're getting and setting separate 
 values instead of serialising/deserialising an entire payload).



-- 
-- 
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/groups/opt_out.


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 oleksandr.pet...@gmail.com 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`.

Is there any plan to support bit-fields? My main interest at present
is the Diameter protocol, where some individual bits in the header are
true/false flags - Gloss decodes that nicely into a sequence of bools,
but I can't see similar support in Buffy.

-- 
-- 
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/groups/opt_out.


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

 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 accumulator does not seem 
 too far fetched to me.

 According to clojure.org/transients: Transients support the read-only 
 interface of the source, i.e. you can call *nth*, *get*, *count* and 
 fn-call a transient vector, just like a persistent vector.

 Did you search in Jira whether this is a known issue?


 Regards,
 Stefan


-- 
-- 
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/groups/opt_out.


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)
 ; = 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)
 ; = nil

 How can I check whether an element is contained in a transient set?




-- 
-- 
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/groups/opt_out.


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 ltoro...@gmail.com wrote:

 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 burkhardt.r...@googlemail.com

 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)
 ; = nil

 How can I check whether an element is contained in a transient set?


  --
 --
 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/groups/opt_out.




 --
 László Török

 --
 --
 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/groups/opt_out.




-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]

-- 
-- 
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/groups/opt_out.


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 a...@puredanger.com

 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)
 ; = 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)
 ; = nil

 How can I check whether an element is contained in a transient set?


  --
 --
 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/groups/opt_out.




-- 
László Török

-- 
-- 
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/groups/opt_out.


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 loops and it is 
the white players turn, after they have entered their move the program 
crashes with the stacktrace at the bottom of this message.. 

I seem to be having a brain fuzz moment because I can't see how much 
application would complete happily the first time through without error, 
then when the nearly identical steps are taken for turn two, I seem to have 
a type error. The code is 
here: 
https://github.com/mankyKitty/clojure-othello/blob/master/src/othello/core.clj 
. I know it's not great, work in progress! :)

From what I can tell from the ST the error is from my squares-to-flip 
function but I'm unable to reproduce the results in the repl, and I've yet 
to reach the point where I'm adding a print on every second line (though 
I'm close). 

I had originally deduced it was the 'merge' call on the times I would have 
an empty second argument, hence the 'if' in there but that doesn't appear 
to have helped at all.

I assume it's something I've not anticipated or accounted for with respect 
to my loop, but I'm not quite sure.. 

Thanks in advance !

--- STACKTRACE ---

Exception in thread main java.lang.ClassCastException: 
clojure.lang.PersistentHashMap cannot be cast to java.util.Map$Entry
at clojure.lang.APersistentMap.cons(APersistentMap.java:42)
at clojure.lang.RT.conj(RT.java:562)
at clojure.core$conj.invoke(core.clj:83)
at clojure.core$merge$fn__4275.invoke(core.clj:2684)
at clojure.core$reduce1.invoke(core.clj:896)
at clojure.core$reduce1.invoke(core.clj:887)
at clojure.core$merge.doInvoke(core.clj:2684)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at othello.core$squares_to_flip.invoke(core.clj:186)
at othello.core$game_loop.invoke(core.clj:213)
at othello.core$_main.doInvoke(core.clj:225)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.Var.invoke(Var.java:411)
at user$eval5$fn__7.invoke(form-init5981136443637675542.clj:1)
at user$eval5.invoke(form-init5981136443637675542.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.Compiler.loadFile(Compiler.java:7020)
at clojure.main$load_script.invoke(main.clj:294)
at clojure.main$init_opt.invoke(main.clj:299)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)

-- 
-- 
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/groups/opt_out.


Re: Am I missing something?

2013-12-04 Thread James Reeves
On 4 December 2013 14:04, James Laver james.la...@gmail.com 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
 not likely to want to change an integer primary key, but bear with me)
 - I then need access to not only the value of the id from the params but
 also the value from the post data, separately
 - :form-params uses string keys not keywords so it then needs to be
 keywordified before it’s suitable for passing to the database layer (not to
 mention to make it significantly less of a pain to work with in userland
 code)


Surely that's only a problem if you choose names for your route parameters
that conflict with your form parameters?



 I think it’s mostly the effect of trying to use all of the pieces together
 that’s causing me some pain. I’ve now worked around it with the middleware
 I previously posted, but it was a little surprising that I had to.

 Would you mind please explaining:
 a: how that syntax deals with merges? I don’t quite understand what’s
 going on underneath. Does that actually bind to params?
 b: how i could get those params extracted into a variable as well as
 access to the request map?


The code sample demonstrates using normal Clojure destructuring with
Compojure's more specialised kind. I wasn't merging anything, I was just
pulling out the form parameters and a parameter named id.

This is covered in more detail in the Compojure wiki:

https://github.com/weavejester/compojure/wiki/Destructuring-Syntax

- James

-- 
-- 
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/groups/opt_out.


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 querying+manipulation of log as a 
Clojure value: the log is just a vector of ordered maps. Works great with 
Datomic's query engine, or regular seq fns (filter, group-by, sort-by, 
etc.).
* Support for ad hoc logging config - no longer reliant on a global config 
atom (though it's still there for convenience).
* Appender rate limiter has been made a lot more flexible, useful by 
default.

https://github.com/ptaoussanis/timbre
https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md
http://ptaoussanis.github.io/timbre/ - API docs


*Carmine v2.4.0 - 2013-11-18*
===
Redis client  message queue

Major recent changes:
* Completely rewrote message queue system - numerous big improvements, 
incl. important reliability improvements.
* Completely rewrote reply parsing system for robustness + flexibility.
* Brought Tundra out of alpha, added S3 datastore. Allows automatic data 
replication to a secondary data store, and an option to automatically evict 
cold keys from memory. Basically provides a convenient way of running Redis 
against much larger datasets than can fit in memory.
* Big improvements to atomic operations API - everything has been unified 
behind a single interface.
* A ton of other small improvements, including bug fixes.

https://github.com/ptaoussanis/carmine
https://github.com/ptaoussanis/carmine/blob/master/CHANGELOG.md
http://ptaoussanis.github.io/carmine/ - API docs


*Nippy v2.5.1 - 2013-12-04*
=
Extendable, high-performance, binary serialization

Major recent changes:
* Continued performance work. Think it's ballpark about as fast as it's 
going to get.
* LZMA2 very-high-compression compressor (ahem).
* New Java Serializable fallback support. Basically serializes anything you 
can throw at it - will select the best available method. Notably Throwables 
of all types are now covered.

https://github.com/ptaoussanis/nippy
https://github.com/ptaoussanis/nippy/blob/master/CHANGELOG.md
http://ptaoussanis.github.io/nippy/ - API docs


*Tower v2.0.1 - 2013-11-06*
=
Internationalisation (i18n) and localisation (L10n) tools

Major recent changes:
* Stable.

https://github.com/ptaoussanis/tower
https://github.com/ptaoussanis/tower/blob/master/CHANGELOG.md
http://ptaoussanis.github.io/tower/ - API docs


*Faraday v1.0.1 - 2013-12-04*
==
Amazon DynamoDB client

Major recent changes:
* Went 1.0, production-ready.

https://github.com/ptaoussanis/faraday
https://github.com/ptaoussanis/faraday/blob/master/CHANGELOG.md
http://ptaoussanis.github.io/faraday/ - API docs


*Touchstone v2.0.1 - 2013-11-25*
=
High performance, rapidly converging A/B testing tool

Major recent changes:
* Stable.

https://github.com/ptaoussanis/touchstone
https://github.com/ptaoussanis/touchstone/blob/master/CHANGELOG.md
http://ptaoussanis.github.io/touchstone/ - API docs


*General status*


Tower still requires Clourescript dictionary support - hope to find some 
time to look into that in the coming weeks. Carmine's got a bunch of 
changes coming up to support Redis Cluster  Sentinel - though I'm waiting 
on the specs there to get finalised first. Everything else should 
(hopefully) stay more or less stable from here (modulo bugs).

Carmine's in good shape as of v2.4. Timbre's in good shape as of v3, though 
the RC will need some time to settle before I'm confident it's good for 
production.

Ahh- yeah, nothing else I can think of.

Hit me up if you have any questions/problems/wanna-say-hi/whatever.

Cheers! :-)

-- 

*Peter Taoussanis*ptaoussanis at gmail.com
https://twitter.com/ptaoussanis

-- 
-- 
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/groups/opt_out.


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 ptaoussa...@gmail.com wrote:

 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 querying+manipulation of log as a
 Clojure value: the log is just a vector of ordered maps. Works great with
 Datomic's query engine, or regular seq fns (filter, group-by, sort-by,
 etc.).
 * Support for ad hoc logging config - no longer reliant on a global config
 atom (though it's still there for convenience).
 * Appender rate limiter has been made a lot more flexible, useful by
 default.

 https://github.com/ptaoussanis/timbre
 https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/timbre/ - API docs


 *Carmine v2.4.0 - 2013-11-18*
 ===
 Redis client  message queue

 Major recent changes:
 * Completely rewrote message queue system - numerous big improvements,
 incl. important reliability improvements.
 * Completely rewrote reply parsing system for robustness + flexibility.
 * Brought Tundra out of alpha, added S3 datastore. Allows automatic data
 replication to a secondary data store, and an option to automatically evict
 cold keys from memory. Basically provides a convenient way of running Redis
 against much larger datasets than can fit in memory.
 * Big improvements to atomic operations API - everything has been unified
 behind a single interface.
 * A ton of other small improvements, including bug fixes.

 https://github.com/ptaoussanis/carmine
 https://github.com/ptaoussanis/carmine/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/carmine/ - API docs


 *Nippy v2.5.1 - 2013-12-04*
 =
 Extendable, high-performance, binary serialization

 Major recent changes:
 * Continued performance work. Think it's ballpark about as fast as it's
 going to get.
 * LZMA2 very-high-compression compressor (ahem).
 * New Java Serializable fallback support. Basically serializes anything
 you can throw at it - will select the best available method. Notably
 Throwables of all types are now covered.

 https://github.com/ptaoussanis/nippy
 https://github.com/ptaoussanis/nippy/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/nippy/ - API docs


 *Tower v2.0.1 - 2013-11-06*
 =
 Internationalisation (i18n) and localisation (L10n) tools

 Major recent changes:
 * Stable.

 https://github.com/ptaoussanis/tower
 https://github.com/ptaoussanis/tower/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/tower/ - API docs


 *Faraday v1.0.1 - 2013-12-04*
 ==
 Amazon DynamoDB client

 Major recent changes:
 * Went 1.0, production-ready.

 https://github.com/ptaoussanis/faraday
 https://github.com/ptaoussanis/faraday/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/faraday/ - API docs


 *Touchstone v2.0.1 - 2013-11-25*
 =
 High performance, rapidly converging A/B testing tool

 Major recent changes:
 * Stable.

 https://github.com/ptaoussanis/touchstone
 https://github.com/ptaoussanis/touchstone/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/touchstone/ - API docs


 *General status*
 

 Tower still requires Clourescript dictionary support - hope to find some
 time to look into that in the coming weeks. Carmine's got a bunch of
 changes coming up to support Redis Cluster  Sentinel - though I'm waiting
 on the specs there to get finalised first. Everything else should
 (hopefully) stay more or less stable from here (modulo bugs).

 Carmine's in good shape as of v2.4. Timbre's in good shape as of v3,
 though the RC will need some time to settle before I'm confident it's good
 for production.

 Ahh- yeah, nothing else I can think of.

 Hit me up if you have any questions/problems/wanna-say-hi/whatever.

 Cheers! :-)

 --

 *Peter Taoussanis*ptaoussanis at gmail.com
 https://twitter.com/ptaoussanis

 --
 --
 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/groups/opt_out.


-- 
-- 
You received this message 

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 merge fst others) since others is a seq 
of maps.


On Wednesday, December 4, 2013 10:24:42 AM UTC-6, Sean Chalmers wrote:

 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 loops and it is 
 the white players turn, after they have entered their move the program 
 crashes with the stacktrace at the bottom of this message.. 

 I seem to be having a brain fuzz moment because I can't see how much 
 application would complete happily the first time through without error, 
 then when the nearly identical steps are taken for turn two, I seem to have 
 a type error. The code is here: 
 https://github.com/mankyKitty/clojure-othello/blob/master/src/othello/core.clj.
  I know it's not great, work in progress! :)

 From what I can tell from the ST the error is from my squares-to-flip 
 function but I'm unable to reproduce the results in the repl, and I've yet 
 to reach the point where I'm adding a print on every second line (though 
 I'm close). 

 I had originally deduced it was the 'merge' call on the times I would have 
 an empty second argument, hence the 'if' in there but that doesn't appear 
 to have helped at all.

 I assume it's something I've not anticipated or accounted for with respect 
 to my loop, but I'm not quite sure.. 

 Thanks in advance !

 --- STACKTRACE ---

 Exception in thread main java.lang.ClassCastException: 
 clojure.lang.PersistentHashMap cannot be cast to java.util.Map$Entry
 at clojure.lang.APersistentMap.cons(APersistentMap.java:42)
 at clojure.lang.RT.conj(RT.java:562)
 at clojure.core$conj.invoke(core.clj:83)
 at clojure.core$merge$fn__4275.invoke(core.clj:2684)
 at clojure.core$reduce1.invoke(core.clj:896)
 at clojure.core$reduce1.invoke(core.clj:887)
 at clojure.core$merge.doInvoke(core.clj:2684)
 at clojure.lang.RestFn.invoke(RestFn.java:421)
 at othello.core$squares_to_flip.invoke(core.clj:186)
 at othello.core$game_loop.invoke(core.clj:213)
 at othello.core$_main.doInvoke(core.clj:225)
 at clojure.lang.RestFn.invoke(RestFn.java:397)
 at clojure.lang.Var.invoke(Var.java:411)
 at user$eval5$fn__7.invoke(form-init5981136443637675542.clj:1)
 at user$eval5.invoke(form-init5981136443637675542.clj:1)
 at clojure.lang.Compiler.eval(Compiler.java:6619)
 at clojure.lang.Compiler.eval(Compiler.java:6609)
 at clojure.lang.Compiler.load(Compiler.java:7064)
 at clojure.lang.Compiler.loadFile(Compiler.java:7020)
 at clojure.main$load_script.invoke(main.clj:294)
 at clojure.main$init_opt.invoke(main.clj:299)
 at clojure.main$initialize.invoke(main.clj:327)
 at clojure.main$null_opt.invoke(main.clj:362)
 at clojure.main$main.doInvoke(main.clj:440)
 at clojure.lang.RestFn.invoke(RestFn.java:421)
 at clojure.lang.Var.invoke(Var.java:419)
 at clojure.lang.AFn.applyToHelper(AFn.java:163)
 at clojure.lang.Var.applyTo(Var.java:532)
 at clojure.main.main(main.java:37)


-- 
-- 
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/groups/opt_out.


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 so that the 
wait time between releases is reduced (and the volume of included patches 
is increased). Voting for an issue helps raise its visibility and level of 
community interest and that is one of the most important things we look at 
for triage. 

Alex

On Wednesday, December 4, 2013 10:00:20 AM UTC-6, Las wrote:

 cool! hope the patch is good for 1.6! :)


 2013/12/4 Alex Miller al...@puredanger.com javascript:

 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)
 ; = 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)
 ; = nil

 How can I check whether an element is contained in a transient set?


  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 László Török
  

-- 
-- 
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/groups/opt_out.


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. !

On 04/12/2013, at 7:17 PM, Alex Miller a...@puredanger.com 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 used seq as the test.
 
 However, without really reading this too closely, I'd guess the real problem 
 is that you want to (apply merge fst others) since others is a seq of maps.
 
 
 On Wednesday, December 4, 2013 10:24:42 AM UTC-6, Sean Chalmers wrote:
 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 loops and it is the white 
 players turn, after they have entered their move the program crashes with the 
 stacktrace at the bottom of this message.. 
 
 I seem to be having a brain fuzz moment because I can't see how much 
 application would complete happily the first time through without error, then 
 when the nearly identical steps are taken for turn two, I seem to have a type 
 error. The code is here: 
 https://github.com/mankyKitty/clojure-othello/blob/master/src/othello/core.clj
  . I know it's not great, work in progress! :)
 
 From what I can tell from the ST the error is from my squares-to-flip 
 function but I'm unable to reproduce the results in the repl, and I've yet to 
 reach the point where I'm adding a print on every second line (though I'm 
 close). 
 
 I had originally deduced it was the 'merge' call on the times I would have an 
 empty second argument, hence the 'if' in there but that doesn't appear to 
 have helped at all.
 
 I assume it's something I've not anticipated or accounted for with respect to 
 my loop, but I'm not quite sure.. 
 
 Thanks in advance !
 
 --- STACKTRACE ---
 
 Exception in thread main java.lang.ClassCastException: 
 clojure.lang.PersistentHashMap cannot be cast to java.util.Map$Entry
   at clojure.lang.APersistentMap.cons(APersistentMap.java:42)
   at clojure.lang.RT.conj(RT.java:562)
   at clojure.core$conj.invoke(core.clj:83)
   at clojure.core$merge$fn__4275.invoke(core.clj:2684)
   at clojure.core$reduce1.invoke(core.clj:896)
   at clojure.core$reduce1.invoke(core.clj:887)
   at clojure.core$merge.doInvoke(core.clj:2684)
   at clojure.lang.RestFn.invoke(RestFn.java:421)
   at othello.core$squares_to_flip.invoke(core.clj:186)
   at othello.core$game_loop.invoke(core.clj:213)
   at othello.core$_main.doInvoke(core.clj:225)
   at clojure.lang.RestFn.invoke(RestFn.java:397)
   at clojure.lang.Var.invoke(Var.java:411)
   at user$eval5$fn__7.invoke(form-init5981136443637675542.clj:1)
   at user$eval5.invoke(form-init5981136443637675542.clj:1)
   at clojure.lang.Compiler.eval(Compiler.java:6619)
   at clojure.lang.Compiler.eval(Compiler.java:6609)
   at clojure.lang.Compiler.load(Compiler.java:7064)
   at clojure.lang.Compiler.loadFile(Compiler.java:7020)
   at clojure.main$load_script.invoke(main.clj:294)
   at clojure.main$init_opt.invoke(main.clj:299)
   at clojure.main$initialize.invoke(main.clj:327)
   at clojure.main$null_opt.invoke(main.clj:362)
   at clojure.main$main.doInvoke(main.clj:440)
   at clojure.lang.RestFn.invoke(RestFn.java:421)
   at clojure.lang.Var.invoke(Var.java:419)
   at clojure.lang.AFn.applyToHelper(AFn.java:163)
   at clojure.lang.Var.applyTo(Var.java:532)
   at clojure.main.main(main.java:37)
 
 -- 
 -- 
 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/KLHo7zV66Gc/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/groups/opt_out.

-- 
-- 
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 

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 able to `apply` the functions to lists of 
arguments, as java constructors cannot be applied (AFAIK, would be great if 
I'm wrong - would solve a lot of my problems!).

The problem is - java constructors are overloaded:

A(String x, int y, int z)
A(BigDecimal x, String y, int z)
...

I was trying to generate such functions in my top-level form, like this:

(doseq [[java-ctor fn-name] [['A. 'mk-a] [B'. 'mk-b]]
  (eval `(defn ~fn-name [x# y# z#]
   (cond (string? x#)
  (~java-ctor ^String x# y# z#)

  (string? y#)
  (~java-ctor x# ^String y# z#

Which still generates reflection warnings as type hints are read by the 
reader and applied to the forms read by the eval, not the result of the 
eval itself (please, correct me if I'm wrong here).

I have a suspicion that the way I'm approaching the problem is wrong :)
How should I go around solving this problem?

-- 
-- 
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/groups/opt_out.


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 update the nodes.  I am wondering if a purely functional 
approach is better than using side effects.

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).

I looked into this nice document 
https://github.com/Prismatic/eng-practices/blob/master/clojure/20130926-data-representation.md
 to 
help me choose the right data structure.
When maximum efficiency is important they suggest defrecord, deftype or 
reify.
If I go for an imperative implementation it seems like deftype to represent 
the tree nodes would work well since it allows for mutable fields.

Any advice on choosing the right data structure and whether to use 
a functional or imperative implementation is appreciated.

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/groups/opt_out.


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 deadmo...@gmail.com 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
 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 able to `apply` the functions to lists of
 arguments, as java constructors cannot be applied (AFAIK, would be great if
 I'm wrong - would solve a lot of my problems!).

 The problem is - java constructors are overloaded:

 A(String x, int y, int z)
 A(BigDecimal x, String y, int z)
 ...

 I was trying to generate such functions in my top-level form, like this:

 (doseq [[java-ctor fn-name] [['A. 'mk-a] [B'. 'mk-b]]
   (eval `(defn ~fn-name [x# y# z#]
(cond (string? x#)
   (~java-ctor ^String x# y# z#)

   (string? y#)
   (~java-ctor x# ^String y# z#

 Which still generates reflection warnings as type hints are read by the
 reader and applied to the forms read by the eval, not the result of the
 eval itself (please, correct me if I'm wrong here).

 I have a suspicion that the way I'm approaching the problem is wrong :)
 How should I go around solving this problem?

 --
 --
 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/groups/opt_out.


-- 
-- 
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/groups/opt_out.


Re: Advice on choosing the right data structure

2013-12-04 Thread James Reeves
On 4 December 2013 20:27, dabd dario.reh...@gmail.com 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 think you'll have performance problems? Have you benchmarked and
checked? :)

- James

-- 
-- 
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/groups/opt_out.


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 December 2013 20:27, dabd dario@gmail.com javascript: 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 think you'll have performance problems? Have you benchmarked and 
 checked? :)

 - James


-- 
-- 
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/groups/opt_out.


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, dabd dario.reh...@gmail.com 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.

 On Wednesday, December 4, 2013 8:38:17 PM UTC, James Reeves wrote:

 On 4 December 2013 20:27, dabd dario@gmail.com 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 think you'll have performance problems? Have you benchmarked and
 checked? :)

 - James

  --
 --
 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/groups/opt_out.




-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]

-- 
-- 
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/groups/opt_out.


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 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, dabd dario@gmail.com javascript: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.

 On Wednesday, December 4, 2013 8:38:17 PM UTC, James Reeves wrote:

 On 4 December 2013 20:27, dabd dario@gmail.com 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 think you'll have performance problems? Have you benchmarked and 
 checked? :)

 - James

  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which 
 may be sweet, aromatic, fermented or spirit-based. ... Family and social 
 life also offer numerous other occasions to consume drinks for pleasure. 
 [Larousse, Drink entry]

  

-- 
-- 
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/groups/opt_out.


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 dario.reh...@gmail.com wrote:

 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 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, dabd dario@gmail.com 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.

 On Wednesday, December 4, 2013 8:38:17 PM UTC, James Reeves wrote:

 On 4 December 2013 20:27, dabd dario@gmail.com 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 think you'll have performance problems? Have you benchmarked and
 checked? :)

 - James

  --
 --
 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/groups/opt_out.




 --
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks,
 which may be sweet, aromatic, fermented or spirit-based. ... Family and
 social life also offer numerous other occasions to consume drinks for
 pleasure. [Larousse, Drink entry]

   --
 --
 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/groups/opt_out.




-- 
Ben Wolfson
Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure.
[Larousse, Drink entry]

-- 
-- 
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/groups/opt_out.


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] ...))

 - James


 On 4 December 2013 19:55, dm3 dead...@gmail.com javascript: 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 
 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 able to `apply` the functions to lists of 
 arguments, as java constructors cannot be applied (AFAIK, would be great if 
 I'm wrong - would solve a lot of my problems!).

 The problem is - java constructors are overloaded:

 A(String x, int y, int z)
 A(BigDecimal x, String y, int z)
 ...

 I was trying to generate such functions in my top-level form, like this:

 (doseq [[java-ctor fn-name] [['A. 'mk-a] [B'. 'mk-b]]
   (eval `(defn ~fn-name [x# y# z#]
(cond (string? x#)
   (~java-ctor ^String x# y# z#)

   (string? y#)
   (~java-ctor x# ^String y# z#

 Which still generates reflection warnings as type hints are read by the 
 reader and applied to the forms read by the eval, not the result of the 
 eval itself (please, correct me if I'm wrong here).

 I have a suspicion that the way I'm approaching the problem is wrong :)
 How should I go around solving this problem?

 -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 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 javascript:
 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 javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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/groups/opt_out.


Re: Advice on choosing the right data structure

2013-12-04 Thread James Reeves
On 4 December 2013 21:09, dabd dario.reh...@gmail.com 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 end? for a depth-first transversal?

- James

-- 
-- 
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/groups/opt_out.


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 need to make the same swap in any libraries you 
use with your zippers (like zip-visit) since fast-zip is not implementation 
compatible with clojure.zip.

More broadly, I've found that straight up recursive algorithms can be a lot 
faster than zippers, especially for read only operations. Of course the 
stack size limits what you can do with tree recursion. As others have said, 
it's best to see if you actually have performance problems first. 

On Wednesday, December 4, 2013 5:30:02 PM UTC-5, James Reeves wrote:

 On 4 December 2013 21:09, dabd dario@gmail.com javascript: 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 end? for a depth-first transversal?

 - James


-- 
-- 
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/groups/opt_out.


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 b.gh...@gmail.com 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 ptaoussa...@gmail.com wrote:

 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 querying+manipulation of log as a
 Clojure value: the log is just a vector of ordered maps. Works great with
 Datomic's query engine, or regular seq fns (filter, group-by, sort-by,
 etc.).
 * Support for ad hoc logging config - no longer reliant on a global config
 atom (though it's still there for convenience).
 * Appender rate limiter has been made a lot more flexible, useful by
 default.

 https://github.com/ptaoussanis/timbre
 https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/timbre/ - API docs


 Carmine v2.4.0 - 2013-11-18
 ===
 Redis client  message queue

 Major recent changes:
 * Completely rewrote message queue system - numerous big improvements,
 incl. important reliability improvements.
 * Completely rewrote reply parsing system for robustness + flexibility.
 * Brought Tundra out of alpha, added S3 datastore. Allows automatic data
 replication to a secondary data store, and an option to automatically evict
 cold keys from memory. Basically provides a convenient way of running Redis
 against much larger datasets than can fit in memory.
 * Big improvements to atomic operations API - everything has been unified
 behind a single interface.
 * A ton of other small improvements, including bug fixes.

 https://github.com/ptaoussanis/carmine
 https://github.com/ptaoussanis/carmine/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/carmine/ - API docs


 Nippy v2.5.1 - 2013-12-04
 =
 Extendable, high-performance, binary serialization

 Major recent changes:
 * Continued performance work. Think it's ballpark about as fast as it's
 going to get.
 * LZMA2 very-high-compression compressor (ahem).
 * New Java Serializable fallback support. Basically serializes anything
 you can throw at it - will select the best available method. Notably
 Throwables of all types are now covered.

 https://github.com/ptaoussanis/nippy
 https://github.com/ptaoussanis/nippy/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/nippy/ - API docs


 Tower v2.0.1 - 2013-11-06
 =
 Internationalisation (i18n) and localisation (L10n) tools

 Major recent changes:
 * Stable.

 https://github.com/ptaoussanis/tower
 https://github.com/ptaoussanis/tower/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/tower/ - API docs


 Faraday v1.0.1 - 2013-12-04
 ==
 Amazon DynamoDB client

 Major recent changes:
 * Went 1.0, production-ready.

 https://github.com/ptaoussanis/faraday
 https://github.com/ptaoussanis/faraday/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/faraday/ - API docs


 Touchstone v2.0.1 - 2013-11-25
 =
 High performance, rapidly converging A/B testing tool

 Major recent changes:
 * Stable.

 https://github.com/ptaoussanis/touchstone
 https://github.com/ptaoussanis/touchstone/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/touchstone/ - API docs


 General status
 

 Tower still requires Clourescript dictionary support - hope to find some
 time to look into that in the coming weeks. Carmine's got a bunch of changes
 coming up to support Redis Cluster  Sentinel - though I'm waiting on the
 specs there to get finalised first. Everything else should (hopefully) stay
 more or less stable from here (modulo bugs).

 Carmine's in good shape as of v2.4. Timbre's in good shape as of v3,
 though the RC will need some time to settle before I'm confident it's good
 for production.

 Ahh- yeah, nothing else I can think of.

 Hit me up if you have any questions/problems/wanna-say-hi/whatever.

 Cheers! :-)

 --
 Peter Taoussanis
 ptaoussanis at gmail.com
 https://twitter.com/ptaoussanis

 --
 --
 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 

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't we add a function like 
children-as-locs to the API for this purpose or is there another way?

(defn children-as-locs
  Returns a seq of locs of the children of loc.
  [loc]
  (when (z/branch? loc)
(let [[node path] loc
  cs (z/children loc)]
  (map-indexed (fn [i c]
 (with-meta [c {:l (vec (take i cs)) 
:pnodes (if path (conj (:pnodes path) 
node) [node]) 
:ppath path 
:r (vec (drop (inc i) cs))}] 
   (meta loc)))
   cs

On Wednesday, December 4, 2013 11:46:29 PM UTC, Alexander Hudek wrote:

 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 need to make the same swap in any libraries you 
 use with your zippers (like zip-visit) since fast-zip is not implementation 
 compatible with clojure.zip.

 More broadly, I've found that straight up recursive algorithms can be a 
 lot faster than zippers, especially for read only operations. Of course the 
 stack size limits what you can do with tree recursion. As others have said, 
 it's best to see if you actually have performance problems first. 

 On Wednesday, December 4, 2013 5:30:02 PM UTC-5, James Reeves wrote:

 On 4 December 2013 21:09, dabd dario@gmail.com 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 end? for a depth-first transversal?

 - James



-- 
-- 
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/groups/opt_out.


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.
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/groups/opt_out.


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 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 querying+manipulation of log as a 
 Clojure value: the log is just a vector of ordered maps. Works great with 
 Datomic's query engine, or regular seq fns (filter, group-by, sort-by, 
 etc.).
 * Support for ad hoc logging config - no longer reliant on a global config 
 atom (though it's still there for convenience).
 * Appender rate limiter has been made a lot more flexible, useful by 
 default.

 https://github.com/ptaoussanis/timbre
 https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/timbre/ - API docs


 *Carmine v2.4.0 - 2013-11-18*
 ===
 Redis client  message queue

 Major recent changes:
 * Completely rewrote message queue system - numerous big improvements, 
 incl. important reliability improvements.
 * Completely rewrote reply parsing system for robustness + flexibility.
 * Brought Tundra out of alpha, added S3 datastore. Allows automatic data 
 replication to a secondary data store, and an option to automatically evict 
 cold keys from memory. Basically provides a convenient way of running Redis 
 against much larger datasets than can fit in memory.
 * Big improvements to atomic operations API - everything has been unified 
 behind a single interface.
 * A ton of other small improvements, including bug fixes.

 https://github.com/ptaoussanis/carmine
 https://github.com/ptaoussanis/carmine/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/carmine/ - API docs


 *Nippy v2.5.1 - 2013-12-04*
 =
 Extendable, high-performance, binary serialization

 Major recent changes:
 * Continued performance work. Think it's ballpark about as fast as it's 
 going to get.
 * LZMA2 very-high-compression compressor (ahem).
 * New Java Serializable fallback support. Basically serializes anything 
 you can throw at it - will select the best available method. Notably 
 Throwables of all types are now covered.

 https://github.com/ptaoussanis/nippy
 https://github.com/ptaoussanis/nippy/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/nippy/ - API docs


 *Tower v2.0.1 - 2013-11-06*
 =
 Internationalisation (i18n) and localisation (L10n) tools

 Major recent changes:
 * Stable.

 https://github.com/ptaoussanis/tower
 https://github.com/ptaoussanis/tower/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/tower/ - API docs


 *Faraday v1.0.1 - 2013-12-04*
 ==
 Amazon DynamoDB client

 Major recent changes:
 * Went 1.0, production-ready.

 https://github.com/ptaoussanis/faraday
 https://github.com/ptaoussanis/faraday/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/faraday/ - API docs


 *Touchstone v2.0.1 - 2013-11-25*
 =
 High performance, rapidly converging A/B testing tool

 Major recent changes:
 * Stable.

 https://github.com/ptaoussanis/touchstone
 https://github.com/ptaoussanis/touchstone/blob/master/CHANGELOG.md
 http://ptaoussanis.github.io/touchstone/ - API docs


 *General status*
 

 Tower still requires Clourescript dictionary support - hope to find some 
 time to look into that in the coming weeks. Carmine's got a bunch of 
 changes coming up to support Redis Cluster  Sentinel - though I'm waiting 
 on the specs there to get finalised first. Everything else should 
 (hopefully) stay more or less stable from here (modulo bugs).

 Carmine's in good shape as of v2.4. Timbre's in good shape as of v3, 
 though the RC will need some time to settle before I'm confident it's good 
 for production.

 Ahh- yeah, nothing else I can think of.

 Hit me up if you have any questions/problems/wanna-say-hi/whatever.

 Cheers! :-)

 -- 

 *Peter Taoussanis*ptaoussanis at gmail.com
 https://twitter.com/ptaoussanis


-- 
-- 
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/groups/opt_out.


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 written so the
goal was brevity+clarity. In production you'll generally be writing to a db
or some other form of distributed storage, so you'll be using your own
appender.

The Carmine appender is performant out-the-box (~50k+ writes/sec on decent
hardware).

-- 
*Peter Taoussanis*

-- 
-- 
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/groups/opt_out.


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 23:22:36 UTC+2, dm3 wrote:

 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] ...))

 - James


 On 4 December 2013 19:55, dm3 dead...@gmail.com 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 
 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 able to `apply` the functions to lists of 
 arguments, as java constructors cannot be applied (AFAIK, would be great if 
 I'm wrong - would solve a lot of my problems!).

 The problem is - java constructors are overloaded:

 A(String x, int y, int z)
 A(BigDecimal x, String y, int z)
 ...

 I was trying to generate such functions in my top-level form, like this:

 (doseq [[java-ctor fn-name] [['A. 'mk-a] [B'. 'mk-b]]
   (eval `(defn ~fn-name [x# y# z#]
(cond (string? x#)
   (~java-ctor ^String x# y# z#)

   (string? y#)
   (~java-ctor x# ^String y# z#

 Which still generates reflection warnings as type hints are read by the 
 reader and applied to the forms read by the eval, not the result of the 
 eval itself (please, correct me if I'm wrong here).

 I have a suspicion that the way I'm approaching the problem is wrong :)
 How should I go around solving this problem?

 -- 
 -- 
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.