Re: Interop with strange java type: java.lang.String

2015-08-20 Thread Stephen C. Gilardi
On Aug 20, 2015, at 3:32 AM, Andy Dwelly andydwe...@gmail.com wrote: Does anyone know how how to create a java.lang.String ? Ideally how to convert a Clojure some string which is a java.lang.String to a java.lang.String. Also, although this is merely idle curiosity on my part, does

Re: Anotating functions for pre-processing

2015-08-05 Thread Stephen C. Gilardi
I wish I could do that in Clojure: (defn ^:transactional someFunction [...] ...) and then have somehow means to decorate someFunction (yes, I am aware there is no container) The code you proposed does have an effect on the someFunction var (but not the function it ends up bound to).

Re: Clojure terminology

2014-09-12 Thread Stephen C. Gilardi
On Sep 12, 2014, at 2:36 PM, Mark Engelberg mark.engelb...@gmail.com wrote: As far as I know, Clojure doesn't give you a whole lot of control over how things print at the REPL The built-in clojure repl has some customization options. You can run a repl with a custom reader and printer, for

Re: clojure lazy-seq caching?

2014-03-02 Thread Stephen C. Gilardi
I understand that lazy-seq caches the computed result as each element is read. However, how can is this made to be thread-safe? The caching is done within a synchronized method as each element's value is realized. There is an instance of clojure.lang.LazySeq that manages each seq element's

Re: deadlock when using clojure data structures at startup

2014-01-30 Thread Stephen C. Gilardi
On Jan 30, 2014, at 8:22 PM, Michael Blume blume.m...@gmail.com wrote: Recently we had an app fail because, as it was starting up, one thread was trying to require a clojure namespace, and another was trying to use a PersistentHashSet. Somehow these two threads wound up in deadlock. I've

Re: Namespaces in waiting

2014-01-06 Thread Stephen C. Gilardi
On Jan 1, 2014, at 3:26 PM, Dave Tenny dave.te...@gmail.com wrote: When I use 'lein repl' in some project context and get to the REPL prompt, there's an available but as yet not ... present ... namespace, i.e. (all-ns) won't list the namespace(s) created in the lein project directory tree.

Re: repl output for list seems inconsistent and a holdover from yesteryear

2011-10-27 Thread Stephen C. Gilardi
On Oct 26, 2011, at 7:08 PM, e wrote: [1 2 3] is a vector that is not evaluated. Since there is no overload with things that are, there's no need for a special mark. If you type [1 2 3] into the REPL it is evaluated. The E part of the REPL always runs. Some expressions evaluate to

Re: problem with take-while

2011-07-26 Thread Stephen C. Gilardi
user= (take-while #(= (mod 20 %) 0) (apply (fn [x y] (rest (range (max x y [10 20])) (1 2) but i expect to have (1 2 5 10) because of (apply (fn [x y] (rest (range (max x y [10 20]) returns (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) and (mod 20 5) and (mod 20 10) should

Re: Build tool for mixed Clojure/Java projects

2011-07-05 Thread Stephen C. Gilardi
On Jul 4, 2011, at 7:52 AM, Michael Wood wrote: Repository need not imply anything to do with networking. I'm sure someone will correct me if I'm wrong, but I am pretty sure that the repository Steve [Lindsay] is talking about above is just a hierarchy of files in your home directory.

Re: Idiomatic way to reference a bundled data file from Clojure source?

2011-06-28 Thread Stephen C. Gilardi
I'd like to bundle a collection of (JSON) datafiles with a Clojure project source tree so that Clojure functions can reliably find and open those datafiles. What's the idiomatic way of going about this? One idiomatic way to do this in Clojure is: - store the files within a directory

Re: What's the best way to test private functions?

2011-06-27 Thread Stephen C. Gilardi
On Jun 18, 2011, at 7:16 AM, Stuart Halloway wrote: To access a private var, simply deref through the var: @#'some-ns/some-private-var As Rich noted here: http://groups.google.com/group/clojure/msg/513367afb934d41b , when the var names a function and it's used in an expression emitted from

Re: Help to optimize palindrome search from input file

2010-10-13 Thread Stephen C. Gilardi
On Oct 12, 2010, at 3:02 PM, tonyl wrote: (defn palindrome? [s] (= s (reduce str (reverse s One opportunity to micro-optimize is to replace reduce str with apply str. str uses a StringBuilder object to build a string from its arguments. When you use reduce, the code walks down s

Re: lein compile changes not getting picked up by lein swank

2010-10-11 Thread Stephen C. Gilardi
On Oct 10, 2010, at 3:05 PM, HiHeelHottie wrote: I'm running lein swank and using slime-connect from emacs. When I use lein compile after making changes to a method, they don't appear to get picked up unless I bring down lein swank, bring it up again, slime- connect, etc. Is there a way

Re: error on a project using clj-processing

2010-10-11 Thread Stephen C. Gilardi
On Oct 11, 2010, at 10:28 PM, Vilson Vieira wrote: i've started a new lein project. it's my project.clj: (defproject test-processing 0.1.0-SNAPSHOT :description Test Processing :dependencies [[org.clojure/clojure 1.2.0-master-SNAPSHOT] [org.clojure/clojure-contrib

Re: Style Question

2010-10-10 Thread Stephen C. Gilardi
The answer depends on what you're trying to accomplish. Does this simpler definition allow you to call blah in the ways you want to? (defn blah [ {:as blah-map}] ;; do stuff with blah-map) --Steve On Oct 10, 2010, at 12:39 AM, Grayswx wrote: Recently, I've been coding functions that

Re: Style Question

2010-10-10 Thread Stephen C. Gilardi
I think I see the goal now: to allow calling with either a map or sequential key-value pairs. What you have appears correct and minimal for that purpose. For a function taking a sequence, you can accomplish something similar without a second arity by choosing to call directly or call using

Re: clojure.contrib.sql and duplicate inserts

2010-09-20 Thread Stephen C. Gilardi
On Sep 20, 2010, at 8:27 AM, Bart J wrote: Currently, it is not possible to insert duplicate rows using the clojure.contrib.sql module (specifically, the insert-values method). Please let me know, if I can add this. Thanks. Are you saying you want to end up with duplicate rows or that

Re: Can resultset-seq blow the stack?

2010-09-19 Thread Stephen C. Gilardi
On Sep 19, 2010, at 3:45 PM, Shantanu Kumar wrote: I simulated a similar recursive call and found it throws StackOverflowError at 5508 levels deep on a 32-bit Sun JVM (not server mode) on Windows 7. Did your similar recursion include the lazy-seq form that wraps the (apparently) recursive

Re: I don't understand this method

2010-08-28 Thread Stephen C. Gilardi
(use '[clojure.contrib.lazy-seqs :only (primes)]) (def ordinals-and-primes (map vector (iterate inc 1) primes)) map macro has this format: (map function collection) The map function takes a function and any number of collections:

Re: No (doc print-dup)?

2010-08-26 Thread Stephen C. Gilardi
On Aug 26, 2010, at 8:07 AM, Jacek Laskowski wrote: Hi, Right in the middle of Clojure and Rails - the Secret Sauce Behind FlightCaster [1] I came across print-dup function. I thought I'd find out a bit more about it using (doc print-dup) which eventually yielded: devmac:~ jacek$ clj

build.clojure.org update: clojure-contrib 1.2 repo path no longer includes -master

2010-05-06 Thread Stephen C. Gilardi
This change was made to some months ago, but some builds that followed the obsolete convention have been hanging around. I removed them today. On Apr 30, 2010, at 9:50 AM, Stuart Halloway wrote: There are plenty of recent SNAPSHOT builds:

Re: clojure 1.2 seq fn enhancement FAQ

2010-04-30 Thread Stephen C. Gilardi
On Apr 29, 2010, at 2:19 PM, MarkSwanson wrote: On Apr 29, 4:21 am, ataggart alex.tagg...@gmail.com wrote: I know it won't matter, but for posterity if nothing else... Functions named contains-key? and contains-val? would make a lot more sense to me than the current contains? and new

Re: Adding an option to clojure.main

2010-04-24 Thread Stephen C. Gilardi
On Apr 24, 2010, at 1:40 AM, Phil Hagelberg wrote: So it seems like recently the only thing I use AOT for is producing -main functions that can be easily run from the command-line. I've found that an alternate to this is to use clojure.main -e, require the necessary namespace, and then call

Re: Error whitch i don't understand

2010-04-18 Thread Stephen C. Gilardi
On Apr 18, 2010, at 9:21 AM, Yonov wrote: Hi, I am trying to implement memoize myself and have stucked on one place for a lot of time. This is the code: (defn mymemoize [func] (let [dict (ref (hash-map)) inner #((let [val (@dict %)] (if

Re: Interrupting the Repl

2010-04-18 Thread Stephen C. Gilardi
On Apr 16, 2010, at 2:06 AM, Brian Watkins wrote: Is there a way to interrupt the Repl when I've set to some kind of infinite loop without also shutting down the JVM entirely? Yes there is. clojure-contrib includes add-break-thread! to do just that. Here's an example: % java -cp

Re: I confused myself. How can I solve this simple problem?

2010-03-07 Thread Stephen C. Gilardi
On Mar 7, 2010, at 10:57 PM, CuppoJava wrote: Is there an elegant solution to this problem? I'm working around it by saving the original println in another variable before creating myprintln, but this isn't very clean. In case by another variable, you were referring to another var: One

Re: clojure.contrib.sql : how not to use a transaction ?

2010-03-06 Thread Stephen C. Gilardi
On Mar 5, 2010, at 5:43 AM, rdunklau wrote: So, is there any function which exposes the PreparedStatement.executeUpdate() method directly ? There is no such function currently. Is calling the Java method directly an undesirable option? --Steve -- You received this message because you are

Re: Milters?

2010-03-01 Thread Stephen C. Gilardi
Anyone doing milters in clojure? Are they reasonable to do on the JVM? Not a direct answer, but for a task where we considered milters and JAMES, we ended up being very happy with subethasmtp: http://code.google.com/p/subethasmtp/ --Steve -- You received this message because you are

Re: no source file

2010-02-25 Thread Stephen C. Gilardi
On Feb 25, 2010, at 8:21 PM, Glen Rubin wrote: whenever I try (load-file sqrs.clj) i get a no source file exception. Does (load-file sqrs.clj) work? --Steve -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Dutch Clojure users

2010-02-06 Thread Stephen C. Gilardi
On Feb 6, 2010, at 10:08 AM, Tommy wrote: I am unfamiliar with maps. How do I add myself to this map? Figuring that out has taken me a long time on at least two occasions... The key is you need to be signed in to make changes. - At the upper right of the page is sign in. Use that to sign

Re: require macro/function [was clojure.contrib.[duck-streams io]]

2010-02-03 Thread Stephen C. Gilardi
On Feb 2, 2010, at 8:40 PM, Stuart Halloway wrote: In teaching people Clojure, non-intuitive behavior with use/require is the #1 problem for beginners, by a mile. I believe we need both ordinary function and macro versions, and I am pretty sure that a well-considered patch implementing

Re: Count the number of times a function was applied

2010-01-31 Thread Stephen C. Gilardi
On Jan 31, 2010, at 8:35 AM, Gabi wrote: Is there any efficient way to get the number of times a given function was executed (in run time not during profiling)? Maybe with some clever use of its metadata ? Clojure function calls are low-level operations for efficiency. I'm not aware of any

Re: Question about seq

2010-01-15 Thread Stephen C. Gilardi
On Jan 15, 2010, at 3:26 AM, Sean Devlin wrote: user= (seq []) nil Why is nil returned, instead of an empty sequence? It's fundamental to Clojure's seq abstraction that every seq has a first. There is no such thing as an empty seq. If you call the seq function on an empty collection, it

Re: Question about seq

2010-01-15 Thread Stephen C. Gilardi
On Jan 15, 2010, at 4:01 AM, Stephen C. Gilardi wrote: On Jan 15, 2010, at 3:26 AM, Sean Devlin wrote: user= (seq []) nil Why is nil returned, instead of an empty sequence? There is no such thing as an empty seq. This was true at one time, but isn't true after the changes to Clojure

Re: Convert arabic to roman

2009-12-26 Thread Stephen C. Gilardi
On Dec 25, 2009, at 6:13 PM, Piotr 'Qertoip' WĹ‚odarek wrote: What is the most clear and idiomatic way to convert arabic numbers to roman notation? Though it may miss the true goal of the exercise, there's also this option: user= (clojure.contrib.pprint/cl-format nil ~...@r 3991)

Re: Add whitespace cleanup support

2009-12-20 Thread Stephen C. Gilardi
On Nov 8, 2009, at 6:03 PM, Phil Hagelberg wrote: (add-hook 'clojure-mode-hook (lambda () (set (make-local-variable 'before-save-hook) 'delete-trailing-whitespace)) One wrinkle here is that in Clojure , is whitespace. It would be nice not to strip out trailing commas within doc strings.

Re: Transient Bug

2009-12-20 Thread Stephen C. Gilardi
On Dec 19, 2009, at 7:50 PM, Chouser wrote: I've updated http://clojure.org/transients to reflect vectors and hash-map support of 'transient' in 1.1.0 Hash-sets appear to work in 1.1.0 as well. --Steve -- You received this message because you are subscribed to the Google Groups Clojure

Re: Transient Bug

2009-12-19 Thread Stephen C. Gilardi
I was experimenting with transients, and they don't seem to work for sorted collections: user= (transient (sorted-map 1 2 3 4)) java.lang.ClassCastException: clojure.lang.PersistentTreeMap cannot be cast to clojure.lang.IEditableCollection (NO_SOURCE_FILE:0) user= (transient (sorted-set

Re: let-binding overrides binding-binding

2009-12-19 Thread Stephen C. Gilardi
On Dec 19, 2009, at 5:23 PM, Stefan Kamphausen wrote: 1. Is my explanation correct? It is. The binding form operates on the var, it doesn't affect name resolution within the binding form's body. *val* within the body of the binding still resolves to the let-bound local. While *val* is

Re: Clojure Console Progress Bar

2009-12-15 Thread Stephen C. Gilardi
I have following script to show the progress status in Console. But I am having an issue where print only prints final string (after 100 times loop finished) not those in between thread sleeps but println prints out all in between. I am pretty new to Clojure ( Lisp for the matter) and have no

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: (1) Is there already a form that does this? Hi Stuart, I think the trick is resolving manually: user= @#'clojure.core/spread #core$spread__4510 clojure.core$spread__4...@bb273cc user= (@#'clojure.core/spread [:a :b

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: That's great. I wouldn't have expected it to work. Do you think this is by design or coincidental/subject to change? The expression I gave was: @#'clojure.core/spread equivalent to: (deref (var clojure.core/spread)) I

Re: how 'bout a debug-repl?

2009-12-11 Thread Stephen C. Gilardi
On Dec 11, 2009, at 5:08 AM, Laurent PETIT wrote: But then, we could even go one level deeper: not only provide a particular instance that would allow to quit the REPL, but a set of instances. And if the returned value of the call to the REPL returns one of the instances in the set, then

Re: Fine-grained locals clearing

2009-12-10 Thread Stephen C. Gilardi
On Dec 10, 2009, at 9:10 AM, Rich Hickey wrote: I'm happy to announce I have implemented this fine-grained locals clearing in the compiler, in the 'new' branch. It should automatically cover all cases in which the code doesn't explicitly reuse the head - including non-tail usage,

Re: Pull request for clojure.contrib.sql?

2009-12-10 Thread Stephen C. Gilardi
On Dec 10, 2009, at 7:18 PM, Graham Fawcett wrote: Thank you! I'm already a registered Clojure contributor. Tomorrow I'll prepare a ticket and attach the patch. Excellent! If you'd rather discuss it first on or off-list, let me know I'll hold off on the ticket. Please do put in a ticket

Re: Main class not found when starting clojure: java -cp clojure.jar clojure.lang.Repl

2009-12-10 Thread Stephen C. Gilardi
On Dec 9, 2009, at 3:54 PM, HerbM wrote: As I was preparing the post a message requesting help for an error (see below) generated when I entered the quick start suggest, I realized that suggestion is generic, and not technically accurate. java -cp clojure.jar clojure.lang.Repl Many

Re: create java class instance from type selected at runtime

2009-12-05 Thread Stephen C. Gilardi
On Dec 5, 2009, at 2:48 PM, Christopher Wicklein wrote: Greetings! Hello! I'd like to create an instance of a Java class like this: let [foo (Bar.)] but, I'd like the type specified by Bar to not be static, e.g. something like this: let [foo (:type params).] but, I can't seem

Re: Generalizing - -

2009-12-03 Thread Stephen C. Gilardi
On Dec 3, 2009, at 10:31 AM, Roman Roelofsen wrote: Are there any plans to add -$ to core or contrib? The rules on contrib are that the work must be original to the author. Even with Andrew's disclaimer that it be considered public domain, he would still need a contributor agreement in place

Re: arithmetic change between 1.0.0 and 1.1. 0

2009-11-24 Thread Stephen C. Gilardi
On Nov 16, 2009, at 5:56 AM, prhlava wrote: No big deal, the fix is simple - this is heads up if more people find their code broke with over-flow to infinity with the new version of clojure. It looks that float type propagates into arithmetics (and it did not before) - better explanation

Re: Better documentation and error messages are needed for the ns macro

2009-11-11 Thread Stephen C. Gilardi
On Nov 10, 2009, at 9:08 PM, John Harrop wrote: (ns foo.bar.baz (:use [clojure.contrib.core :only (seqable?)])) (and thus violates the usual clojure rule of using vectors rather than lists for groupings that are not invocations -- that is, function calls, macro calls, or special form

Re: immutable defs?

2009-10-07 Thread Stephen C. Gilardi
On Oct 7, 2009, at 5:19 AM, Meikel Brandmeyer wrote: Or is setting the validator calling it on the already set value? Yes, the validation mechanism calls the validator on the already set value. --Steve smime.p7s Description: S/MIME cryptographic signature

Re: immutable defs?

2009-10-07 Thread Stephen C. Gilardi
On Oct 7, 2009, at 12:47 AM, Mark Tomko wrote: This is pretty much what I'd had in mind. Thanks for the comments and suggestions all. I don't see how the text of the Exception is set by the macro, but it'd be really spectacular if the message were more clear. Is that message coming from

Re: immutable defs?

2009-10-06 Thread Stephen C. Gilardi
On Oct 2, 2009, at 10:29 AM, Mark wrote: Is there a way to make a declaration in Clojure that cannot be rebound later? Ideally, I'd like something that fails if I try to do this: (def myname mark) ; ...more code, elided... (def myname Mark) Along these lines, I was thinking of adding

Re: refs implement IFn, atoms and agents do not?

2009-10-04 Thread Stephen C. Gilardi
On Oct 3, 2009, at 1:50 PM, Stuart Halloway wrote: Is there a principled reason for this? I have written some code that (unintentionally) limits itself to refs because it assumes that all reference types can sit in function position. This discussion:

Re: refs implement IFn, atoms and agents do not?

2009-10-04 Thread Stephen C. Gilardi
On Oct 4, 2009, at 5:04 PM, Mark Volkmann wrote: Minor technicality ... Vars are a reference type, but deref and @ don't work with them. I'm guessing you're thinking of an interaction like this: user= (def a 3) #'user/a user= @a java.lang.ClassCastException:

Re: minor grievance with arithmetic on characters

2009-09-11 Thread Stephen C. Gilardi
On Sep 11, 2009, at 10:58 AM, Lauri Pesonen wrote: 2009/9/11 Rich Hickey richhic...@gmail.com: We should fix the doc. Patch welcome for this. Ticket #189 - I've provided a patch following Stephen's suggested doc string. Thanks very much! --Steve smime.p7s Description: S/MIME

Re: minor grievance with arithmetic on characters

2009-09-08 Thread Stephen C. Gilardi
On Sep 8, 2009, at 2:14 AM, Timothy Pratley wrote: According to the docstring compare returns -1, 0 or 1: user= (compare \b \g) -5 We could fix the doc along the lines of: Comparator. Returns a negative number, zero, or a positive number when x is logically 'less than', 'equal to', or

Re: Connection pool with clojure.contrib.sql

2009-08-27 Thread Stephen C. Gilardi
On Aug 27, 2009, at 12:37 AM, ngocdaothanh wrote: As I understand clojure.contrib.sql's with-connection opens DB connection at the beginning and closes it at the end of each call. That's correct. How do I create a connection pool so that with-connection can reuse connections?

Re: How to generate a hash map from a list

2009-08-24 Thread Stephen C. Gilardi
On Aug 23, 2009, at 8:21 PM, Stan Dyck wrote: I'm still new to this so bear with me. Welcome. I'm trying to apply a function to a seq-able thing to produce a hashmap. So for instance say the function is (inc 3). I'd like to write a function that does [1 2 3] -- {1 4, 2 5, 3 6} Can

Re: Continuous Integration Builds for Clojure are Back!

2009-08-19 Thread Stephen C. Gilardi
On Aug 19, 2009, at 12:43 PM, Howard Lewis Ship wrote: [java] java.lang.Exception: Name conflict, can't def assoc! because namespace: clojure.contrib.repl-ln refers to:#'clojure.core/assoc! (repl_ln.clj:71) The current (HEAD) version of clojure.contrib/repl_ln.clj no longer defines

Re: Augmenting the defn attr-map

2009-08-16 Thread Stephen C. Gilardi
On Aug 13, 2009, at 4:52 PM, Chas Emerick wrote: I've actually been using it at the REPL here and there, and I've found it pretty pleasant -- it's a very pretty way to hint args compared to #^, and arg:Type ordering makes for easy readability (e.g. you can very easily scan an arg form and see

Re: Augmenting the defn attr-map

2009-08-16 Thread Stephen C. Gilardi
On Aug 16, 2009, at 7:38 PM, Chas Emerick wrote: On Aug 16, 2009, at 6:29 PM, Stephen C. Gilardi wrote: Very cool! I like this a lot. Would you be up for writing some doc strings and including it in clojure.contrib.def? Yeah, I could do that. I don't actually think it's practical on its

Re: Augmenting the defn attr-map

2009-08-16 Thread Stephen C. Gilardi
On Aug 16, 2009, at 11:56 PM, tsuraan wrote: (defh a [b:String [c:Double :as list:java.util.List] {d:java.util.Random :d}] (.toCharArray b) (.size list) (.floatValue c) (.nextInt d)) What's that :as in the [ c:Double :as list:java.util.List ] vector? The entire expression you

Re: Parsing XML containing UTF8 with clojure.xml/parse

2009-08-12 Thread Stephen C. Gilardi
I have to parse some XML files with c.x/parse. However the files contain UTF-8 characters, which end up as '?' after being parsed by c.x/parse. Is there some possibility to correctly parse the files? I suspect there is some settings somewhere in my Clojure/JVM/System which makes the whole thing

Re: Very minor problem in the REPL

2009-07-17 Thread Stephen C. Gilardi
On Jul 17, 2009, at 9:05 AM, AlamedaMike wrote: As I say, technically very trivial, but it violates the principal of least surprise (for me). I bring it up only because of reasons of broader acceptance by the business community. I know how some of them think, and even trivial stuff like this

Re: turn off scientific notation?

2009-07-16 Thread Stephen C. Gilardi
On Jul 16, 2009, at 10:13 AM, flodel wrote: I have a Clojure script that reads numbers in a normal format like 0.012, but after processing, returns in a scientific format, for example, 8.03E-6 Is there a way to turn this scientific notation off? Numbers are stored internally in a binary

Re: turn off scientific notation?

2009-07-16 Thread Stephen C. Gilardi
On Jul 16, 2009, at 11:50 AM, Laurent PETIT wrote: what do you mean ? For what I know, the output streams have nothing to do with formatting ? You're right, Laurent, thanks for the correction. REPL output is printed using prn which (for Doubles) ultimately calls .toString on the Double

Re: Compilation troubles...

2009-07-13 Thread Stephen C. Gilardi
On Jul 12, 2009, at 4:41 PM, Morgan Allen wrote: Fair enough. However, what I had in mind was that I could simply compile one namespace that would then act as a sort of 'bootstrap loader' for other clojure source, so that I wouldn't have to recompile manually all the time. Rayne's

Re: Bug? (keyword ...)

2009-07-13 Thread Stephen C. Gilardi
On Jul 13, 2009, at 9:56 AM, jon wrote: It would seem cleaner if the java Keyword.intern() and Symbol.intern() methods were symmetrical and used the same way in core.clj. It looks unintended to me. Rich, I can provide a patch if a ticket and patch are welcome. --Steve smime.p7s

Re: Compilation troubles...

2009-07-13 Thread Stephen C. Gilardi
On Jul 13, 2009, at 11:45 AM, Morgan Allen wrote: The speed difference isn't the main thing- but I *was* under the impression that the only way for java to communicate with clojure was using AOT class compilation. OK, cool. That is another benefit of AOT compilation. The primary use for

Re: Why this macro fails??

2009-07-13 Thread Stephen C. Gilardi
On Jul 13, 2009, at 10:26 PM, sailormoo...@gmail.com wrote: user= (try (Integer/parseInt x) (catch Exception _ 0)) 0 user= (defmacro parse-int [a default] `(try (Integer/parseInt ~a) (catch Except ion _ ~default))) #'user/parse-int user= (parse-int x 0) java.lang.Exception: Can't bind

Re: Compilation troubles...

2009-07-12 Thread Stephen C. Gilardi
On Jul 12, 2009, at 7:28 AM, Morgan Allen wrote: Thanks for the info- it works just fine now. A couple of questions, though: 1- How would I change the 'classes' directory to something else? There are at least two ways: You can specify it as a property on the command line you use to

Re: Compilation troubles...

2009-07-11 Thread Stephen C. Gilardi
On Jul 11, 2009, at 9:12 AM, alfred.morgan.al...@gmail.com wrote: java -cp clojure.jar clojure.main Followed by: (compile 'sov.sim.character) The directory containing sov/sim/ and the compilation destination (which defaults to classes) must also be in classpath. In your test, classpath

Re: clojure.contrib.sql - docallable method

2009-07-10 Thread Stephen C. Gilardi
On Jul 10, 2009, at 9:22 AM, markgunnels wrote: I wanted to recommend the following method be added to clojure.contrib.sql (stolen directly from do-prepared). I have used it successfully with Oracle stored procedure calls. Please let me know if I'm not posting to the right place or in the

Re: clojure.contrib.sql - docallable method

2009-07-10 Thread Stephen C. Gilardi
On Jul 10, 2009, at 11:05 AM, markgunnels wrote: That name sounds much better than mine and sorry for breaking process. The code was definitely a trivial modification of code you wrote. In all the fuss over procedure, I see I forgot to thank you for your request and your report of success

Re: Homoiconicity and printing functions

2009-07-08 Thread Stephen C. Gilardi
On Jul 8, 2009, at 9:11 AM, Mike wrote: What I'm missing is why I can't print a function. I understand that most of the functions I write use quite a few macros, and after expansion into the core forms it looks shredded...but isn't there any way for me to see a representation of this source

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread Stephen C. Gilardi
On Jul 7, 2009, at 5:51 AM, John Harrop wrote: Somehow, code that is treated as valid when compiled a function at a time is treated as invalid when compiled all at once. That pretty much proves it's an implementation bug, since the same code can't both be buggy and be fine at the same

Re: Calling static methods on a variable holding a class

2009-07-07 Thread Stephen C. Gilardi
On Jul 7, 2009, at 3:29 PM, Stuart Sierra wrote: If you really don't know what the class is (for example, you get a Class object returned by some library function) then you can use the Java Reflection API to call the static method. See http://java.sun.com/docs/books/tutorial/reflect/ If you

Re: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-06 Thread Stephen C. Gilardi
On Jul 6, 2009, at 3:13 PM, Tom Emerson wrote: Thanks Paul, for the quick response. On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelbergp...@hagelb.org wrote: That's right. Side note to folks with commit access: it would be a good idea to check in a note to the deprecated repositories telling

Re: Mysterious ClassFormatError after simple code change.

2009-07-05 Thread Stephen C. Gilardi
On Jul 5, 2009, at 2:01 AM, John Harrop wrote: and got: #CompilerException java.lang.ClassFormatError: Unknown constant tag 32 in class file com/mycompany/myfile$eval__14598 (NO_SOURCE_FILE:0) Are there large literals elsewhere in the same namespace? Here's some info from a previous

Re: sanity check needed

2009-07-05 Thread Stephen C. Gilardi
On Jul 5, 2009, at 8:12 PM, Mark Volkmann wrote: I'd appreciate it if someone could look it over and let me know if I've done anything that isn't very idiomatic. A few recommendations just at the look and feel level: - use doc strings for functions in place of comments - global delete of

Re: Return value of load

2009-07-04 Thread Stephen C. Gilardi
On Jul 4, 2009, at 4:02 AM, Meikel Brandmeyer wrote: Is there some specific reason for that or could load be adapted to also return the last value evaluated? I experimented with this, got it to work for a simple case, and prepared my initial reply below. In working with the idea some more

Re: *command-line-args*

2009-07-02 Thread Stephen C. Gilardi
On Jul 2, 2009, at 2:00 PM, Mark Volkmann wrote: I run it with clj demo.clj foo bar baz and get this output: clojure.lang.ArraySeq 2 I get the same output with clj demo.clj -- foo bar baz. Why doesn't it output 3? That depends on your definition of clj. Here's what I get without using a

Re: unexpected return value

2009-07-02 Thread Stephen C. Gilardi
On Jul 2, 2009, at 1:48 PM, Mark Volkmann wrote: (defn match [prev-char next-char] (cond = prev-char \( (= next-char \)) \[ (= next-char \]) true false)) It looks like you intended condp here instead of cond. Your test works as expected if you make that change. However, there's

Re: send versus send-off

2009-06-30 Thread Stephen C. Gilardi
On Jun 30, 2009, at 5:30 PM, Kai wrote: From scheduling I know that there are CPU-bound and IO-bound processes. Perhaps send-off tends to hold off on yielding for longer durations since it expects frequent interrupts. If this is the case, I think it would be useful to elaborate on that in the

Re: Would *default-precision* make sense?

2009-06-29 Thread Stephen C. Gilardi
On Jun 29, 2009, at 10:11 AM, Nicolas Oury wrote: I am not sure, but I believe it's due to *warn-on-reflection* being bound by the compiler/REPL before evaluating (set! *warn-on- reflection* true). When I looked, the REPL was called within a macro 'with-bindings repl' that expands to

Re: ClassCastException - maybe a bug

2009-06-28 Thread Stephen C. Gilardi
On Jun 28, 2009, at 11:48 AM, Handkea fumosa wrote: On Jun 28, 11:27 am, Rich Hickey richhic...@gmail.com wrote: Deducing it doesn't contain 5 because it was passed a key incomparable to some other key seems like a stretch to me, and bug-hiding. Clojure is relatively free of exception

Re: How to shorten clojure.lang.* classes

2009-06-28 Thread Stephen C. Gilardi
On Jun 28, 2009, at 3:03 PM, samppi wrote: I use Clojure's classes a lot in my multimethods. Is there any way to abbreviate them; that is, is there a method to refer to clojure.lang.APersistentList as APersistentList? I've tried (use 'clojure.lang) and (require ['clojure.lang :as 'c]), but

Re: Bug: (list? (cons 4 '(1 2 3))) returns false!

2009-06-27 Thread Stephen C. Gilardi
On Jun 28, 2009, at 12:07 AM, Handkea fumosa wrote: user= (list? '(1 2 3)) true user= (list? (cons 4 '(1 2 3))) false user= (doc cons) - clojure.core/cons ([x seq]) Returns a new seq where x is the first element and seq is the rest. nil user=

Re: Small question: inserting something at the beginning of a vector

2009-06-26 Thread Stephen C. Gilardi
On Jun 26, 2009, at 11:09 AM, samppi wrote: I'm considering changing rep+'s documentation to state that it will return a collection rather than a vector, and then just use cons without vec. You might also consider describing it as a seq. If you use cons, the object returned will be of type

Re: print without separating spaces?

2009-06-25 Thread Stephen C. Gilardi
On Jun 25, 2009, at 11:43 AM, CuppoJava wrote: Is there a print command that doesn't separate it's arguments using spaces? I wrote my own function to work-around this but hopefully it's already been done for me. (defn write [ strings] (print (apply str strings))) Hi Patrick, Clojure also

Re: Problem error message

2009-06-25 Thread Stephen C. Gilardi
On Jun 25, 2009, at 5:00 PM, Four of Seventeen wrote: Got this doing a load-file: #CompilerException java.lang.ClassFormatError: Unknown constant tag 116 in class file hxr/priv/idb$eval__10559 (NO_SOURCE_FILE:0) That error appears to be coming from a Java-level class loader (see the

Re: Are keywords and symbols garbage-collected?

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 11:31 AM, samppi wrote: Are keywords and symbols garbage-collected? If I generated a lot of keywords or symbols, put them into a collection, and then removed them, would they disappear and free up space? I'm wondering if they're similar to Ruby symbols, which are never

Re: (create-struct) without keys.

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 11:07 AM, Nicolas Oury wrote: I think it should be possible to write (create-struct) and have an empty structure definition returned. With (struct (create-struct)) more or less equivalent to creating an empty map. I agree that this would fit with the graceful underflow

Re: Are keywords and symbols garbage-collected?

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 1:30 PM, Four of Seventeen wrote: On Jun 24, 12:22 pm, Stephen C. Gilardi squee...@mac.com wrote: Symbol objects are subject to garbage collection, but the namespace and name strings that identify them are not. Those strings are interned via the intern method

Re: ns exports

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 5:52 PM, tsuraan wrote: Does clojure still have a concept of a namespace's exports? I'd like to be able to list, in my ns declaration, the publicly available functions that my module has, but I'm not seeing any way to do this. It looks like there used to be an export

Re: Small question: inserting something at the beginning of a vector

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 6:44 PM, arasoft wrote: This also works: (into [-1] [0 1 2 3 4]) but I am more than uncertain whether it is proper. Generally, the need to insert at the beginning of a vector should trigger some close scrutiny as to whether vector is the right data type to use in this

Re: Concatenating Regexes?

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 6:13 PM, CuppoJava wrote: Is there a nice way of doing this without having to go back to using Java's string syntax? I don't see a nice way to do it. You can use either (java.util.rexex.Pattern/compile my-str) or (with-in-str (str \# \ my-str \) (read)) to

Re: Question regarding example in Stuart Halloway's book (page 120)

2009-06-24 Thread Stephen C. Gilardi
On Jun 24, 2009, at 7:02 PM, arasoft wrote: Why does this work? (take-while (complement #{\a\e\i\o\u}) the-quick-brown-fox) When I do something similar, like (take-while (complement #(Character/isWhitespace %)) the-quick-brown- fox) I have to deal with the parameter explicitly (%). How is

Re: Was it decided to add these functions to core?

2009-06-23 Thread Stephen C. Gilardi
On Jun 23, 2009, at 2:07 PM, Chouser wrote: On Tue, Jun 23, 2009 at 1:09 PM, CuppoJavapatrickli_2...@hotmail.com wrote: (iterate inc 0) Just riffing here, but what if range took some kind of sentinel to indicate an infinite range? So instead of (iterate inc 0), you could say (range 0

  1   2   3   4   5   6   >