Cool! I'm glad you found it useful :-)
On Wednesday, January 7, 2015 2:12:35 AM UTC+2, Andrey Antukh wrote:
>
> Hi!
>
> 2015-01-06 20:25 GMT+01:00 Noam Ben-Ari >:
>
>> Hi,
>>
>> I've written a small library (1 ns, 100 lines) to transform nested maps
>> from "dash-case" keys to "camelCase" keys an
You are right. If it is only applied to keys, like in Thomas's example, it
can be very helpful.
On Wednesday, January 7, 2015 11:21:39 AM UTC+2, Andrey Antukh wrote:
>
> Hello
>
> 2015-01-07 10:11 GMT+01:00 Noam Ben-Ari >:
>
>> @Thomas
>>
>> Unfortunately, clojure.walk is not StackOverflowError-s
Hello
2015-01-07 10:11 GMT+01:00 Noam Ben-Ari :
> @Thomas
>
> Unfortunately, clojure.walk is not StackOverflowError-safe. Same goes for
> tree-seq (uses walk). The only safe solution I found so far are zippers.
>
> Regarding memoization, yes I agree it will help if converting the same
> maps freq
@Thomas
Unfortunately, clojure.walk is not StackOverflowError-safe. Same goes for
tree-seq (uses walk). The only safe solution I found so far are zippers.
Regarding memoization, yes I agree it will help if converting the same maps
frequently, however at scale, with many users hitting the same A
Hi!
2015-01-06 20:25 GMT+01:00 Noam Ben-Ari :
> Hi,
>
> I've written a small library (1 ns, 100 lines) to transform nested maps
> from "dash-case" keys to "camelCase" keys and back.
>
> The original use case was taking MySQL records that use camelCase field
> names and convert them to dash-case s
If you want to boost performance a bit just memoize the conversion
functions. Memoize makes you vurnable to exploits though, better use
something with WeakRefs if you convert anything from untrusted sources (eg.
guava CacheBuilder). But given your usecase this will probably be the
biggest gain,
Thanks for this, Andy.
I see it uses postwalk and recursion for nested maps, so it will eventually
blow up the stack. Probably faster than a zipper though.
Also, for changing case it uses a custom split and join instead of regex, a
very interesting approach.
I won't be using it directly though
I have not used it, but from the docs it appears there is at least some
overlap with this library:
https://github.com/qerub/camel-snake-kebab
It mentions in its docs that it avoids using regex's.
Andy
On Tue, Jan 6, 2015 at 11:25 AM, Noam Ben-Ari wrote:
> Hi,
>
> I've written a small libr
Hi,
I've written a small library (1 ns, 100 lines) to transform nested maps
from "dash-case" keys to "camelCase" keys and back.
The original use case was taking MySQL records that use camelCase field
names and convert them to dash-case so they don't stick out like a sore
thumb in my code. Simi