Hello all,
I've been reading the list in chunks during the holidays, often
without enough time to do triage. Given the volume, it's important
that all patches be submitted (by registered contributors only) as
attachments to issues in the issues system:
http://code.google.com/p/clojure/issues/lis
Chouser a écrit :
>> What do you think of adding rec-cons, rec-cat and your (fixed) cute
>> version instead to seq-utils?
>> (see http://clj-me.blogspot.com/2009/01/recursive-seqs.html for rec-cat
>> and rec-cons)
>>
>
> That'd be fine too, especially for rec-cons and rec-cat. The
> 'reducti
Justin Johnson wrote:
> Will someone please explain to me why this isn't working? Is there
> something special about newInstance that I'm missing?
>
> user=> (. org.tmatesoft.svn.core.wc.SVNClientManager newInstance)
> #
>From the Javadoc, newInstance is a static method on SVNClientManager,
so
Will someone please explain to me why this isn't working? Is there
something special about newInstance that I'm missing?
user=> (. org.tmatesoft.svn.core.wc.SVNClientManager newInstance)
#
user=> (.newInstance org.tmatesoft.svn.core.wc.SVNClientManager)
java.lang.InstantiationException: org.tma
Hi,
This example is from clojure site.
My question is on line 5 and line 6:
The confusion is str is a function and here looks like used as a
regular variable.
Thanks in advance.
Sun
(defn loves [x y]
(str x " loves " y))
(defn test-rebind []
(println (loves "ricky" "lucy"))
(let [str-orig
Hi,
Am 05.01.2009 um 14:02 schrieb Shmurk:
That's where I failed, I didn't knew that Java method calls were
expanded like macros, thank you very much for the answer!
Well. All the interop with Java works via the . and new special
forms. The Classname. and .methodName shortcuts are just
for co
Chouser a écrit :
> On Dec 12 2008, 3:35 pm, Christophe Grand
> wrote:
>
>> I was sure it was a job for iterate:
>>
>> (defn reductions
>> "Returns a lazy seq of the intermediate values of the reduction (as
>> per reduce) of coll by f, starting with init."
>> ([f coll]
>>(if (seq col
Not related to or compatible with Common Lisp, so no. Pretty sure its
not an acronym. Closures are a commonly used concept in functional
programming, so it isn't mysterious where it came from. Just drop a J
in there for Javaness.
On Jan 3, 9:05 pm, Ed wrote:
> I have been wanting to know the sam
On Monday 05 January 2009 09:35, wubbie wrote:
> Hi,
> This example is from clojure site.
> My question is on line 5 and line 6:
> The confusion is str is a function and here looks like used as a
> regular variable.
>
> Thanks in advance.
> Sun
>
>
> (defn loves [x y]
> (str x " loves " y))
> (d
On Mon, Jan 5, 2009 at 6:35 PM, wubbie wrote:
>
> Hi,
> This example is from clojure site.
> My question is on line 5 and line 6:
> The confusion is str is a function and here looks like used as a
> regular variable.
The var that is clojure.core/str aka. 'str, points to a function that
implement
Hi,
Am 05.01.2009 um 10:30 schrieb Shmurk:
I have one questions about the "programming style" used in the Clojure
standard library. For example, in the file core.clj, I see:
(. *out* (flush))
This is the oldest form.
Why is it written like this? Could we write it like this instead:
(. *ou
Ah, static methods... Clearly I haven't spent enough time in the Java
world.
user=> (org.tmatesoft.svn.core.wc.SVNClientManager/newInstance)
#
On Mon, Jan 5, 2009 at 8:41 AM, Justin Johnson wrote:
> Will someone please explain to me why this isn't working? Is there
> something special about ne
On Sat, Jan 3, 2009 at 9:10 PM, Mark Volkmann wrote:
>
> On Sat, Jan 3, 2009 at 7:36 PM, Randall R Schulz wrote:
>>
>> On Saturday 03 January 2009 17:32, Tom Faulhaber wrote:
>>> Think of a French-style j like in bonjour, Jean Renoir, or Jacques
>>> Cousteau. That gives the word "Clojure" a sou
Chouser a écrit :
> On Mon, Jan 5, 2009 at 9:53 AM, Christophe Grand
> wrote:
>
>> Chouser a écrit :
>>
>>> This isn't in clojure.core yet (any reason why not?) so would you mind
>>> if I add it to clojure.contrib.seq-utils? Or of course you can do it
>>> if you prefer. :-)
>> hat do y
Hi,
Am 05.01.2009 um 18:35 schrieb wubbie:
This example is from clojure site.
My question is on line 5 and line 6:
The confusion is str is a function and here looks like used as a
regular variable.
Thanks in advance.
binding can be used to temporarily assign
a different value to a global Var
On Mon, Dec 29, 2008 at 1:59 PM, Christian Vest Hansen
wrote:
>
> Rich & rest.
>
> I have gone through the process of implementing this in defn. The
> patch is inlined for commenting (if need be) and attached for accurate
> application.
For the record, this proposal has been considered and rejec
Hi, I'm new to Clojure and I love it so far. It's the first Lisp that
I can use professionally and it's great.
I have one questions about the "programming style" used in the Clojure
standard library. For example, in the file core.clj, I see:
(. *out* (flush))
Why is it written like this? Could
On Sat, Jan 3, 2009 at 6:20 PM, Olov Lassus wrote:
>
>> The 'let' macro already has a similar check.
>>
>> Attached is a patch that adds even-ness and related assertions to a
>> bunch of core macros.
>
> That's better - I applied the patch and it's working as expected here.
Thanks. I've created
On Tue, 30 Dec 2008 22:25:35 -0800
"Mark Engelberg" wrote:
>
>In Clojure Box, is there any way to make the REPL automatically "use"
>whatever namespaces are in the files you are actively working on?
>
If you are working on a namespace, you shouldn't 'use' it, you should
switch the REPL to that
Hey Aria,
Here's my (not functional) but reasonably fast (Knuth) shuffle I've
been using.
(defn random-permutation [s]
"Return a random permutation of this seq."
(let [arr (to-array s) len (alength arr)]
(dotimes [i (dec len)]
(let [r (+ i (rand-int (- len i))),
prev (a
All the above are addressed with a patch at:
http://code.google.com/p/clojure/issues/detail?id=32
--Chouser
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to cloj
On Sun, 04 Jan 2009 13:50:44 -0500
"Stephen C. Gilardi" wrote:
>
> On Dec 15, 2008, at 6:48 AM, black...@ipowerhouse.com wrote:
>
> > This may be a problem with the way I'm doing things but I think it
> > would be useful for the (connection) function of internal to not be
> > internal. For exa
On Jan 3, 7:46 pm, vogelrn wrote:
> sqrt(a/b) should always be equal to sqrt(a)/sqrt(b) since (a/b)^m =
> a^m/b^m for b != 0. However, I'm unsure of whether it's the best
> option for ratios because unless both the numerator and the
> denominator are perfect squares, you're going to end up with
On Mon, Jan 5, 2009 at 9:53 AM, Christophe Grand wrote:
>
> Chouser a écrit :
>> On Dec 12 2008, 3:35 pm, Christophe Grand
>> wrote:
>>
>>> I was sure it was a job for iterate:
>>>
>>> (defn reductions
>>> "Returns a lazy seq of the intermediate values of the reduction (as
>>> per reduce) of
I'm trying to recall where I heard a quote that goes something like this.
"If none of your functions have side effects then all you're doing is
heating up the processor."
Of course you should avoid side effects in most of your functions, but
at least one of them needs to have a side effect for m
On Jan 5, 1:00 pm, Meikel Brandmeyer wrote:
> While these new forms are
> available, what would be the use of rewritten everything?
I'm not trying to rewrite anything, I'm just so thrilled about this
new language that I was (for once in my life) looking at the source
trying to study what was hap
I think the best way would be to simply store functions as lists (e.g.
(fn [] ...)) in the file, use clojure.core/read to read the data
structure and store both the list representation and the eval'd
function object in the program. This might be implemented by having a
memoizing 'call' function, t
Since there has been so much back-and-forth about the Clojure snake, I
decided to write one [1]. Like Mark, my goal is to create a readable
version, but the details are quite different.
I plan to use this as the code example for the Swing section in the
book. Feedback welcome.
Stuart
[1]
I often get this error when experimenting with clojure. I just pasted
Stuart's new 'snakes' code into the repl and received this error after
almost every line.
I've never seen this error before, and I do Java programming all day.
My Java code is multi-threaded, processes lots of data...in other
On Mon, Jan 5, 2009 at 3:54 PM, Stuart Halloway
wrote:
>
> Since there has been so much back-and-forth about the Clojure snake, I
> decided to write one [1]. Like Mark, my goal is to create a readable
> version, but the details are quite different.
>
> I plan to use this as the code example for t
On Mon, Jan 5, 2009 at 3:48 PM, Mark Volkmann wrote:
>
> I'm trying to recall where I heard a quote that goes something like this.
>
> "If none of your functions have side effects then all you're doing is
> heating up the processor."
>
> Of course you should avoid side effects in most of your fun
Just downloaded clojurebox and it installs like a charm here (windows
vista business). It looks like I am stuck with windows at my new
workspace (just had my first day of work there), so to have clojurebox
was a nice thing. One question is how I would go about to setting up a
emacs --daemon and em
Nice use of 'import-static' and multimethods for 'paint' ;-)
Personally, I would move (def timer (Timer. turn-millis panel)) to the
end:
(doto panel
(.setFocusable true)
(.addKeyListener panel))
(doto frame
(.add panel)
(.setSize (* width point-size) (* height point-size))
(.setVisibl
On Mon, Jan 5, 2009 at 2:48 PM, Mark Volkmann wrote:
>
> I'm trying to recall where I heard a quote that goes something like this.
>
> "If none of your functions have side effects then all you're doing is
> heating up the processor."
>
> Of course you should avoid side effects in most of your func
Closest I can get is this quote from a blog (http://
voelterblog.blogspot.com/2008_03_01_archive.html) but I remember it
being written nicer somewhere else as well.
However, using purely functional programming is also not very useful,
since, if we allow no side effects, our program will do nothin
PS: Sometimes the apple is too close to the edge or not seen at all.
Might need to adjust apple position generation.
On Jan 5, 10:26 pm, Fanda wrote:
> Nice use of 'import-static' and multimethods for 'paint' ;-)
>
> Personally, I would move (def timer (Timer. turn-millis panel)) to the
> end:
On Jan 5, 12:48 pm, "Mark Volkmann" wrote:
> I'm trying to recall where I heard a quote that goes something like this.
>
> "If none of your functions have side effects then all you're doing is
> heating up the processor."
>
> Of course you should avoid side effects in most of your functions, but
On Mon, Jan 5, 2009 at 1:29 AM, Brian Doyle wrote:
> ... Instead of
> just returning a hash of errors what about returning the record with the
> errors hash in
> the metadata? That way you just have the data and the errors in one
That's an interesting idea. On the one hand it seems weird to m
Dear Clojurians,
This patch allows multimethods to use different hierarchies, than
the global hierarchy for use with isa?. Currently only the global
hierarchy is possible.
The patch extends the MultiFn class to accept also a Var pointing
to a hierarchy. The rationale is, that otherwise the multi
Hi,
Why are there multiple "Logging str" output.
Also in (apply str-orig args), I don't see any args passed at all!
Thanks
sun
On Jan 5, 2:14 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 05.01.2009 um 18:35 schrieb wubbie:
>
> > This example is from clojure site.
> > My question is on line 5 an
I thought that first place I heard it was Rich mentioning it in one of the
videos on http://clojure.blip.tv, but I can't find it.
On Mon, Jan 5, 2009 at 3:48 PM, Mark Volkmann wrote:
>
> I'm trying to recall where I heard a quote that goes something like this.
>
> "If none of your functions have
> I guess it comes down to what belongs in metadata. While errors are
> certainly data about other data, they don't feel to me like metadata a
> la :doc, :tag, :file, :line, and :test. They're the sort of thing I'd
> show in an application's UI as part of normal user interactions,
> rather than so
On Mon, Jan 5, 2009 at 4:24 PM, bOR_ wrote:
>
> Just downloaded clojurebox and it installs like a charm here (windows
> vista business). It looks like I am stuck with windows at my new
> workspace (just had my first day of work there), so to have clojurebox
> was a nice thing. One question is how
On Mon, Jan 5, 2009 at 5:04 PM, Paul Barry wrote:
> I thought that first place I heard it was Rich mentioning it in one of the
> videos on http://clojure.blip.tv, but I can't find it.
>
That certainly didn't originate with me. Probably from the Haskell folks.
Rich
> On Mon, Jan 5, 2009 at 3:48
I don't know if he was the first, but I heard it from Simon Peyton
Jones first:
In an interview around 3:15:
http://channel9.msdn.com/posts/Charles/Simon-Peyton-Jones-Towards-a-Programming-Language-Nirvana/
When answering a question around 10:40:
http://oscon.blip.tv/file/324976
Kevin
On Jan 5
I love the quote. I believe it comes from one of the co-creators of
Haskell, Simon Peyton Jones (http://en.wikipedia.org/wiki/
Simon_Peyton_Jones).
Here's a short video of him with the quote around 3:15:
http://channel9.msdn.com/posts/Charles/Simon-Peyton-Jones-Towards-a-Programming-Language-Nir
Hi,
I got core dump while running
It's on linux(ubuntu):
user=> (if true (str "true!") (str "false!")
)
"true!"
user=> (if false (str "true!") (str "false!"))
"false!"
user=> #
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x064f7e68, pid=6500, ti
On Mon, Jan 5, 2009 at 2:54 PM, Stuart Halloway
wrote:
>
> Since there has been so much back-and-forth about the Clojure snake, I
> decided to write one [1]. Like Mark, my goal is to create a readable
> version, but the details are quite different.
>
> I plan to use this as the code example for t
I didn't think you originated the quote, but did you mention it during one
of your presentations? Maybe I'm thinking of someone else.
On Mon, Jan 5, 2009 at 6:09 PM, Rich Hickey wrote:
>
> On Mon, Jan 5, 2009 at 5:04 PM, Paul Barry wrote:
> > I thought that first place I heard it was Rich ment
On Monday 05 January 2009 15:30, wubbie wrote:
> Hi,
>
> I got core dump while running
>
> ...
>
> user=> #
> # An unexpected error has been detected by Java Runtime Environment:
> #
> # SIGSEGV (0xb) at pc=0x064f7e68, pid=6500, tid=2893822864
> #
> # ...
>
> Process inferior-lisp aborted (core d
Ok, I'll do it.
Thanks
Sun
On Jan 5, 6:36 pm, Randall R Schulz wrote:
> On Monday 05 January 2009 15:30, wubbie wrote:
>
>
>
> > Hi,
>
> > I got core dump while running
>
> > ...
>
> > user=> #
> > # An unexpected error has been detected by Java Runtime Environment:
> > #
> > # SIGSEGV (0xb) a
Where do I find the Clojure Contributor Agreement so I can submit a
patch with my issue?
Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegrou
Perhaps the assert-args macro should be public?
Since compile-time verification of your macros is essentially free and
it avoids runtime errors that may be pretty difficult to diagnose, it
seems to me to be very good practice to check your macro arguments.
Something I still do all the time is wr
Here: http://clojure.org/contributing
On Jan 5, 3:39 pm, Andrew Baine wrote:
> Where do I find the Clojure Contributor Agreement so I can submit a
> patch with my issue?
>
> Andrew
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
On Mon, Jan 5, 2009 at 11:37 AM, Christophe Grand wrote:
> Stuart,
>
> Do you think rec-cat, rec-cons and reductions belong to seq-utils?
>
> Christophe
>
Find by me. I won't claim ownership over seq-utils or str-utils. As
far as I'm concerned, any contrib committers can add to them.
-Stuart
On Jan 4, 12:59 pm, "Stephen C. Gilardi" wrote:
> In my case, I set the value of java.ext.dirs to a list of just one
> directory. That directory contains (relative) symbolic links to all
> the Jar files and directories I want Clojure to use as its Classpath.
Symlinks! Ack! Terrible visions of
"As the saying goes, a program without side-effects does nothing more
than make your CPU hot."
http://en.wikibooks.org/wiki/Learning_Clojure
http://groups.google.com/group/clojure/browse_thread/thread/fe8e6f306b9891a7/3e35a075ad45571a?lnk=gst&q=learning+clojure#3e35a075ad45571a
Posted by Brian W,
You might be able to simplify this by having just one Ref containing
the global "state" of the game.
-S
On Jan 4, 12:59 pm, Timothy Pratley wrote:
> A while ago I wrote a short MUD which had to keep track of a changing
> group of players, and other data. Retrospectively I've developed a
> helper
Question
How can I have clojure-contrib sql execute and return arbitrary SQL
SELECT statement?
Example
This statement:
(defn db-read []
(sql/with-connection db
(sql/with-results res
"SELECT
users.id,
users.name,
roles.name
FROM
On Jan 3, 2:48 pm, "Mark Engelberg" wrote:
> I've noticed that Clojure is missing several math functions that come
> standard with most programming languages, especially other
> Schemes/Lisps. Many of these functions are available in java's math
> library, but only for doubles.
Nice work, Mark.
Ops, my mistake. Second one should be:
(defn db-read []
(sql/with-connection db
(sql/with-results res
"SELECT
users.id,
users.name
FROM
users
INNER JOIN
roles
ON
user.id = roles.user_id
ORDER BY
us
On Jan 5, 2009, at 7:17 PM, ck wrote:
Question
How can I have clojure-contrib sql execute and return arbitrary SQL
SELECT statement?
Example
The "works" and "doesn't work" cases you posted appear to be identical.
I believe there can be nothing about the SQL in the string t
On Jan 5, 2009, at 7:59 PM, ck wrote:
Ops, my mistake. Second one should be:
(defn db-read []
(sql/with-connection db
(sql/with-results res
"SELECT
users.id,
users.name
FROM
users
INNER JOIN
roles
ON
user.id = roles.user_i
Sorry to resurrect this, but I noticed that there isn't an issue to
track this - is this something unlikely to be fixed officially for
1.0 ? The workaround you posted certainly works for me, but I just
wanted to make sure the actual core.clj filter implementation receives
the fix eventually.
On D
On Mon, Jan 5, 2009 at 7:03 PM, chris wrote:
>
> Perhaps the assert-args macro should be public?
I chose to make it private for now to allow the API to morph as needed
without making breaking changes. Of course Rich will be the final
arbiter of all this.
--Chouser
--~--~-~--~~
Stephen, thanks for pointing out the namespace problem. That fixed the
exception mentioned above, which was stupidity on my part.
With that I'm able to run (again) the
scrapbook=> (db-read)
in the second example, i.e. the one without the reference to second
table in columns, I get list of maps
On Jan 5, 2009, at 8:52 PM, ck wrote:
Stephen, thanks for pointing out the namespace problem. That fixed the
exception mentioned above, which was stupidity on my part.
With that I'm able to run (again) the
scrapbook=> (db-read)
in the second example, i.e. the one without the reference to sec
Why doesn't the following code terminate on its own? It outputs the
number 6 as expected, but then just hangs. I'm guessing its related to
non-daemon threads related to agents that are still running. What's
the proper way to exit?
(def my-agent (agent 1))
(defn sleep-and-multiply [old-state time
Yep, that's it.
The two columns with the same name cause the problem.
Interestingly enough, the quick fix using
roles.name AS role_name
does *not* help either. But that give me something to look at, in this
case figuring out how 'resultset-seq' works and why it does not use
the aliases col
For completeness of the post, here's the stack trace:
java.lang.RuntimeException: java.lang.IllegalArgumentException: Too
many arguments to struct constructor (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:4179)
at clojure.core$eval__3756.invoke(core.clj:1566)
I think I read somewhere that the number of threads in the thread pool
used by agents is based on the number of processors available. Is it
exactly that number? Is that the number of threads per agent of the
total number of threads?
--
R. Mark Volkmann
Object Computing, Inc.
--~--~-~--~
On Mon, Jan 5, 2009 at 10:10 PM, Mark Volkmann
wrote:
>
> I think I read somewhere that the number of threads in the thread pool
> used by agents is based on the number of processors available. Is it
> exactly that number?
Agents currently use one of two thread pools. 'send' uses
pooledExecutor
I created a little file with it's own namespace and the tried to use
items form that file in another file. I used :use to import that
namespace into the second file but was having a devil of a time
getting it to work. It took me a while to riddle out that the file
seems to HAVE to be named
I made a post about this in October, with an attached patch. I guess
it got lost in the shuffle.
http://groups.google.com/group/clojure/browse_frm/thread/e533e9cdf758f210?q=#43e5775c2d959dc7
I'll file a bug and attach the patch.
Allen
--~--~-~--~~~---~--~~
You r
I was just messing around with array's and produced the following
exception. I don't actually need this to work for any reason, but I
was rather surprised by the behavior. Is this a bug or expected
behavior? Please note I'm using revision 1195.
user=> (alength nil)
java.lang.IllegalArgumentExce
On Jan 6, 11:21 am, Stuart Sierra wrote:
> You might be able to simplify this by having just one Ref containing
> the global "state" of the game.
Hi Stuart, yes I agree that is the better approach.
I went down the 'multi-mutable' path trying to improve relationship
handling. Consider two rooms
I have a macro I am trying to debug but I can't get it to expand. I
get the following:
java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:1)
[Thrown class clojure.lang.Compiler$CompilerException]
The backtrace is useless here as just gives me a lot of internal
clojure/java calls, none
Well, after a lot of staring, it seems the issue was that I wasn't
array splicing one of my args so a list was being passed where a
function was expected.
Is there any way to clean this up so that the error message is a
little more direct?
On Jan 5, 2009, at 10:05 PM, Joseph Jones wrote:
You need to remember to ...
clojure.core/shutdown-agents
([])
Initiates a shutdown of the thread pools that back the agent
system. Running actions will complete, but no new actions will be
accepted
nil
On Tue, Jan 6, 2009 at 3:35 AM, Mark Volkmann wrote:
>
> Why doesn't the following cod
79 matches
Mail list logo