(reduce #(assoc %1 %2 (keyword %2))
{}
(mapcat vmap [:keys :strs :syms])))
--
Mark Triggs
--
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
j-g-faustus writes:
> I was apparently too late. Oh well :)
My apologies for pre-emptively stealing your idea :)
--
Mark Triggs
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegr
ere
> is a mechanism similar to (or perhaps a generalization of) composition
> for that, but I couldn't find it in the API docs.
>
> Bill Smith
> Austin, TX
--
Mark Triggs
--
You received this message because you are subscribed to the Google
Groups "Clojure" gro
s that are happening concurrently in this program never have to
> write to the same places, but sometimes they do have to read from the
> same places and I'm wondering if this is responsible for some of what
> I'm seeing.
--
Mark Triggs
--
You received this message
equence and wanting to be fully lazy, so I'm not sure
of the best way of achieving both objectives. I just thought I'd raise
the issue in case someone brighter than me has any good ideas :)
Cheers,
Mark
--
Mark Triggs
--
You received this message because you are subscribed to
omeone please check the other functions that were
>> patched similarly?
>
> I'll do it since I created the original patch.
>
> https://www.assembla.com/spaces/clojure/tickets/222
Many thanks everyone.
Cheers,
Mark
--
Mark Triggs
--
You received this message because you are
r as a lazy sequence of strings.
rdr must implement java.io.BufferedReader."
[#^java.io.BufferedReader rdr]
(let [line (. rdr (readLine))]
(when line
(cons line (lazy-seq (line-seq-new rdr))
and, I think, still preserves the intention of the original change.
Does tha
=>(every? even? nil)
> true
>
> user=>(every? even? [])
> true
>
> Is this behavior the specified behavior? Can I ASSUME it is true in
> my code?
--
Mark Triggs
--
You received this message because you are subscribed to the Google
Groups "Clojure"
out of memory:
>
> (machine (iterate (fn [c] (if (= c \c) \a \d)) \c))
>
> Java heap space
> [Thrown class java.lang.OutOfMemoryError]
--
Mark Triggs
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group,
thout 'repeatedly'.
>
> Can you give us an example of how you're using 'repeatedly' with take?
> regards,
> -tom
--
Mark Triggs
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this
ntry)))
> java-map))
>
> user=>(put-all (java.util.HashMap. ) {:a 1 :b 2 :c 3})
> #
>
> I already tried into :)
--
Mark Triggs
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojur
ET RET
>
> In the *Messages* buffer I can see this:
>
> Connecting to Swank on port 4005.. [2 times]
> Connected. Hack and be merry!
>
> I can then enter slime-mode and for example eval (+ 1 2) in a buffer
> and I
> get as reply 3 in the echo area.
st
>(lazy_reduce nthnext coll
> (map - indices (cons 0 indices)
--
Mark Triggs
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cl
>>
>> Is there some disadvantage with this approach that I'm not seeing?
--
Mark Triggs
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to c
eatedly #(int-array 102400)))
without blowing up the stack or throwing OutOfMemory (on my JVM).
Thanks again,
Mark
Mark Triggs writes:
> Hi all,
>
> Is there an idiom for what I'm doing below, or does a function already
> exist?
>
> (let [vowels (slice "abcdefgh
m log files
(calling .split on a string, then grabbing certain segments)
Thanks,
Mark
--
Mark Triggs
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojur
An artifact of not running my code from a clean REPL before posting ;)
It should just read `frames'.
Cheers,
Mark
artg writes:
> What is "group-frames"?
>
> --art
>
> On Jul 21, 12:00 am, Mark Triggs wrote:
[...]
>> (defn score-game [r
(take 10 (group-frames rolls)
Cheers,
Mark
--
Mark Triggs
--~--~-~--~~~---~--~~
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
Not
quot;ACACG" => ("ACC"), whereas the Python version returns
> all the LCSes found (for the same strings => set(['ACC', 'AAC'])). I
> have tried to find out why this is, but cannot identify the cause.
>
> On Jul 17, 12:16 am, Mark Triggs wrote:
&
Hi there,
I had a bit of a go at converting the Python version into Clojure and
removed the need to mutate an array. Because the 'lcs' function was
basically just mapping over a list of i/j pairs and accumulating the
resulting matrix, it seemed like a good candidate for reduce:
(defn lcs [x y]
Hi Phil,
Part of me hopes there's a nicer way of doing this, but I was able to
get it working using:
(defn bi-get-pixels
[#^BufferedImage bi]
(let [raster (.getData bi)
pixels (.getPixels raster 0 0 (.getWidth bi) (.getHeight bi)
(cast (Class/forName "[I")
Hi all,
I just thought I'd write to share a terrible (but maybe useful!) hack
for SLIME. I've written some code that sniffs around the classpath to
find libraries matching some regexp, then inserts the appropriate
`import' sexps into the current buffer. For example:
M-x clj-import [RET] Inde
Hi David,
Quite a few times when I've felt the need for this sort of thing I've
found that laziness comes to the rescue. Would something like this
sort of approach work for you?
(defn possibilities [word pos]
"All variations of `word' with letters from 'a' to 'z' inserted at
`pos'"
(let [[b
Something like this in your ~/.emacs might do the job:
(define-key global-map (kbd "C-x C-b")
(lambda ()
(interactive)
(select-window (call-interactively 'list-buffers
Cheers,
Mark
On Mar 30, 7:41 am, Mark Engelberg wrote:
> When I have two windows open, and hit C-x-C-b, it
Hi David,
On Mar 22, 5:01 pm, David Sletten wrote:
> On Mar 21, 2009, at 1:44 PM, Mark Triggs wrote:
>
> > user=> (str (filter even? (range 1 10)))
> > "clojure.lang.lazy...@f1005"
>
> > Previously this would readably print the contents of the seq and
Hi all,
Moving my existing code across to the new lazy trunk, I noticed a very
small change:
user=> (str (filter even? (range 1 10)))
"clojure.lang.lazy...@f1005"
Previously this would readably print the contents of the seq and some
of my code was relying on this. Obviously it's not diffic
In addition to what others have said, I also tend to use doall when
working with agent actions that return sequences (i.e. to force any
computation to happen in the agent's thread and not in the caller's)
Cheers,
Mark
On Wed, Jan 21, 2009 at 7:32 AM, Mark Volkmann
wrote:
>
> Can someone descri
Aha! I notice that this problem goes away if I run the JVM the way
I'm supposed to (with -cp lucene-core.xxx.jar) instead of using (add-
classpath ...) to load the jar in the first place. This probably
isn't a big deal, then :o)
Thanks,
Mark
On Jan 13, 11:06 am, Mark Triggs wrote
Hi all,
I've just been fiddling with Lucene indexing from Clojure, and wanted
to
access a static field of this inner class:
http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/index/IndexWriter.MaxFieldLength.html
I'm importing IndexWriter$MaxFieldLength with no problems, but
attempts
I've also found this useful for accessing members in nested maps. For
example:
(let [me {:person {:name {:first "Mark"
:last "Triggs"}
:email "mark.h.tri...@gmail.com"}}]
(-> me :person :name :first))
=> "Mark"
On Jan 12, 1:04 pm, kkw w
On Oct 31, 1:57 pm, Mark Triggs <[EMAIL PROTECTED]> wrote:
> When I ran my code it very quickly ran out of memory and fell over.
> After thinking about it for a while I've realised it must be because my
> 'do-something' function call is hanging on to the head of
my diagnosis is right, is there some sort of idiomatic way of
dealing with this sort of issue? I suppose that if the JVM allowed for
true tail recursion then this problem wouldn't arise?
Many thanks,
Mark
--
Mark Triggs
<[EMAIL PROTECTED]>
--~--~-~--~~~--
32 matches
Mail list logo