Re: Clojure in production

2013-06-13 Thread Stuart
We use Clojure across several APIs and for data analysis at SmartBIM in Atlanta, and we're hiring! Send me an email at stuart.hinson at the company's domain if you're local and interested On Thursday, June 13, 2013 5:07:07 PM UTC-4, Deepak Giridharagopal wrote: > > On Monday, June 10, 2013 3:47:

Re: DISCUSS: replace (rand)

2008-12-02 Thread Stuart Halloway
have to worry about in Clojure. Stuart > Looks like the only synchronization is for lazy initialization of the > instance of Random used by the static method: > > public final class Math { > >private static Random randomNumberGenerator; > >private

Re: DISCUSS: replace (rand)

2008-12-02 Thread Stuart Halloway
some spare time ... but secretly I was hoping that this thread would goad someone else into writing the tests and publishing their results. :-) Stuart > On Tue, Dec 2, 2008 at 3:05 PM, Stuart Halloway > <[EMAIL PROTECTED]> wrote: >> >> nextDouble calls next, which accordin

Re: DISCUSS: replace (rand)

2008-12-02 Thread Stuart Halloway
>>> (48 - bits)); >} > > On Dec 2, 8:05 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: >> nextDouble calls next, which according to Java 5 docs is: >> >> synchronized protected int next(int bits) { >> seed = (seed * 0x5DEECE66DL + 0xBL) &

Re: proposal: match multimethod

2008-12-02 Thread Stuart Halloway
t tests, where one might say something like (each-matches [actual-value expected-value]+) and have the match operator applied. Stuart > On Dec 1, 5:07 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: >> I am thinking about adding a match method to Clojure-contr

Re: eval in macro: No method for dispatch value

2008-12-02 Thread Stuart Halloway
Hi Michiel, eval is for form data, so I am more surprised that it works for ArrayList than that it fails for StringBuffer. Stu > After playing around with macros, I ran into this problem with Clojure > (the latest version from github). The following code throws an > IllegalArgumentException:

Re: change in doto behavior

2008-12-02 Thread Stuart Halloway
Yes. doto is more general now. The . is needed to indicate Java interop calls because doto can do other things which are not Java interop calls: (doto "double" println println) double double -> "double" Stuart > Can someone tell me whether this change was inten

doc patch: gensym default prefix is G__, not G

2008-12-03 Thread Stuart Halloway
gensym-docs-default-to-match-impl.diff Description: Binary data --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from thi

Re: Clojure podcast by Stuart Halloway

2008-12-03 Thread Stuart Halloway
A few other details: the podcast is free, and fairly short (23 minutes). Cheers, Stuart > I just noticed that there's a new Clojure podcast by Stuart Halloway > on the Pragmatic Programmers site: > > http://pragprog.com/podcasts/show/24 > > The blurb says: > >

Re: Bug: clojure.contrib.trace misses a #

2008-12-03 Thread Stuart Sierra
Fixed, thanks. -Stuart Sierra On Dec 3, 12:36 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > there is a missing # in the new trace code. Patch attached. > One could think, that clojure-contrib uses clojure-contrib: > there's defvar in clojure.contrib.d

Re: proposal: match multimethod

2008-12-03 Thread Stuart Sierra
ef629... And I haven't forgotten about that, just haven't had time to work on it. Anyone else who wants to tackle it is welcome. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure"

Re: Clojure template library

2008-12-03 Thread Stuart Sierra
>". That way your template can be a valid XML document. Yes, it's more verbose, but PHP does it. Or, if you want, allow user-definable delimiters. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

PATCH for clojure.contrib.javadoc: use any local/remote javadocs

2008-12-03 Thread Stuart Sierra
? In the process, I separated the web-browser functions into a separate lib, since those might be useful elsewhere. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

Re: (doc)strings after param in defn

2008-12-03 Thread Stuart Halloway
and foo then returned the result of the final expression 5. Many languages work this way. In Ruby: def foo "evaluted and lost" "return value" end Cheers, Stuart --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: Clojure template library

2008-12-04 Thread Stuart Sierra
ow, I've never been a big fan of functional languages and I laughed really hard when I realized ... that I had implemented a functional language. The nature of the problem simply dictated a particular solution." Thanks, Rich. -Stuart Sierra --~--~-~--~~~---~--

Re: Clojure Contrib's build.xml

2008-12-04 Thread Stuart Sierra
I just pushed a fix. -Stuart Sierra On Dec 4, 9:33 am, Randall R Schulz <[EMAIL PROTECTED]> wrote: > Hi, > > This morning after I "svn up" -ed Clojure Contrib, I could no longer > build. It turns out that was 'cause I was still using Ant 1.6.2. But I > looked

Re: PATCH for clojure.contrib.javadoc: use any local/remote javadocs

2008-12-04 Thread Stuart Sierra
Yes, I realized what that reflector code was for after I sent the message. Thanks, -Stuart On Dec 4, 3:45 am, "Christophe Grand" <[EMAIL PROTECTED]> wrote: > Hi Stuart, > > That's very neat! Thanks! I'll apply your patch but I don't want to require >

Re: Running out of memory when using filter?

2008-12-04 Thread Stuart Sierra
On Dec 4, 6:20 pm, Paul Mooser <[EMAIL PROTECTED]> wrote: > However, I'm running out of heap space using the following function to > filter my sequences: ... > I know that filter is lazy, and I see that the documentation of lazy- > cons says that lazy-conses are cached. Cached for what duration ?

Re: PATCH: Fix in-case macro from clojure.contrib fcase library

2008-12-05 Thread Stuart Sierra
Fixed. Thanks, -Stuart Sierra On Dec 5, 12:39 am, "Tchavdar Roussanov" <[EMAIL PROTECTED]> wrote: > The attached patch fixes the compile error when in-case macro is used in > different name space. The expanded code contains a private function from > clojure

Re: Elegant but very slow

2008-12-05 Thread Stuart Sierra
classes in the Java example, I don't think it will ever be possible to write a competitive implementation in pure Clojure. However, the advantage of having Java as a host language is that you can use it for low-level operations like this. -Stuart Sierra --~--~-~--~~

Re: Atoms

2008-12-05 Thread Stuart Sierra
On Dec 4, 8:02 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > I've added a new reference type - atom. I like it; it greatly simplifies a common use for Refs. "Clojure. Sometimes you just need to mutate." "Clojure. Mu

Re: Atoms

2008-12-05 Thread Stuart Sierra
quot; programming using the different transaction models. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe

Re: Mutual definitions (exercise 2.8.6 in Kent Dybvigs book TSPL)

2008-12-05 Thread Stuart Sierra
On Dec 5, 11:17 am, Randall R Schulz <[EMAIL PROTECTED]> wrote: > You can (def is-even?) before your (defn is-odd? ...), which will allow > it to compile. The recently-added "declare" is for just this purpose: (declare is-

Re: Running out of memory when using filter?

2008-12-05 Thread Stuart Sierra
doc-seq] (filter my-filter doc-seq)) Does it still blow up? -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To

Re: Running clojure-contrib.jar

2008-12-06 Thread Stuart Halloway
If you have a space between "jar" and ";" that is a problem. Stuart >> Start by telling us precisely what you did to "run clojure." > > I have the below in my batch file > SET CLASSPATH=/clojure/clojure/clojure.jar ;\ > /clojure/clojure/clojure-c

Re: Clojure Blogs | Yahoo Pipes | Clojure Pipe

2008-12-07 Thread Stuart Halloway
Hi Bill, Cool idea. All my posts are tagged "clojure" on our blog, if that helps: http://blog.thinkrelevance.com/tags/clojure > Hi all, > > A lot of people are writing Clojure-related blog posts; however, I am > often only interested in the Clojure posts they do and not the other > posts. There

Re: A newbie question on Agents and ants

2008-12-07 Thread Stuart Halloway
Hi Matt, Clojure dynamically binds *agent* to the currently active agent on a thread. Stuart > Hi all, >I have a newbie question about Agents. I've been looking at the > ants.clj file: > http://clojure.googlegroups.com/web/a

clojure.contrib.test-is: first major rewrite

2008-12-07 Thread Stuart Sierra
lar expressions and "thrown- with-msg?" 2. Nested test contexts, as in RSpec and some other testing frameworks. 3. Adding test metadata to vars that are already defined elsewhere. Peace, joy, and happy testing. -Stuart Sierra --~--~-~--~~~---~--~~ You

Re: clojure.contrib.test-is: first major rewrite

2008-12-07 Thread Stuart Sierra
On Dec 7, 2:51 pm, Allen Rohner <[EMAIL PROTECTED]> wrote: > One other feature idea: I'd like the ability to run individual tests. > Once I've discovered a unit test failure, I want to be able to run the > test by itself without the noise from other tests. You can do that now with test-var, which

Re: clojure.contrib.test-is: first major rewrite

2008-12-07 Thread Stuart Sierra
On Dec 7, 2:49 pm, Allen Rohner <[EMAIL PROTECTED]> wrote: > An acceptable alternative would be to have a way to run all the tests > in a namespace and all 'children' of a namespace. Then I could create > a namespace like "test.functional.db.foo" "test.functional.db.bar" and > then say "(run-tests

_Programming Clojure_ sample code on github, with unit tests

2008-12-08 Thread Stuart Halloway
Hi all, I have placed the sample code for _Programming Clojure_ on github, at http://github.com/stuarthalloway/programming-clojure . Most of the code samples now have unit tests, using Stuart Sierra's test-is. If you see an erratum in the book that you suspect was caused by chang

Re: Running clojure-contrib.jar

2008-12-08 Thread Stuart Halloway
most recent is Beta 3. Regards, Stuart > > Hi All, > > It is working now. I found that I followed the instruction provided by > the author blindly, it was not meant for the windows box(vista) I am > using. The problem is on path separation, the book used forward slash > inst

Re: Is it possible to tell programatically if I'm in a transactional context?

2008-12-08 Thread Stuart Halloway
Hi Dave, It looks like LockingTransaction.getRunning would need to be made public. What do you plan to do with it? As a workaround: (defn in-tx? [] (try (ensure (ref true)) (catch IllegalStateException e false))) Stuart > > I gave a small talk on Clojure this afternoon to my tea

Re: clojure.contrib.test-is: first major rewrite

2008-12-08 Thread Stuart Sierra
you don't. :) Just use "is" for now. I'll consider making (is (and ...)) a recognized form, though. I'm not certain about "are" yet, but I figured I had to offer at least a little sugar. Maybe what it really needs is template-style argument, l

Re: clojure.contrib.test-is: first major rewrite

2008-12-08 Thread Stuart Sierra
On Dec 8, 3:53 pm, "J. McConnell" <[EMAIL PROTECTED]> wrote: > Great! Will the planned thrown-with-msg? support regex matching? I > used something like that in clojure.contrib.test-clojure.evaluation, > which was pretty handy. Yes, that's where I

Re: clojure.contrib.test-is: first major rewrite

2008-12-09 Thread Stuart Sierra
. It's going to change, either by specifying the number of arguments, as Frantisek suggested, or with a template expression. For now, I recommend just using "is". -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subsc

PCL -> Clojure examples updated

2008-12-09 Thread Stuart Halloway
Over the last few weeks I have updated the examples in the Practical Common Lisp -> Clojure blog series [1]. They should be up-to-date with the changes to binding forms in Clojure, plus a few errata fixes. Enjoy, and let me know if you find errors. Cheers, Stu [1] http://blog.thinkrelevance

recur vs. lazy: establishing guidelines

2008-12-09 Thread Stuart Halloway
whole story. What are the counterarguments in favor of non-lazy butlast? Cheers, Stuart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojur

A generic tree walker - clojure.contrib.walk

2008-12-09 Thread Stuart Sierra
Hi folks, I just committed a new contrib lib, an experimental tree walker for Clojure. I'm hoping it will make it easier to write macros that need to do transformations arbitrary code structures. -Stuart Sierra - clojure.contrib.walk/walk ([f form]) Performs a

Re: recur vs. lazy: establishing guidelines

2008-12-09 Thread Stuart Sierra
On Dec 9, 1:18 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Here is where I am: If your function creates/returns only atoms or   > fixed size collections, loop/recur is fine. If it might return (or   > internally create) variable/huge/infinite collections, use lazy-*. I a

patch: idiot proof error message when compiling to the wrong place

2008-12-09 Thread Stuart Halloway
Provides an error message like: (compile 'com.thinkrelevance.Hello) -> java.lang.RuntimeException: Unable to write to /some/bad/loc/ classes/com/thinkrelevance/Hello.class (Hello.clj:1) I used a RuntimeException because the constructor for IOException did not take a "cause" argument. Cheers,

why can't I set! stuff in user.clj?

2008-12-09 Thread Stuart Halloway
g.RuntimeException: java.lang.IllegalStateException: Can't change/establish root binding of: *print-length* with set Thanks, Stuart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: why can't I set! stuff in user.clj?

2008-12-10 Thread Stuart Halloway
Hi Steve, Thanks for the info. Is this limitation of user.clj arbitrary, or motivated by some concern that the average Clojure user should know about? Is the a reason not to load the bindings first? Does user.clj (in current form) do more harm than good? Stuart > user.clj is loa

Re: In core structure editor, anyone?

2008-12-10 Thread Stuart Sierra
//www.emacswiki.org/cgi- bin/wiki/ParEdit> is a powerful combination. Paredit is like a structured editor for Lisp expressions. There's a patch to handle Clojure data structures: <http://github.com/jochu/clojure-mode/tree/ master/clojure-paredit.el> -Stuart Sierra --~--~-~--~-

Re: why can't I set! stuff in user.clj?

2008-12-11 Thread Stuart Halloway
+1. I would love to see a one-file story. Stu > On Dec 10, 2008, at 1:50 PM, Stephen C. Gilardi wrote: > >> - I think init.clj and repl-init.clj would be good additions to >> what we have now. I'll be happy to write the code if it's welcome. > > Alternatively, we could make those hooks be func

Re: In core structure editor, anyone?

2008-12-11 Thread Stuart Sierra
ee an editor that goes all the way and abandons text sources altogether. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

Re: frequency of each unique item in collection

2008-12-11 Thread Stuart Sierra
think what you want is: (defn frequencies [coll] (reduce (fn [counts x] (assoc counts x (if-let [c (counts x)] (inc c) 1))) {} coll)) user=> (frequencies [:a :a :b :a :b]) {:b 2, :a 3} -Stuart Sierra --~--~-~--~~~---

Re: frequency of each unique item in collection

2008-12-11 Thread Stuart Sierra
I've added a slightly modified version to clojure.contrib.seq-utils: (defn frequencies "Returns a map from distinct items in coll to the number of times they appear." [coll] (reduce (fn [counts x] (assoc counts x (inc (get counts x 0 {} coll))

Re: Lisp/Clojure doesn't have syntax?

2008-12-11 Thread Stuart Halloway
Randall, Well said, and I need to find a place to make this explanation in the book prior to chapter 7. :-) Stuart > On Thursday 11 December 2008 13:37, Paul Barry wrote: >> I've been reading the latest chapter from Stuart's book, Chapter 7: >> Macros, an

Re: Purpose of memfn?

2008-12-11 Thread Stuart Halloway
I like the second form better, and may remove memfn from the book entirely. Stuart > On Programming Clojure I read: > >> The method-as-function idiom is a common one, so Clojure provides >> the memfn macro to wrap methods for you: > > (map (memfn toUpperCase) ["a&

Re: Misplaced doc strings in clojure.contrib.seq-utils

2008-12-12 Thread Stuart Sierra
Thanks, Perry. It's fixed now (SVN 292). -Stuart Sierra On Dec 8, 11:02 am, Perry Trolard wrote: > In clojure.contrib.seq-utils, partition-by & group-by have docstrings > following their arglists, so (doc parition-by) prints > > - > clojure.con

Safe to delete namespace dirs in clojure-contrib?

2008-12-12 Thread Stuart Sierra
ntrib directories, or can we safely delete them? -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from t

Re: Why allow both ({:map 'example} :map) and (:map {:map 'example})?

2008-12-12 Thread Stuart Sierra
On Dec 11, 3:29 pm, "Aaron Cohen" wrote: > Isn't it just asking for confusion? It's useful to have it both ways: (map :one-key bunch-of-maps) (map one-map bunch-of-keys) -Stuart Sierra --~--~-~--~~~---~--~~ You received this message bec

Re: Safe to delete namespace dirs in clojure-contrib?

2008-12-13 Thread Stuart Sierra
On Dec 12, 2008, at 3:24 PM, Stuart Sierra wrote: > It's been a month since Clojure rev. 1094 introduced the namespace-is- > file change.  Are people still using releases that require the old > contrib directories, or can we safely delete them? They're gone now as of SVN

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

2008-12-15 Thread Stuart Sierra
mplement coll?) (tree-seq coll? seq x))) Should maps be flattened in addition to "sequential things"? But still (flatten2 nil) => (nil) In general, you get weird results if the thing passed to flatten is not a vector or a list: (flatten "hello") => (&quo

Re: Clojure classes graph (was chart.png)

2008-12-15 Thread Stuart Sierra
Cool, thanks! -S On Dec 14, 4:47 pm, Chouser wrote: > I've updated the Clojure classes graph (thanks for the push, R. > Schulz!)  The new version includes the newest classes as well as Java > interfaces that are applicable.  These latter are shown inside > diamonds. > > A couple different .svg a

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

2008-12-15 Thread Stuart Sierra
I expect it to do the same, especially because: (seq []) => nil (flatten []) => nil (seq nil) => nil In the case of flatten, I think this is rarely going to make any difference, but I'll patch it. -Stuart Sierra --~--~-~--~~~---~--~~ You received this me

Re: calling use with a seq of strings

2008-12-15 Thread Stuart Sierra
You can do this: (apply use (map symbol (list "clojure.contrib.str-utils" "clojure.contrib.duck-streams"))) -Stuart Sierra On Dec 15, 3:51 pm, "Brian Doyle" wrote: > I have a seq of strings that are namespaces like, > ("clojure.contrib.str-utils",

walkers, templates, and another stab at condp

2008-12-15 Thread Stuart Sierra
ib.condp (SVN rev. 304) for source & more comments. Hope something here is useful, or at least interesting. I'm going to use this to redefine "are" in clojure.contrib.test-is. Later, -Stuart Sierra --~--~-~--~~~---~--~~ You received this message becau

Re: Common Lisp's symbol-name in Clojure?

2008-12-15 Thread Stuart Sierra
Yep, it is: (name symbol) -Stuart Sierra On Dec 15, 5:34 pm, Paul Reiners wrote: > Is there anything in Clojure that is equivalent to Common Lisp's > symbol-name function? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: template.clj (r306) in clojure.contrib won't compile

2008-12-16 Thread Stuart Sierra
Thanks for the report, walterc. Fixed now -- I'd accidentally deleted a big chunk of the macro. -Stuart Sierra On Dec 16, 1:18 am, walterc wrote: > the template function is missing parameter binding part of a let --~--~-~--~~~---~--~~ You received this

Re: test-is uncaught exception behavior

2008-12-16 Thread Stuart Sierra
Fixed now (rev. 311), thanks for the report. -Stuart Sierra On Dec 16, 12:42 am, Allen Rohner wrote: > In recent versions of test-is, it appears that exceptions are only > caught inside of the 'is' macro, as opposed to during the whole test > run. This is a problem when r

Re: Listen on changes to refs

2008-12-16 Thread Stuart Sierra
oms in addition to agents. Then you can use all the regular ref functions instead of "alter-cell". -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

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

2008-12-16 Thread Stuart Sierra
Thanks, Lennart. That works, although it took me a few minutes to figure out why. (For the record, tree-seq returns a copy of its argument as the first item in the sequence.) This also means that (flatten "string") ;=> (\s \t \r \i \n \g) I've put in a patch. -Stu

Re: ClassName. Constructor Notation in Macros?

2008-12-16 Thread Stuart Halloway
Hi Randall, The syntactic sugar forms are reader behavior, and occur too soon: at read time, not macro expansion time. Macros need to expand to real forms, not reader shortcuts. Stuart > Hi, > > A couple of days ago I was having a lot of trouble getting the > (ClassName. ctor-a

Re: ClassName. Constructor Notation in Macros?

2008-12-16 Thread Stuart Halloway
time. Is that right? Stuart > On Dec 16, 2:32 pm, Stuart Halloway wrote: >> Hi Randall, >> >> The syntactic sugar forms are reader behavior, and occur too soon: at >> read time, not macro expansion time. >> > > Actually, the dot sugar is not reade

reload library, blowing away old public symbols

2008-12-16 Thread Stuart Halloway
x27;~ns))) Use case: Writing tests with Fact [1]. Tests are named with gensyms, and I want to reload a set of tests without continuing to run outdated versions of the tests. Does this already exist? It not, is it useful enough to deserve a home somewhere? Cheers, Stuart [1] http://groups.goog

Re: reload library, blowing away old public symbols

2008-12-16 Thread Stuart Sierra
I would find this useful; I've even tried writing it in the past. Perhaps it could go in clojure.contrib.ns-utils. A thought -- would it be more thorough to use "remove-ns"? -the other Stuart (Sierra) On Dec 16, 4:32 pm, Stuart Halloway wrote: > Hi all, > > I some

Re: ClassName. Constructor Notation in Macros?

2008-12-17 Thread Stuart Halloway
Something flakey there. I clicked the star several times and nothing happened. I then checked in Firebug that the star is backed by JavaScript, and when I tried it again it worked. Odd. Randall, let me know if you need anything else upvoted. :-) Stuart > On Wednesday 17 December 2008 06

Re: FAQ

2008-12-17 Thread Stuart Sierra
ariable number of arguments? Answer: The variable arguments are actually just an array: (.method object fixed-args... (into-array type variable-args...)) -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &qu

Re: Recursive traversal of an object

2008-12-17 Thread Stuart Sierra
, Enumerables, or some weird collection that doesn't implement java.util.Collection, then all bets are off. For code related to traversing a structure, look at clojure.core/tree- seq and clojure.contrib.walk. -Stuart Sierra On Dec 17, 11:14 am, Itay Maman wrote: > Hi, > > I am t

test-is: templates, composition, source lines!

2008-12-17 Thread Stuart Sierra
(testing.clj:4) expected: (= (+ 2 2) 5) actual: (not= 4 5) Ran 3 tests containing 7 assertions. 1 failures, 0 errors. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: FAQ

2008-12-18 Thread Stuart Sierra
t's a good FAQ suggestion, Kev. With the latest release, it's even shorter! 1. Download clojure_20081217.zip 2. Run java -jar clojure.jar -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &quo

Re: 20081217 Release

2008-12-18 Thread Stuart Sierra
FYI, I noticed that the readme.txt in the release still says to run with clojure.lang.Repl, when all you need now is: java -jar clojure.jar -Stuart Sierra On Dec 18, 8:46 am, Rich Hickey wrote: > I've cut a new release, 20081217, which is available from Google Code:

Re: test-is possible bug in are

2008-12-18 Thread Stuart Sierra
Make sense? This is roughly equivalent to (map (fn [x y] (is (< x y))) [[5 7] [8 10]]) but it happens at compile time. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: A more useful assert macro

2008-12-19 Thread Stuart Halloway
surprised me. Should assert return its value? If not, what should I name the function that works just like assert but returns its value? Stuart > At the moment assert macro accepts only a single argument - a test. If > the test fails (is false), an exception is thrown. But th

contrib updated to use latest test-is

2008-12-19 Thread Stuart Halloway
most of the rest of the day (East Coast US) if anybody wants to discuss testing Clojure and Contrib. Cheers, Stuart [1] http://code.google.com/p/clojure-contrib/source/detail?spec=svn317&r=317 --~--~-~--~~~---~--~~ You received this message because you

Clojure vs. CL macros question

2008-12-19 Thread Stuart Halloway
side effect [2]. Should macros written by ordinary mortals follow PG's rule? If not, should this be listed as a difference from other Lisps at [3]? Stuart [1] http://www.paulgraham.com/onlisp.html. Free download, see discussion in 10.3. [2] http://paste.lisp.org/display/72406 [3] http://c

Re: Clojure vs. CL macros question

2008-12-19 Thread Stuart Sierra
-S On Dec 19, 2:05 pm, Stuart Halloway wrote: > According to Paul Graham's On Lisp, macroexpanders should be purely   > functional, and you should not count on how often a macro gets   > expanded. This seems like a reasonable restriction for Clojure too.   > However, Chouser poste

*compile-path* hardwired in compiled Clojure core

2008-12-19 Thread Stuart Sierra
/clojure/classes" And it doesn't obey the system property used by clojure.lang.Compile: java -Dclojure.compile.path="/tmp/classes" -cp /tmp/ classes:clojure.jar clojure.main Clojure user=> *compile-path* "/Users/rich/dev/clojure/classes" -Stuart Sierra --~--~-

for FAQ: what are use/require/import/refer?

2008-12-20 Thread Stuart Sierra
(ns foo.bar (:use my.little.lib) (:require clojure.contrib.duck-streams) (:import (java.io File InputStream)) (:refer clojure.set)) ":require" also allows aliasing, like this: (ns foo.bar (:require [clojure.set :as set])) Now you can write the symbol "clojure.set/union"

Re: recur rationale?

2008-12-20 Thread Stuart Sierra
#x27;t compile if it's not in tail position, so you know you're doing it right. Leaving that aside, I actually find loop/recur more intuitive than Scheme-style "helper functions." It really gets down to the essence of what a loop is. -Stuart Sierra --~--~-~--~~---

Re: for FAQ: what are use/require/import/refer?

2008-12-20 Thread Stuart Sierra
ing them access to everything used/imported in the top- level "ns". I forgot whether the arguments to (:load ...) need slashes at the beginning. Either way, they're inside CLASSPATH. Ok, that was a lot; I hope some of it made sense. -Stuart Sierra --~--~-~--~~-

Re: recur rationale?

2008-12-20 Thread Stuart Halloway
explicit recur, given the alternatives. Cheers, Stuart > On Dec 20, 3:20 pm, verec > wrote: >> Though I wonder how complicated it would be to "coalesce" any such >> set of mutually recursive functions into a single "JVM method" where >> such &quo

Re: clojure.contrib.enum Exception

2008-12-21 Thread Stuart Sierra
Whoops, looks like contrib.enum doesn't work with the new AOT- compilation. I wrote it, so I'll take a look, but for the mean time... don't use it. :) -Stuart Sierra On Dec 21, 12:56 am, Andrew Baine wrote: > Any help is much appreciated: > > user> (require :ve

Re: gen-class from REPL

2008-12-21 Thread Stuart Sierra
Hi Bill, I think "compile" calls "load-lib", or something like that, so it assumes there's a source file somewhere. -Stuart Sierra On Dec 21, 3:19 pm, ".Bill Smith" wrote: > Is this a valid thing to do from the REPL? > > $ java -jar clojure.jar &

Re: Numeric tower and Java's math library

2008-12-22 Thread Stuart Sierra
l dispatch correctly? Yeah, I love (expt 2 64) as a Common Lisp parlor trick. I've thought about trying to write a Clojure "pow", but I don't know enough about the algorithms involved. How do you compute something like 25/9 to the power of 3/2? -Stuart Sierra --~--~

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

2008-12-22 Thread Stuart Sierra
a name, which is a symbol. "Symbols and keywords have two parts: a namespace part, which may be nil or a string; and a name part, which is a string." -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Simple doseq problem

2008-12-22 Thread Stuart Sierra
n. Try this: user=> (doseq [word (list "one" "two" "three")] (println word)) one two three nil -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gro

My SLIME installation diary

2008-12-23 Thread Stuart Sierra
m setting up Clojure, clojure-contrib, SLIME, swank-clojure, clojure-mode, and paredit. Step 1: prepare a space cd /Users/stuart/Projects mkdir clj cd clj Step 2: get the latest sources of everything svn checkout http://clojure.googlecode.com/svn/trunk/ clojure svn che

Re: Building clojure-contrib from source

2008-12-23 Thread Stuart Sierra
On Dec 23, 6:30 am, Konrad Hinsen wrote: > > Or change > > >     > > > to > > >     > > Thanks, that works fine. Is there a reason not to apply this change   > to clojure-contrib? Fixed in SVN rev. 328. Also changed fr

Re: making code readable

2008-12-29 Thread Stuart Sierra
it's not followed consistently. Go with what feels good. :) > Is there a way I could prevent them from being changed later? Not really, you can always re-def. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: test-is nesting

2008-12-30 Thread Stuart Halloway
If you guys can get these changes sorted out quickly (next few weeks) I would love to cover them in the book. No pressure. :-) Thanks, Stuart > On Mon, Dec 29, 2008 at 9:12 PM, Larrytheliquid > wrote: >> >> This is what I'm thinking, let me explain: http://gist.gith

Re: test-is nesting

2008-12-30 Thread Stuart Sierra
e compiler. One last thing: it seems to be often overlooked that the "is" macro can take a second argument, a doc string: (is (= 4 (+ 2 2)) "two and two make four") That doc string will be included in failure reports. If I add doc str

Re: test-is nesting

2008-12-30 Thread Stuart Sierra
FAIL in (my-tests) (NO_SOURCE_FILE:1) Arithmetic with integers should work expected: (= 5 (+ 2 2)) actual: (not= 5 4) Ran 1 tests containing 1 assertions. 1 failures, 0 errors. nil user> -Stuart Sierra --~--~-~--~~~---~--~~ You received this message because you are

implementing the Hofstadter Male and Female sequences

2009-01-02 Thread Stuart Halloway
-male (h-female (dec n)) (def h-male (memoize h-male)) (def h-female (memoize h-female)) (def h-male-seq (map h-male (iterate inc 0))) (def h-female-seq (map h-female (iterate inc 0))) Stuart --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: Java arrays caveat -- why?

2009-01-02 Thread Stuart Halloway
Java arrays are mutable. If you pass them around, everything in Clojure that relies on the assumption of immutability stops working. How big is your array? Does the Java API continue to hold on to it? Stuart >> From http://clojure.org/java_interop#toc27 : > > "Clojure supp

Re: calling Clojure from Java

2009-01-04 Thread Stuart Sierra
finedInInterface [this arg1 arg2 ...] ...) Note: defn names for functions defined in the interface begin with "-". Remember every method takes an extra "this" argument. To generate the .class file, use "(compile my.cool.library)" or clojure.lang.Compile. -Stuart Sierra

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

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 committe

  1   2   3   4   5   6   7   8   9   10   >