Re: terminating an app that uses agents

2009-01-05 Thread Christian Vest Hansen
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

Re: How do I debug a macro?

2009-01-05 Thread Joseph Jones
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:

How do I debug a macro?

2009-01-05 Thread Joseph Jones
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

Re: mset

2009-01-05 Thread Timothy Pratley
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

(alength nil) => java.lang.IllegalArgumentException: More than one matching method found

2009-01-05 Thread rzeze...@gmail.com
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

Re: Multiple table SELECT problem

2009-01-05 Thread Allen Rohner
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

Namespaces and filenames

2009-01-05 Thread Joseph Jones
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

Re: agent thread pool

2009-01-05 Thread Chouser
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

agent thread pool

2009-01-05 Thread Mark Volkmann
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. --~--~-~--~

Re: Multiple table SELECT problem

2009-01-05 Thread ck
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)

Re: Multiple table SELECT problem

2009-01-05 Thread ck
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

terminating an app that uses agents

2009-01-05 Thread Mark Volkmann
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

Re: Multiple table SELECT problem

2009-01-05 Thread Stephen C. Gilardi
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

Re: Multiple table SELECT problem

2009-01-05 Thread ck
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

Re: why two list comprehensions are different?

2009-01-05 Thread Chouser
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 --~--~-~--~~

Re: Running out of memory when using filter?

2009-01-05 Thread Paul Mooser
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

Re: Multiple table SELECT problem

2009-01-05 Thread Stephen C. Gilardi
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

Re: [clojure-contrib.sql] Multiple table SELECT problem

2009-01-05 Thread Stephen C. Gilardi
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

Re: Multiple table SELECT problem

2009-01-05 Thread ck
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

Re: Math functions

2009-01-05 Thread Stuart Sierra
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.

[clojure-contrib.sql] Multiple table SELECT problem

2009-01-05 Thread ck
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

Re: mset

2009-01-05 Thread Stuart Sierra
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

Re: quote on side effects

2009-01-05 Thread Timothy Pratley
"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,

Re: Using java.ext.dirs to manage the Classpath for Clojure REPLs

2009-01-05 Thread Stuart Sierra
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

Re: reduction

2009-01-05 Thread Stuart Sierra
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

Re: Please submit patches as attachments to issues

2009-01-05 Thread Andrew Baine
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

Re: why two list comprehensions are different?

2009-01-05 Thread chris
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

Re: Please submit patches as attachments to issues

2009-01-05 Thread Andrew Baine
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

Re: process inferior-lisp core dumped!

2009-01-05 Thread wubbie
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

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: quote on side effects

2009-01-05 Thread Paul Barry
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

Re: yet another Clojure snake

2009-01-05 Thread Mark Volkmann
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

process inferior-lisp core dumped!

2009-01-05 Thread wubbie
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

Re: quote on side effects

2009-01-05 Thread kevin
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

Re: quote on side effects

2009-01-05 Thread kevin
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

Re: quote on side effects

2009-01-05 Thread Rich Hickey
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

Re: Clojure Box, alpha

2009-01-05 Thread Shawn Hoover
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

Re: Some code review for clj-record?

2009-01-05 Thread Michael Reid
> 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

Re: quote on side effects

2009-01-05 Thread Paul Barry
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

Re: newbie question on binding

2009-01-05 Thread wubbie
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

per-defmulti hierarchies

2009-01-05 Thread Meikel Brandmeyer
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

Re: Some code review for clj-record?

2009-01-05 Thread John D. Hume
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

Re: quote on side effects

2009-01-05 Thread Mark H.
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

Re: yet another Clojure snake

2009-01-05 Thread Fanda
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:

Re: quote on side effects

2009-01-05 Thread bOR_
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

Re: quote on side effects

2009-01-05 Thread Cosmin Stejerean
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

Re: yet another Clojure snake

2009-01-05 Thread Fanda
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

Re: Clojure Box, alpha

2009-01-05 Thread bOR_
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

Re: quote on side effects

2009-01-05 Thread Chouser
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

Re: yet another Clojure snake

2009-01-05 Thread Chouser
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

java.io.IOException: Not enough storage is available to process this command

2009-01-05 Thread falcon
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

yet another Clojure snake

2009-01-05 Thread Stuart Halloway
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]

quote on side effects

2009-01-05 Thread Mark Volkmann
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

Re: Updating website and Clojure files

2009-01-05 Thread Chouser
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

Re: why two list comprehensions are different?

2009-01-05 Thread Chouser
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

Re: newbie question on binding

2009-01-05 Thread Meikel Brandmeyer
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

Re: newbie question on binding

2009-01-05 Thread Christian Vest Hansen
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

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

newbie question on binding

2009-01-05 Thread wubbie
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

Re: reduction

2009-01-05 Thread Christophe Grand
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

Re: reduction

2009-01-05 Thread Christophe Grand
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

Re: reduction

2009-01-05 Thread Chouser
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

Re: Suggestion: introduce (defn name attr-map? [params*] doc-string body) form.

2009-01-05 Thread Chouser
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

Please submit patches as attachments to issues

2009-01-05 Thread Rich Hickey
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

Re: .newInstance error

2009-01-05 Thread Drew Raines
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

Re: .newInstance error

2009-01-05 Thread Justin Johnson
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

Re: meaning and pronunciation of Clojure

2009-01-05 Thread Rich Hickey
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

Re: reduction

2009-01-05 Thread Christophe Grand
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

.newInstance error

2009-01-05 Thread Justin Johnson
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

Re: Math functions

2009-01-05 Thread Mark H.
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

Re: meaning and pronunciation of Clojure

2009-01-05 Thread Ken
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

Re: Programming Style

2009-01-05 Thread Meikel Brandmeyer
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

Re: Understanding how to use namespaces

2009-01-05 Thread mehrheit
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

Re: Programming Style

2009-01-05 Thread Shmurk
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

Re: clojure.contrib.sql (connection) public?

2009-01-05 Thread blackdog
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

Re: Serializing functions

2009-01-05 Thread mehrheit
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

Re: Programming Style

2009-01-05 Thread Meikel Brandmeyer
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

Programming Style

2009-01-05 Thread Shmurk
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

Re: Functional Shuffle

2009-01-05 Thread Jason Wolfe
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