Re: writing bytes to a file

2009-01-08 Thread Randall R Schulz
On Thursday 08 January 2009 01:28, James Reeves wrote: > On Jan 7, 7:14 pm, "Brian Doyle" wrote: > >    (defn write-bytes > >      "Writes the bytes from the in-stream to the given filename." > >      [#^java.io.InputStream in-stream #^String filename] > >      (with-open [out-stream (new FileOut

Re: re-find

2009-01-07 Thread Randall R Schulz
On Wednesday 07 January 2009 15:21, Jeff Foster wrote: > I'm not understanding re-find. > > (re-find #"bar" "bar") => "bar" > > whereas > > (re-find #"(foo)|(bar)" "foo bar") => ["foo" "foo" nil] > > Why does one return a vector and one just the result directly? The use of capturing parentheses i

Re: process inferior-lisp core dumped!

2009-01-05 Thread Randall R Schulz
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

Re: newbie question on binding

2009-01-05 Thread Randall R Schulz
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

Re: meaning and pronunciation of Clojure

2009-01-03 Thread Randall R Schulz
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 sound that's *very* similar > to the concept of a closure. And the "j" evokes the JVM. And that is how I pronounce the middle c

Re: meaning and pronunciation of Clojure

2009-01-03 Thread Randall R Schulz
On Saturday 03 January 2009 16:48, Mark Volkmann wrote: > On Sat, Jan 3, 2009 at 4:13 PM, Randall R Schulz wrote: > > On Saturday 03 January 2009 13:06, Mark Volkmann wrote: > >> ... > >> > >> Also, is it pronounced it is spelled or is it pronounced the same

Re: meaning and pronunciation of Clojure

2009-01-03 Thread Randall R Schulz
On Saturday 03 January 2009 13:06, Mark Volkmann wrote: > ... > > Also, is it pronounced it is spelled or is it pronounced the same as > "closure"? I did find a post that said it's pronounced like > "closure", but I've always pronounced it the way it is spelled. What's the difference? RRS --~-

Re: literate snake

2009-01-02 Thread Randall R Schulz
On Friday 02 January 2009 14:23, Christian Vest Hansen wrote: > What is it that makes this code "literate"? I don't know whether or not you're familiar with the concept of Literate Programming. If you are, then you can judge for yourself whether that code qualifies as literate. If not, check ou

Re: (Classname/staticField) is not the same as Classname/staticField

2009-01-01 Thread Randall R Schulz
On Thursday 01 January 2009 14:02, pmf wrote: > On Jan 1, 10:19 pm, CuppoJava wrote: > > Hi, > > For some reason the Classname/staticField macro is not working > > properly for me. > > > > graphics=> (AudioSystem/getSystem) > > # > > > > graphics=> AudioSystem/getSystem > > java.lang.Exception: N

Re: Local mutually recursive functions?

2009-01-01 Thread Randall R Schulz
On Thursday 01 January 2009 11:47, Rock wrote: > Given that there's nothing like letrec in Clojure, and that let acts > like let* in CL, I gather that local recursive functions are possible > whereas local mutually recursive ones are not. Is that correct? If > so, will they ever be in the future?

Re: Constant expression optimization

2008-12-31 Thread Randall R Schulz
On Wednesday 31 December 2008 09:56, Dave Griffith wrote: > Can't find the chapter and verse, but a bit of googling shows that > GCJ does this optimization > http://gcc.gnu.org/ml/gcc-patches/2003-05/msg02312.html Yes, but you claim that this guarantee is in the language specification and that

Re: Constant expression optimization

2008-12-31 Thread Randall R Schulz
On Wednesday 31 December 2008 09:10, Dave Griffith wrote: > No, but the semantics of java.lang classes are fully specified in the > Java spec, Can you quote chapter and verse to this effect? I'm not finding it, at least not in "The Java™ Language Specification, Third Edition." There's an index

Re: Constant expression optimization

2008-12-31 Thread Randall R Schulz
On Wednesday 31 December 2008 09:10, Dave Griffith wrote: > No, but the semantics of java.lang classes are fully specified in the > Java spec, and JVM implementers are allowed to rely on them. It's > entirely possible that there are special case optimizations for > java.lang.Math calls. Beyond t

Re: Constant expression optimization

2008-12-31 Thread Randall R Schulz
On Wednesday 31 December 2008 09:03, Dave Griffith wrote: > Note, however, that your JVM may very well know that > java.lang.Math.log (0.5) is a constant, and optimize the calculation > out of the JIT compiled code. This wouldn't show up in the > bytecode, and is extremely difficult to actually

Re: Contrib REPL Invocation Changes

2008-12-30 Thread Randall R Schulz
On Monday 29 December 2008 20:50, Stephen C. Gilardi wrote: > > ... > > Here it is working with the current clojure.jar and > clojure-contrib.jar: > > % java -cp clojure.jar:clojure-contrib.jar clojure.contrib.repl_ln > Clojure > 1:1 user=> (prn "hi") > "hi" > nil > 1:2 user=> I can't replicate t

Re: Contrib REPL Invocation Changes

2008-12-29 Thread Randall R Schulz
On Monday 29 December 2008 18:36, Stephen C. Gilardi wrote: > On Dec 29, 2008, at 8:49 PM, Randall R Schulz wrote: > > Following today's SVN updates to the Clojure Core and Contrib (as > > of this writing, at 17:42 PST, which is GMT -8), I can no longer > > invoke the

Contrib REPL Invocation Changes

2008-12-29 Thread Randall R Schulz
Hi, Following today's SVN updates to the Clojure Core and Contrib (as of this writing, at 17:42 PST, which is GMT -8), I can no longer invoke the Contrib REPL as I was able to before today. When I do, I get no prompt until I type a non-empty line, after which I'm presented with an unending repeti

Re: making code readable

2008-12-29 Thread Randall R Schulz
On Monday 29 December 2008 09:11, lpetit wrote: > You should consider using docstrings for documenting functions There's a big difference between the comments directed at someone reading the code (possibly the author at a later date) and someone wishing to use it. Function-level documentation s

Fwd: [jvm-l] Kawa Scheme on Android

2008-12-28 Thread Randall R Schulz
Howdy, Folks, The gauntlet has been thrown down: -- Forwarded Message -- Subject: [jvm-l] Kawa Scheme on Android Date: Sunday 28 December 2008 14:43 From: Per Bothner To: jvm-langua...@googlegroups.com I managed to get a "hello-world"-style program written in Kawa Scheme run

Re: Proxying in clojure

2008-12-28 Thread Randall R Schulz
On Sunday 28 December 2008 09:35, Mark Volkmann wrote: > Can you explain what is happening in the collision? function? > I don't think I've seen % used outside the context of an anonymous > function. To my eye, those uses of % _are_ within an anonymous function: (defn collision? [{[b] :body} a]

Re: where is set operations (union, intersection, etc) defined?

2008-12-27 Thread Randall R Schulz
On Saturday 27 December 2008 12:32, wubbie wrote: > Hi, > > I'm trying union/intersection/difference operations, but > got undefined symbols error: > java.lang.Exception: Unable to resolve symbol: intersection in this > context (NO_SOURCE_FILE:22) user=> (use 'clojure.set) nil user=> (doc inters

Re: Non-numeric characters clarification

2008-12-24 Thread Randall R Schulz
On Wednesday 24 December 2008 16:23, Abhishek Reddy wrote: > Hi, > > http://clojure.org/reader says symbols "begin with a non-numeric > character and can contain alphanumeric characters and *, + ..." > > What are the numeric characters? It seems to include '+' and '-' as > well as digits -- is th

Re: no quote needed?

2008-12-24 Thread Randall R Schulz
On Wednesday 24 December 2008 13:44, Mark Volkmann wrote: > Why doesn't the list below that is the second argument to reduce need > to be quoted? > Is () always treated the same as '() ? > > (reduce conj () (range 5)) Empty lists self-evaluate: user=> () () user=> '() () Similarly: user=> (e

Re: 12 Days of Christmas in idiomatic(?) clojure

2008-12-24 Thread Randall R Schulz
On Wednesday 24 December 2008 12:22, Stephen C. Gilardi wrote: > On Dec 24, 2008, at 2:47 PM, Randall R Schulz wrote: > >> 364 > >> [...] > >> Hmmm, enough gifts for every other day of the year! > > > > Wow. The planet on which you reside orbits a good bi

Re: 12 Days of Christmas in idiomatic(?) clojure

2008-12-24 Thread Randall R Schulz
On Wednesday 24 December 2008 11:30, Stephen C. Gilardi wrote: > ... > > Nice, Matt! > > With the "reductions" function recently discussed this becomes: > > user=> (reduce + (reductions + (range 1 13))) > 364 > user=> > > Hmmm, enough gifts for every other day of the year! Wow. The planet on whi

Re: Random Number Generation Issues

2008-12-23 Thread Randall R Schulz
On Tuesday 23 December 2008 15:15, Randall R Schulz wrote: > ... > > I tried 20 times with the same result each time. If you increase the > range much beyond MAX_VALUE, you start to get the repeats and then > the monotonically increasing property ceases to hold, though >

Re: Random Number Generation Issues

2008-12-23 Thread Randall R Schulz
On Tuesday 23 December 2008 14:44, Chris Bunch wrote: > I've got the newest version of Clojure and wrote a simple program to > generate a list of 100 random numbers, but I seem to get a lot of > duplicate numbers (especially when I pick a large upper bound for > rand-int). My code is pretty simila

Re: Random Number Generation Issues

2008-12-23 Thread Randall R Schulz
On Tuesday 23 December 2008 14:44, Chris Bunch wrote: > I've got the newest version of Clojure and wrote a simple program to > generate a list of 100 random numbers, but I seem to get a lot of > duplicate numbers (especially when I pick a large upper bound for > rand-int). My code is pretty simila

Re: SPARQL DSL - a humble request for review and guidance

2008-12-23 Thread Randall R Schulz
On Tuesday 23 December 2008 07:27, Adam Harrison (Clojure) wrote: > Randall R Schulz wrote: > > ... > > Hi Randall, > > How do you envision read-table control to be useful in the context of > this particular problem - perhaps to redefine tokens beginning with > '?

Re: SPARQL DSL - a humble request for review and guidance

2008-12-22 Thread Randall R Schulz
On Monday 22 December 2008 07:58, Michael Wood wrote: > ... > > This seems to be a lot simpler if you use keywords instead of > ?something: The tradition of using a leading question mark to designate a (logical) variable is pretty widespread, and many practitioners from the realms of automated

Re: namespace function

2008-12-22 Thread Randall R Schulz
On Monday 22 December 2008 08:10, Rich Hickey wrote: > ... > > Clojure names have distinct namespace components so they can be used > to designate/find things in namespaces. Designate, yes. Find, no, if I understand what you're saying. There's no index / repository / collection / directory / ta

Re: Behavior of equals (==) w/r/t keywords

2008-12-22 Thread Randall R Schulz
On Monday 22 December 2008 07:23, Rich Hickey wrote: > ... > > This conversation is way off track. > > Symbols and keywords are not 'in' namespaces, they are not interned > in namespaces, there are not lists of, e.g. keywords in a particular > namespace. Then the term "namespace" is rather poorly

Re: namespace function

2008-12-22 Thread Randall R Schulz
On Monday 22 December 2008 05:55, Mark Volkmann wrote: > On Sun, Dec 21, 2008 at 3:44 PM, Stephen C. Gilardi wrote: > > ... > > I thought that every symbol and keyword was in some namespace, > defaulting to the current namespace when the symbol or keyword is > defined. Since the default namespace

Re: Behavior of equals (==) w/r/t keywords

2008-12-22 Thread Randall R Schulz
On Monday 22 December 2008 05:51, Mark Volkmann wrote: > On Sun, Dec 21, 2008 at 2:30 PM, Randall R Schulz wrote: > > On Sunday 21 December 2008 11:33, chris wrote: > >> ... > >> > >> That answers my question. Don't use a namespace, and the keyword >

Re: bit-and, bit-or arity question

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 15:14, ntu...@googlemail.com wrote: > Why do "bit-or" and "bit-and" only accept 2 arguments? "or" and "and" > accept an arbitrary number and I think it is useful to modifiy "bit- > or" and "bit-and" to accept 2 or more, for example: > > (defn my-bit-or [x y & rest] > (

Re: namespace function

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 13:35, Mark Volkmann wrote: > Why do I get an IncompatibleClassChangeError below? I'm using > revision 1180. > > (def my-map {:a 1 :b 2}) > (namespace my-map) > java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0) I'm not sure about that specific error, though I'v

Re: Behavior of equals (==) w/r/t keywords

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 11:33, chris wrote: > ... > > That answers my question. Don't use a namespace, and the keyword is > global. Pass in a namespace, and the keyword is in that namespace. Yes, the default namespace for keywords is different than for symbols, which is why the ::keyword fo

Re: Behavior of equals (==) w/r/t keywords

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 10:18, chris wrote: > Right, waking up a bit. > > I would like, at some point, to serialize a bunch of structures to a > byte stream. > > They are the mapped structs (struct :data1 :data2). > > Lets say I would like to do this generically, I need a function that > takes

Re: Behavior of equals (==) w/r/t keywords

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 09:33, chris wrote: > This is not what I would expect: > > user> (== :test :test) > false user=> (doc ==) - clojure.core/== ([x] [x y] [x y & more]) Returns non-nil if nums all have the same value, otherwise false To be clear: == is for numer

Re: non-seq collections

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 07:51, Mark Volkmann wrote: > Until this morning I was under the impression that ALL Clojure > collections are sequences. Sequences are views of collections (sequential ones, if you can believe it!). All collections can be sequenced, but they are not to be equated. >

Re: class diagram

2008-12-21 Thread Randall R Schulz
On Sunday 21 December 2008 07:44, Mark Volkmann wrote: > Somebody created a class diagram for the Java classes and interfaces > in the Clojure implementation, I believe using GraphViz, and I'm > having trouble finding it now. Can someone share the URL? > > Also, is there a Clojure function that ou

Re: recur rationale?

2008-12-20 Thread Randall R Schulz
On Saturday 20 December 2008 06:29, verec wrote: > At about 72:54 of the clojure sequence talk, Rich explains that he > doesn't want to provide "false guaranties" to people used to "true > tail calls" even though he could detect such "tail position calls" > and basically transforms them into what

Re: doc strings for multimethods?

2008-12-20 Thread Randall R Schulz
On Friday 19 December 2008 23:00, Lauri Oherd wrote: > Docstrings for individual defmethods are not possible. Except that "not possible" is not the same thing as "not allowed" or "not available." > You can find more info about it there: > http://groups.google.com/group/clojure/msg/f7751913e8759

Re: Circular Require Change?

2008-12-19 Thread Randall R Schulz
On Friday 19 December 2008 09:10, Cosmin Stejerean wrote: > On Fri, Dec 19, 2008 at 10:30 AM, Kevin Martin wrote: > > Thanks Rich! I'll keep an eye on the defect(shame there isn't a > > watch feature on google code). Other than this little minor > > annoyance, the new AOT changes are working g

Re: IntelliJ Plugin now on Google Code

2008-12-19 Thread Randall R Schulz
Peter, Great news! On Friday 19 December 2008 05:36, Peter Wolf wrote: > For those who are following or helping my efforts (thank you), the > IntelliJ Clojure plugin code is now on GoogleCode. Enjoy! > > http://code.google.com/p/clojure-intellij-plugin/source/browse/#svn/t >runk/src/org/clojure

Re: (Ab)using agents for inter-process communication

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 14:44, Randall R Schulz wrote: > On Thursday 18 December 2008 14:40, Stephan Mühlstrasser wrote: > > ... > > > > As Chouser pointed out, the flush is the important ingredient. > > > > After thinking a while about this, I'm wonderi

Re: (Ab)using agents for inter-process communication

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 14:40, Stephan Mühlstrasser wrote: > On Dec 18, 11:30 pm, Randall R Schulz wrote: > > On Thursday 18 December 2008 13:33, Stephan Mühlstrasser wrote: > > > > > > Nothing fancy: > > > > (defn cat-stream > > > >

Re: (Ab)using agents for inter-process communication

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 13:33, Stephan Mühlstrasser wrote: > On Dec 18, 10:01 pm, Randall R Schulz wrote: > > > My question was not precise enough. I meant why can the parent > > > process - the Clojure program - terminate before all all the > > >

Re: (Ab)using agents for inter-process communication

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 12:43, Stephan Mühlstrasser wrote: > On Dec 18, 9:24 pm, Randall R Schulz wrote: > > On Thursday 18 December 2008 12:07, Stephan Mühlstrasser wrote: > > > ... > > > > > > Is this use of agents incorrect? > > > > I would

Re: (Ab)using agents for inter-process communication

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 12:07, Stephan Mühlstrasser wrote: > Hi, > > I've not yet seen any examples on how to deal with external processes > in Clojure (I hope I didn't overlook something in clojure-contrib). > > The following is my attempt to start a sub-process and to pass > through stdout

Re: running Gorilla

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 12:13, Mark Volkmann wrote: > On Thu, Dec 18, 2008 at 2:07 PM, Randall R Schulz wrote: > > ... > > > > First of all, check whether you Vim has the necessary Ruby support: > > > > % vim --version |sed -n -e 1p -e '/ruby/p&#x

Re: running Gorilla

2008-12-18 Thread Randall R Schulz
On Thursday 18 December 2008 11:52, Mark Volkmann wrote: > I'm probably doing something wrong, but I haven't been able to get > Gorilla to work with Vim. The installation instructions say: > > ... > > I've done this, but it doesn't seem to recognize Gorilla shortcuts. > Should I be able to open a

Re: Best Way to Ensure a Call to (shutdown-agents)?

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 10:57, Randall R Schulz wrote: > On Monday 15 December 2008 17:58, Randall R Schulz wrote: > > ... > > This sequence of evaluations ends in the REPL hanging: > > 1:1 user=> (.. Runtime (getRuntime) (addShutdownHook (new Thread > shutdo

Re: Best Way to Ensure a Call to (shutdown-agents)?

2008-12-17 Thread Randall R Schulz
On Monday 15 December 2008 17:58, Randall R Schulz wrote: > Hi, > > I've just started using agents and as I've done that, I've noticed > that once you use an agent, exiting the REPL leads to a hang (with > zero CPU usage). As Rich pointed out to me, this is avoided

Re: ClassName. Constructor Notation in Macros?

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 06:55, Rich Hickey wrote: > ... > > Added issue: > > http://code.google.com/p/clojure/issues/detail?id=7 > > Rich I tried to vote / star this issue, but it seems to have no effect. There was one star when I entered and that remains the case even after two attempts

Re: Bug? sorted-map as fn behaves differently than hash-map as fn

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 06:26, Mark Volkmann wrote: > ... > > It appears that you can create a sorted-map where all the keys are > symbols and you can create a sorted-map where all the keys are > strings, but you can't create a sorted-map where some of the keys are > symbols and some are str

Re: ClassName. Constructor Notation in Macros?

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 06:21, Meikel Brandmeyer wrote: > Hi Randall, > > ... > > http://clojure-log.n01se.net/macro.html That's a long way to go get a macro expansion! How many people here are familiar with DrScheme? I wonder how long it will be before some industrious person creates a c

Re: ClassName. Constructor Notation in Macros?

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 06:21, Meikel Brandmeyer wrote: > Hi Randall, > > On 17 Dez., 15:12, Randall R Schulz wrote: > > user=> (dcmfail) > > java.lang.IllegalArgumentException: Unable to resolve classname: > > BufferedWriter (repl-1:2) > > This doesn

Re: Bug? sorted-map as fn behaves differently than hash-map as fn

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 06:14, Meikel Brandmeyer wrote: > Hi, > > On 17 Dez., 14:55, MikeM wrote: > > ((sorted-map 'a 1 'b 2) "a") => ClassCastException > > > > I would think that sorted-maps and hash-maps should both give nil > > for this, but perhaps the sorted-map implementation requires

Re: ClassName. Constructor Notation in Macros?

2008-12-17 Thread Randall R Schulz
On Wednesday 17 December 2008 05:48, Rich Hickey wrote: > On Dec 16, 3:52 pm, Randall R Schulz wrote: > > ... > > > > Which takes us back to why the dot-suffix notation was not working > > in a macro but (new ...) was. ... > > Could you please post a short code

Re: question about (commute messages conj msg)

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 18:10, wubbie wrote: > Hello, > > My question is that conj takes two argument and how conj finds > the first argument? Is it somehow provided by commute? Consider the documentation for (commute ...) (at ): -==--==--==--==--==--==--==--==--==--

Re: reload library, blowing away old public symbols

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 15:05, Allen Rohner wrote: > > On Dec 16, 4:32 pm, Stuart Halloway wrote: > > > Hi all, > > > > > > I sometimes need to (re)load a library, removing public symbols > > > from previously loaded version of the same lib: > > > > > > (defmacro ns-reload > > >    `(do > > >

Re: Clojure classes graph (was chart.png)

2008-12-16 Thread Randall R Schulz
On Sunday 14 December 2008 13:47, Chouser wrote: > I've updated the Clojure classes graph (thanks for the push, R. > Schulz!) The new version includes the newest classes as well as Java > interfaces that are applicable. These latter are shown inside > diamonds. > > ... > > I won't be maintaining

Re: confused by Vars, Refs, Agents and Atoms

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 13:54, Andrew Baine wrote: > Check out http://blip.tv/file/812787/ ... Rich's video presentations are also available via the iTunes store. Search for "Clojure," of course—you won't get any false hits. > Best, > > Andrew Randall Schulz --~--~-~--~~

Re: ClassName. Constructor Notation in Macros?

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 12:37, Rich Hickey wrote: > On Dec 16, 2:32 pm, Stuart Halloway wrote: > > Hi Randall, > > > > The syntactic sugar forms are reader behavior, and occur too soon: > > at read time, not macro expansion time. > > ... > > > Macros need to expand to real forms, not reader s

Re: ClassName. Constructor Notation in Macros?

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 11:32, Stuart Halloway wrote: > > Hi, > > > > ... > > > > However, I am left wondering what exactly is the interaction that > > was causing the dot-suffix form of the constructor call to fail in > > a macro expansion. I sense it has to do with the fact that symbols > >

Blogging About Clojure?

2008-12-16 Thread Randall R Schulz
Hi, Wordy though I am, I've never done any blogging before, but now that I'm finally beginning to get up-to-speed on Clojure, I think I might have some things to say. So I was wondering if anyone could recommend a good blog site for this purpose? Naturally, I'll want to include source code, s

ClassName. Constructor Notation in Macros?

2008-12-16 Thread Randall R Schulz
Hi, A couple of days ago I was having a lot of trouble getting the (ClassName. ctor-args...) form of constructors to work while (new ClassName ctor-args...) was fine. It eventually occurred to me that the problem had to do with those constructor calls being in macro bodies. Now it turns out t

Re: Getting Started with Gen-Class

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 08:26, J. McConnell wrote: > On Mon, Dec 15, 2008 at 7:33 PM, Rich Hickey wrote: > > When pulling new Clojure from SVN, please do: > > > > ant clean > > ant > > > > So you know you have a consistent build. > > If the supported way to build Clojure is to clean before t

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 08:03, J. McConnell wrote: > ... > > '(nil) is a list containing the single element nil. nil is no kind of > list whatsoever. So, (seq? '(nil)) is true, since '(nil) is a list > and lists are seqs and (seq? nil) is false since nil is not a > sequence. > > The quoted lis

Re: Best Way to Ensure a Call to (shutdown-agents)?

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 07:36, Randall R Schulz wrote: > ... > > So I am still confused about the right way to deal with agents in > order to get reliable and prompt exit from the REPL and why an EOF > from the terminal hangs (only if agents were started and regardless

Re: Best Way to Ensure a Call to (shutdown-agents)?

2008-12-16 Thread Randall R Schulz
On Tuesday 16 December 2008 06:02, MikeM wrote: > You can try this: > > (let [t (new Thread (fn[] (shutdown-agents)))] >(.. java.lang.Runtime (getRuntime) (addShutdownHook t))) > > It works for me, but seems to take a long time to complete the > shutdown. I tried adding this to the module tha

Re: macroexpand-1 vs. macroexpand

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 17:58, Mark Volkmann wrote: > I'm trying to understand the difference between these. Is it that > macros expanded by macroexpand-1 could result in calls to additional > macros that won't be expanded, but macroexpand will continue > expanding until no macro calls remain?

Best Way to Ensure a Call to (shutdown-agents)?

2008-12-15 Thread Randall R Schulz
Hi, I've just started using agents and as I've done that, I've noticed that once you use an agent, exiting the REPL leads to a hang (with zero CPU usage). As Rich pointed out to me, this is avoided by calling (shutdown-agents). So my question is this: What's a simple way to ensure that (shut

Re: Getting Started with Gen-Class

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 17:05, CuppoJava wrote: > I checked with SVN. > It says I checked out revision number 1160? As of this writing, that's the latest rev. In your previous message you said you tried "ant clean". I assume that you followed that by "ant jar" (or just did "ant clean jar").

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 15:22, Stephen C. Gilardi wrote: > On Dec 15, 2008, at 6:08 PM, Randall R Schulz wrote: > > user=> (class *err*) > > java.io.PrintWriter > > PrintWriter is (as far as I can determine) the more modern of the two > classes that are

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Randall R Schulz
On Sunday 14 December 2008 17:21, Randall R Schulz wrote: > Hi, > > I have quite a bit of Java code with I/O capabilities that generally > support both PrintStream and PrintWriter. I was a bit perplexed when > I tried to apply one of these methods to *out* and was re

Re: Nested Java Types

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 07:44, Rich Hickey wrote: > On Mon, Dec 15, 2008 at 10:40 AM, Randall R Schulz wrote: > > On Friday 05 December 2008 15:36, Randall R Schulz wrote: > >> I make pretty extensive use of nested classes > >> (most significantly Enum types). >

Re: “Don’t know how to create ISeq from: Symbol” error

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 09:34, Paul Reiners wrote: > I have the following Clojure code and I'm not sure why it's not > working: > > (defn match (x y &optional binds) > (cond >((eql x y) (values binds t)) >((assoc x binds) (match (binding x binds) y binds)) >((assoc y binds) (match

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 09:30, Mon Key wrote: > > > > I would expect (flatten nil) => nil > > Why? > => nil > nil is not a sequence - your expectation is that Clojure flatten and > return `nothing'... which *would* be a bug Flattening nothing gives something? Flatten is not consistent with se

Re: Nested Java Types

2008-12-15 Thread Randall R Schulz
On Friday 05 December 2008 15:36, Randall R Schulz wrote: > I make pretty extensive use of nested classes > (most significantly Enum types). > > I was wondering if it might be a good idea to > allow "dot" resolution to find such types. > > > E.g.:

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 07:22, Stuart Sierra wrote: > On Dec 15, 9:08 am, Randall R Schulz wrote: > > > flatten returns a sequence  - in this case a sequence containing > > > 'nil. How else would you flatten on nil? > > > > I would expect (flatten nil) =

Macro Style Question: Expanding to Multiple (def ...) Forms

2008-12-15 Thread Randall R Schulz
Hi, I'm wondering whether it's a good idea to create a defsomething -style macro that establishes multiple root bindings? In other one, a macro that expands to multiple (def ...) forms? The first thing I noticed when I did this is that (barring further machinations within the macro) it evalua

Re: Best Choice of Java Class For *out*

2008-12-15 Thread Randall R Schulz
On Monday 15 December 2008 01:16, Albert Cardona wrote: > Randall R Schulz wrote: > > What might be the issues or consequences of making the root binding > > of *out* a PrintWriter? > > I've been using a PrintWriter for *out* for months now, and no > problems so fa

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-15 Thread Randall R Schulz
On Sunday 14 December 2008 21:56, Mon Key wrote: > > user=> (flatten nil) > > (nil) > > Not a bug. > > flatten returns a sequence - in this case a sequence containing > 'nil. How else would you flatten on nil? I would expect (flatten nil) => nil > ... Randall Schulz --~--~-~--~~

Acceptable Arguments to Two-Argument (symbol ...)

2008-12-14 Thread Randall R Schulz
Hi, The doc text for symbol is: user=> (doc symbol) - clojure.core/symbol ([name] [ns name]) Returns a Symbol with the given namespace and name. However, the "ns" argument must be a String, not a namespace. Would it be reasonable to allow an actual namespace as the n

Best Choice of Java Class For *out*

2008-12-14 Thread Randall R Schulz
Hi, I have quite a bit of Java code with I/O capabilities that generally support both PrintStream and PrintWriter. I was a bit perplexed when I tried to apply one of these methods to *out* and was rebuffed thusly: java.lang.IllegalArgumentException: No matching method found: printMessage for

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-14 Thread Randall R Schulz
On Sunday 14 December 2008 11:08, Randall R Schulz wrote: > ... It turns out that flatten (from clojure.contrib.seq-utils) is really where I go wrong with my simple version of gather-slot-values. Does this makes sense (specifically the last one)? user=> (flatten []) nil user=>

Re: Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-14 Thread Randall R Schulz
On Sunday 14 December 2008 11:08, Randall R Schulz wrote: > Hi, > > I ran into a special case that I'd like to avoid. When (filter ...) > is either applied to an empty collection or the filter predicate > returns false for all the elements in the supplied collection,

Emtpy (filter ...) Result Yields nil; Could / Should It Be An Empty List?

2008-12-14 Thread Randall R Schulz
Hi, I ran into a special case that I'd like to avoid. When (filter ...) is either applied to an empty collection or the filter predicate returns false for all the elements in the supplied collection, filter returns nil. Would it be acceptable and desirable for it to return and empty list in

Re: Proxy mappings now use strings for keys - deliberate?

2008-12-14 Thread Randall R Schulz
On Sunday 14 December 2008 10:40, James Reeves wrote: > I've notice that the latest builds of Clojure now use strings for > keys in proxy mappings, whilst in the past they used to use symbols. > Was this change deliberate? Yes. Rich pointed this out in the SVN commit commentary for 1159: "proxy

Re: Functional programming newbie question

2008-12-14 Thread Randall R Schulz
On Sunday 14 December 2008 09:00, harrison clarke wrote: > yep. a function f(n) is O(n) if there are constants c and n0 such > that f(n) <= c * n for all n >= n0. > > sometimes you do care about the c and the n0, though. To be sure. And there can be times that, for the problem size you know you

Re: DISCUSS: replace (rand)

2008-12-14 Thread Randall R Schulz
On Saturday 13 December 2008 23:19, Mark H. wrote: > So I'm going to stop pretending like I'm an expert and actually post > some Clojure code. Be constructively critical 'cause I'm a n00b in > that regard ;-) This is a pseudorandom number generator for the > Gaussian (0,1) distribution. > > ...

Re: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Randall R Schulz
On Saturday 13 December 2008 17:19, Drew Olson wrote: > ... > > You can also compile vim from source with the +ruby flag Yes, of course, but that's a bridge too far. > - Drew RRS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Functional programming newbie question

2008-12-13 Thread Randall R Schulz
On Saturday 13 December 2008 15:35, Randall R Schulz wrote: > ... > > Any algorithm that requires to O(n) steps is itself O(n). And by that I meant "...two O(n) steps...", of course. > The big-O concept is roughly "equality up to a constan

Re: Functional programming newbie question

2008-12-13 Thread Randall R Schulz
On Saturday 13 December 2008 14:29, levand wrote: > > ... > > > Calling reverse when done is still O(N) > > Really? Maybe my grasp of big-O notation is faulty, but isn't the > recursive function itself O(n), and then a reversal another O(n) > operation on top of that, leading to two complete trave

Re: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Randall R Schulz
On Saturday 13 December 2008 08:17, Brian Doyle wrote: > I'm sure I'm doing something stupid but I can't start up gorilla. > > ... > > Here is my script: > > java -cp > ~/share/clojure.jar:~/share/clojure-contrib.jar:~/share/gorilla.jar > de.kotka.gorilla Tildes don't expand anywhere but at the b

Re: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Randall R Schulz
On Saturday 13 December 2008 00:10, Meikel Brandmeyer wrote: > Hi Randall, > > ... > > For your problem with the ruby-enabled vim: at least > debian has a vim-ruby package, IIRC. So maybe Suse > has this also. I installed a couple of new packages on my 10.3 box and now "vim --version" reports +r

Re: Running out of memory when using filter?

2008-12-12 Thread Randall R Schulz
On Friday 12 December 2008 15:15, Mark Engelberg wrote: > ... > > --Mark Not being nearly sophisticated enough in Clojure, FP or the relevant concepts to say anything other than "that all makes complete sense to me," I wonder only what would be the impact on existing programs were the default

Re: Gorilla: Release of Version 1.1.0

2008-12-12 Thread Randall R Schulz
On Friday 12 December 2008 13:59, Meikel Brandmeyer wrote: > Hi Randall, > > Am 12.12.2008 um 22:54 schrieb Randall R Schulz: > > I think I may have asked this before, but what Vim version > > requirements > > does Gorilla have? > > .. I guess what you should

  1   2   3   >