On Aug 25, 5:45 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Here's one I wrote probably needs revisited
>
> (defn doCmd
> "do any command"
> ([& params]
> (let [cmd (new java.util.ArrayList)]
> (doseq atom params
>
On Aug 26, 12:08 am, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Aug 25, 1:16 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 25, 9:31 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 23, 6:13 am, Parth Malwankar <[EMAIL PROTECTED]> wrote:
>
> > > > On Aug 23, 12:23 am,
On Aug 25, 9:16 pm, John <[EMAIL PROTECTED]> wrote:
> For each element, get element and next element (incrementing index by
> one, not two), operate on the two, returning a new collection.
> There's the brute force method, but I'm wondering if map or for or any
> of their ilk can pull pairs at a
For each element, get element and next element (incrementing index by
one, not two), operate on the two, returning a new collection.
There's the brute force method, but I'm wondering if map or for or any
of their ilk can pull pairs at a time out of a collection, moving
across the collection one el
On Mon, Aug 25, 2008 at 9:46 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> On Aug 22, 3:59 pm, "Shawn Hoover" <[EMAIL PROTECTED]> wrote:
> > While thinking about drewr's map destructuring question on IRC, I found
> that
> > nth doesn't work on maps. Other group emails state this fact but I can't
On Aug 22, 6:24 pm, Chouser <[EMAIL PROTECTED]> wrote:
> It's pretty easy to get typo (or brain-o) in the package or method
> name when using genclass, especially since the correct naming recently
> changed. Currently you might see something like:
>
> user=> (gen-and-load-class 'pkg.ClassName :
On Aug 18, 12:57 am, Parth Malwankar <[EMAIL PROTECTED]>
wrote:
> On Aug 18, 1:57 am, Randall R Schulz <[EMAIL PROTECTED]> wrote:
>
> > On Sunday 17 August 2008 07:08, Parth Malwankar wrote:
>
> > > I am trying to create a "in" macro.
> > > (in 'a 'b 'a 'c) => true.
>
> > > ...
>
> > Apart from
On Aug 18, 3:15 pm, Chouser <[EMAIL PROTECTED]> wrote:
> Let's say I have a library of functions that operate on a some data,
> and I really *really* don't want client code to be able to see the
> data directly. But I still want "normal" API patterns for access via
> functions. For example, a
I'll be attending and speaking at the JVM Languages Summit at Sun in
September:
http://openjdk.java.net/projects/mlvm/jvmlangsummit/
If you are in the area and interested in language implementation on
the JVM, check it out. Registration is limited and filling up quickly:
http://groups.google.co
On Aug 19, 12:27 pm, Stuart Sierra <[EMAIL PROTECTED]>
wrote:
> Not sure what's going on here. It appears that calling map on an
> Iterator skips the second item, unless you call seq on the Iterator
> first.
> -Stuart
>
> user=> (def a (new java.util.ArrayList))
> #'user/a
> user=> (doseq n (ra
On Aug 25, 3:33 pm, "Shawn Hoover" <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 25, 2008 at 11:57 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> > (def hits (ref 0))
> > (def cache (ref {:n nil :factors nil}))
> > (def cache-hits (ref 0))
>
> > (defn cached-factor [n]
> > (dosync (commute hits inc
On Mon, Aug 25, 2008 at 11:57 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> (def hits (ref 0))
> (def cache (ref {:n nil :factors nil}))
> (def cache-hits (ref 0))
>
> (defn cached-factor [n]
> (dosync (commute hits inc))
> (let [cached @cache]
>(if (= n (cached :n))
> (dosync (commut
On Aug 25, 1:56 pm, Chouser <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 25, 2008 at 1:41 PM, Allen Rohner <[EMAIL PROTECTED]> wrote:
>
> > Another option would be to give a different name to the new function,
> > and deprecate doseq at some point in the future. Clojure is still
> > fairly new, and
On Aug 25, 1:16 pm, Parth Malwankar <[EMAIL PROTECTED]> wrote:
> On Aug 25, 9:31 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 23, 6:13 am, Parth Malwankar <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 23, 12:23 am, Chouser <[EMAIL PROTECTED]> wrote:
>
> > > > On Fri, Aug 22, 2008 at 1
On Aug 19, 11:06 pm, Stuart Halloway <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> In order to deeply appreciate how Clojure removes the pain of lock-
> based concurrency, I am re-implementing the example code from Java
> Concurrency in Practice [http://www.javaconcurrencyinpractice.com/] in
> Clojur
On Mon, Aug 25, 2008 at 1:16 PM, Parth Malwankar
<[EMAIL PROTECTED]> wrote:
>
> (defn- _update-employee-role [n r recs] ...
> (defn- _delete-employee-by-name [n recs] ...
I just renamed these in the wiki, as using underscores in function
names is discouraged in Clojure. If you don't like the new
> On Aug 25, 11:27 am, Stuart Halloway <[EMAIL PROTECTED]>
> wrote:
>>> It's a bit apples and oranges emulating pattern matching and case
>>> classes with multimethods, but very illustrative. It's important to
>>> note that the Scala code is using type tags, not values, in doing
>>> the
>>> matc
On Mon, Aug 25, 2008 at 1:41 PM, Allen Rohner <[EMAIL PROTECTED]> wrote:
>
> Another option would be to give a different name to the new function,
> and deprecate doseq at some point in the future. Clojure is still
> fairly new, and I'd hate to see these kinds of things solidify too
> early.
A ne
> > Unfortunately, this would be a breaking change
>
> Does that mean it's off the table, or just postponed until some future
> "major" release?
>
Another option would be to give a different name to the new function,
and deprecate doseq at some point in the future. Clojure is still
fairly new, an
On Aug 20, 9:46 am, Chouser <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 20, 2008 at 7:11 AM, Parth Malwankar
>
> <[EMAIL PROTECTED]> wrote:
>
> > (sclass (struct mystruct)) => mystruct
>
> It doesn't look like it. It appears that although the StructMap keeps
> a reference to the Def, there's no wa
On Aug 25, 9:31 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Aug 23, 6:13 am, Parth Malwankar <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 23, 12:23 am, Chouser <[EMAIL PROTECTED]> wrote:
>
> > > On Fri, Aug 22, 2008 at 1:10 PM, Parth Malwankar
>
> > > <[EMAIL PROTECTED]> wrote:
>
> > > > Base
Hello,
I have added a new section on "Mutation Facilities"
-> "Employee Record Manipulation"
http://en.wikibooks.org/wiki/Clojure_Programming#Employee_Record_Manipulation
This is based on the discussion:
http://groups.google.com/group/clojure/browse_thread/thread/2d3eb5d20f2007b4
Please feel f
On Aug 22, 3:59 pm, "Shawn Hoover" <[EMAIL PROTECTED]> wrote:
> While thinking about drewr's map destructuring question on IRC, I found that
> nth doesn't work on maps. Other group emails state this fact but I can't
> find that it's by design. (doc nth) says it works on sequences. Maps do work
>
On Aug 23, 6:13 am, Parth Malwankar <[EMAIL PROTECTED]> wrote:
> On Aug 23, 12:23 am, Chouser <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Fri, Aug 22, 2008 at 1:10 PM, Parth Malwankar
>
> > <[EMAIL PROTECTED]> wrote:
>
> > > Based on a recent thread on structures I am curious to know
> > > what migh
On Aug 25, 11:27 am, Stuart Halloway <[EMAIL PROTECTED]>
wrote:
> > It's a bit apples and oranges emulating pattern matching and case
> > classes with multimethods, but very illustrative. It's important to
> > note that the Scala code is using type tags, not values, in doing the
> > match, so I
On Mon, Aug 25, 2008 at 11:09 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> Unfortunately, this would be a breaking change
Does that mean it's off the table, or just postponed until some future
"major" release?
--Chouser
--~--~-~--~~~---~--~~
You received this m
> It's a bit apples and oranges emulating pattern matching and case
> classes with multimethods, but very illustrative. It's important to
> note that the Scala code is using type tags, not values, in doing the
> match, so I think using tags rather than looking for non-zero values
> is more similar
On Aug 23, 3:53 pm, Allen Rohner <[EMAIL PROTECTED]> wrote:
> I had a small amount of confusion about the "appearance" or
> "structure" of let, for, and doseq.
>
> We're all familiar with (let), to create local variables
>
> (let [varA (foo)
>varB (bar)]
> (+ varA varB))
>
> (for) do
On Aug 23, 7:28 pm, Tom Davies <[EMAIL PROTECTED]> wrote:
> I know this is a very old thread, but I think the composition question
> deserves a better answer.
>
> cliffc wrote:
>
> [snip]
>
>
>
> > Ok, the long sought after counter example.: STM's do not compose w/
> > correctness.
> > Bad Java
On Aug 25, 8:45 am, Stuart Halloway <[EMAIL PROTECTED]> wrote:
> For Java.next [1,2] part 3, I am porting Daniel Spiewak's color
> example [3] to Clojure. Here's the Clojure version:
>
> (defstruct color :red :green :blue)
>
> (defn red [v] (struct color v 0 0))
> (defn green [v] (struct color 0 v
> (defn basic-colors-in [color]
> (for [[k v] color :when (not= v 0)] k))
Chouser: That is way better, thanks!
Stuart
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send em
On Mon, Aug 25, 2008 at 9:16 AM, Chouser <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 25, 2008 at 8:45 AM, Stuart Halloway
> <[EMAIL PROTECTED]> wrote:
>>
>> (defn keys-with-value-matching [map test-fn]
>> (for [pair (map identity map) :when (test-fn (last pair))]
>> (first pair)))
>>
>> (de
On Mon, Aug 25, 2008 at 8:45 AM, Stuart Halloway
<[EMAIL PROTECTED]> wrote:
>
> (defn keys-with-value-matching [map test-fn]
> (for [pair (map identity map) :when (test-fn (last pair))]
> (first pair)))
>
> (defn basic-colors-in [color]
> (keys-with-value-matching color (comp not zero?)
For Java.next [1,2] part 3, I am porting Daniel Spiewak's color
example [3] to Clojure. Here's the Clojure version:
(defstruct color :red :green :blue)
(defn red [v] (struct color v 0 0))
(defn green [v] (struct color 0 v 0))
(defn blue [v] (struct color 0 0 v))
(defn keys-with-value-matching
Here's one I wrote probably needs revisited
(defn doCmd
"do any command"
([& params]
(let [cmd (new java.util.ArrayList)]
(doseq atom params
(let [#^String prms (. atom split " ")]
On Aug 25, 10:00 pm, Parth Malwankar <[EMAIL PROTECTED]>
wrote:
> I want to run a shell command through Clojure
> so I tried the following which doesn't work:
>
> user=> (.. Runtime (getRuntime) (exec "vim"))
> [EMAIL PROTECTED]
> user=> (.. Runtime (getRuntime) (exec "/usr/bin/vim"))
> [EMAIL PRO
Hi Parth,
On 8/25/08, Parth Malwankar <[EMAIL PROTECTED]> wrote:
>
> I want to run a shell command through Clojure
> so I tried the following which doesn't work:
>
By "doesn't work" do you mean that you don't see any output from the processes?
First thing to understand is that processes creat
I want to run a shell command through Clojure
so I tried the following which doesn't work:
user=> (.. Runtime (getRuntime) (exec "vim"))
[EMAIL PROTECTED]
user=> (.. Runtime (getRuntime) (exec "/usr/bin/vim"))
[EMAIL PROTECTED]
user=> (.. Runtime (getRuntime) (exec "ls"))
[EMAIL PROTECTED]
I may
38 matches
Mail list logo