Hi,
The data.priority-map has been a nice library. I have used it quiet often.
Recently, when I used it, I discovered the following unexpected behaviour..
can somebody throw some light on it?
(- (pm/priority-map-by #( (count %1) (count %2)))
(update-in [1] #(assoc (or % {}) 2 3))
The project file I used ..
(defproject trybug 1.0.0-SNAPSHOT
:description FIXME: write description
:dependencies [[org.clojure/clojure 1.3.0]
[org.clojure/data.priority-map 0.0.1]]
:repositories {sonatype-oss-public
On Dec 16, 2:01 am, Trevor tcr1...@gmail.com wrote:
I have created an output stream, which appears to work fine, however
I get an error when trying to convert the output stream into an input
stream for use in ring:
('use [clojure.java.io :only [input-stream]])
= (with-out-str (ofn var))
You can't really do this in a single thread without risking blocking.
But with another thread, it's fairly simple. For example, I do this in
my gzip-middleware, copying an InputStream through a pipe with GZIP
wrapping:
Hi,
Am 16.12.2011 um 01:58 schrieb Cedric Greevey:
I know that every fn is a class; I am questioning the very need for
prim interfaces.
If you don't have an interface, you can't redef the function at runtime. Since
the class of the function changes, you'll have the call sites wired to the
Edit: you should probably use with-open at some point, to make sure
you close the output writer. I copied pretty badly from my own
example :P. So more like:
(let [pipe-in (PipedInputStream.)]
(future; new thread to prevent blocking deadlock
(with-open [out (- pipe-in
priority-map-by is going to do funky things if your ordering function
does not obey the trichotomy property (i.e., for all a, b, exactly one
of ab, a=b, or ab holds).
The reason for this is that priority-map internally uses Clojure's
sorted-map, and Clojure's sorted-map does funky things if the
On Fri, Dec 16, 2011 at 4:51 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 16.12.2011 um 01:58 schrieb Cedric Greevey:
I know that every fn is a class; I am questioning the very need for
prim interfaces.
If you don't have an interface, you can't redef the function at runtime.
You
Thanks Mark, for your response... While I understand what you are saying..
I don't understand as to why the following is working ..
(assoc (pm/priority-map 1 1 2 1) 3 1)
gives
{1 1 2 1 3 1}
Am I not supposed to be using this? will it eventually bite me?
Sunil.
On Fri, Dec 16, 2011 at 3:48 PM,
Hi,
Am 16.12.2011 um 12:17 schrieb Cedric Greevey:
You *already* can't change the type signature of an optimized function
without needing to recompile its callers.
But once you settled on a type signature, you have the usual fast
benchmark,optimize,reload-cycle. Without interfaces you don't
Hi, learning clojure so this may just be a lack of understanding on my
part. Been looking at a post about swing and clojure and it used an
agent to implement a flipper with code below.
When I run the code in clojure 1.2.1 via
(def flipper (new-flipper))
(send flipper start)
all is fine and the
Hi, learning clojure and came across some code discussing swing and a code
for a flipper as below
(defn new-flipper []
(agent {:total 0, :heads 0,
:running false,
:random (java.util.Random.)}))
(defn calculate [state]
(if (:running state)
(do (send *agent*
(defmacro dbg [x]
`(let [x# ~x]
(println (str *file* :) [ '~x = x# ])
x#))
I personally use this macro. It shows only the file name (I can't find
out how to get the current line number).
This one has the advantage of still returning the same value as the
expression itself.
On Dec 15,
Here's an idea. Put the videos on a site that has the best CDN reach
(especially noticeable in Asia), does automatic transcoding to lower
resolutions, and most importantly can jump to any point in the
videos. Works on android, ipod, wp7, and even blackberry. Youve
probably not heard of it,
Are it going to support JCache JSR?
2011/12/13 Fogus mefo...@gmail.com
core.cache v0.5.0 Release Notes
===
core.cache is a new Clojure contrib library providing the following
features:
* An underlying `CacheProtocol` used as the base abstraction for
Hello,
I just read some of the clojure.core source, and when reading map and
range, I noticed that inside lazy-seq, recursion doesn't seem to stack
overflow. I then tried it myself on some trivial examples, and indeed,
I can take hundreds of thousands of entries from such a list without
anything
(defmacro dbg [x]
`(let [x# ~x]
(println (str *file* :) [ '~x = x# ])
x#))
Without the line number, because I don't know how to retrieve (neither
could I find anything on it).
On Dec 15, 6:48 am, jaime xiejianm...@gmail.com wrote:
Hello there,
I want to write a function named debug
I new to clojurescript and i thought i would take a simple example
like http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick
it has javascript that does the following:
button
onclick=document.getElementById('field2').value=document.getElementById('field1').valueCopy
Text/button
i
Please create a JIRA ticket for adding 'empty' support to `bean`.
-S
--
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
This is a problem with a feature introduced in 1.3: binding-conveyance for
Agent sends. Starting in 1.3, agent actions are called with the same
thread-local Var bindings that were in effect when they were called. In
some situations, this can build up a stack of thread-local Var binding
frames,
On Dec 13, 8:38 pm, Alan Malloy a...@malloys.org wrote:
Issue is in bean, not walk. walk calls (empty foo) on its collection,
in order to make sure you get back a collection of the same type. bean
maps are, I guess, some special type rather than an ordinary
c.l.PersistentHashMap; and that type
Stuart Sierra the.stuart.sie...@gmail.com writes:
Hi Stuart,
This is a problem with a feature introduced in 1.3: binding-conveyance
for Agent sends. Starting in 1.3, agent actions are called with the
same thread-local Var bindings that were in effect when they were
called. In some
On Dec 14, 2011, at 11:48 PM, jaime wrote:
I want to write a function named debug which will print out date-
time msg + current source-line + etc. info, but I don't know how to
get the current source and line number of the running point (just like
what REPL does when encounter any exceptions)
Narvius narv...@gmail.com writes:
Hi Narvius,
So, my question is, why exactly DOESN'T it crash and burn horribly
with the cries of dying bits in the background? I suppose it has
something to do with how lazy-seqs work (another mystery for me).
A lazy seq is basically a sequence of the first
Tassilo wrote: But shouldn't at least the thread-local Var binding frames
be freed after the actions have been performed?
Yes. It's a bug. Just created CLJ-898:
http://dev.clojure.org/jira/browse/CLJ-898
-S
--
You received this message because you are subscribed to the Google
Groups Clojure
Can you create a paste of your index.html as well as your ClojureScript
file?
Thanks!
David
On Thu, Dec 15, 2011 at 5:12 PM, bob rditm...@gmail.com wrote:
I new to clojurescript and i thought i would take a simple example
like
Discussed here:
https://groups.google.com/forum/#!topic/clojure/1qUNPZv3OYA/discussion
--
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 -
This is great. Thanks for the help.
On Dec 16, 2:55 am, Alan Malloy a...@malloys.org wrote:
Edit: you should probably use with-open at some point, to make sure
you close the output writer. I copied pretty badly from my own
example :P. So more like:
(let [pipe-in (PipedInputStream.)]
Stuart Sierra the.stuart.sie...@gmail.com writes:
Hi Stuart,
Tassilo wrote: But shouldn't at least the thread-local Var binding
frames be freed after the actions have been performed?
Yes. It's a bug. Just created CLJ-898:
http://dev.clojure.org/jira/browse/CLJ-898
I've attached a patch to
On Fri, Dec 16, 2011 at 9:32 AM, Mark Engelberg
mark.engelb...@gmail.com wrote:
Or how about something like #(if (= %1 %2) 0
(compare [(count %1) (str %1)] [(count %2) (str %2)]))
I retract this particular example. Upon further thought, since maps
aren't guaranteed to always stringify the same
Thank all of you for the information. I finally picked up an approach
of using form and *file*, and here's my code snippet of the
function:
==
(defmacro debug
Print debug info.
[ variables]
(let [datetime 2011-12-17 01:59:37
Yes this is a good point, but how can I avoid this blowing up problem
if I'm not handling a single variable (just as the code in my last
post)?
On 12月16日, 上午5时09分, Cedric Greevey cgree...@gmail.com wrote:
On Thu, Dec 15, 2011 at 1:54 PM, Alan Malloy a...@malloys.org wrote:
This will print all
Fleshing out the solution I outlined in a previous email, here's a
concrete implementation that lets you use maps as priorities.
(defn- make-id-generator []
(let [i (atom 0),
generate-unique-id (fn generate-unique-id [item] (swap! i inc))]
(memoize generate-unique-id)))
(defn-
This is a question about Clojure performance on the JVM. There might be
similar but different tweaks on the CLR or for ClojureScript, but I'm only
curious about those if someone knows how to achieve the desired performance
improvements today.
I can give more concrete examples if there is
2011/12/16 jaime xiejianm...@gmail.com:
Yes this is a good point, but how can I avoid this blowing up problem
if I'm not handling a single variable (just as the code in my last
post)?
Someone else indicated that just using pr-str and using the
*print-length* and *print-level* vars can avoid
I believe the line number can be found in the metadata on lists that
are read in by the reader.
--
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
On Fri, Dec 16, 2011 at 8:20 AM, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 16.12.2011 um 12:17 schrieb Cedric Greevey:
You *already* can't change the type signature of an optimized function
without needing to recompile its callers.
But once you settled on a type signature, you have the
You can tweak the size of the young generation with the -Xmn flag, but
setting it very small likely will be worse. That is because (1) you'll
have more young GCs and due to the way GC works they are just as
expensive as they would be with a large young generation and (2) then
more objects will go
On Dec 16, 3:51 am, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 16.12.2011 um 01:58 schrieb Cedric Greevey:
I know that every fn is a class; I am questioning the very need for
prim interfaces.
If you don't have an interface, you can't redef the function at runtime.
Since the class of
39 matches
Mail list logo