> 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 }]
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 }
I've come up with various functions to do this but so far they all
feel a bit clunky.
With all these reports of performance degradation, it sounds like it
would be really useful to have a performance regression suite.
-Per
On Thu, Sep 30, 2010 at 1:19 PM, Mark Engelberg
wrote:
> bitwise-and and bitwise-shift-right and bitwise-shift-left run more
> than 50 times slower in clojure
bitwise-and and bitwise-shift-right and bitwise-shift-left run more
than 50 times slower in clojure 1.3 alpha 1 versus clojure 1.2. Could
the 1.3 gurus please investigate this?
Try something like this to see the difference:
(time (doseq [x (range 10)] (bit-shift-left x 1)))
This points to an
I believe the performance problems boil down to the abysmal
performance of bit-shift-right and bit-and in Clojure 1.3 alpha 1.
I'll post this in a separate thread to make sure it gets read.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to th
2010/9/30 Phil Hagelberg
> The following form fails in Clojure 1.0, but was fixed in 1.1:
>
>(eval '(do (require 'clojure.inspector) clojure.inspector/inspect))
>
> It used to fail because it tried to compile the whole quoted form, but
> it couldn't compile the inspect reference because the r
But note that a namespace's definition may be spread among several source
files, though.
So you're just able to localize the "main" file of the namespace, which
contains the (ns) directive, but you can't localize the "loaded" files
participating to the namespace, those you contain (in-ns) directiv
The following form fails in Clojure 1.0, but was fixed in 1.1:
(eval '(do (require 'clojure.inspector) clojure.inspector/inspect))
It used to fail because it tried to compile the whole quoted form, but
it couldn't compile the inspect reference because the require hadn't
been run yet. I think
On Thu, Sep 30, 2010 at 04:48, HiHeelHottie wrote:
>
> Is there an idiomatic way to build up a string over different lines of
> code? Or, should one simply use StringBuilder.
>
>
I recently wrote a program that generates complex java enums (as source)
from input data recorded in clojure syntax (
On Wed, Sep 29, 2010 at 9:01 PM, HiHeelHottie wrote:
> Thanks for the response. What if you are appending over different
> lines of code? Would it be slightly more efficient to use one
> StringBuilder or not worth the bother.
I'm trying to think what your code would look like that you'd have
mu
Start with an empty vector, say v.
conj your strings to the vector at the various points in your code, so
at the end v will be something like
["this" "is" "a" "string"]
Then, when you're done, apply str to the vector, i.e., (apply str v) to get
"thisisastring"
str uses a string builder behind the
On Sep 29, 2010, at 11:01 PM, HiHeelHottie wrote:
> What if you are appending over different lines of code?
Could you give an example of what you're trying to do? Mutable strings are
almost never necessary, in my experience.
--
You received this message because you are subscribed to the Google
Thanks for the response. What if you are appending over different
lines of code? Would it be slightly more efficient to use one
StringBuilder or not worth the bother.
On Sep 29, 11:32 pm, Stuart Campbell wrote:
> On 30 September 2010 12:48, HiHeelHottie wrote:
>
>
>
> > Is there an idiomatic
On Sep 29, 2010, at 10:32 PM, Stuart Campbell wrote:
> I would just use (str) - it uses a StringBuilder when given more than one
> argument:
There's also (format), which I find helpful for building more complex strings.
--
You received this message because you are subscribed to the Google
Grou
On 30 September 2010 12:48, HiHeelHottie wrote:
>
> Is there an idiomatic way to build up a string over different lines of
> code? Or, should one simply use StringBuilder.
>
>
I would just use (str) - it uses a StringBuilder when given more than one
argument:
user> (source str)
(defn str
"Wit
It's too small to be an Emacs package, but I've forked it into its own
file and a few improvements have been made to it.
Here:
http://furius.ca/pubcode/pub/conf/common/elisp/blais/close-matching.el
( It is linked from this page: http://furius.ca/pubcode/ )
On Sep 28, 6:03 pm, ".Bill Smith"
Is there an idiomatic way to build up a string over different lines of
code? Or, should one simply use StringBuilder.
--
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
swank.commands.basic> (find-ns-definition 'clojure.set)
(("clojure.set" (:location (:zip
"/home/scott/project/lib/clojure-1.2.0-master-20100813.160144-94.jar"
"clojure/set.clj") (:line 1) nil)))
Scott
On Wed, Sep 29, 2010 at 6:34 PM, Jeff Valk wrote:
> On Wed, 29 Sep 2010 at 15:18, David Jagoe
On Wed, 29 Sep 2010 at 15:18, David Jagoe wrote:
> Anyone know of a utility that returns a absolute filename given a
> namespace symbol?
If you're using Emacs/SLIME, you could use swank-clojure's classpath browsing
information. The var "available-classes" in namespace "swank.util.class-browse"
Hi all,
Anyone know of a utility that returns a absolute filename given a
namespace symbol? Actually what I'm trying to do is adjust
ring.middleware.reload to only reload source files if they've changed
(otherwise I run into problems with session management), so if anyone
knows of utilities that a
Hi,
Am 29.09.2010 um 21:37 schrieb David Sletten:
> I was trying to remember how to do the new keywords, but I couldn't find an
> example. You have the default value for :test in there too.
It's basically normal map destructuring in the varags position, ie. after the &
in the argument list.
Si
Hello all,
I made an update to dj, for those who care. The new branch generaldeps
supports proper SNAPSHOT behavior and has been reworked to support
generically different types of dependencies.
Accessible at git://github.com/bmillare/dj.git
I've also compiled a more concise feature list.
# Feat
On Sep 29, 2010, at 11:01 AM, Meikel Brandmeyer wrote:
> Hi,
>
> a slight enhancement for 1.2: Clojure now supports keyword arguments
> directly.
>
> (defn find-all
> [item coll & {:keys [test test-not] :or {test =}}]
> (if test-not
>(remove #(test-not item %) coll)
>(filter #(test it
Thx, for your answers. Helps alot.
I think the clojure version is cleaner. The meaning of all those &...
words are confusing in CL.
--
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 tha
(pr-str '(+ 1 2)) :
pr-str is not given code-as-data , because it's not a macro. pr-str is given
the result of first evaluating its arg, that is '(+ 1 2). And evaluating '(+
1 2) results in the list (+ 1 2).
So pr-str is right, your assumptions were wrong.
To achieve your goal, just use (pr-str '
Ok, I see. The example from http://clojuredocs.org/v/1859 did mislead
me and is incorrect.
Thanks for your answer.
--
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
Hi,
On 29 Sep., 15:33, "K." wrote:
> For instance (pr-str '(+ 1 2)) returns "(+ 1 2)", which can not be
> read back since (eval (read-string (pr-str '(+ 1 2 returns 3!
Here is your misunderstanding. Reading ends at read-string. When you
look at the result you will find a list with the symbo
Hi,
a slight enhancement for 1.2: Clojure now supports keyword arguments
directly.
(defn find-all
[item coll & {:keys [test test-not] :or {test =}}]
(if test-not
(remove #(test-not item %) coll)
(filter #(test item %) coll)))
Sincerely
Meikel
--
You received this message because yo
On 09/24/2010 01:45 PM, Rasmus Svensson wrote:
> 2010/9/24 cej38 :
>> I noticed that clojure.string is not showing up on the API webpage,
>> http://clojure.github.com/clojure/, is that an oversight?
>>
>
> All the clojure.java.* namespaces and clojure.test are gone too... I
> don't think this is i
Hello,
I have some questions about how to use the prn functions.
>From the documentation of the prn function:
"[...] By default, pr and prn print in a way that objects can be read
by the reader [...]"
In this case, why does the prn-str function does not quote sequences?
For instance (pr-str '(+
On Sep 29, 2010, at 3:55 AM, nickikt wrote:
>
>
> (defun find-all (item sequence &rest keyword-args
> &key (test #'eql) test-not &allow-other-keys)
> "Find all those elements of sequence that match item,
> according to the keywords. Doesn't alter sequence."
> (if test-not
>
On Sep 29, 5:26 am, Stefan Kamphausen wrote:
> Hi,
>
> anybody seen this already?
>
> http://www.basementcoders.com/transcripts/James_Gosling_Transcript.html
> (Transcript fromhttp://basementcoders.com/?p=721)
>
> When being asked about other languages he says: "Clojure. Clojure's
> got a lot of
On Sep 29, 1:08 pm, Phil Hagelberg wrote:
> On Tue, Sep 28, 2010 at 4:17 AM, Alex wrote:
> > $ lein swank
> > user=> Connection opened on local port 4005
> > # > 127.0.0.1,port=0,localport=4005]>
>
> > First question: why no visible output?
>
> Running "lein swank" just launches a swank server.
Hi,
On 29 Sep., 11:28, Shantanu Kumar wrote:
> Could you please post the working example you got?
(defmacro hinted-fn [class-sym]
(let [arg (gensym "arg")]
`(fn [~(with-meta arg {:tag class-sym})] (.get_val ~arg
Hope that helps.
Sincerely
Meikel
--
You received this message becaus
Hi,
I'm using this "arcaic" method because I'm installing this stack in a
machine behind proxy restrictions.
I tried the way you has explained, but I couldn't get success dowloading the
deps (swank-clojure-1.2.1.jar) in the project.clj when running "lein deps".
-- christian
On Tue, Sep 28, 2010
nathanmarz wrote:
> That worked great, thanks.
Could you please post the working example you got?
Regards,
Shantanu
--
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
On 29 Sep 2010, at 5.19 am, George Jahad wrote:
>
>
> Also, Sam, my previous post seems to have gotten eaten, but I'll work
> on that screencast.
Actually, you seem to have sent it directly to me :-)
A screencast would be wonderful!
Sam
---
http://sam.aaron.name
--
You received this messag
(sorry to use this channel)
I just wanted to notice the maintainers of Planet Clojure, that it's RSS
feed is outdated. The web site shows more recent articles than the feed
does.
Besides of that: Thank you for this really handy service!
Regards,
Stefan
--
You received this message because you
Hallo all,
I'm started working on PAIP and doing the examples in Clojure. I
understand what this function does (i think) now but I'm not sure how
to write it in Clojure since I have no CL background.
(defun find-all (item sequence &rest keyword-args
&key (test #'eql) test-not &al
Hi,
anybody seen this already?
http://www.basementcoders.com/transcripts/James_Gosling_Transcript.html
(Transcript from http://basementcoders.com/?p=721)
When being asked about other languages he says: "Clojure. Clojure's
got a lot of coolness about it but it's not for everyone."
Kind regards,
40 matches
Mail list logo