> 1- concat is defined to have 4 different arities: 0-arg, 1-arg, 2-arg,
> 3+args. In order to figure out which arity to use, apply has to realize at
> least as many elements as the minimum number of args required by the
> largest arity, which in this case is 3
> 2- apply has a small bug that cause
Hi,
I have a riddle I am not sure how to solve:
```
user=> (defn just-a-demo-seq[] (println "in just-a-demo-seq") [1 2 3 4 5 6
7 8 9])
#'user/just-a-demo-seq
user=> (def do-not-print-it (apply concat (repeatedly just-a-demo-seq)))
in just-a-demo-seq
in just-a-demo-seq
in just-a-demo-seq
in just-a-
Hi,
I noticed that after upgrade to Clojure 1.8.0 (from 1.7.0) a weird
occurrence of logging, even during uberjar generation which looks like
this, using lein 2.5.3:
$ lein uberjar
Compiling core
2016-03-10 22:11:23.030:INFO::main: Logging initialized @964ms
I believe that actual log is pegged
ed, Sep 16, 2015 at 10:39 AM, Andy L wrote:
> Thanks for the confirmation. I run "jstat" on both cases and it indicates
> a lot of GC in Survivor0 bucket, specifically for "LazySeq+Gzip+2Threads" .
> New area of learning for me though. That would explain spikes and
Thanks for the confirmation. I run "jstat" on both cases and it indicates a
lot of GC in Survivor0 bucket, specifically for "LazySeq+Gzip+2Threads" .
New area of learning for me though. That would explain spikes and JVM
pauses.
Best regards,
Andy
On Wed, Sep 16, 2015 at 9:41 AM, Gerrit Jansen van
Gerrit,
Yes, I do compare apples to oranges, but my orange looks like a nice
Macintosh apple when run in a single thread :-). What I do not expect is
that lack of symmetry in a multiple thread situation and weird JVM CPU
spikes.
WRT to encoding - thanks for the hint - I removed ASCII one from Jav
Hi,
Thanks for looking into my questions. I posted a self contained example
here https://github.com/coreasync/parallel-gzip with instructions how to
create test data as well. Also attached results below I get on my quite
decent hardware (partial 'time' results are mangled, was not sure how to
sepa
Hi,
I would like ask for some advise with regards to kind of unusual
interaction between lazy-seq and threads. I have a code opening some big
compressed text files and processing them line by line. The code reduced to
a viable example would look like that:
(with-open [i (-> "mybigfile.gz" cloju
Hi,
Is it possible to change default value of
clojure.pprint/*print-right-margin* var and alikes in one place. I use
pprint in many places and would like to avoid wrapping it with "binding" in
every case.
Thanks,
Andy
--
You received this message because you are subscribed to the Google
Groups
Hi,
Thanks for all suggestions. It all encouraged me to deep dive into atom-s
code which turns out to be a simple wrapper over Java
java.util.concurrent.atomic.AtomicReference which essentially is a
spinlock. Knowing how it works under the hood makes so easier
to use it ...
Below piece (hopefully
Hi,
I realized recently that cohesive pretty formatting LISP programs is a very
difficult problem to solve in the first place due to its homoiconicity.
There could be some nice approximations but the devil is in the details.
That all made me so grateful for what we have and I stopped complaining :
>
>
> Most of the cache implementations in core.cache have no side-effects. They
> simply return a new cache rather than overwriting the old one. The memoize
> library places the cache in an atom, so it's guaranteed to change
> atomically.
>
I tried to read the cache code (btw an excellent exerci
or even better (using future themselves as a "marker" in the atom):
(defmacro map-future-swap! [a k f]
`(locking ~a
(when (not (contains? @~a ~k))
(swap! ~a assoc ~k (future (swap! ~a assoc ~k (~f ~k
)
)
)
--
You received this message because you are subscribed t
> The SoftCache uses a ConcurrentHashMap, but that caching option isn't used
> in core.memoize. Are you building a custom memoizer?
>
>
WRT ConcurrentHashMap, it was an incorrect conclusion on my part. In any
case, I fail to see "thread safety" in the cache implementation, but again
I could be wron
> (defn memoized [f]
> (comp deref (memoize (fn [& args] (delay (apply f args)
>
>
Thanks for looking into that. This indeed would solve a "semantics" problem
of memoize, as it returns a value now. However, it seems that
clojure.core.memoize,
or rather clojure.core.cache memoize is based of,
Hi,
Here is the situation. There is a function "f" retrieving some data from
various sources (including reading files, a lot of io, e.g. map-reduce)
expected by design to return the same result for given input. Results of
"f" invocation from parallely running futures are stored in an atom wrapped
Hi,
This is another puzzle/exercise based on a very practical need. I could not
find a built in function, hoping something like "colfn" already exists.
Otherwise I wonder about an idiomatic solution. This is self-explanatory
code:
user=> (require '[clojure.algo.generic.functor :as fu])
user=> (re
Thanks for all the ideas. I like cyclefn the most, a bit of investment
resulting in super clean output.
Andy
On Sat, Nov 15, 2014 at 9:35 AM, Ben Wolfson wrote:
> or
>
> (defn enumerate [xs] (map vector (range) xs))
>
> (defn altsum [n] (reduce (fn [acc [i f]] (f acc (inc i)))
>
On Thu, Nov 13, 2014 at 7:23 PM, Robert Levy wrote:
> You don't need this for numbers over 900 right?
>
>
I see what you mean. But no, I just practice and try to capture patterns.
So, going after your example I got following:
(reduce + (map applyv (cycle [+ -]) (range 1 10)))
where something li
(reduce + (map * (mapcat (fn[_] [1 -1]) (repeat nil)) (range 1 n)))
not the best pattern for this case, but possibly useful to generate
alternated values ...
A.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo
On Thu, Nov 13, 2014 at 6:36 PM, Dave Ray wrote:
> How about:
>
> (->> (map * (cycle [1 -1]) (range 1 n))
> (reduce +))
>
>
Thx - I did not know cycle before. I think this is it, although I prefer
nesting over threading. This is another I was thinking about:
--
You received this message b
Hi,
All I was able to come up with was this
(defn altsum[n] (reduce + (map * (range 1 (inc n)) (interpose -1 (repeat
1)
... works quite well, however I was wondering if there is more idiomatic
way to write that.
Thanks,
Andy
--
You received this message because you are subscribed to the
I confused dates :-( , nm
On Sun, Oct 19, 2014 at 11:43 AM, Andy L wrote:
> I tried to go to those links and getting "This form is currently private
> and cannot be viewed by the public."
>
> Thx,
> Andy
>
> On Sun, Oct 19, 2014 at 6:38 AM, Alex Miller wrote
I tried to go to those links and getting "This form is currently private
and cannot be viewed by the public."
Thx,
Andy
On Sun, Oct 19, 2014 at 6:38 AM, Alex Miller wrote:
> I hope to have something including the raw results published early this
> week but depends how long it takes to make a re
Thank you. BTW, I really liked Clojure/West video editing style.
Andy
On Fri, Sep 12, 2014 at 8:55 AM, John Gabriele wrote:
> A format I particularly like is when there's simply one video file where:
>
> * the main portion of the window shows the slides,
> * a small thumbnail-size portion s
On 06/07/2012 09:22 PM, Ambrose Bonnaire-Sergeant wrote:
Every Seqable is not Sequential.
(sequential? {:a 1}) => false
Is there a simple test for sequable?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cloju
26 matches
Mail list logo