>> Sean, Sean...I was just making fun of your signature. :)
>
> Phew! Just checking...
>
> (I'm on some lists where the response to similar questions has been
> "You want me to do your homework?"...)
The Clojure community is certainly not one of those.
Regards,
BG
--
Baishampayan Ghose
b.ghose
On Thu, Sep 30, 2010 at 11:54 PM, David Sletten wrote:
> Sean, Sean...I was just making fun of your signature. :)
Phew! Just checking...
(I'm on some lists where the response to similar questions has been
"You want me to do your homework?"...)
--
Sean A Corfield -- (904) 302-SEAN
Railo Technolo
On Oct 1, 2010, at 1:57 AM, Sean Corfield wrote:
> On Thu, Sep 30, 2010 at 12:52 AM, David Sletten wrote:
>> Huh?! How many solutions do you want? You're starting to annoy me Sean.
>
> Sorry dude. I think it's really insightful to see lots of different
> solutions to small point problems like t
On Thu, Sep 30, 2010 at 12:52 AM, David Sletten wrote:
> Huh?! How many solutions do you want? You're starting to annoy me Sean.
Sorry dude. I think it's really insightful to see lots of different
solutions to small point problems like this when you're learning a
language - particularly when the
I wrote a blog recently on a helper function I use for stuff like this
called mapmap:
http://tech.puredanger.com/2010/09/24/meet-my-little-friend-mapmap/
mapmap takes a function to generate keys and a function to generate
values, applies them to a sequence, and zipmaps their results. Using
a map
#(s/upper-case (name %))
Good and clear in this case.
#(-> % name s/upper-case)
I think that would be nice if there were three functions.
(comp s/upper-case name)
I think its hard to read for beginners, because you have to read it
backwards and no parens to indicate but you could say that the hav
Hi,
On 30 Sep., 09:37, Sean Corfield wrote:
> That's very similar to one of my attempts and... I don't know... I
> just don't like it as much. Splitting the map into two streams and
> zipping them back together just doesn't feel as 'nice' and making one
> pass over the key/value pairs of the map
On Sep 30, 2010, at 3:40 AM, Sean Corfield wrote:
> On Thu, Sep 30, 2010 at 12:30 AM, Mark Engelberg
> wrote:
>> Except that if you use .toUpperCase, you have to remember to type hint
>> the input. Any time you call a Java method without type hinting, you
>> take a significant performance hit.
On Thu, Sep 30, 2010 at 12:30 AM, Mark Engelberg
wrote:
> Except that if you use .toUpperCase, you have to remember to type hint
> the input. Any time you call a Java method without type hinting, you
> take a significant performance hit. The wrapper function takes care
> of that for you.
Good t
On Thu, Sep 30, 2010 at 12:18 AM, Meikel Brandmeyer wrote:
> (defn to-string-keys
> [m]
> (zipmap (map (comp clojure.string/upper-case name) (keys m)) (vals
> m)))
That's very similar to one of my attempts and... I don't know... I
just don't like it as much. Splitting the map into two streams a
On Thu, Sep 30, 2010 at 12:24 AM, Baishampayan Ghose wrote:
> clojure.contrib.string/upper-case is a trivial wrapper over
> .toUpperCase. In my humble opinion it's perfectly OK to use such
> static Java methods directly instead of writing trivial wrappers
> around them.
Except that if you use .to
On Thu, Sep 30, 2010 at 12:24 AM, Baishampayan Ghose wrote:
> This also helps in avoiding the contrib dependency.
Good point. Thanx BG.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying someb
> On Wed, Sep 29, 2010 at 11:53 PM, Baishampayan Ghose
> wrote:
>> (into {} (for [[k v] { :stuff 42 :like 13 :this 7 }]
>> [(.toUpperCase (name k)) v]))
>
> (defn- to-struct [r] (into {} (for [[k v] r] [(.toUpperCase (name k)) v]))
>
> That is certainly nicer than most of my attempts, t
Hi,
On 30 Sep., 09:08, Sean Corfield wrote:
> That is certainly nicer than most of my attempts, thank you!
>
> Any reason for .toUpperCase instead of clojure.string/upper-case?
>
> Thanx also to David for the (empty m) tip (but I'm only working with
> hash maps at the moments).
In that case...
On Wed, Sep 29, 2010 at 11:53 PM, Baishampayan Ghose wrote:
> (into {} (for [[k v] { :stuff 42 :like 13 :this 7 }]
> [(.toUpperCase (name k)) v]))
(defn- to-struct [r] (into {} (for [[k v] r] [(.toUpperCase (name k)) v]))
That is certainly nicer than most of my attempts, thank you!
An
On Sep 30, 2010, at 2:53 AM, Baishampayan Ghose wrote:
>> I have a need to convert maps in the following ways:
>>
>> Given a map with keyword keys, I need a map with uppercase string keys
>> - and vice versa.
>>
>> { :stuff 42 :like 13 :this 7 } <=> { "STUFF" 42 "LIKE" 13 "THIS" 7 }
>
> What a
> I have a need to convert maps in the following ways:
>
> Given a map with keyword keys, I need a map with uppercase string keys
> - and vice versa.
>
> { :stuff 42 :like 13 :this 7 } <=> { "STUFF" 42 "LIKE" 13 "THIS" 7 }
What about this -
(into {} (for [[k v] { :stuff 42 :like 13 :this 7 }]
17 matches
Mail list logo