On Sep 3, 1:13 am, Sudish Joseph wrote:
> (defn flatten-2 [lst]
> (lazy-seq
> (if-let [x (first lst)]
> (let [xs (rest lst)]
> (if (seq? x)
> (concat (flatten-2 x) (flatten-2 xs))
> (cons x (flatten-2 xs)))
This version is broken:
user=> (flatten-2
Hi,
On Sep 3, 2:21 am, Bokeh Sensei wrote:
> vimclojure took me a whole weekend to get started.
> it's sensitive to how it's setup, but with no way to automatically
> verify the correctness of it.
Ok. I give up. Obviously I'm not able to explain how to install
VimClojure, neither with the READM
On Sep 2, 7:02 pm, tmountain wrote:
> (defn generate-chain [source]
> (loop [the-list (map #(list (first (split-at 2 %)) (last %))
> (partition 3 1 (.split (.replace source "\n" "
> ") " ")))
> res (hash-map)]
> (if (empty? the-list)
> res
> (rec
On Sep 3, 1:13 am, Sudish Joseph wrote:
> The other solutions seem higher level, but it's worth noting that
> destructuring -- (let [[x & xs] lst] ...) -- uses next and is therefore
> not fully lazy in that you will peek ahead by one into the lazy
> sequence, so to speak. You have to use explic
On Wed, Sep 2, 2009 at 1:02 PM, tmountain wrote:
>
> Hi all - I've recently encouraged a friend to start learning Clojure,
> and he has written some basic Markov chaining code as a learning
> exercise. His code works fine with small sets of input data, but
> larger inputs have been causing a Stac
vimclojure took me a whole weekend to get started.
it's sensitive to how it's setup, but with no way to automatically
verify the correctness of it.
Try this in vim:
:call vimclojure#Repl.New()
If it fails, that probably means the vimclojure plugin can't find the
vimclojure jar on the path.
In m
Rich, Chouser or other Clojure group admin,
It may be helpful to put the search link in the currently unused
welcome message section of the group "Home" page.
-Aaron
On Sat, Aug 29, 2009 at 3:34 PM, Daniel wrote:
>
> On Sun, Aug 30, 2009 at 1:54 AM, Rich Hickey wrote:
>>
>> While the "Searc
> Maybe it's premature optimization, but I don't want the overhead of a
> sorted map structure when a minimal (and ideally, optimized for few
> keys) map will do better.
Then you might want to look at struct-map... predefined keys are in a
fixed order.
--~--~-~--~~~
Can someone explain why the getHistoryCount method in Ref.java
acquires a write lock instead of a read lock? I say in my STM article:
"It acquires a write lock instead of a read lock because it walks the
history chain to get the count and needs to prevent other threads from
modifying the chain wh
Hi Karl,
The other solutions seem higher level, but it's worth noting that
destructuring -- (let [[x & xs] lst] ...) -- uses next and is therefore
not fully lazy in that you will peek ahead by one into the lazy
sequence, so to speak. You have to use explicit first / rest to get
that:
;; with de
Another way of searching .
Instead of "Search this group" use "Search Groups" , and inform google of
the group you intend search and your message. Here is an example, re-find
group:clojure .
Regards,
Emeka
On Sun, Aug 30, 2009 at 12:19 PM, Emeka wrote:
> Thanks, I was about asking for hel
Maybe it's premature optimization, but I don't want the overhead of a
sorted map structure when a minimal (and ideally, optimized for few
keys) map will do better.
On Tue, Sep 1, 2009 at 11:46 AM, Rob Lachlan wrote:
>
> As, Patrick Sullivan, said, the built-in sorted-map guarantees that
> the key
Hello,
At some point I needed at "flatten" function taking a list of atomic
elements or nested lists, and producting a "flat" list of only atomic
elements (in the same order). It should be lazy.
This is what I came up with. Can anyone see a more elegant solution (I
feel I am working "low-level" s
It's in c.c.seq-utils
You can look up stuff here:
http://richhickey.github.com/clojure-contrib/api-index.html
On Sep 2, 4:12 pm, tmountain wrote:
> I believe the flatten in contrib is defined as follows. I can't
> remember which module I found it in.
>
> (defn flatten
> "Takes any nested com
Hello!
I've backported contrib's logging.clj library to work with Clojure
1.0. It was just a handful of modifications wrt how the import function
worked.
I'd like to get it included in the clojure-1.0-compat branch of
contrib. Shall I create an assembla ticket and attach my patch there?
-Phil
I believe the flatten in contrib is defined as follows. I can't
remember which module I found it in.
(defn flatten
"Takes any nested combination of sequential things (lists, vectors,
etc.) and returns their contents as a single, flat sequence.
(flatten nil) returns nil."
[x]
(filter (co
Iv been trying to use the Nailgun functionlity of vimclojure but Im
stuck on a silly issue, Im hitting el inside:
(println "hello")
And nothing happens, same goes for the rest options.
In addition its not clear to me how to start the REPL the doc/
README.txt says:
"Start a Repl via the |sr| sh
Hi all - I've recently encouraged a friend to start learning Clojure,
and he has written some basic Markov chaining code as a learning
exercise. His code works fine with small sets of input data, but
larger inputs have been causing a StackOverflowError.
I've taken a look at the code and suspect t
On Sep 2, 1:44 am, Richard Newman wrote:
> Conrad,
>
> (into {}
> (filter (fn [[key val]]
> (even? val))
> {:dog 5 :cat 4 :mouse 7 :cow 6}))
>
> =>
> {:cat 4, :cow 6}
Or if you like "point-free" style
(into {}
(filter (comp even? second)
{:dog 5
If you're gonna go point free...
((comp (partial into {})
(partial filter (comp even? val)))
{:dog 5 :cat 4 :mouse 7 :cow 6})
On Sep 2, 11:03 am, Krukow wrote:
> On Sep 2, 5:02 pm, Krukow wrote:
>
> > Or if you like "point-free" style
> > (into {}
> > (filter (comp even? second
On Sep 2, 5:02 pm, Krukow wrote:
> Or if you like "point-free" style
> (into {}
> (filter (comp even? second)
> {:dog 5 :cat 4 :mouse 7 :cow 6}))
> =>
> {:cat 4, :cow 6}
Saving a few chars, and perhaps more readable:
user> (into {}
(filter (comp even? val)
21 matches
Mail list logo