Hi,
Am 04.10.2009 um 00:50 schrieb b2m:
What macros do y'all have that you want to apply things to?
A sure code smell, IMO. It most likely is based on a misunderstanding
what macros are capable to do.
I am using structs and functions for workings with these structs.
Just some very
I'm more interested in the compiler being able to detect obvious (to
it, not me) errors.
Example 1:
user= (await1 (binding [*warn-on-reflection* true ] (send (agent 0) #
(if *warn-on-reflection* (inc %) (dec %)
#ag...@238a47: -1
user= (await1 (send (agent 0) #(binding
Hi,
On 4 Okt., 08:31, Meikel Brandmeyer m...@kotka.de wrote:
The functions themselves can be easily made independent from the
number of keys. Just save the keys in a constant.
(defn process-department
[department-struct]
(- +payment-levels+
(map #(* (fee %) (department-struct
Hi,
Are you sure you aren't leaking memory? (by keeping a reference to an ever
growing state -- do you use memoize?)
Christophe
On Sat, Oct 3, 2009 at 10:22 PM, Elliott Slaughter
elliottslaugh...@gmail.com wrote:
Thanks.
JVisualVM shows the initial memory usage is a couple hundred MB,
Hi,
I second Sean's view: dispatching a multimethod on argument count is
possible, but maybe not the clearest use of multimethods. I would also
prefer the multiple arglist approach.
Am 03.10.2009 um 21:39 schrieb Sean Devlin:
(defn reduce
([f coll] (reduce f (first coll) (rest coll)))
Very good point Meikel. The only reason I wrote the code that way is
I was asking myself What if I had Rich's Job? How would I write
reduce? I should have been more explicit.
On Oct 4, 7:42 am, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
I second Sean's view: dispatching a multimethod on
On Sat, Oct 3, 2009 at 6:50 PM, b2m b2monl...@googlemail.com wrote:
What macros do y'all have that you want to apply things to?
(defn init-funs [name levels]
(do
(apply-macro create-department-struct name levels)
(apply-macro create-process-department name levels)
nil))
A
Hi,
I noticed that output from clojure.test's (run-tests) is not displayed
in the VimClojure REPL (launched with LocalLeadersr). I guessed it's
because clojure.test/*test-out* is not redefined appropriately (to
print to the vim buffer) like *out* is. So I tried the following at
the VimClojure
Hi,
On 4 Okt., 04:40, John Harrop jharrop...@gmail.com wrote:
If you need to be creating these things dynamically, with information only
available at runtime, defstruct is probably the wrong tool for the job, or
the only struct member should be :name, and the levels at least should just
be
Hi,
Am 04.10.2009 um 11:11 schrieb Mike Mazur:
Clojure= (binding [*test-out* *out*]
(run-tests))
Is the mechanism that configures the *out* stream exposed somehow? Can
I tell it to process *test-out* as well?
Well. This is exactly the mechanism to process the *test-out*. In the
On Oct 3, 2009, at 1:50 PM, Stuart Halloway wrote:
Is there a principled reason for this? I have written some code that
(unintentionally) limits itself to refs because it assumes that all
reference types can sit in function position.
This discussion:
Hi.
Am 04.10.2009 um 14:29 schrieb Sean Devlin:
Very good point Meikel. The only reason I wrote the code that way is
I was asking myself What if I had Rich's Job? How would I write
reduce? I should have been more explicit.
(defn reduce
([f coll] (reduce f (first coll) (rest coll)))
([f
I want to do this:
(defn a ...)
(cache a) ; or (cache #'a) or (cache 'a); it doesn't matter to me
...instead of this:
(def a (memoize (fn ...)))
That way, it separates the concern of what a does from the
optimization I'm doing on it. Now, I'm kind of stuck; how should I do
it?
(defn
Oops; I didn't finish this thread's subject title.
On Oct 4, 1:41 pm, samppi rbysam...@gmail.com wrote:
I want to do this:
(defn a ...)
(cache a) ; or (cache #'a) or (cache 'a); it doesn't matter to me
...instead of this:
(def a (memoize (fn ...)))
That way, it separates the
On Oct 4, 2009, at 5:04 PM, Mark Volkmann wrote:
Minor technicality ... Vars are a reference type, but deref and @
don't work with them.
I'm guessing you're thinking of an interaction like this:
user= (def a 3)
#'user/a
user= @a
java.lang.ClassCastException:
On Sun, Oct 4, 2009 at 4:26 PM, Stephen C. Gilardi squee...@mac.com wrote:
On Oct 4, 2009, at 5:04 PM, Mark Volkmann wrote:
Minor technicality ... Vars are a reference type, but deref and @ don't
work with them.
I'm guessing you're thinking of an interaction like this:
user= (def
Hi,
Am 04.10.2009 um 22:47 schrieb talk:
(defn cache
Replaces the function that the given variable refers to
with a memoizing version of it.
[fn-var]
(??? fn-var (memoize @fn-var)))
Macros to the rescue:
(defmacro cache
Replaces the function that the given name refers to
What a lifesaver! Thanks a lot!
On Oct 4, 2:58 pm, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
Am 04.10.2009 um 22:47 schrieb talk:
(defn cache
Replaces the function that the given variable refers to
with a memoizing version of it.
[fn-var]
(??? fn-var (memoize
I recently integrated Clojure with two async messaging systems.
I wound up doing send operations through a Clojure agent.
I was curious how many agents I could spawn per second and found I
could spawn about 20K agents / second.
Code for testing:
(def t (agent true))
(defn tt [_ num]
(try
Thanks Sean and Meikel.
I tightened up the function a bit as a single function with multiple
arglist:
--
(defn clear-cached-files3
([]
(dosync (alter file-seq-cache empty)))
([ ks]
(dosync (dorun (for [key ks] (alter file-seq-cache dissoc key
@file-seq-cache))
Hi,
Am 05.10.2009 um 05:03 schrieb Robert Stehwien:
(dosync (dorun (for [key ks] (alter file-seq-cache dissoc key
You might want to write (dorun (for ...)) as (doseq ...). Since you
don't use the resulting sequence using for to generate sequence and
then using to dorun to force
On Oct 4, 4:01 am, Christophe Grand christo...@cgrand.net wrote:
Are you sure you aren't leaking memory? (by keeping a reference to an ever
growing state -- do you use memoize?)
You're right, it was a memory leak, although it took me hours to find.
Clojure's lazy lists were responsible for the
22 matches
Mail list logo