Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-05 Thread B Smith-Mannschott
On Sat, Jul 2, 2011 at 21:33, David Nolen wrote: > On Sat, Jul 2, 2011 at 3:21 PM, James Keats wrote: >> >> And once you encounter the >> reality and frustration infamously characterized by likening the >> managing of lispers to the herding of cats then you begin to admire >> languages like pytho

Re: Build tool for mixed Clojure/Java projects

2011-07-03 Thread B Smith-Mannschott
On Sun, Jul 3, 2011 at 21:57, Konrad Hinsen wrote: > I am looking for a build tool that fulfills the following requirements: > > 1) Must handle Clojure namespaces that are AOT-compiled. > 2) Must handle Clojure namespaces that are not AOT-compiled. > 3) Must handle Java source code files. > 4) Mus

Re: Where's old contrib string, str-utils and str-utils2

2011-06-29 Thread B Smith-Mannschott
On Wed, Jun 29, 2011 at 17:45, Timothy Washington wrote: > That's what I thought too, but I didn't see it in the source. I also fired > up the repl and tried some of the functions from str-utils2, and they > weren't there... > $ lein repl > user=> (require 'clojure.string) > nil > user=> (clojure.

Re: Can the namespace portion of a symbol contain slashes?

2011-06-24 Thread B Smith-Mannschott
On Fri, Jun 24, 2011 at 08:54, Meikel Brandmeyer wrote: > Hi, > > Am 24.06.2011 um 01:59 schrieb Sean Corfield: > >> Which is the whole point: the docs ascribe meaning to a/b and to / but >> do not ascribe meaning to a/b/c > > I'm sorry, but what is difficult about “it can be used *once*”. I under

Re: Can the namespace portion of a symbol contain slashes?

2011-06-23 Thread B Smith-Mannschott
On Thu, Jun 23, 2011 at 19:48, Sean Corfield wrote: > On Thu, Jun 23, 2011 at 10:40 AM, Stuart Halloway > wrote: >> The docs (http://clojure.org/reader) are specific: >> '/' has special meaning, it can be used once in the middle of a symbol to >> separate the namespace from the name, e.g. my-name

Re: Can the namespace portion of a symbol contain slashes?

2011-06-23 Thread B Smith-Mannschott
On Thu, Jun 23, 2011 at 18:48, Ken Wesson wrote: > On Thu, Jun 23, 2011 at 11:55 AM, B Smith-Mannschott > wrote: >> user> (name 'a/b/c) >> "c" >> user> (namespace 'a/b/c) >> "a/b" >> >> Is this intentional? I would

Can the namespace portion of a symbol contain slashes?

2011-06-23 Thread B Smith-Mannschott
user> (name 'a/b/c) "c" user> (namespace 'a/b/c) "a/b" Is this intentional? I would have expected a/b/c to be rejected as a symbol name since we use slashes to separate namespace from name and conventionally use "." to indicate hierarchy in namespace names. // Ben -- You received this message b

how? editing xml idiomatically using zipper

2011-06-03 Thread B Smith-Mannschott
I'm looking for some useful idioms for transforming XML in Clojure. I'm using the representation provided by clojure.xml and manipulating it using clojure.zip, clojure.contrib.zip-filter and clojure.contrib.zip-filter.xml. Here's an XML showing the parts I'll be talking about. hello group

Re: find first non nil element of sequence

2011-05-27 Thread B Smith-Mannschott
On Fri, May 27, 2011 at 16:03, Ulises wrote: > You could use identity as a predicate to filter: > > user=> (def s [nil nil 1 2 3]) > #'user/s > user=> (first (filter identity s)) > 1 > user=> (first (filter identity [nil false :oops])) --> :oops false is not nil. -- You received this message b

seeking memoize that evaluates wrapped function at most once for any given arguments

2011-04-17 Thread B Smith-Mannschott
I noticed recently that clojure.core/memoize does not promise that memoized calls will occur only once in the presence of multiple threads. i.e: user=> (dorun (map (memoize (fn [x] (Thread/sleep 1000) (print x))) (repeat 10 1))) 1nil However: user=> (dorun (pmap (memoize (fn [x] (Thread/sleep 10

Re: using clojure for (java) code generation; advice sought

2011-04-04 Thread B Smith-Mannschott
The issue of Multi-threading has cropped up WRT templating. It's not clear from the StringTemplate documentation what is and what isn't thread safe. From the look of the API, though I wouldn't be on anything. Fleet, mentioned in the previous message seems to have a real problem here too since flee

Re: using clojure for (java) code generation; advice sought

2011-04-03 Thread B Smith-Mannschott
On Fri, Apr 1, 2011 at 22:18, B Smith-Mannschott wrote: > On Wed, Mar 30, 2011 at 15:00, Stuart Sierra > wrote: >> Take a look at http://www.stringtemplate.org/ for a Turing-complete, >> purely-functional, Java-based template language designed for code >> generation.

Re: clearly, I'm too dense to upgrade slime/swank/clojure-mode... help?

2011-04-01 Thread B Smith-Mannschott
(I'm using Clojure 1.2.0; I neglected to mention that in my first message.) I was able to upgrade to clojure-mode 1.8.0 and clojure-test-mode 1.5.4 after installing a later package.el "0.9" than the one I had installed previously: commit e47f392dd688ac5f7bb06eeb96b7a29d95de1ce7 Author: Phil H

Re: clearly, I'm too dense to upgrade slime/swank/clojure-mode... help?

2011-04-01 Thread B Smith-Mannschott
On Fri, Apr 1, 2011 at 22:23, Dennis Crenshaw wrote: > I have a problem with swank with an upgrade recently, clojure1.3-alpha5 > works, clojure-1.3alpha6 does not, to my knowledge-- which Clojure version > are you using in your project? Silly me, I forgot to mention that. I'm on Clojure 1.2.0. /

Re: using clojure for (java) code generation; advice sought

2011-04-01 Thread B Smith-Mannschott
On Thu, Mar 31, 2011 at 05:00, Eli Barzilay wrote: > On Tue, Mar 29, 2011 at 4:43 PM, B Smith-Mannschott wrote: >> Horrible hack, maybe, but it got me thinking. What you seem to be >> doing is moving between "code" and "literal" mode by quoting with #. >>

Re: using clojure for (java) code generation; advice sought

2011-04-01 Thread B Smith-Mannschott
On Wed, Mar 30, 2011 at 15:00, Stuart Sierra wrote: > Take a look at http://www.stringtemplate.org/ for a Turing-complete, > purely-functional, Java-based template language designed for code > generation. Thanks! This is actually the second time I've run across stringtemplate, only now i'm taking

clearly, I'm too dense to upgrade slime/swank/clojure-mode... help?

2011-04-01 Thread B Smith-Mannschott
Some months ago my ability to send non-ascii characters to clojure running in a swank server started with maven clojure:swank broke, despite the fact that I'm doing this: (set-language-environment "UTF-8") (setq slime-net-coding-system 'utf-8-unix) In my .emacs file as suggested back in June 20

Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread B Smith-Mannschott
On Tue, Mar 29, 2011 at 16:30, Jonathan Smith wrote: > You might want to read through the source of scriptjure: > https://github.com/arohner/scriptjure > > For one way to do this sort of thing. Pretty much, you would make a > basic recursive descent parser that operates on a tree of clojure > prim

Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread B Smith-Mannschott
On Tue, Mar 29, 2011 at 16:56, Meikel Brandmeyer wrote: > Hi, > > On 29 Mrz., 15:13, B Smith-Mannschott wrote: > >> How does one really separate "content" from >> "presentation" in such a case? > > Maybe not feasible, but a thought, that ju

Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread B Smith-Mannschott
str >          (for ~loop-stuff >            (str ~@body > > (defn eval-template [s] >  (-> (build-code s) >      read-string >      eval)) > > In the templates anything surrounded by #'s (hashes) is a clojure form > that should be a compatible argument to str. >

Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread B Smith-Mannschott
On Tue, Mar 29, 2011 at 16:04, Saul Hazledine wrote: > On Mar 29, 3:13 pm, B Smith-Mannschott wrote: ... > I haven't done this within Clojure but below is small example of a C++ > Cheetah template: > > https://gist.github.com/892415 > > Although it looks a bit of a mes

Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread B Smith-Mannschott
On Tue, Mar 29, 2011 at 10:06, Saul Hazledine wrote: > Hello Ben, > > On Mar 28, 10:36 pm, B Smith-Mannschott wrote: >> Hi all! >> >> I'm using Clojure to generate java source (enums, specifically) and am >> looking for ideas. >> > > I&#x

using clojure for (java) code generation; advice sought

2011-03-28 Thread B Smith-Mannschott
Hi all! I'm using Clojure to generate java source (enums, specifically) and am looking for ideas. Currently my generator consists of a collection of function which call each other tree-recursion-like. Input: Each function takes a map of input. Much of this is constant for any one run of the gene

Re: Summer of Code 2011

2011-03-06 Thread B Smith-Mannschott
On Sun, Mar 6, 2011 at 15:55, Ken Wesson wrote: > On Sun, Mar 6, 2011 at 8:39 AM, Chas Emerick wrote: >> No, you're exactly right.  Leaving aside the obvious utility of being able >> to consume non-sexpr-structured content/data, there are plenty of domains >> for which s-expressions are not optim

Re: how can I call java method that requires Foo[] as argument?

2011-02-20 Thread B Smith-Mannschott
t into-array. Much better than writing my own. // ben On Sun, Feb 20, 2011 at 19:25, B Smith-Mannschott wrote: > (sorry, the first message got sent before it was actually done. > butterfingers.) > > > Hi all! > > My new goal in life is to learn my way around the SVNKit API, us

Re: how can I call java method that requires Foo[] as argument?

2011-02-20 Thread B Smith-Mannschott
On Sun, Feb 20, 2011 at 19:24, Daniel Solano Gomez wrote: > On Sun Feb 20 19:13 2011, B Smith-Mannschott wrote: >> The class SVNCommitClient [1] defines two overloads of doMkDir. I'm >> trying to call the two argument version: >> >>     SVNCommitInfo doMkDir(SVN

Re: how can I call java method that requires Foo[] as argument?

2011-02-20 Thread B Smith-Mannschott
(sorry, the first message got sent before it was actually done. butterfingers.) Hi all! My new goal in life is to learn my way around the SVNKit API, using Clojure. It didn't take me long to reach the first stumbling block: Here's the situation: The class SVNCommitClient [1] defines two overlo

how can I call java method that requires Foo[] as argument?

2011-02-20 Thread B Smith-Mannschott
Hi all! My new goal in life is to learn my way around the SVNKit API, using Clojure. It didn't take me long to reach the first stumbling block: Here's the situation: The class SVNCommitClient [1] defines two overloads of doMkDir. I'm trying to call the two argument version: SVNCommitInfo do

Re: (identical? "foo" "foo") evaluates to true

2011-02-15 Thread B Smith-Mannschott
On Tue, Feb 15, 2011 at 11:46, C. Arel wrote: > Hi all, > I am watching the data structure videos and there it evaluates to > false. > Does this mean that only one object is created now? (Clojure update on > String objects?) I think this is a distinction without a difference since Strings are imm

Re: Handling of unsigned bytes

2011-02-11 Thread B Smith-Mannschott
On Fri, Feb 11, 2011 at 20:34, Stuart Sierra wrote: > Java doesn't have any unsigned types, and that's not really something we can > change.  Java libraries that need to do binary I/O tend to work with byte > arrays and handle individual bytes as ints. > -Stuart Sierra > clojure.com Well, except

Re: searching for a good name thread-let, thread-with, thread-thru

2011-02-08 Thread B Smith-Mannschott
On Tue, Feb 8, 2011 at 22:05, Meikel Brandmeyer wrote: > Ah. A classic: > http://groups.google.com/group/clojure/browse_thread/thread/66ff0b89229be894/c3d4a6dae45d4852 > > Some more names in this old thread. > > Sincerely > Meikel Ah. Indeed. And Mark Fredrickson's "let->" is equivalent to my th

Re: searching for a good name thread-let, thread-with, thread-thru

2011-02-08 Thread B Smith-Mannschott
On Sat, Feb 5, 2011 at 16:36, Jason wrote: > How about > >  (%-> >     starting-value >     (foo 3 %) >     (bar % arg2 arg3)) > > This combines the standard shorthand argument form from the inline > function with the threading. I also like be because the '%' stands > out. This, or something very

Re: searching for a good name thread-let, thread-with, thread-thru

2011-02-05 Thread B Smith-Mannschott
On Sat, Feb 5, 2011 at 10:14, B Smith-Mannschott wrote: > I considered that, but decided against it because vector is the > conventional syntax for variable bindings in Clojure (let, fn, > defrecord, ...) Once I'd decided to do that, it became clear that the > first of the forms

Re: searching for a good name thread-let, thread-with, thread-thru

2011-02-05 Thread B Smith-Mannschott
On Sat, Feb 5, 2011 at 00:19, Michael Ossareh wrote: > On Fri, Feb 4, 2011 at 12:05, B Smith-Mannschott > wrote: >> >> I came up with this macro, but I'm unsure what to call it: >> >> (defmacro thread-let [[varname init-expression :as binding] & e

searching for a good name thread-let, thread-with, thread-thru

2011-02-04 Thread B Smith-Mannschott
Clojure's threading macros -> and ->> to be quite a win. It breaks down when the expression to be chained together are not consistent in nesting the threaded expression second or last. An idiomatic way to gain the necessary flexibility seems to be via let: (let [x (line-seq x) x (sort x)

Re: Ridiculously massive slowdown when working with images

2011-01-31 Thread B Smith-Mannschott
On Mon, Jan 31, 2011 at 08:00, Bill James wrote: > Benny Tsai wrote: >> Nice!  That version runs in 6 milliseconds on my machine, fastest of >> all the code posted so far.  One more idea: use 'unchecked-inc' >> instead of 'unchecked-add'.  This takes it under 3 milliseconds in my >> tests. >> >> (

Re: splicing and anonymous functions

2011-01-30 Thread B Smith-Mannschott
(1) #( ... ) is tanslated to (fn* [ ARGS ] ( ... )) before any macros are expanded because it is a *reader macro*. (2) The contents of #() are taken to be a function application. That's why you can write #(+ 1 %) and have + applied to 1 and %. By the same token, you can't write #(true) and expect

Re: [ANN] fs - file system utilities for Clojure

2011-01-19 Thread B Smith-Mannschott
On Wed, Jan 19, 2011 at 15:30, Rayne wrote: > It isn't nearly as big a deal as you think it is. I'm guessing you have a > single file called 'fs.clj' with the namespace 'fs', right? > mkdir src/fs/ > mv src/fs.clj src/fs/core.clj > > and then edit the file and change the namespace to fs.core. Why

Re: Question On Implicit Recursion

2011-01-13 Thread B Smith-Mannschott
On Thu, Jan 13, 2011 at 17:36, Benny Tsai wrote: > (conj) will add items to different places in the collection, depending > on the type of the collection.  For a set, this can be at either the > end OR the beginning. For a (hashed) set, this can be *anywhere* (between existing elements too). FTF

Re: how do I improve indentation of reify methods in clojure-mode

2011-01-11 Thread B Smith-Mannschott
On Tue, Jan 11, 2011 at 08:12, Eric Schulte wrote: > As an example of a user-accessible function for customizing indentation, > the following can be used with the latest clojure-mode either > interactively or from a user's config. > >  (defun clojure-new-indent (&optional func level) >    "Set the

ANN: PoolradWheel, a "translation wheel" for 3 classic AD&D games

2011-01-10 Thread B Smith-Mannschott
In the late 80's SSI Published a series of AD&D computer games starting with Pool of Radiance [1]. Some of these came with a decoder Wheel required to enter the game and at some points during game play. This program simlates the decoder wheel as required for entering the game. [1] http://en.wikipe

how do I improve indentation of reify methods in clojure-mode

2011-01-08 Thread B Smith-Mannschott
I'm using (emacs) clojure-mode 1.7.1 and I'm not happy with the how it indents method definitions, e.g. in reify: | (reify ItemListener |(itemStateChanged | [this e] | (f (selected? e The fact that Protocols method name, arg list and method body are all indented to ne

Re: type hinting the arguments of a function ..

2010-12-29 Thread B Smith-Mannschott
On Wed, Dec 29, 2010 at 16:10, David Nolen wrote: > On Wed, Dec 29, 2010 at 6:59 AM, B Smith-Mannschott > wrote: >> >> (In Clojure 1.3-alpha-3, which I happen to have lying around): >> >> double is a function, not a class. So, Clojure resp

Re: type hinting the arguments of a function ..

2010-12-29 Thread B Smith-Mannschott
(In Clojure 1.3-alpha-3, which I happen to have lying around): double is a function, not a class. So, Clojure responds: CompilerException java.lang.IllegalArgumentException: Unable to resolve classname ... (defn f [^double x] x) ; does not work because double is not a class (defn f [^Doub

Re: Doc string removed from clojure.xml/emit

2010-12-14 Thread B Smith-Mannschott
On Dec 14, 2010, at 18:00 , Ralph wrote: > Any reason why the doc string has been removed from clojure.xml/emit > (and emit-element)? Are these functions deprecated? > Well, they're buggy. http://www.assembla.com/spaces/clojure/search?q=clojure.xml+emit On issue 412 Stuart Halloway explains:

Re: Python is way faster than Clojure on this task

2010-11-05 Thread B Smith-Mannschott
On Fri, Nov 5, 2010 at 17:38, pepijn (aka fliebel) wrote: > I will have a look around. > > I listed the map I used in my first email, It's on my Dropbox: > http://dl.dropbox.com/u/10094764/World2.zip > > Meanwhile I wrote a function that is already twice as fast as I had, > no memory problems, no

Re: Clojure performance on shootout

2010-10-26 Thread B Smith-Mannschott
On Tue, Oct 26, 2010 at 11:27, Santosh Rajan wrote: > Here is another speed comparison. Of note is that there is another jvm based > lisp dialect kawa. > http://per.bothner.com/blog/2010/Kawa-in-shootout/ Yes, this one is interesting. Might not figuring out what Kawa is doing differently yield so

Re: Setting Clojure “constants” at runtime (cros sposted to Stackoverflow)

2010-10-23 Thread B Smith-Mannschott
- Why not make the jar available at compile time as well? (e.g. maven scope="provided") - You could also use a delay: (def *version* (delay (get-version))) and then write @*version* when you want the version information at runtime. - Equivalently, you could memoize get-version and just call tha

Re: Newbie: Multiple String Operations

2010-10-15 Thread B Smith-Mannschott
On Fri, Oct 15, 2010 at 16:25, Paul wrote: > Hi all, > > I need to perform string replacement a number of times and currently > achieve this using: > > (.replace (.replace (.replace (.replace ... > > Is there a more succinct and 'clojurish' way to do this? > Instead of (.replace (.replace (.r

Re: Java Source Indentation

2010-10-14 Thread B Smith-Mannschott
On Fri, Oct 15, 2010 at 04:13, David Jacobs wrote: > I've just started learning Clojure and I'm excited about what I see. The > combination of power and sophistication in the language is refreshing, and > I've started to dive into the source code to understand it better. > > One meta-observation

Re: List folders/ Files recursively

2010-10-06 Thread B Smith-Mannschott
On Wed, Oct 6, 2010 at 16:59, Justin Kramer wrote: > On Oct 6, 8:39 am, B Smith-Mannschott wrote: > > On Wed, Oct 6, 2010 at 08:49, Abraham wrote: > > > ; prints all files > > > (import 'java.io.File) > > > (defn walk [dirpath] >

Re: List folders/ Files recursively

2010-10-06 Thread B Smith-Mannschott
On Wed, Oct 6, 2010 at 08:49, Abraham wrote: > Dear All , > > I wanted to list the files of a folder , if a folder within , then it > should list the files of that folder and so on.. ie recursively list > files of folders > > I tried with recur & loop and could not do it . Then i searched the >

Re: Duplicate code in c.c.properties and c.c.java-utils

2010-10-02 Thread B Smith-Mannschott
On Sat, Oct 2, 2010 at 19:45, Stuart Sierra wrote: > On Oct 2, 2:53 am, Shantanu Kumar wrote: > > I found that the function read-properties is implemented in both > > c.c.properties and c.c.java-utils -- is this intentional? Which one is > > recommended, and why? > > c.c.properties is deprecated

Re: Duplicate code in c.c.properties and c.c.java-utils

2010-10-02 Thread B Smith-Mannschott
On Sat, Oct 2, 2010 at 21:29, B Smith-Mannschott wrote: > > > On Sat, Oct 2, 2010 at 19:45, Stuart Sierra > wrote: > >> On Oct 2, 2:53 am, Shantanu Kumar wrote: >> > I found that the function read-properties is implemented in both >> > c.c.properties an

Re: Duplicate code in c.c.properties and c.c.java-utils

2010-10-02 Thread B Smith-Mannschott
On Sat, Oct 2, 2010 at 19:45, Stuart Sierra wrote: > On Oct 2, 2:53 am, Shantanu Kumar wrote: > > I found that the function read-properties is implemented in both > > c.c.properties and c.c.java-utils -- is this intentional? Which one is > > recommended, and why? > > c.c.properties is deprecated

Re: Idiomatic Way to Build String or Simply Use StringBuilder

2010-09-29 Thread B Smith-Mannschott
On Thu, Sep 30, 2010 at 04:48, HiHeelHottie wrote: > > Is there an idiomatic way to build up a string over different lines of > code? Or, should one simply use StringBuilder. > > I recently wrote a program that generates complex java enums (as source) from input data recorded in clojure syntax (

Re: 1.2 contrib shuffles

2010-08-28 Thread B Smith-Mannschott
On Sat, Aug 28, 2010 at 07:00, Stuart Sierra wrote: > On Aug 27, 3:42 pm, B Smith-Mannschott wrote: > > This thread got me thinking that when a namespace is partially promoted > to > > Clojure proper, it might be good to provide a reduced version of the old > > names

Re: 1.2 contrib shuffles

2010-08-27 Thread B Smith-Mannschott
This thread got me thinking that when a namespace is partially promoted to Clojure proper, it might be good to provide a reduced version of the old namespace, providing just the functionality that was not promoted as an alternative to complete removal. Anyway, I've sketched out the idea as a patch

Re: 1.2 contrib shuffles

2010-08-27 Thread B Smith-Mannschott
tests due to. It shouldn't appear in a final versions. > All contributors and Rick do a great job but you should think about > some QA. > > On 27 Sie, 15:20, B Smith-Mannschott wrote: > > On Fri, Aug 27, 2010 at 13:54, Daniel Janus wrote: > > > Hi, > > > > &g

Re: 1.2 contrib shuffles

2010-08-27 Thread B Smith-Mannschott
On Fri, Aug 27, 2010 at 13:54, Daniel Janus wrote: > Hi, > > so I finally got around to port my app to Clojure 1.2 and got confused > about the contrib shuffles. > > There's clojure.java.io and clojure.contrib.io. The docs on the latter > says that most of the functions defined in there are depre

Re: clojure-contrib master now in submodules

2010-08-22 Thread B Smith-Mannschott
's the late 90s >> and this shouldn't be a blocking issue anymore. >> >> Can I git-clone Maven so it will reach for a local repo? >> Can I git-clone Clojure with a standalone build system? >> >> Tim Daly >> >> >> >> B Smith-

Re: why data structure

2010-08-22 Thread B Smith-Mannschott
On Sun, Aug 22, 2010 at 12:30, Belun wrote: > why does everything have to be a data structure ? like (operation > parameter parameter ...) Because Clojure is a Lisp. Lisps are homoiconic [1]. Clojure wouldn't be a Lisp if programs weren't data. [1] http://en.wikipedia.org/wiki/Homoiconicity //

Re: git clone Clojure/Maven?

2010-08-22 Thread B Smith-Mannschott
On Sun, Aug 22, 2010 at 10:43, Tim Daly wrote: > The fact that Maven uses http bit me today. > I was working offline in a coffee shop, > Maven tried to download something dynamically > and failed. End of my development work. This smells a little like the problem we had when the amateurs at my $JO

Re: clojure-contrib master now in submodules

2010-08-22 Thread B Smith-Mannschott
On Sun, Aug 22, 2010 at 09:52, B Smith-Mannschott wrote: > Maven uses http, so one can download the various modules of clojure > contrib via a web browser. Snapshot builds are here: > > http://build.clojure.org/snapshots/org/clojure/contrib/ > > i.e. > > http://build.c

Re: clojure-contrib master now in submodules

2010-08-22 Thread B Smith-Mannschott
Maven uses http, so one can download the various modules of clojure contrib via a web browser. Snapshot builds are here: http://build.clojure.org/snapshots/org/clojure/contrib/ i.e. http://build.clojure.org/snapshots/org/clojure/contrib/MODULE/VERSION The old monolithic clojure-contrib.jar is n

Re: questions about float operations

2010-08-20 Thread B Smith-Mannschott
On Fri, Aug 20, 2010 at 14:26, bufo wrote: > I am currently learning clojure by reading The Joy of Clojure and I > have 2 questions on float opertions: > > - why does (+ 4.2 8.4) return 12.601 and (+ 1.5 2.6) 4.1? > Since 4.2, 8.4 and (+ 4.2 8.4) are java Doubles why does it not behave

Re: multiline strings and multiline comments ?

2010-08-16 Thread B Smith-Mannschott
On Mon, Aug 16, 2010 at 18:26, Andrew Gwozdziewycz wrote: > On Mon, Aug 16, 2010 at 3:34 AM, faenvie wrote: >> hi clojure-users, >> >> i wonder what the reason is, that clojure(-reader) >> does not allow >> >> 1. multiline-strings like scala: >> >>  """this is a >>   | multiline string""" > > Yes

Re: multiline strings and multiline comments ?

2010-08-16 Thread B Smith-Mannschott
On Mon, Aug 16, 2010 at 16:48, Rasmus Svensson wrote: > 2010/8/16 Rasmus Svensson : 2. multiline comments like java /* this is a   multiline comment */ >>> >>> I don't know. >>> >> >> Comment blocks are usually done by starting each line with ;; >> >> ;; this is >> ;; a comment

Re: multiline strings and multiline comments ?

2010-08-16 Thread B Smith-Mannschott
On Mon, Aug 16, 2010 at 16:33, Rasmus Svensson wrote: >>> 2. multiline comments like java >>> >>> /* this is a >>>   multiline comment */ >> >> I don't know. >> > > Comment blocks are usually done by starting each line with ;; > > ;; this is > ;; a comment > ;; block > (some-code) > > Anything aft

Re: Efficiency of reduce function for lists.

2010-07-26 Thread B Smith-Mannschott
On Mon, Jul 26, 2010 at 09:58, Michael Wood wrote: > On 26 July 2010 09:25, B Smith-Mannschott wrote: > [...] >> That said, don't use my code. It's hideous. And by now, I'm sure >> there's a cleaner solution possible for my approach: >> >> The

Re: Efficiency of reduce function for lists.

2010-07-26 Thread B Smith-Mannschott
On Mon, Jul 26, 2010 at 08:13, ka wrote: >> For the program, I know that when processing a character, I do not >> need the previous result. All I need is the current character, and I >> can return a function that acts on the result. I'm not sure if this is >> simple to implement in a functional wa

Re: Efficiency of reduce function for lists.

2010-07-25 Thread B Smith-Mannschott
On Sun, Jul 25, 2010 at 00:16, samnardoni wrote: > I have a simple string (or list of characters to be precise) in a form > of: "1234<5678<<9". > > I want to parse this string and end up with: "123569". > > The "<" is essentially the same as a "backspace". > > I managed to implement this fairly si

Re: Access function argument from outer anonymous function

2010-07-22 Thread B Smith-Mannschott
On Thu, Jul 22, 2010 at 10:36, Paul Richards wrote: > When I use the reader macro for anonymous functions I can use "%" to > access the function argument: > > #(... % ...) > > This is great.  When I nest these however: > > #(.. #(.. % ..) ) > > Is there a way to access the function argument for th

Re: Two convenience methods

2010-07-21 Thread B Smith-Mannschott
On Wed, Jul 21, 2010 at 23:45, Travis Hoffman wrote: ... > The second function is suggested as an addition to clojure.set. The > "disjoint?" function decides if two sets have no elements in common. > This can easily be done using: > >  (not (nil? (intersection s1 s2))) > > but this implementation

Re: alter atom while iterating

2010-07-20 Thread B Smith-Mannschott
On Thu, Jul 15, 2010 at 12:16, ka wrote: >>        (for [a (r 2), b (r 3)] [a b]) >>        ; produces: >>         >>        ( >>        [0 0] [0 1] >>        [0 2] [1 0] [1 1] [1 2]) > > Why does (r 2) get evaluated before the seq is needed ? > > => (def k (for [a (r 2), b (r 3)] [a b]) ) > > #

Re: auto-indent in Counterclockwise

2010-07-08 Thread B Smith-Mannschott
On Thu, Jul 8, 2010 at 17:13, Laurent PETIT wrote: > > 2010/7/8 Lee Spector >> >> On Jul 8, 2010, at 10:31 AM, Laurent PETIT wrote: >> > What you first describe is odd. Is this a Mac particularity ? >> > On Windows/Linux, Hitting Ctrl+Space_bar results in showing a popup with >> > all the possibl

Re: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread B Smith-Mannschott
On Tue, Jun 29, 2010 at 17:24, Meikel Brandmeyer wrote: > Hi, > > On Jun 29, 4:24 pm, B Smith-Mannschott wrote: > >> This fully realizes the (range 1) before calling foo, which is >> wasteful if foo is written to consume more incrementally. >> >> I'v

Re: Apply/Laziness question (was Re: Newb Question)

2010-06-29 Thread B Smith-Mannschott
On Mon, Jun 28, 2010 at 20:31, Savanni D'Gerinel wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Along those lines, why is the apply necessary? > > More clearly, and I encountered this with a different block of code > earlier today, repeat returns a lazy sequence.  Str does nothing to

Re: Enhanced primitive support - redux

2010-06-25 Thread B Smith-Mannschott
On Sat, Jun 26, 2010 at 05:58, Andrzej wrote: > On Sat, Jun 26, 2010 at 4:04 AM, Rich Hickey wrote: >> equiv, the revenge of num > > Has it already been decided that some sort of this new numeric tower > will find its way into Clojure? > > Personally, I think this change will open a can of worms

Re: can not install clojure-test-mode using elpa (package.el)

2010-06-14 Thread B Smith-Mannschott
On Mon, Jun 14, 2010 at 07:16, B Smith-Mannschott wrote: > On Sun, Jun 13, 2010 at 23:26, Phil Hagelberg wrote: >> There are some bugs in package.el that I have fixed in my personal fork but >> have not yet made it upstream yet. Try clearing out .emacs.d/elpa and trying >> a

Re: can not install clojure-test-mode using elpa (package.el)

2010-06-13 Thread B Smith-Mannschott
On Sun, Jun 13, 2010 at 23:26, Phil Hagelberg wrote: > There are some bugs in package.el that I have fixed in my personal fork but > have not yet made it upstream yet. Try clearing out .emacs.d/elpa and trying > again with the version at http://GitHub.com/technomancy/package.el and it > should wor

can not install clojure-test-mode using elpa (package.el)

2010-06-13 Thread B Smith-Mannschott
Hi Clojurians, This weekend, while off the grid, I discovered that mvn clojure:swank and M-x slime-connect no longer talk to eachother. When I got back, I looked in M-x package-list-packages to see that there had been updates to clojure-mode (1.7.2), clojure-test-mode (1.4), slime (20100404). (sw

Re: RFC: clj-ds Clojure data structure for Java (et al.)

2010-06-08 Thread B Smith-Mannschott
On Tue, Jun 8, 2010 at 14:34, Krukow wrote: > I would like to hear the groups opinion before (and if) I release this > to the general public. > > http://github.com/krukow/clj-ds > > README: > ... > *WHY* > First, I love Clojure :) ... > Unfortunately sometimes clients require that I use Java... >

Re: review the clojure.string code

2010-06-03 Thread B Smith-Mannschott
On Thu, Jun 3, 2010 at 11:03, Laurent PETIT wrote: > 2010/6/3 B Smith-Mannschott >> >> On Thu, Jun 3, 2010 at 09:31, Laurent PETIT >> wrote: >> > Hello, >> > >> > 2 quick remarks concerning the patch: >> > >> >   * type

Re: review the clojure.string code

2010-06-03 Thread B Smith-Mannschott
On Thu, Jun 3, 2010 at 09:31, Laurent PETIT wrote: > Hello, > > 2 quick remarks concerning the patch: > >   * type hints are written like #^String and not ^String not anymore: http://github.com/richhickey/clojure/commit/787938361128c2bc21ed896dd4523651b59cb420 http://github.com/richhickey/cloju

Re: java.lang.Boolean cannot be cast to clojure.lang.IFn

2010-05-31 Thread B Smith-Mannschott
On Mon, May 31, 2010 at 14:11, garyk wrote: > Hi, > I've started learn Clojure. While I am writing some functions I was > getting the java.lang.Boolean cannot be cast to clojure.lang.IFn. I > was wondering if somebody could help me to move on: > > ; for testing > (def sudoku ( sorted-map '[1 1] '(

Re: JIT Compilation on Android

2010-05-28 Thread B Smith-Mannschott
On Sat, May 29, 2010 at 05:44, MHOOO wrote: > I've got 1.2.0-master running on android froyo with a repl. Froyo > supports JIT compilation, but whenever I call code which is defining a > new class (e.g.: "(defn blub [] nil)"), I get an Exception: > -

Re: promoting contrib.string to clojure, feedback requested

2010-05-27 Thread B Smith-Mannschott
On Thu, May 27, 2010 at 19:28, Sean Devlin wrote: > Oh, and following the tradition of clojure.java.io, you'll probably > want to name it clojure.java.string, since it relies heavily on > interop. If bits of Java poke through the public interface, yes. This is certainly the case for clojure.java.

is there something like my alter-map already in clojure?

2010-05-27 Thread B Smith-Mannschott
(defn alter-map "Transform values in map m using functions in fnmap with same key." [m fnmap] (reduce (fn [m [k f]] (assoc m k (f (m k m fnmap)) I wrote this some weeks ago and am finding it quite useful. Is there something like this in Clojure already, that I've ov

Re: matchure becoming clojure.contrib.match

2010-05-25 Thread B Smith-Mannschott
On Mon, May 24, 2010 at 05:41, Drew Colthorp wrote: > A few weeks ago I announced a pattern matching library called > matchure. I'm excited to say it's being merged into clojure.contrib as > clojure.contrib.match. I'd like some feedback on ideas for some > backward-incompatible changes I'm plannin

Re: Dividing list by predicate

2010-05-23 Thread B Smith-Mannschott
On Sun, May 23, 2010 at 21:21, Michael Gardner wrote: > I need to use a predicate to divide one list into two, one containing all > values for which the predicate is true, and the other with all remaining > values. I can do this easily by filtering twice, once with the predicate and > once with

Re: divide-n-conquer collections

2010-05-07 Thread B Smith-Mannschott
On Thu, May 6, 2010 at 02:08, Fabio Kaminski wrote: > im really a newcomer, and since i couldnt find this information anywhere.. > there we go :) > how can i split a collection and later join a collection in clojure.. to > apply concurrent transversal patterns in collections, like a divide and > c

Re: given a java.lang.Class, accessing a static field of the associated class

2010-05-06 Thread B Smith-Mannschott
On Thu, May 6, 2010 at 15:22, Stuart Halloway wrote: > Reflection is slow, there are less than ten of these, and the possible set > ain't gonna change. > > I would write a function that looks them up from a map. Yea, I considered that too. The only reason I didn't was because of a misguided desi

given a java.lang.Class, accessing a static field of the associated class

2010-05-06 Thread B Smith-Mannschott
This post originally started as a question, but I've since found a solution. I thought I'd post it anyway, perhaps someone knows of a nicer approach. I'd like a function which maps from a boxed type as represented by a java.lang.Class (i.e. Integer, Boolean, Float) to the associated unboxed type.

Re: copious FAIL when building clojure-contrib HEAD

2010-04-20 Thread B Smith-Mannschott
Mark, Alex, and especially Rich: thanks for the help, explanation and quick fix! Works great. // Ben -- 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 Note that posts from new members are mod

copious FAIL when building clojure-contrib HEAD

2010-04-20 Thread B Smith-Mannschott
greetings! This is a follow-up to my posts form this past weekend [1], where it seemed as if the problem were solved (on my mac, at least.) Now that I'm back on my netbooks and quad-core desktop (all various flavors of ubuntu), I'm finding I can't actually build clojure-contrib 1.2.x *at all*. I'

Re: platform-specific unit test failures in cc.test-complex-numbers

2010-04-17 Thread B Smith-Mannschott
On Sat, Apr 17, 2010 at 21:32, Stuart Halloway wrote: > It's almost certainly the commit that added the InternalReduce protocol: > 5b281880571573c5917781de932ce4789f18daec. > > I am slowly pounding my skull against this and would welcome any help. It > appears that the internal-reduce function fla

Re: platform-specific unit test failures in cc.test-complex-numbers

2010-04-17 Thread B Smith-Mannschott
I let Meheadable and George (my two macs) run clojure-contrib builds while I was watching TV to get an idea of the probability of this crash occurring was. George, a 1 GHz PowerPC G4 (1 core) fails 37 of 59 builds (circa 63%) Meheadable, a 2.2 GHz Core2Duo (2 cores) fails 48 of 132 builds (circa 3

Re: platform-specific unit test failures in cc.test-complex-numbers

2010-04-17 Thread B Smith-Mannschott
On Sat, Apr 17, 2010 at 18:02, B Smith-Mannschott wrote: > On Sat, Apr 17, 2010 at 15:45, B Smith-Mannschott > wrote: >> More oddness: >> >> If I remove all unit tests *except* test-compex-numbers, all is well: >> >>  [INFO] [clojure:test {exec

Re: platform-specific unit test failures in cc.test-complex-numbers

2010-04-17 Thread B Smith-Mannschott
On Sat, Apr 17, 2010 at 15:45, B Smith-Mannschott wrote: > More oddness: > > If I remove all unit tests *except* test-compex-numbers, all is well: > >  [INFO] [clojure:test {execution: test-clojure}] > >  Testing clojure.contrib.test-complex-numbers > >  Ran 8 test

  1   2   >