Thanks for the thread links. This is basically what I suspected -- if
you want to use structs in multimethods, you have to roll your own
constructor which adds some kind of "type" tag to either the hashmap
or the metadata.
It just seems like a common case, so I was hoping there was a more
conven
Hi Greg
Here is a proof of concept of one approach you could take:
http://groups.google.com/group/clojure/web/job-queue.clj
A set of agents are maintained to represent computation jobs. When the
results are gathered, the agent is thrown away. I think using multiple
agents in this way could be qu
On Jan 21, 10:48 pm, Mark Engelberg wrote:
> Is there any way to determine whether something is a "struct" (versus
> an ordinary hash map), and if so, determine which kind of struct it
> was built from?
P.S., for the first part, you can use
(instance? clojure.lang.PersistentStructMap x )
alt
I feel like I've seen an answer to this before, but I can't find the
specific thread now. However, the following two threads seem to have
very closely related info (including a reply or two from Rich).
http://groups.google.com/group/clojure/browse_thread/thread/a5e0ba6480d04829/e8e2a14c77f5babf?
I support something like this. Also maybe see my "maximal-elements"
here:
http://groups.google.com/group/clojure/browse_thread/thread/134642cc76de17f7?hl=en#
A nice feature of getting all the maximal elements is you can do
(first (maximal-elements ...)) to recreate functions like yours but
also
Is there any way to determine whether something is a "struct" (versus
an ordinary hash map), and if so, determine which kind of struct it
was built from?
For example, in Scheme, consider (define-struct circle (x y radius)),
you get a circle? predicate for free that knows how to distinguish
betwee
On Jan 21, 5:21 pm, e wrote:
> I would think it would be useful to have something exactly like a stream but
> that allowed as many iterators as you like but that a mutex prevented any
> two from consuming the same piece of information.
That might be useful for something, but it's hard to make
Chouser, how usable is clojurescript to generate extremely simple
javascript calls? When creating HTML templates, I find myself using
ugly string interpolation to generate the .js. I would really love it
if I could do something like:
(clojurescript/str (swfobject/embedSWF "open-flash-chart.swf"
"
I'd like to implement a processing queue in which I'll asynchronously
drop events (represented by, say, a structmap) onto a queue, and
retrieve the results later.
One possible approach to this could be using an agent to store the
results (the agent's controlled state is a collection of results fr
A couple months ago, there was a discussion in this group about the
functions max and min and making them work with data types other than
numbers. I was toying around tonight, and I wrote the following
functions.
(defn- boundary
[compare-fn f & args]
(reduce (fn [a b] (if (compare-fn (compar
wwmorgan wrote:
> map is lazy, but to-array is not. The output you are seeing is the
> result of to-array needing to realize every element of its collection.
> every? only applies its predicate to as many elements of its
> collection as are necessary. See the following:
Thank you.
This became m
On Jan 21, 2009, at 8:58 PM, Vincent Foley wrote:
>
> I made some tests, and if I am not mistaken, if an eos is not
> specifically specified, Object is used, is that right?
>
> user=>
> (let [iter (stream-iter (range 5))]
> (def s (stream (fn [eos]
> (let [x (next! iter eos)]
I made some tests, and if I am not mistaken, if an eos is not
specifically specified, Object is used, is that right?
user=>
(let [iter (stream-iter (range 5))]
(def s (stream (fn [eos]
(let [x (next! iter eos)]
(if (= eos x)
(do (pr
amazing. Some day there will be a book written about this perfect storm:
"The Language Age".
Ok, I admit. I started watching this presentation last night:
http://www.parleys.com/display/PARLEYS/Home#talk=2556139;slide=1;title=The%20future%20will%20be%20about%20programming%20languages
did I see
Consider the function deeply-nested:
(defn deeply-nested [n]
(loop [n n
result [:bottom]]
(if (= n 0)
result
(recur (dec n) [result]
If you print it at the REPL for small values of n, no problem:
(deeply-nested 25)
-> [[:bottom]
>
> Well, it's the combination of a seq being persistent and a stream
> being one-pass - to realize the seq you'll need that pass.
could be implemented still doing that pass . . . and --> This may be where
you are headed in the To Be Continued, but it out to be possible to wrap a
sequence with a
I just got bit by (clojure.contrib.lazy-seqs/combinations) returning
nil, not [[]] as I expected. I could see arguments for either being
the "correct" output, but let me give my case for [[]].
In my mind, asking what the output of (combinations) should be is
completely analogous to asking what t
On Jan 21, 8:05 pm, e wrote:
> I'm stopping to write this after the seq definition (bullet) to give you my
> exact feeling moving on. You may find that that is ok and that I will get
> it by the end of the page:
>
> What I assume at this point to be true is that if I first use an iter to *
> c
I would think it would be useful to have something exactly like a stream but
that allowed as many iterators as you like but that a mutex prevented any
two from consuming the same piece of information. So if a lot of agents had
a handle to a stream, would they have to attach and detach iterators to
I'm stopping to write this after the seq definition (bullet) to give you my
exact feeling moving on. You may find that that is ok and that I will get
it by the end of the page:
What I assume at this point to be true is that if I first use an iter to *
consume* some of the stream, that part is use
On Jan 21, 7:40 pm, Vincent Foley wrote:
> I have a question regarding the examples, specifically map* and
> filter*
>
> (defn map* [f coll]
> (let [iter (stream-iter coll)]
> (stream
> (fn [eos]
>(let [x (next! iter eos)]
> (if (= eos x) x (f x)))
>
> (take 4 (m
Excellent!
In case anyone else has the same problem I did: if the latest swank-
clojure blows up on you, merging in the changes from the trunk will
solve it. This is fairly painless as there are only a few conflicts.
--~--~-~--~~~---~--~~
You received this messag
I have a question regarding the examples, specifically map* and
filter*
(defn map* [f coll]
(let [iter (stream-iter coll)]
(stream
(fn [eos]
(let [x (next! iter eos)]
(if (= eos x) x (f x)))
(take 4 (map* inc (filter* even? (range 100
-> (1 3 5 7)
How is e
> It could be that the two threads are contending over the Array object
> reference (Java arrays aren't pointers). Is there a nice way to
> create "subvector" objects that only reference the underlying memory
> and not the parent array object?
You might be interested in the *Buffer classes (e.g.
Did you encounter these problems with a recent codebase, or was it
days or weeks ago ?
We had reports of correct installations on Windows, Imac and Linux
boxes with recent codebase.
One use solved a problem on mac that could be the one you are faced
with ? :
"
The issue was that clojure.jar was
Is the mmap interface a possibility?
You could bulkget an array for each thread. I guess that would
probably not gain much against just copying an array for each thread.
I couldn't find a way to create a subvector of a java array.
Chris
On Jan 21, 12:20 pm, "Mark H." wrote:
> On Jan 21, 8:56
On Jan 21, 5:02 pm, Jon Harrop wrote:
> On Tuesday 20 January 2009 21:41:29 Rich Hickey wrote:
>
> > This issue (TCO) is resolved - it's a limitation of the JVM that
> > Clojure accepts. If that is a significant problem for anyone they
> > should either not use Clojure or work on adding TCO to
On Tuesday 20 January 2009 21:41:29 Rich Hickey wrote:
> This issue (TCO) is resolved - it's a limitation of the JVM that
> Clojure accepts. If that is a significant problem for anyone they
> should either not use Clojure or work on adding TCO to the JVM via the
> MLVM effort:
>
> http://openjdk.j
Hello Rich,
Looking forward to using them! It is pleasure to see such nice
development!
Frantisek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googleg
On Jan 21, 2009, at 4:39 PM, Frank wrote:
I am interested in trying to use Clojure to develop web-based
applications. Can someone point me to any Clojure libraries that have
been written that I can use. Thanks.
Compojure and webjure are two names worthy of Google searches along
those line
Hi,
I am interested in trying to use Clojure to develop web-based
applications. Can someone point me to any Clojure libraries that have
been written that I can use. Thanks.
Frank
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
Sadly, it would not install for me. I am running 3.4.1 and I do Java dev so
I should have all the dependencies. It installs without complaint but comes
up broken in the about plugins and there is no function ality to be found.
Tom
2009/1/21 lpetit
>
> Hello,
>
> If you want to give a "try" to
On Wed, Jan 21, 2009 at 3:06 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 21.01.2009 um 21:44 schrieb Mark Volkmann:
>
>> What is the difference between vimclojure and Gorilla?
>
> VimClojure provides static things like syntax highlighting,
> indenting and static code completion as supported by
> Vi
> Feedback welcome
Brilliant! :)
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to
clojure
Hi,
Am 21.01.2009 um 21:44 schrieb Mark Volkmann:
What is the difference between vimclojure and Gorilla?
VimClojure provides static things like syntax highlighting,
indenting and static code completion as supported by
Vim (). It's purely Vim and needs nothing else.
Gorilla supplements VimClo
What is the difference between vimclojure and Gorilla?
On Wed, Jan 21, 2009 at 2:01 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 21.01.2009 um 17:25 schrieb Mark Feeney:
>
>> Anyone else having issues with Gorilla with "recent" SVN builds of
>> clojure and clojure-contrib? What I'm seeing is that
Hi,
Am 21.01.2009 um 17:25 schrieb Mark Feeney:
Anyone else having issues with Gorilla with "recent" SVN builds of
clojure and clojure-contrib? What I'm seeing is that the main
commands (es, et, eb, ef, etc.) work as usual, but the in-Vim Repl,
doesn't seem to display any evaluation output. N
Hi,
Am 21.01.2009 um 14:06 schrieb bOR_:
Just for posterity: It took me a while to realize that my fresh vim
didn't have a maplocalleader defined. Had to add it to the .vimrc so
that chimp (and I guess gorilla as well) would actually have some
keybindings associated with it.
let maplocalleader
I've started documenting the streams work I have been doing, for those
interested:
http://clojure.org/streams
Feedback welcome,
Rich
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this
> I wonder if it wouldn't be a good idea to move the call to binding
> fromsocket-replinto accept-fn. It seems like a reasonable default to rebind
> *in* and *out* for the duration of the accepting function; the example
> uses this as does my application.
I'm not sure that rebinding *in* and *ou
On Jan 21, 8:56 am, Perry Trolard wrote:
> If I understand what you did correctly, the reason it worked for you
> is that Rich committed a fix to SVN in the meantime!
Awesome, real-time fix!
> > The last (count result-p) call takes a few seconds (probably
> > because there's a one-to-one mappin
map is lazy, but to-array is not. The output you are seeing is the
result of to-array needing to realize every element of its collection.
every? only applies its predicate to as many elements of its
collection as are necessary. See the following:
user=> (every? print-arg [true false true])
[true]
Hi all,
Does anyone have, or know where I can find, simple working examples
showing the use of:
- definline
- defmacro with all the fields, (defmacro name doc-string? attr-map?
([params*] body) + attr-map?)
I get doc-string, but don't understand:
- attr-map
- (...) + attr-map
- the preci
(defn print-arg [x]
(let [result# x]
(println (format " [%s] " result#))
result#))
(every? true? (map #(print-arg %) [true false true]))
; [true]
; [false]
;false
(ev
Hello,
If you want to give a "try" to clojure-dev (but you may well end up
using it if you can afford all its current limitations :-), I'll
recommand these two links :
- documentation page : the first lines explain how to install it (as
easy as installing any eclipse plugin from an eclipse updat
On Jan 21, 2009, at 11:33 AM, Tom Ayerst wrote:
> If you are an emacs fan I am told Clojurebox, no contest.
If you already use Emacs but aren't sure how to get Clojure support
setup, Bill Clementson has plenty of helpful posts:
http://bc.tech.coop/blog/081023.html
http://bc.tech.coop/blog/0812
Thanks for testing, Mark.
If I understand what you did correctly, the reason it worked for you
is that Rich committed a fix to SVN in the meantime!
> The last (count result-p) call takes a few seconds (probably
> because there's a one-to-one mapping of tasks to sequence
> elements) but it finish
If you are an emacs fan I am told Clojurebox, no contest.
If you are not comfortable with emacs I would recommend using a basic editor
(if you want syntax highlighting you could use JEdit with the clojure config
(search for it in the e-mail archive)) and a repl running from the commeand
line (for
Hi all,
Anyone else having issues with Gorilla with "recent" SVN builds of
clojure and clojure-contrib? What I'm seeing is that the main
commands (es, et, eb, ef, etc.) work as usual, but the in-Vim Repl,
doesn't seem to display any evaluation output. No errors on stdout of
the gorilla server.
On Wed, Jan 21, 2009 at 10:29 AM, Mark Volkmann
wrote:
>
> What does "321" represent?
user=> (show 321 :bridge)
=== public final java.lang.Integer ===
[32] compareTo : int (Object)
nil
321 is an Integer literal. When 'show' sees a non-class as its first
argument, it fetchs the object's class
If you're not already an emacs user, I found it can be quite the
learning curve getting into it. So I'd recommend you also give the
eclipse clojure-dev plugin a shot. It now has a REPL, namespace
browser, syntax highlighting, etc and works fine on windows.
http://code.google.com/p/clojure-dev/
O
On Wed, Jan 21, 2009 at 9:18 AM, Chouser wrote:
>
> On Wed, Jan 21, 2009 at 9:52 AM, Mark Volkmann
> wrote:
>>
>> On Wed, Jan 21, 2009 at 7:44 AM, Chouser wrote:
>>>
>>> On Wed, Jan 21, 2009 at 12:05 AM, Chouser wrote:
The predicate takes a map based on the 'bean' of the member objec
On Wed, Jan 21, 2009 at 9:52 AM, Mark Volkmann
wrote:
>
> On Wed, Jan 21, 2009 at 7:44 AM, Chouser wrote:
>>
>> On Wed, Jan 21, 2009 at 12:05 AM, Chouser wrote:
>>>
>>> The predicate takes a map based on the 'bean' of the member object,
>>> but with :text and :member keys added. The :text is w
If you are running windows, clojurebox is the easiest way to set
things up. On linux, this guide might help: http://riddell.us/clojure/
On Jan 21, 3:05 pm, anderspe wrote:
> Hello, i am waiting for the book "Programming Clojure" by Stuart
> Halloway,
> I have set upp a enviroment that i can run
On Wed, Jan 21, 2009 at 7:44 AM, Chouser wrote:
>
> On Wed, Jan 21, 2009 at 12:05 AM, Chouser wrote:
>>
>> The predicate takes a map based on the 'bean' of the member object,
>> but with :text and :member keys added. The :text is what will be
>> printed, the :member is the original member objec
Hello, i am waiting for the book "Programming Clojure" by Stuart
Halloway,
I have set upp a enviroment that i can run a REPL and
load script.
But i am looking for som basic info about sett upp interaction
to a editor, EMACS or...
I have tryed Plugin to Netbeans but it was Alpha and have
som prob
I think that having efficient algorithms for the fundamental data
structures is extremely important.
But Rich and the Contributers must have tons of other stuff to worry
about. In the meantime I will
use Jason's fix.
On Jan 20, 8:27 pm, Mark Engelberg wrote:
> I say "thumbs up" to this proposal.
On Wed, Jan 21, 2009 at 12:05 AM, Chouser wrote:
>
> The predicate takes a map based on the 'bean' of the member object,
> but with :text and :member keys added. The :text is what will be
> printed, the :member is the original member object itself.
This means that (as of clojure svn 1221) you c
On Jan 21, 12:14 am, Chouser wrote:
> The first method of the String class does not take varargs:
> user=> (.isVarArgs (first (.getMethods String)))
> false
>
> The above is the Right Kind of False, as shown here:
> user=> (if (.isVarArgs (first (.getMethods String))) :true :false)
> :false
>
>
Just for posterity: It took me a while to realize that my fresh vim
didn't have a maplocalleader defined. Had to add it to the .vimrc so
that chimp (and I guess gorilla as well) would actually have some
keybindings associated with it.
let maplocalleader = ","
Gracias!
On Dec 19 2008, 8:26 am, M
On Jan 21, 4:12 am, "Stephen C. Gilardi" wrote:
> On Jan 20, 2009, at 7:01 PM, Stephen C. Gilardi wrote:
>
> I've checked in an implementation for this. I confirmed that it
> doesn't harm the jdbc url method of connecting, but I don't have a
> DataSource setup to test the DataSource method. Juerg
61 matches
Mail list logo