On Dec 2, 11:15 pm, lazy1 wrote:
> Hello,
>
> I'm trying to create a "factory" method for Java classes, however I'm
> doing something wrong.
>
> (import '(java.util Dictionary HashMap))
>
> (def *containers* { :dict Dictionary :hash HashMap})
> (defn new-container
> [type]
> (new (*container
On Dec 2, 9:09 pm, David Brown wrote:
...
> If you're running JDK 6, you can run the virtualvm, or jconsole to get
> a better handle on the memory usage, and even dig into what it might
> used for.
Google does not return useful references to a tool called virtualvm;
perhaps you mean VisualVM (j
Matthew;
Thank you! Now I'm being able to program with Clojure. This was the
route I should have use from the begging. Aquamacs is not very
suitable for ELPA installations. Anyone who wants to use Clojure in
Emacs, in a Mac OS X computer should follow this instructions. It's
very easy.
Guido
On
On Dec 2, 9:09 pm, David Brown wrote:
> How much memory do you have on your machine. A recent Sun JVM on a
> machine with a bunch of memory will consider it to be a "server"
> machine. It will set the heap max to 1/4 of total physical memory
> (which suggests you might have 16GB of RAM).
I have
Hello Raoul,
I don't know if one of the blog posts that you are referring to was
mine. I did blog yesterday about running tests concurrently. I have
put the code that I use to run my tests on GitHib here:
http://github.com/brentonashworth/fpl-clojure-util
See the file test.clj
I use this with c
>> Is this behavior the specified behavior? Can I ASSUME it is true in
>> my code?
I imagine that Clojure's some?/every? follow Common Lisp's every and
some, defined as:
every returns false as soon as any invocation of predicate returns
false. If the end of a sequence is reached, ev
I've always relied on this being true without losing sleep at night (or
during the day), and it has a good grounding in predicate logic:
http://en.wikipedia.org/wiki/Universal_quantification#The_empty_set
Cheers,
Mark
Sean Devlin writes:
> The following return true:
>
> user=>(every? even?
The following return true:
user=>(every? even? nil)
true
user=>(every? even? [])
true
Is this behavior the specified behavior? Can I ASSUME it is true in
my code?
Sean
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em
Hey, the API page doesn't look right in Firefox 3.5
The cut off around halfway through the page.
I think this also happens in Safari, but I'm not sure right now.
Oh, and IE 6... YUCK! (But that's expected :))
Sean
--
You received this message because you are subscribed to the Google
Groups "C
On Dec 2, 2009, at 5:04 PM, dysinger wrote:
> We need to hire another two full-time devs (!) to work on a clojure
> project
> (distributed backend on clojure). Don't be nervous about that old job
> - take a
> risk! Wake up and work in your PJs with interesting code and get paid
> to code in
> clo
On Dec 2, 8:15 pm, lazy1 wrote:
> Hello,
>
> I'm trying to create a "factory" method for Java classes, however I'm
> doing something wrong.
>
> (import '(java.util Dictionary HashMap))
>
> (def *containers* { :dict Dictionary :hash HashMap})
> (defn new-container
> [type]
> (new (*containers
(new) tries to resolve the argument at compile-time, not runtime. You need
to spell out each (new class) in a cond. You might write a macro to make it
a little less verbose.
-Mike
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this grou
Thanks to everyone for the solutions. I actually wrote this terribly
ugly function. Terrible. This should go in the "don't write code like
this section" in clojure book.
(defn md2 [d1 d2 d3 d4 d5]
(let [cnt (count d1)]
(loop [i 0 v []]
(if (= i cnt)
v
(do
(if (=
1. CLR Interop: Interop is the focus of development at the moment.
Work is progressing on those things that the JVM implementation
doesn't worry about: ref/out params, assembly references, generics,
etc.I haven't spent much think time on attributes yet. Do you
have some specific use cases?
Hello,
I'm trying to create a "factory" method for Java classes, however I'm
doing something wrong.
(import '(java.util Dictionary HashMap))
(def *containers* { :dict Dictionary :hash HashMap})
(defn new-container
[type]
(new (*containers* type)))
(def d (new-container :dict))
The above gi
>> On Wed, Dec 2, 2009 at 6:22 PM, Don wrote:
>> > Thank you Stefan and Kevin. Awesome solutions that answer my
>> > question. However I actually made a mistake in posing my question.
>> > Let me attempt to ask my question again.
>>
>> > I have 5 vectors as such:
>> > a [2 4 6 7]
>> > b [1 3
(defn min-dist [coll]
(let [minval (reduce min coll)]
(map #(if (= minval %) 1 0) coll)))
this function, if you pass
user=> (min-dist [2 1 2 6 4])
(0 1 0 0 0)
assume the 5 vectors are stored in a b c d e.
user=> (apply map vector (map min-dist (map vector a b c d e)))
([0 0 0 0] [1 0 0 0]
On Wed, Dec 2, 2009 at 7:59 PM, Don wrote:
> I still can't figure it out. If have this set.
>
> a [2 4 6 7]
> b [1 3 9 2]
> c [2 4 5 6]
> d [6 1 3 8]
> e [4 8 2 1]
>
> If I do (reduce min (map #(get % 0) (list a b c d e)))
>
> It grabs the min value from index 0 of the five vectors and retu
On Wed, Dec 02, 2009 at 02:01:36PM -0800, Johann Hibschman wrote:
>There is a qualitative difference between the runs, though. I can run
>test-split-3 five times in a row, all with similar times, without
>having the java process size get bigger than 0.6 GB. When I run any of
>the others, the size
Is there a translation?
Google translator is not so good and I only know basic German...
2009/12/2 Stefan Kamphausen
> Hi,
>
> having received the blessings of #clojure (kind of) I'll be bold
> enough to post a link to an article on Clojure that was published
> today.
>
> http://www.linux-magaz
On Dec 2, 12:43 pm, Jim Weirich wrote:
> On Dec 2, 2009, at 4:36 PM, ataggart wrote:
>
> > If by "koan" you mean usage examples, then there are plenty of them
> > within the clojure source itself, as well as clojure-contrib.
>
> The Koans are more than "just" examples. They are designed to
>
On Wed, Dec 2, 2009 at 5:43 PM, Don wrote:
> I am having difficulty approaching this problem. I'm not sure if it
> can be done in one swoop, or requires a few steps.
>
> I have 5 vectors as such:
>
> a [2 4 6 7]
> b [1 3 9 2]
> c [2 4 5 6]
> d [6 1 3 8]
> e [4 8 2 1]
>
> And I want to take the m
On Dec 2, 2:50 pm, ataggart wrote:
> After reading the code, I'm inclined to not trust those numbers. Note
> that the time metrics for test-split* are all in the same ballpark,
> creating the same number of superfluous, intermediate String
> instances, but the memory numbers you list are wildly
I still can't figure it out. If have this set.
a [2 4 6 7]
b [1 3 9 2]
c [2 4 5 6]
d [6 1 3 8]
e [4 8 2 1]
If I do (reduce min (map #(get % 0) (list a b c d e)))
It grabs the min value from index 0 of the five vectors and returns 1
corresponding to 'b'. But I'm not sure how I would determi
assuming, vector a b c d e are already defined.
I'd do
user=> (map vector a b c d e)
([2 1 2 6 4] [4 3 4 1 8] [6 9 5 3 2] [7 2 6 8 1])
you can then use the solutions provided from previous messages
to find the min value of each vector.
so you then end up with
[0 1 0 0 0] [0 0 0 1 0] [0 0 0 0 1
Forgot to mention that i'm still calculating the minimum distance
between the vectors, but my output isn't actually the minimum value.
The output is the minimum value in terms of the vectors, if that makes
sense.
On Dec 2, 3:22 pm, Don wrote:
> Thank you Stefan and Kevin. Awesome solutions that
Thank you Stefan and Kevin. Awesome solutions that answer my
question. However I actually made a mistake in posing my question.
Let me attempt to ask my question again.
I have 5 vectors as such:
a [2 4 6 7]
b [1 3 9 2]
c [2 4 5 6]
d [6 1 3 8]
e [4 8 2 1]
and the output i want is this
a1
user=> (vec (map min [2 4 6 7] [1 3 9 2] [2 4 5 6] [6 1 3 8] [4 8 2 1]))
[1 1 2 1]
user=>
On Wed, Dec 2, 2009 at 2:53 PM, Stefan Kamphausen
wrote:
> Hi,
>
> On Dec 2, 11:43 pm, Don wrote:
>> I am having difficulty approaching this problem. I'm not sure if it
>> can be done in one swoop, or re
Hi,
On Dec 2, 11:43 pm, Don wrote:
> I am having difficulty approaching this problem. I'm not sure if it
> can be done in one swoop, or requires a few steps.
>
> I have 5 vectors as such:
>
> a [2 4 6 7]
> b [1 3 9 2]
> c [2 4 5 6]
> d [6 1 3 8]
> e [4 8 2 1]
> And I want to take the minimum val
Hi,
having received the blessings of #clojure (kind of) I'll be bold
enough to post a link to an article on Clojure that was published
today.
http://www.linux-magazin.de/Heft-Abo/Ausgaben/2010/01/Nebenlaeufig
Please note, that as of today you can also buy that fine magazine in
print. ;-)
Hopef
I am having difficulty approaching this problem. I'm not sure if it
can be done in one swoop, or requires a few steps.
I have 5 vectors as such:
a [2 4 6 7]
b [1 3 9 2]
c [2 4 5 6]
d [6 1 3 8]
e [4 8 2 1]
And I want to take the minimum value at a given index between the
vectors. Therefore, min
On Dec 2, 2009, at 4:36 PM, ataggart wrote:
> If by "koan" you mean usage examples, then there are plenty of them
> within the clojure source itself, as well as clojure-contrib.
The Koans are more than "just" examples. They are designed to
demonstrate one concept at a time and are arranged so
On Dec 2, 1:32 pm, Stefan Kamphausen wrote:
> Hi,
>
> On Dec 2, 10:24 pm, ataggart wrote:
>
> > My guess is that String and array, while not implementing the
> > IAssociative interface, all have the O(1) lookup performance
> > guarantees of associative data structures,
>
> um, no? According to
We need to hire another two full-time devs (!) to work on a clojure
project
(distributed backend on clojure). Don't be nervous about that old job
- take a
risk! Wake up and work in your PJs with interesting code and get paid
to code in
clojure! (I live on Kauai, HI)
The team currently consists of
hi,
i've seen some blog posts / code about using agents to use up
cores/hyper-threading and speed up testing cycles. how might one do
that with clojure.test{.tap}? like if somebody already has that in
github somewhere i don't want to reinvent the wheel.
thanks.
--
You received this message beca
On Dec 2, 12:38 pm, David Nolen wrote:
> Yeah it sounds like you'll need to package up JOGL 2 and push it to Clojars
> right?
>
>
>
> On Wed, Dec 2, 2009 at 3:20 PM, Zach Tellman wrote:
> > On Dec 1, 3:31 pm, David Nolen wrote:
> > > So just to keep the conversation going:
>
> >http://download.j
If by "koan" you mean usage examples, then there are plenty of them
within the clojure source itself, as well as clojure-contrib.
See also: http://rosettacode.org/wiki/Category:Clojure
Leave it to rubyists to turn a simple concept like examples into some
religious indoctrination. I kid!
On Dec
Hi,
On Dec 2, 10:24 pm, ataggart wrote:
> My guess is that String and array, while not implementing the
> IAssociative interface, all have the O(1) lookup performance
> guarantees of associative data structures,
um, no? According to the bit-partition implementation of vector and
the slightly m
On Dec 2, 1:08 pm, Stefan Kamphausen wrote:
> Hi,
>
> On Dec 2, 9:06 pm, ataggart wrote:
>
> > > I'd like to understand the (probably well-grounded) reason for that.
> > > As far as I can see PersistentList extends Counted, so the check for
> > > the index-range should at least be possible. Ho
Hi,
On Dec 2, 9:06 pm, ataggart wrote:
> > I'd like to understand the (probably well-grounded) reason for that.
> > As far as I can see PersistentList extends Counted, so the check for
> > the index-range should at least be possible. However, I think people
> > would expect an equality check in
Using the Cocoa build of Emacs 23 (http://www.emacsformacosx.com) I
was able to get up and running extremely quickly with Technomancy's
swank-clojure install.
http://technomancy.us/swank-clojure
After just a few minutes I was in the REPL and ready to go.
Good luck!
On Nov 30, 8:32 pm, Charras
The folks over at http://edgecase.com put together a great project for
people interested in Ruby to really get a grasp of the standard
library as well as introduce them to the idea of unit testing. The
project is up on Github: http://github.com/edgecase/ruby_koans
The basic idea is you run Rake w
Yeah it sounds like you'll need to package up JOGL 2 and push it to Clojars
right?
On Wed, Dec 2, 2009 at 3:20 PM, Zach Tellman wrote:
> On Dec 1, 3:31 pm, David Nolen wrote:
> > So just to keep the conversation going:
> >
> >
> http://download.java.net/maven/2/net/java/dev/gluegen/http://downl
On Dec 1, 3:31 pm, David Nolen wrote:
> So just to keep the conversation going:
>
> http://download.java.net/maven/2/net/java/dev/gluegen/http://download.java.net/maven/2/net/java/dev/jogl/
>
> I note that these two maven repos specify the platform with the following:
>
> lib-{platform}-{arch}
>
>
On Dec 2, 12:02 pm, Chouser wrote:
> On Wed, Dec 2, 2009 at 2:06 PM, ataggart wrote:
>
> > On Dec 2, 9:10 am, Konrad Kułakowski (kony)
> > wrote:
> >> Recently I need something which works as "inverse of interleave"
>
> > How about this?
>
> > (defn skip [coll n]
> > (lazy-seq
> > (when-le
On Dec 2, 12:06 pm, ataggart wrote:
> On Dec 2, 7:10 am, Stefan Kamphausen wrote:
>
>
>
>
>
> > Hi,
>
> > while studying the collection types and trying to find out which
> > functions work on all collection types (i.e. lists, vectors, maps,
> > sets) I was flabbergasted by the following
>
> >
On Dec 2, 7:10 am, Stefan Kamphausen wrote:
> Hi,
>
> while studying the collection types and trying to find out which
> functions work on all collection types (i.e. lists, vectors, maps,
> sets) I was flabbergasted by the following
>
> user> (contains? (list 1 2 3) 3)
> false
>
> OK, the doc of c
On Wed, Dec 2, 2009 at 2:06 PM, ataggart wrote:
>
>
> On Dec 2, 9:10 am, Konrad Kułakowski (kony)
> wrote:
>> Recently I need something which works as "inverse of interleave"
>
> How about this?
>
> (defn skip [coll n]
> (lazy-seq
> (when-let [s (seq coll)]
> (cons (first s) (skip (drop
Hi,
2009/12/2 Konrad Kułakowski (kony)
> Recently I need something which works as "inverse of interleave"
>
> I did something like that:
>
> (defn unravel [expr-list]
>(loop [flist () slist () tic-tac 0 olist expr-list]
>(let [item (first olist)]
>
On Dec 2, 10:50 am, Johann Hibschman wrote:
> I don't understand Clojure's space requirements when processing lazy
> sequences. Are there some rules-of-thumb that I could use to better
> predict what will use a lot of space?
>
> I have a 5.5 GB pipe-delimited data file, containing mostly floats
On Dec 2, 10:50 am, Johann Hibschman wrote:
> I don't understand Clojure's space requirements when processing lazy
> sequences. Are there some rules-of-thumb that I could use to better
> predict what will use a lot of space?
>
> I have a 5.5 GB pipe-delimited data file, containing mostly floats
Thanks a bunch, this has been very helpful.
-- Dennis
On Wed, Dec 2, 2009 at 1:03 PM, Tayssir John Gabbour <
tayssir.j...@googlemail.com> wrote:
> BTW, I should point out that zip-filter.xml/xml-> is surprisingly
> syntaxy.
>
> (xml-> loc
>:CLUSTER :HOST :METRIC
> (fn [loc]
>
I don't understand Clojure's space requirements when processing lazy
sequences. Are there some rules-of-thumb that I could use to better
predict what will use a lot of space?
I have a 5.5 GB pipe-delimited data file, containing mostly floats (14
M rows of 40 cols). I'd like to stream over that fil
Thanks, I think I have the idea.
(ns ziptest
(:require [clojure.zip :as zip]
[clojure.xml :as xml]
[clojure.contrib.zip-filter :as zf])
(:use clojure.contrib.zip-filter.xml)
(:import (java.io ByteArrayInputStream)))
(def *xml-string*
"a1b1c1a1b1c2a1b2c1")
(defn string-to-zi
On Dec 2, 9:10 am, Konrad Kułakowski (kony)
wrote:
> Recently I need something which works as "inverse of interleave"
>
> I did something like that:
>
> (defn unravel [expr-list]
> (loop [flist () slist () tic-tac 0 olist expr-list]
> (let [item (first olist)]
>
BTW, I should point out that zip-filter.xml/xml-> is surprisingly
syntaxy.
(xml-> loc
:CLUSTER :HOST :METRIC
(fn [loc]
[[(xml1-> (zip/up loc) (attr :NAME))
(xml1-> loc (attr :NAME))
(xml1-> loc (attr :VAL))
(xml1-> loc
Hi!
Taking minor liberties with your code (for clarity), the following
gives pretty much the same result as your handle-xml function:
(ns blah
(:require [clojure.xml :as xml]
[clojure.zip :as zip])
(:use clojure.contrib.zip-filter.xml))
(defn my-test []
(doseq [x (xml-> (zip/x
On Dec 2, 4:51 pm, Dennis wrote:
> The XML is of the form:
> ganglia
> multiple clusters
> multiple hosts
> multiple metrics
Use XPath. Seriously, I hate XML and XSLT, but XPath is simply the
most concise way to extract things from a nested structure. Most XPath-
libraries allow for p
Thanks for sharing the insights.
/Karl
--
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 from new members are moderated - please be patient with your
first post.
To unsubscr
the only solution comes to mind is a two pass partition.
ie
(flatten (partition 1 2 dl)) for the first list
and (flatten (partition 1 2 (rest dl))) for the 2nd list.
2009/12/2 Konrad Kułakowski (kony) :
> Recently I need something which works as "inverse of interleave"
>
> I did something like
On Wed, Dec 2, 2009 at 11:29 AM, Dennis wrote:
> Sean,
> I probably did not make it clear, but I am using parse. The second line of
> handle-xml function in my original E-Mail has the parse in it. I then
> iterate over the xml-seq.
Are you familiar with 'zippers'? There is a zipper for xml-seqs
Recently I need something which works as "inverse of interleave"
I did something like that:
(defn unravel [expr-list]
(loop [flist () slist () tic-tac 0 olist expr-list]
(let [item (first olist)]
(if (= item nil)
(lis
Tim Bray starts with the delightfull forthright "Clojure is the best
Lisp ever!" and then goes on to explain why the JVM's current lack of
hard tail calls don't matter.
http://www.tbray.org/ongoing/When/200x/2009/12/01/Clojure-Theses
Interesting, and certainly confirms my own prejudices about Clo
On Wed, Dec 2, 2009 at 10:10 AM, Stefan Kamphausen
wrote:
> OK, the doc of contains? told me that for indexed collection-types it
> will only check, whether the index is within the valid range. So
> maybe:
>
> user> (contains? (list 1 2 3) 1)
> false
>
> At that point I dived into the implementa
Sean,
I probably did not make it clear, but I am using parse. The second line of
handle-xml function in my original E-Mail has the parse in it. I then
iterate over the xml-seq.
I am also using:
(ns zod
(:require [clojure.contrib.http.agent :as http])
(:import (java.util Timer TimerTask))
Try the clojure.xml namespace. There's a funciton parse in there that
should help.
On Dec 2, 10:51 am, Dennis wrote:
> Howdy,
>
> Being new to clojure, I am having a difficult time parsing XML in an elegant
> manner. I am pulling metric information from a ganglia server as XML and
> then parsin
On Dec 2, 12:29 am, Krukow wrote:
> On Dec 1, 10:56 pm, Rich Hickey wrote:
> [snip]
>
> > There are 2 ways to make a deftype reach a protocol. First, you can
> > implement the protocol directly in the deftype/reify, supplying the
> > protocol where you do interfaces, and the methods of the prot
Howdy,
Being new to clojure, I am having a difficult time parsing XML in an elegant
manner. I am pulling metric information from a ganglia server as XML and
then parsing it. The below function works but it makes me feel icky. I was
hoping for some tips.
The "dc" variable contains a map with so
It creates journals in readable and executable form:
1.journal
"
(tr-fn 1 2) ;1
(tr-fn 10 20) ;2
(tr-fn-swap) ;3
(tr-inc) ;4
"
--
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 po
Hi,
I have implemented the simple journal-based persistence library for Clojure
programs and now making it public.
It follows "Prevalent system" design pattern.
I consider it a good fit for the prototyping stage of a project development.
When you don't want to pay the price of impedance mismatch
On Dec 1, 3:59 pm, Charras wrote:
> Steve, I already try to follow does instructions. I copied the text
> into the *scratch* buffer, and did control j (C-j), but nothing
> happen, it just move the cursos to the next line. Do you know how can
> I make Aquamacs eval the *scratch* buffer? 'Cause I th
Hi,
while studying the collection types and trying to find out which
functions work on all collection types (i.e. lists, vectors, maps,
sets) I was flabbergasted by the following
user> (contains? (list 1 2 3) 3)
false
OK, the doc of contains? told me that for indexed collection-types it
will onl
Hi,
Cool. Thank you for your report! Just some notes.
On Dec 2, 3:10 am, Gilbert wrote:
> - vimclojure offers a number of features, but the documentation is
> hidden in a text file inside ~/.vim/doc/clojure.txt (you can also read
> it here: http://bitbucket.org/kotarak/vimclojure/src/tip/doc/c
Hi,
On Dec 2, 2:48 am, Raoul Duke wrote:
> ah. i guess i'm supposed to use clojure.test and clojure.test.tap, i see.
This is probably the right thing to do. I plan to work on ClojureCheck
again soon. But at the moment I don't have enough spare time. I hope
to find some time over christmas.
Sin
Q: I noticed that the lein nailgun runs as java -client. Being used to
seeing -server everywhere, I wonder if the -client bit makes sense,
and if it slows down simulations that are running in the vimclojure
environment.
ps x | grep java
29248 pts/1Sl 0:01 java -client -cp src/:classes/:li
Thanks for the help! Got it to work.
I did install automaton twice on clojars though, and perhaps
unnecessary so. If I want to import the jar, I need to type (import
'(dk.brics.automaton Automaton RunAutomaton RegExp)) , and when I had
clojars list the dependency only as [automaton "1.11.2"] ther
On Tue, Dec 01, 2009 at 08:16:41PM -0800, rzeze...@gmail.com wrote:
>Once you have the heap dump you can use the Eclipse Memory Analyzer
>Tool. It can take your heap dump and create various reports. One of
>them being a "dominator tree" which will show you what object has the
>largest retained h
On 12/01/2009 08:51 PM, Fogus wrote:
%< -
> I think learning C (it was my 3rd language) is likewise
> important, but it's heavy in incidental complexities that just muddle
> the problem at hand and probably not good as a start. New programmers
> need to solve as many problems as they can
78 matches
Mail list logo