Re: Request for Discussion: changing lib root directory calculation to improve load/:load

2009-02-10 Thread Stephen C. Gilardi
a clear global picture of Clojure's timeline, but now seems a good time to make this change to me. Again, those are very quick thoughts (no more time to think about it right now), Thanks very much for responding! --Steve 2009/2/10 Stephen C. Gilardi squee...@mac.com I came across this when

Re: Request for Discussion: changing lib root directory calculation to improve load/:load

2009-02-10 Thread Stephen C. Gilardi
import_static.clj javalog.clj lazy_seqs/ fast_memoize.clj lazy_seqs.clj macros.clj mmap.clj ns_utils.clj prxml.clj repl_ln.clj I think the latter is much clearer. --Steve 2009/2/10 Stephen C. Gilardi squee...@mac.com On Feb

Re: Request for Discussion: changing lib root directory calculation to improve load/:load

2009-02-10 Thread Stephen C. Gilardi
On Feb 10, 2009, at 12:32 PM, Greg Harman wrote: Let me offer a perspective coming from a Java background: I know that there are subtle differences between a namespace and a Java package, but I still tend to subconsciously consider them analogous: they are container structures for organizing

Re: anonymous functions

2009-02-10 Thread Stephen C. Gilardi
On Feb 10, 2009, at 11:09 PM, Mark Volkmann wrote: Just checking my understanding of the rules for writing anonymous functions ... (fn [args] ...) allows any number of expressions in its body. #(...) only allows a single expression in its body, correct? Why the difference? Because a single

Re: Patch: universal main() with repl/script/compile

2009-02-09 Thread Stephen C. Gilardi
On Feb 9, 2009, at 2:13 PM, Rich Hickey wrote: On Feb 9, 2:10 pm, Thorsen Eric ethor...@enclojure.org wrote: For some reason I could not reply to the original thread... Begin forwarded message: From: Stephen C. Gilardi squee...@mac.com Date: February 6, 2009 12:49:34 PM EST To: Eric

Re: clojure.contrib.sql connections

2009-02-08 Thread Stephen C. Gilardi
On Feb 8, 2009, at 4:04 PM, Mark Volkmann wrote: The error I get is org.postgresql.util.PSQLException: FATAL: no PostgreSQL user name specified in startup packet. I think the problem is that the username and password values in db aren't used by with-connection unless a DataSource object is

Re: Issue request: RT.load's don't load if already loaded mechanism breaks :reload-all

2009-02-06 Thread Stephen C. Gilardi
On Feb 6, 2009, at 8:28 AM, Stephen C. Gilardi wrote: When *reload-all* is true, RT.load() will (re)load all libs from their .clj files even if they're already loaded. To clarify: When *reload-all* is true, RT.load will (re)load any lib it is asked to load from the lib's .clj file even

Issue request: RT.load's don't load if already loaded mechanism breaks :reload-all

2009-02-06 Thread Stephen C. Gilardi
require and use support a :reload-all flag that is intended to cause the specified libs to be reloaded along with all libs on which they directly or indirectly depend. This is implemented by temporarily binding a loaded-libs var to the empty set and then loading the specified libs. AOT

Re: clojure.contrib.sql and inner joins

2009-02-04 Thread Stephen C. Gilardi
Hi Brian, On Feb 4, 2009, at 9:21 AM, BrianS wrote: However, whenever I insert a SQL query that contains an inner join command (standard SQL), I get the following error: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Too many arguments to struct

Re: clojure.contrib.sql and inner joins

2009-02-04 Thread Stephen C. Gilardi
On Feb 4, 2009, at 9:46 AM, Stephen C. Gilardi wrote: That sounds like what's going on in your example. Can you please confirm? Also, if you have one handy, could you please send me a short, standalone example of code that triggers the problem? I'd like to look at how

Re: clojure.contrib.sql and inner joins

2009-02-04 Thread Stephen C. Gilardi
On Feb 4, 2009, at 11:09 AM, BrianS wrote: Once I substituted actual column names in the SELECT portion of the statement, the inner joins started working as they should. Excellent! As always, thanks for the attention, assistance, and the original work in clojure.contrib.sql, it has all

Re: Macro error

2009-02-03 Thread Stephen C. Gilardi
On Feb 3, 2009, at 7:45 PM, Jeffrey Straszheim wrote: Btw, I fixed the ~ needed on relation. It didn't help. It seems I just can't put a ~@ form inside of a { } set builder. { } reads a literal map. It appears to expect an even number arguments between the curly braces at read time. You

Re: possible bug with doto and function literals

2009-02-03 Thread Stephen C. Gilardi
On Feb 3, 2009, at 10:32 PM, kyle smith wrote: (map #(doto %1 (.add 2)) (doto (new java.util.ArrayList) (.add 1))) user= (map #(doto %1 (.add 2)) (doto (new java.util.ArrayList) (.add 1))) java.lang.IllegalArgumentException: No matching method found: add for class java.lang.Integer

Re: Bug or desired behavior: contains? doesn't seem to work on java.util.Sets.

2009-02-03 Thread Stephen C. Gilardi
On Feb 3, 2009, at 10:44 PM, Jason Wolfe wrote: user (contains? (.keySet {:a :b}) :a) false It seems that all that's required to make contains? work on general Sets is to replace IPersistentSet with Set on lines 648 and 649 of RT.java. I can make a patch if desired. Along those lines,

Re: a question about binding

2009-02-01 Thread Stephen C. Gilardi
On Feb 1, 2009, at 12:04 PM, Eric wrote: So, my question is this: what is the difference/relationship between #' and the fully-qualified name? #'x is a sequence of characters that the reader (LispReader.java) translates into (var x) when reading. (see http://clojure.org/special_forms#var)

Re: Symbol to Namespace Qualified Symbol

2009-02-01 Thread Stephen C. Gilardi
On Feb 1, 2009, at 2:44 PM, Craig McDaniel wrote: Anyone have a better method to go from a symbol to a namespace qualified symbol? I'm using this ugly kludge now: (symbol (.substring (.toString (resolve sym)) 2)) I'm keeping a map of currently traced functions and the key is the

Re: Downloading the Java SE API documentation

2009-02-01 Thread Stephen C. Gilardi
On Feb 1, 2009, at 9:54 PM, Vincent Foley wrote: Does anyone know where I could get [downloadable Java API Documentation] in HTML format? On this page: http://java.sun.com/javase/downloads/index.jsp search for Java SE 6 Documentation The file jdk-6u10-docs.zip unzips to

Re: clojure.contrib.sql and SQL Server = cast exceptions?

2009-01-30 Thread Stephen C. Gilardi
Hi Brian, On Jan 29, 2009, at 11:03 AM, BrianS wrote: Now that I am beginning to really investigate this cool part of the clojure-contrib library with SQL Server, I have hit the point where I would like to call parameterized stored procedures, which is why you said you changed the SQL

Re: Documenting Clojure Code

2009-01-30 Thread Stephen C. Gilardi
On Jan 30, 2009, at 4:49 PM, bOR_ wrote: (def myvar ; cant do a nice description here, even though hash-maps can stand in for functions. (hash-map :a 1 :b 3)) clojure.contrib.def/defvar offers some help with that: - clojure.contrib.def/defvar

Re: Ways of making a Clojure program?

2009-01-29 Thread Stephen C. Gilardi
On Jan 29, 2009, at 8:03 AM, timc wrote: I'm struggling to understand exactly what form(s) a Clojure program can take. In particular, the empty section The REPL and main entry points on the clojure.org web site doesn't help. I'm sorry about that being empty. I'm on the hook for that and I'll

Re: Simple Examples of Concurrency?

2009-01-27 Thread Stephen C. Gilardi
On Jan 27, 2009, at 3:57 PM, wubbie wrote: Why defn ends with -(dash)? (defn- mire-handle-client [in out] A good approach to finding out what a function does is to consult doc: (doc defn-) --Steve smime.p7s Description: S/MIME cryptographic signature

Re: clojure.contrib.sql and SQL Server = cast exceptions?

2009-01-26 Thread Stephen C. Gilardi
Hi Brian, Could you please paste a copy of the stack trace for the ClassCastException you're seeing to http://clojure.pastebin.com and post the URL for it here? If you're driving your program at the repl, you can get a stack trace from the most recent exception with:

Re: clojure.contrib.sql and SQL Server = cast exceptions?

2009-01-26 Thread Stephen C. Gilardi
the code from clojure.contrib.sql. The actual function I was running was db-read, and the stack trace can be found at http://clojure.pastebin.com/f660e0aac . Thanks, Brian On Jan 26, 10:25 am, Stephen C. Gilardi squee...@mac.com wrote: Hi Brian, Could you please paste a copy of the stack trace

Re: 'ls.c'/csv fixed space style directory listing, figure out the formatting to issues

2009-01-26 Thread Stephen C. Gilardi
On Jan 26, 2009, at 4:31 PM, BerlinBrown wrote: I want to output a directory with a similar listing (see below), but only a fixed number of spaces. Is there a clojure approach to already do this. -rw 13290 1216183460872 LispExample_Flow.png -rw 3211 1217537516267 PDFReport.java I think in

Re: default namespaces

2009-01-26 Thread Stephen C. Gilardi
On Jan 26, 2009, at 6:39 PM, Mark Volkmann wrote: I still have a question though. Why is it that when I use the ns macro to create a new namespace, the core symbols are still available even though I haven't done a refer on clojure.core? That's one of the features of the ns macro. It handles

Re: changes to test_clojure and test_contrib

2009-01-26 Thread Stephen C. Gilardi
On Jan 26, 2009, at 7:43 PM, Shawn Hoover wrote: I have a few tests in the works and am lacking commit access as well. Should test contributions follow the procedure of group discussion, then file an issue, then post a patch? If so, what would you like to know about the patch(es)? I

Re: time lies, even with doall

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 5:24 PM, e wrote: Do folks in the contrib group like this new implementation? To make contributions to clojure-contrib, you'll need to have a Contributor Agreement on file with Rich. Please see http://clojure.org/contributing . I think your implementation is an

Re: NewBie Q: doall forces eval and dorun not; but why?

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 5:51 PM, wubbie wrote: I saw dorun and doall in core.clj as follows: That is, doall just calls dorun. My question is, how come doall does force eval and dorun does not. thanks in advance, Both force evaluation. Immediately before either returns, there is a fully

Re: Turning a sequence of chars into a string.

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 6:21 PM, budu wrote: So, is there a better way to accomplish this? Then, do someone have a better name for it? And finally, would this be worth including into Clojure or Clojure-contrib, with a better name? The usual way to do this is with (apply str ...) For example:

Re: NewBie Q: doall forces eval and dorun not; but why?

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 6:45 PM, Laurent PETIT wrote: 2009/1/26 Stephen C. Gilardi squee...@mac.com Both force evaluation. Immediately before either returns, there is a fully realized sequence in memory. Are you sure ? I think the point of dorun is to prevent this case : with dorun

Re: NewBie Q: doall forces eval and dorun not; but why?

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 7:35 PM, wubbie wrote: then, back to my original question. They (dorun do all) differe ONLY in return value. Then how come one forces eval and the other not? Both force evaluation. Is there something that makes you think otherwise? In the case of dorun, the members of

Re: NewBie Q: doall forces eval and dorun not; but why?

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 7:47 PM, Stephen C. Gilardi wrote: In the case of dorun, the members of the sequence are evaluated and then immediately thrown away. Immediately overstates it... they are left unreferenced and get thrown away when the Java garbage collector notices

Re: NewBie Q: doall forces eval and dorun not; but why?

2009-01-25 Thread Stephen C. Gilardi
On Jan 25, 2009, at 8:05 PM, wubbie wrote: Wait... I just tried (first (list (+ 1 2) (+ 3 4))) and got 3! So (list a b c) is different than '( a b c)? I thought they are equivalent! Right, as your experiment shows, the ' in '(a b c) quotes both the list itself and all of its contents.

Re: newbie Q: recur vs self call

2009-01-24 Thread Stephen C. Gilardi
On Jan 24, 2009, at 11:17 AM, wubbie wrote: I understand vaguely. My understanding is that recur is related to tail-call-optimization. Where can I get more detailed info on recur? A search on Google for: clojure recur brings up some good references. --Steve smime.p7s

Re: Proposal: smarter set operations that take size into account for speed

2009-01-24 Thread Stephen C. Gilardi
On Jan 24, 2009, at 8:11 PM, Jason Wolfe wrote: Finally, I don't know how to make a patch, and found nothing in a quick search of the wiki/newsgroup/website. I heard Git floating around somewhere earlier; am I to check out the SVN with git-svn and make a patch that way? To prepare a patch,

Re: are (swing) elements in a data structures read only?

2009-01-24 Thread Stephen C. Gilardi
On Jan 24, 2009, at 10:14 PM, wubbie wrote: How do you define side-effects? There's a good description here: http://en.wikipedia.org/wiki/Side_effect_(computer_science) --Steve smime.p7s Description: S/MIME cryptographic signature

Re: A case when do suppresses exception?

2009-01-24 Thread Stephen C. Gilardi
The map function returns a lazy sequence. Unless something forces the members of the sequence to be evaluated, they won't be. In Form1, you explicitly call an anonymous function that throws. In Form2, the sequence returned by map is the last value in the do form, so it is the value of the

Re: A nil puzzle

2009-01-23 Thread Stephen C. Gilardi
There was a recent suggestion here: http://groups.google.com/group/clojure/msg/32d323e15f8ce624 about the proper value of: (clojure.contrib.lazy-seqs/combinations) (and perhaps by extension (clojure.contrib.lazy-seqs/combinations '()) (or any number of empty seq arguments))

Re: evalOnlyDefs

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 8:38 AM, Peter Wolf wrote: Looking for opinions from Clojure internals Wizards... I can think of only one Clojure internals Wizard, but I have some thoughts. I am thinking about safe loading for IDEs (see other thread). IDEs need a way to load and resolve code,

Re: evalOnlyDefs

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 11:52 AM, Konrad Hinsen wrote: Some questions this raises: - Should libs be restricted to definitions (and lib support things like ns and (some kind of) load-resource) only? - Should the appearance of an ns form automatically make that restriction enforced for the rest of

Re: (clojure.contrib.lazy-seqs/combinations) should return [[]], not nil?

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 12:53 PM, Jason Wolfe wrote: Just to clarify: I dont' care what the type of the output is. I guess (seq [[]]) would actually be more consistent with the existing function. The point is that the output of 0-arg combinations should be a seq containing an empty vector (or

Re: (clojure.contrib.lazy-seqs/combinations) should return [[]], not nil?

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 1:11 PM, Stephen C. Gilardi wrote: I'd be interested in hearing from Chouser before making the change. He added combinations to lazy-seqs. I think it's quite cool that simply removing the when accomplishes this. --Steve smime.p7s Description: S/MIME cryptographic

Re: evalOnlyDefs

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 4:13 PM, Konrad Hinsen wrote: How about something like (let [my-factor (* 3 (. Math sqrt 2) (. Math log 42.))] (defn foo [x] (* my-factor x))) where the let outside of the definition makes sure the constant factor is evaluated only once? Are you pointing out that

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 3:23 PM, Jason Wolfe wrote: OK, if these are not wanted in core right now, will anyone sign off for adding them to clojure.contrib? I can't say I like the idea of having two sets of functions that do exactly the same thing, but ... sometimes you just don't want things to

Re: namespace concept

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 4:54 PM, e wrote: [lots of stuff] Would you please take a look at the text and example at http://clojure.org/libs and ask questions about anything you don't understand in it? Once you understand libs (through reading and asking questions here), I think it will make

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 7:56 PM, e wrote: (ns my-ns (:use [clojure.set :exclude (difference)] [clojure.contrib.set :only (difference)])) Did you have to say :exclude or does the last thing override? I had to say :exclude. :use makes a call to refer which

Re: namespace concept

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 7:12 PM, e wrote: first explicit question: after the example lib and the bullets, I don't see why there are two different keywords, use and require. Just look at the start of the sentences. They are identical. Why not just pick one of the two keywords and let only

Re: namespace concept

2009-01-23 Thread Stephen C. Gilardi
On Jan 23, 2009, at 8:21 PM, e wrote: Ah hah! I finally understand something. See this is what would really help in the explanation. Something like, In Java, each file defines only a single outer class, which must have the same name as the file. This simple approach means that there

Re: newbie: namespaces and load-file

2009-01-22 Thread Stephen C. Gilardi
On Jan 22, 2009, at 12:46 PM, Paul Henning wrote: As described, this doesn't work. load-file looks up symbols in the current namespace (user in this case), but foo is interned in app. At some point in this process, Clojure needs to know which foo you're talking about. It can't retrieve

Re: newbie: namespaces and load-file

2009-01-22 Thread Stephen C. Gilardi
On Jan 22, 2009, at 3:56 PM, Paul Henning wrote: As long as no one cares if I muck with *ns*, I can make it work [...] That brings up an important point. The var *ns* may look like a global variable in C++, but it's really a dynamic variable--something quite a bit safer and more

Re: Clojure Web Libraries

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

Re: Utilities for clojure.contrib?

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 3:36 PM, Jason Wolfe wrote: OK, I'll get on this then. It this just for changes to core, or should I post proposed functions for contrib there/ on the contrib issues page too? If not, what should I do with them? I recommend that proposed changes for clojure-contrib be

Re: doall vs. dorun

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 5:32 PM, Mark Volkmann wrote: Here's one: (defn read-my-file [] (with-open [reader (BufferedReader. (FileReader. my-file.txt))] (doall (line-seq reader line-seq returns a lazy sequence, but you have to consume that sequence before with-open closes the file. How is

Re: clojure.contrib.sql - Support DataSource in with-connection

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 6:16 PM, Juergen Gmeiner wrote: I've been using clojure for prototyping in JBoss and I found that clojure.contrib.sql does not currently support opening JDBC connections via a javax.sql.DataSource. So I propose the patch below. Hi Juergen, I'd like for

Re: clojure.contrib.sql - Support DataSource in with-connection

2009-01-20 Thread Stephen C. Gilardi
On Jan 20, 2009, at 7:01 PM, Stephen C. Gilardi wrote: I'd like for clojure.contrib.sql to support DataSource. As an alternative implementation, what do you think of db-spec allowing a :datasource key. If :datasource is specified, with-connection could use its value to acquire

Re: Another socket repl

2009-01-19 Thread Stephen C. Gilardi
On Jan 19, 2009, at 9:38 AM, Craig McDaniel wrote: In case this is of use to anybody else, I thought I'd share my version of a socket REPL: http://clojure.googlegroups.com/web/socket-repl.clj Unlike the socket repl on the Wiki Example page, it does the following: - uses the repl from

Re: Another socket repl

2009-01-19 Thread Stephen C. Gilardi
On Jan 19, 2009, at 2:15 PM, Craig McDaniel wrote: Thanks, that's a good point. I'm posting a new file server-socket.clj that is more generic and includes the REPL as an example case. I checked in server_socket.clj - thanks! --Steve smime.p7s Description: S/MIME cryptographic signature

Re: Runtime exception when agent calls sort

2009-01-18 Thread Stephen C. Gilardi
On Jan 18, 2009, at 12:11 PM, mbrodersen wrote: (defn html-write-cmd [out cmd] (doseq [key (keys cmd)] (.write out (format b\%s\/b = \%s\br key (cmd key) I gather this is a command you're sending to the agent via send-off. The first

Re: Calling a mapreduce job from inside another

2009-01-18 Thread Stephen C. Gilardi
On Jan 18, 2009, at 12:48 PM, aimhier wrote: Is it possible to call a map-reduce job from inside another. If yes how. Also is it possible to disable the reducer completely, i.e I wish to stop immediately after the mapper is applied. This appears not to be a question about Clojure. I see

Re: Reading non-printing characters in the reader?

2009-01-17 Thread Stephen C. Gilardi
On Jan 17, 2009, at 2:37 AM, Tom Faulhaber wrote: Question: How do I read non-printing characters in the reader? From reading src/jvm/clojure/lang/LispReader.java and experimenting, I see that there are at least 3 ways to read such an arbitrary character code with the reader: - Octal

Re: How to implement go to definition and find all references

2009-01-17 Thread Stephen C. Gilardi
On Jan 17, 2009, at 8:40 AM, Peter Wolf wrote: Actually, the observation below might be really good news. Does it means that all references are resolved at compile time? Do I ever have to run the code to figure out the context of a reference? Or, does the lexical context give me all

Re: fit for contribution to clojure.contrib.ns-utils?

2009-01-17 Thread Stephen C. Gilardi
On Jan 17, 2009, at 4:11 PM, Dan Larkin wrote: (defn require-resolve [id] (let [sym (symbol id) ns-symbol (symbol (namespace sym)) var-symbol (symbol (name sym))] (require ns-symbol) (ns-resolve (find-ns ns-symbol) var-symbol))) The name is

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 7:31 AM, lpetit wrote: Maybe for scripts a global var such as *script-name* could be set automatically ? I like this. I've also seen several requests for a way to know when code is running in a script which could be satisfied by this as well. This would be an easy

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 8:37 AM, Stephen C. Gilardi wrote: I like this. I've also seen several requests for a way to know when code is running in a script which could be satisfied by this as well. For clarity, here's what I'm proposing based on recent discussion in this thread: [1] When

Re: Namespace/Classpath Question

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 5:01 PM, Kevin Albrecht wrote: In ~/src/foo/bar/alpha.clj : (ns foo.bar.alpha (:require (foo.bar beta))) (println (get-stuff)) The :require clause succeeded in loading foo.bar.beta, but :require does not bring get-stuff into namespace foo.bar.alpha. You can solve

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 7:36 PM, Timothy Pratley wrote: I guess another way would be to just rebind *command-line-script* to nil on subsequent loads? It doesn't feel like an complete solution but I believe it covers the use cases discussed so far. That could work, but I think this kind of

Re: question about understanding/exploring agents

2009-01-15 Thread Stephen C. Gilardi
On Jan 15, 2009, at 2:57 AM, bOR_ wrote: That is, if I understand blocking correctly. Currently assuming that blocking only happens when two things would like to write the same ref? Blocking in this case refers to this definition: http://en.wikipedia.org/wiki/Blocking_(computing) You

Re: *1 *2 isn't working properly

2009-01-15 Thread Stephen C. Gilardi
On Jan 15, 2009, at 7:28 AM, HB wrote: Do *1 *2 *3 ... are saved in a built in sequence that we can inspect its contents? No, they are separate vars. Here's the code from the core of the read- eval-print loop in clojure/src/clj/clojure/main.clj that shows how they're updated:

configurable bash script to launch Clojure available

2009-01-15 Thread Stephen C. Gilardi
I've checked in a bash script for launching Clojure to clojure-contrib/ launchers/bash/clj-env-dir. It's configured using environment variables (one required and several optional). It sets up the CLASSPATH for the Clojure instance it launches based on the contents of a directory. This is a

Re: question about understanding/exploring agents

2009-01-15 Thread Stephen C. Gilardi
On Jan 15, 2009, at 9:26 AM, bOR_ wrote: I think I know when to use one and when to use the other, but the extra clarification doesn't hurt. However, what happens if you get it wrong? use send where you should have used send-off, and visa versa? I would like to know what they do differently.

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Stephen C. Gilardi
On Jan 15, 2009, at 11:31 AM, Chouser wrote: I had a launch script (which I've now lost due to my own clumsiness) that defaulted to a repl if given no file options, and always loaded a .clojurerc.clj file before starting a repl (whether it was by default or specifically asked via -r). This

Re: How to reduce a list of booleans?

2009-01-15 Thread Stephen C. Gilardi
On Jan 15, 2009, at 1:53 PM, Daniel Jomphe wrote: What would you consider the normal way of solving this small problem of mine? (reduce #(and %1 %2) [true false true]) --Steve smime.p7s Description: S/MIME cryptographic signature

Re: Parameterized query with clojure.contrib.sql

2009-01-14 Thread Stephen C. Gilardi
On Jan 14, 2009, at 1:26 PM, Greg Harman wrote: Thanks much for your work. The new with-query-results seems to work quite well. You're quite welcome. I'm glad to hear it! Your timing is impeccable with this set of changes: I had just finished hacking out a (much uglier) version of

clojure.contrib.sql updates

2009-01-13 Thread Stephen C. Gilardi
I've checked in updates to clojure.contrib.sql. The theme is providing update and delete functions and a move to pervasive support of parameterization in queries and selection criteria. Please see the doc strings for detailed changes. Here's a summary of the changes: sql.clj - Add

Re: Parameterized query with clojure.contrib.sql

2009-01-13 Thread Stephen C. Gilardi
On Jan 12, 2009, at 4:57 PM, Greg Harman wrote: I couldn't figure out how to do this with the included functions/ macros in clojure.contrib.sql so I massaged with-results and do- prepared together to get this macro (with supporting fn), which seems to work. Useful addition for contrib.sql?

Re: update-values for clojure.contrib.sql

2009-01-13 Thread Stephen C. Gilardi
On Jan 11, 2009, at 10:42 AM, Stephen C. Gilardi wrote: I'd like to include something like this in clojure.contrib.sql. That will go smoothest if I can base it directly on what you've written and that's only possible if you send in a contributor agreement. Would you please send one

Re: update-values for clojure.contrib.sql

2009-01-11 Thread Stephen C. Gilardi
On Jan 2, 2009, at 2:21 AM, budu wrote: Hi, I was experimenting with clojure-contrib's sql features and found that there wasn't any update-values function. I've written my own and I'm sharing it here: (defn update-values [table where column-names values] Update columns of a table with

Re: Creating classes/Sub classes in clojure

2009-01-09 Thread Stephen C. Gilardi
On Jan 9, 2009, at 4:04 PM, BerlinBrown wrote: Is it better style to use the 'proxy'ing to create a class or to use the gen-class approach. There are limitations to proxying that make gen-class sometimes necessary, but based on reading the group and only limited personal experience, I

Re: sort behavior question

2009-01-08 Thread Stephen C. Gilardi
On Jan 8, 2009, at 1:55 PM, Dmitri wrote: There are two issues here that I'm seeing, first is that the list and vector have different behavior, my understanding is that they are both sequences and one should be able to perform the same operations on them. I don't know more about the

Re: File organization bootstrapping

2009-01-07 Thread Stephen C. Gilardi
On Jan 7, 2009, at 2:04 PM, Shawn Hoover wrote: Clojure developers, would it be a good idea for Compiler.java or clojure.core/compile to check if *compile-path* exists, else throw an exception specific to that problem? I like the idea. There is a subtle problem I don't think it will catch

Re: Simple example of using postgresql with contrib.sql...

2009-01-07 Thread Stephen C. Gilardi
On Jan 7, 2009, at 12:11 PM, ssecorp wrote: This was going to be a question but I solved it before I finished the post :) Figured I might post the solution then, hopefully it will help someone else. Very cool. (ns progs.netflix.db (:require (clojure.contrib [sql :as sql])) (:require

Re: re-find

2009-01-07 Thread Stephen C. Gilardi
On Jan 7, 2009, at 6:21 PM, Jeff Foster wrote: Looking at the code, re-find uses re-groups which explicitly says that it either returns a vector or a string. This is clunky to deal with - is there any reason it doesn't always return a vector? Whether it returns a vector or string depends on

Re: Simple example of using postgresql with contrib.sql...

2009-01-07 Thread Stephen C. Gilardi
On Jan 7, 2009, at 6:20 PM, ssecorp wrote: I tried to use connection in internal to get resultSetMetadata but I never succeeded with it. In the current svn version of clojure.contrib, connection is available without using sql.internal. Also, there's now an example of getting connection

Re: Website: REPL Main section?

2009-01-06 Thread Stephen C. Gilardi
On Jan 6, 2009, at 12:46 PM, Greg Harman wrote: The REPL Main section of the website doesn't have any content... not written yet, or accidental omission? http://clojure.org/repl_and_main Not written yet. I'll be writing it soon. --Steve smime.p7s Description: S/MIME cryptographic

Re: setting foreign and primary key with contrib.sql ? how to setup db with un and pw?

2009-01-06 Thread Stephen C. Gilardi
On Jan 6, 2009, at 2:27 PM, ssecorp wrote: On Jan 6, 8:12 pm, ssecorp circularf...@gmail.com wrote: CREATE TABLE foo ( col1 INTEGER NOT NULL, col2 VARCHAR(32) NOT NULL, col3 DATE NOT NULL, PRIMARY KEY (col1, col2) ); how would I set primary key if it is a combination of 2 keys?

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 =

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

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

2009-01-04 Thread Stephen C. Gilardi
The java.ext.dirs System property provides a very convenient way to set up and maintain a Classpath for Clojure REPLs. The property can be set from the command line used to launch Clojure (typically within a launcher script). Its value is a list of directories whose *contents* will be the

Re: Using a directory full of symlinks to manage the Classpath for Clojure REPLs

2009-01-04 Thread Stephen C. Gilardi
On Jan 4, 2009, at 10:07 PM, Drew Raines wrote: java.ext.dirs has a default value that -Djava.ext.dirs overwrites, so make sure you replace whatever your platform's Java expects (like $JAVA_HOME/lib/ext). I've been bitten before trying to speak HTTPS while not having sunpkcs11.jar available.

Re: what's the correct syntax for new clojure?

2009-01-03 Thread Stephen C. Gilardi
There's a correct, updated version here: http://clojure.org/concurrent_programming (import '(java.util.concurrent Executors)) (defn test-stm [nitems nthreads niters] (let [refs (map ref (replicate nitems 0)) pool (Executors/newFixedThreadPool nthreads) tasks (map (fn [t]

Re: Bugs in contains? (?)

2009-01-03 Thread Stephen C. Gilardi
On Jan 3, 2009, at 5:16 PM, Meikel Brandmeyer wrote: == is for numbers. That's correct. Now that = also handles numbers in an type- independent way, do well still need == in Clojure? Is it primarily a higher performance equality check when you know you're dealing with numbers? --Steve

Re: Bugs in contains? (?)

2009-01-03 Thread Stephen C. Gilardi
On Jan 3, 2009, at 5:50 PM, Chouser wrote: But as noted originally, hashes are a bit more strict than Clojure =: (= v1 l1) == true (get (hash-map v1 :found) l1) == nil I see this as a bug. For clojure data structures, = maps to .equals and Java defines rules for the relationship between

Suggest clojure.lang.Util.isInteger consider Byte and Short as integers

2009-01-03 Thread Stephen C. Gilardi
clojure.lang.Util.isInteger does not currently consider Bytes and Shorts to be integers. That leads to this behavior: 1:17 user= ([1 2 3] (short 2)) java.lang.IllegalArgumentException: Key must be integer (repl-1:17) I suggest that isInteger return true for Bytes and Shorts as well. --Steve

Re: meaning and pronunciation of Clojure

2009-01-03 Thread Stephen C. Gilardi
On Jan 3, 2009, at 9:10 PM, Mark Volkmann wrote: Hey Rich, can you confirm what is official according to you? Should the j be pronounced like a j or like an s? You can hear the man himself saying it here: http://blip.tv/file/1313398/ I hear no particular nod in his pronunciation to the

Re: Compilation problems

2009-01-02 Thread Stephen C. Gilardi
On Jan 2, 2009, at 11:37 AM, Rayne wrote: into a file called rayne.clj and started it clojure, and typed (compile 'rayne). The compilation produced 2 different class files, but it gave me a class not found error saying it couldn't find rayne $_main__32.class. It produced the class files, but

Re: Compilation problems

2009-01-02 Thread Stephen C. Gilardi
On Jan 2, 2009, at 11:51 AM, Rayne wrote: I checked, and the classpath (compile-path) is the classes directory in my clojure folder, so I put the file in there, and tried to compile it, it gave me You'll need to learn a bit about Classpath to work with Clojure. Basically, Classpath is a

Re: Emacs+SLIME+Clojure troubles

2009-01-01 Thread Stephen C. Gilardi
On Jan 1, 2009, at 7:57 PM, Bill Clementson wrote: Or is there some other dynamic documentation for a function that you're referring to? For me, it throws the exception when I type a space and SLIME tries to look up the arguments for the current function. For example, in a fresh SLIME

Re: Contrib REPL Invocation Changes

2008-12-30 Thread Stephen C. Gilardi
On Dec 30, 2008, at 9:53 AM, Randall R Schulz wrote: Anyway, I guess it needs to be pointed that the invocation you supplied won't work unless the Clojure Contrib JAR file is built with pre- compiled Java classes and that this only happens if you supply the clojure.jar property

Re: Contrib REPL Invocation Changes

2008-12-29 Thread Stephen C. Gilardi
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 as I was able to before today. When I do, I get no prompt until I type a non-empty

Re: Contrib REPL Invocation Changes

2008-12-29 Thread Stephen C. Gilardi
Now I'm dumped back to my shell prompt following a single Clojure REPL prompt (of the Contrib REPL variety) without even touching the keyboard: % clojure-svn --crepl +cp=$PROJ_SRC/tau/run +cp=/dar/clojure 1:1 user= % Here it is working with the current clojure.jar and clojure-contrib.jar: %

<    1   2   3   4   5   6   >