Re: Trying to get the ants demo to run on Windows

2008-11-19 Thread mb
Hi, there were some breaking changes in the SVN head lately in preparation of v1.0. Rich updated the ants demo some days, ago. So maybe you now have the new demo with the "old" clojure. I got the demo working without problems before the changes. Sincerely Meikel --~--~-~--~~

Re: multimethods + derive question

2008-11-19 Thread mb
Hello stuart, On 19 Nov., 13:45, Stuart Halloway <[EMAIL PROTECTED]> wrote: > I am working on the multimethod chapter this week. This has required a   > lot of exploration, as the multimethod feature set goes well beyond   > what most people are using yet. I have hit one rough spot: derive. I   >

Re: Namespaces and distinctness

2008-11-19 Thread mb
Hi, On 19 Nov., 09:47, Simon Brooke <[EMAIL PROTECTED]> wrote: > Java has a simple and neat convention for achieving global namespace > distinctness without the overhead of a central registry - you just > reverse your domain name and append a bit. Is there a similar > convention for Clojure names

Re: General question, what are using for clojure?

2008-11-19 Thread mb
Hi, the following thread was a poll for features, but also about what people do with Clojure. http://groups.google.com/group/clojure/browse_thread/thread/7bf9257fea4a0c47/93c8e34baa18ca59?lnk=gst&q=POLL#93c8e34baa18ca59 Sincerely Meikel --~--~-~--~~~---~--~~ You

Re: (Newbie) Are lexically-scoped methods possible?

2008-11-18 Thread mb
Hi, On 19 Nov., 06:53, samppi <[EMAIL PROTECTED]> wrote: > Yes, but I meant creating methods rather than regular functions, in a > lexical scope. Is it possible to create methods using fn? (ns foo) (defmulti bar ...) (ns foo.test) (defmethod foo/bar ...) One can also use the MultiFn Java met

Re: clojure.contrib.test-is changes

2008-11-18 Thread mb
Hello Stuart, On 18 Nov., 15:58, Stuart Sierra <[EMAIL PROTECTED]> wrote: > 1. I want to keep optional messages per-assertion.  These are very > useful in the RSpec testing framework for Ruby; they're like comments > explaining what each assertion is supposed to demonstrate. I'd also like to see

Re: Alioth binary-tree benchmark

2008-11-18 Thread mb
Hi, blindly copying code is usually not a good way to learn a new language I don't know, whether this is more idiomatic Clojure code, but it works... (defn build-tree [item depth] (when (< 0 depth) (let [i (* 2 item) d (dec depth)] [item (build-tree (dec i) d) (build

Re: Eager map?

2008-11-17 Thread mb
Hi, On 18 Nov., 03:01, Adam Jones <[EMAIL PROTECTED]> wrote: > I'm in the middle of writing some code to extract sql results, which > means I'm doing a *lot* of forcing right now. It's almost enough for > me to wish there was a convention (and provided definitions) for > denoting lazy/strict vers

Re: Strange behaviour

2008-11-17 Thread mb
Hi, On 17 Nov., 13:05, Konrad Hinsen <[EMAIL PROTECTED]> wrote: >         (defn replace-syms >            [sym-map expr] >            (let [replace #(replace-syms sym-map %)] >               (cond (contains? sym-map expr) (get sym-map expr) >                     (list? expr) (map #(replace-syms s

Re: Running Clojure scripts at the command line

2008-11-17 Thread mb
Hi, On 17 Nov., 09:07, "Michael Wood" <[EMAIL PROTECTED]> wrote: > #!/usr/bin/env java -cp /sq/ext/clojure/clojure.jar clojure.lang.Script Most systems only allow one argument to the command. scsh solved this issue with the special \ argument and block comment #! ... !# #! /usr/bin/scsh \ -m or

Re: Clojure for LISP programmers....

2008-11-16 Thread mb
Hi Simon, there is a detailed explanation of syntax, data structures etc. as well as a complete reference at the Clojure site[1]. Then there's a wiki[2] with a lot of information of setting Clojure up with different editors like emacs or vim and a lot of examples. Also explaining some of the qui

Re: recur in catch and finally?

2008-11-16 Thread mb
Hi, On 17 Nov., 02:09, Chouser <[EMAIL PROTECTED]> wrote: > You could of course work around this by putting your loop in some > other function and calling it from inside catch. In this specific case I used: (last (take-while #(not (nil? %)) (iterate #(.getCause %) e))) However, a separate funct

Re: let accepting a vector

2008-11-13 Thread mb
Hi Stuart, > I spent a few minutes trying to write a macro to do this that doesn't   > use eval. So far no good. Is it truly impossible, though? I have never   > seen a good discussion of "things that can be done only with eval".   > Any pointers? The problem is, that macros happen at compile ti

Re: let accepting a vector

2008-11-13 Thread mb
Hi, On 13 Nov., 07:27, Larrytheliquid <[EMAIL PROTECTED]> wrote: > Is there a way to pass a vector to a function like let, rather than manually > typing in the brackets? let is not a function, but a special form (see: http://clojure.org/special_forms). It is only possible via eval to achieve th

Re: About testing private functions

2008-11-10 Thread mb
Hi, simply change to the namespace in question: in /foo/foo.clj: ---8<--- (ns foo) (defn- private-foo-func [x y] (+ x y)) ---8<--- in test-foo.clj: ---8<--- ; Make sure foo namespace is loaded ; correctly before we go on. (require 'foo) (in-ns 'foo) ; Make sure, we don't interfere with ;

Re: a question about ns

2008-11-10 Thread mb
Hi, On 10 Nov., 12:48, Chanwoo Yoo <[EMAIL PROTECTED]> wrote: > (ns test >   (->:import "import org.apache.http.HttpVersion; import > org.apache.http.http.client.HttpClient")) ns is itself a macro, which treats the :import, :use, :require and :refer-clojure clauses specially. Since it does not e

Re: A trivial question about type and class

2008-11-06 Thread mb
Hi, On 6 Nov., 13:30, Chanwoo Yoo <[EMAIL PROTECTED]> wrote: > > Is {:a 1} not a hash-map? It seems that there is some inconsistency... Clojure holds promises about the interface and the performance characteristics of the provided functions. In general Clojure is a lot about abstract interfaces.

Re: Having struggle in understanding FP (and Clojure question)

2008-11-05 Thread mb
Hi, On 5 Nov., 15:40, Konrad Hinsen <[EMAIL PROTECTED]> wrote: > But does gen-class have to look the way it does? Couldn't the same   > functionality be provided in a way that looks more like a proper part   > of the language? I'm not sure about the form itself. I had look at a CLOS tutorial and

Re: Having struggle in understanding FP (and Clojure question)

2008-11-05 Thread mb
Hi, On 5 Nov., 08:31, Konrad Hinsen <[EMAIL PROTECTED]> wrote: > That's exactly my point. Multimethods may well be sufficient or even   > superior for implementing OO concepts useful in Clojure. We will see   > when someone actually uses them this way (or has it already   > happened?). But as lon

Re: Having struggle in understanding FP (and Clojure question)

2008-11-04 Thread mb
Hi, On 4 Nov., 15:03, Konrad Hinsen <[EMAIL PROTECTED]> wrote: > As an illustration of the two approaches, consider a program to sort   > data. In OOP, one would define an abstract class "comparable" with a   > method "sort" that works by calling methods such as "greater" and   > "equal" implemen

Re: Pathetic n00b wonders how to deploy

2008-10-31 Thread mb
Hi, On 31 Okt., 04:46, JCB <[EMAIL PROTECTED]> wrote: > 1) does Clojure maintain the CL notion of a "running image" (ACL > terms), or a "core" (sbcl terms)? > > For example, in ACL I can do (dumplisp), and I think sbcl has > something called (save-lisp-and-die) .. I don't think so, no. > 2) Doe

Re: macro questions, "can't embed unreadable..."

2008-10-30 Thread mb
Hi, On 31 Okt., 05:30, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > It works with a literal for vecs: > > user=> (declare-init [[a 1] [b 2] [c 3]]) > #=(var user/c) > > But if I def the seq of seqs: > > user=> (def myvecs '[[a 1] [b 2] [c 3]]) > #=(var user/myvecs) > user=> myvecs > [[a 1] [

Re: Ants and agents

2008-10-30 Thread mb
Hi, On 30 Okt., 12:43, Tom Davies <[EMAIL PROTECTED]> wrote: > > Then every iteration of ant behaviour (and evaporation etc.) creates   > > a new thread, right? This implies that an agent is not forever bound   > > to the same thread. Nor is a thread bound to one agent, as otherwise   > > one cou

Re: Proxy Bug?

2008-10-30 Thread mb
Hi, On 30 Okt., 08:48, ntupel <[EMAIL PROTECTED]> wrote: > Interestingly java.io.OutputStream.write(I)V is invoked even though this > should be covered by the proxy write method. I lookep up the implementation of proxy-super. It replaces the method temporarily. So proxy-super basically doesn't w

Re: Proxy Bug?

2008-10-29 Thread mb
Hi, On 30 Okt., 00:31, ntupel <[EMAIL PROTECTED]> wrote: > Consider the following code which attempts to redefine clojure/*out*: > (def output-stream > (let [buffer (new java.io.ByteArrayOutputStream)] > (proxy [java.io.OutputStream] [] > (flush [] > (.append output (.toString

Re: Chimp Patch - MacroExpand command

2008-10-28 Thread mb
Hi, On 28 Okt., 19:52, "J. McConnell" <[EMAIL PROTECTED]> wrote: > For anyone using Meikel Brandmeyer's Chimp plugin for Vim, below is a > patch that adds a MacroExpand command, which sends a (macroexpand-1 > ...) for the inner s-expr. Hope someone finds it useful. Thank you for the patch. I add

Re: genclass error message

2008-10-28 Thread mb
Hi, On 7 Okt., 01:57, Chouser <[EMAIL PROTECTED]> wrote: > Currently if you fail to provide or mis-name the main fn in a > gen-class implementation, you get an error like: > > Exception in thread "main" java.lang.UnsupportedOperationException: > net.n01se/main not defined > > This is wrong, since

Re: classpath problem on MacOSX

2008-10-28 Thread mb
Hi, On 28 Okt., 12:42, Chanwoo Yoo <[EMAIL PROTECTED]> wrote: > Thanks! mb. I did a stupid mistake. There no stupid mistakes. Unless you do them twice... ;) > "export CLASSPATH=.:/Users/chanwoo/Documents/lisp/clojure/code: > $CLASSPATH" Is this verbatim? The fi

Re: classpath problem on MacOSX

2008-10-28 Thread mb
Hi, On 28 Okt., 08:42, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi. > > When I try to use 'contrib' library, next error message occurs. > > user=> (use 'clozure.contrib.duck-streams) > java.io.FileNotFoundException: Could not locate Clojure resource on > classpath: clozure/contrib/duck_st

Re: string interpolation

2008-10-28 Thread mb
Hi Islon, On 28 Okt., 04:38, Islon <[EMAIL PROTECTED]> wrote: > Is there any chance closure will get string interpolation? > > Do things like (prn "Hi ${someone}, my name is ${myname}") is nice, not > crucial of course, but nice. There is format. user=> (def someone "World") #=(var user/someone)

Re: Evaluation of arguments in a macro

2008-10-27 Thread mb
Hi, On 27 Okt., 21:08, Matt Moriarity <[EMAIL PROTECTED]> wrote: > I am trying to write a macro to rewrite something like this: > > (set-props my-jframe :title "blah" :visible true) > > Into calls to the setter methods. I finally settled on this: > > (defmacro set-props [obj & props] > (l

Re: Clojure and introspection/reflection analysis?

2008-10-23 Thread mb
Hi, On 24 Okt., 00:42, BerlinBrown <[EMAIL PROTECTED]> wrote: > And then I have a utility to load hello_world.lisp and execute > the hello-world call. > > At the command line: > #Inspect: hello-world function was called > #Hello World > #Inspect: hello-world has finished executing. There is

Re: Placement of metadata in defn

2008-10-23 Thread mb
Hi Paul, On 23 Okt., 15:11, Paul Drummond <[EMAIL PROTECTED]> wrote: > I am a bit puzzled by how metadata seems to behave differently > depeding on where it's used and whether #^ is included or not: AFAIU, #^ attaches the given map to the thing read. > (defn #^{:doc "doc"}  my-fn ([x] x)) > ;;W

Re: Vim syntax support for BigDecimal literals

2008-10-23 Thread mb
Hi, On 23 Okt., 14:48, "J. McConnell" <[EMAIL PROTECTED]> wrote: > Here's a tiny patch against the VimClojure syntax file to allow Vim to > recognize BigDecimal literals (numbers suffixed with "M"): > > kant[~/.vim/syntax]$ diff clojure.vim.orig clojure.vim > 162c162 > < syn match   clojureNumber

Re: Strange behavior of the #() macro

2008-10-23 Thread mb
Hi Rick, First of all: #(x) is equivalent with (fn [] (x)). So as an example with reduce: user=> (reduce #(+ %1 %2) (range 1 101)) 5050 user=> (reduce (fn [x y] (+ x y)) (range 1 101)) 5050 So it should be obvious, that #(3) throws exception as soon as it is called, since it is equivalent to (fn

Re: Data types in Clojure

2008-10-23 Thread mb
Hi, On 23 Okt., 08:50, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This leads me to a more down-to-earth question: what is the right way > to use clojure/zip in a program? First I tried > > (use 'clojure.zip) I normally use an alias: (require '[clojure.zip :as zip]) user=> (-> (zip/ve

Re: Data types in Clojure

2008-10-22 Thread mb
Hi Konrad, On 22 Okt., 18:07, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > But assume I wanto to provide two implementations for such an > interface, in two separate namespaces. Can I then write client code > that will work with either one? I would have to pass it the namespace > as an argume

Re: Testing Clojure (was Re: Bug? Strange set equality (r1075))

2008-10-22 Thread mb
Hello Stuart, On 21 Okt., 16:37, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Since there is now a movement afoot to write a comprehensive test   > suite, I want to re-post the spike I did earlier on ClojureCheck. > > It would be cool to use check-style tests for at least part of the   > Clojure

Re: Data types in Clojure

2008-10-22 Thread mb
Hi Konrad, On 22 Okt., 12:49, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > However, there is one point that is not clear to me: how does Clojure > deal with data types in general, and abstract data types in > particular? How would one implement a library for tree operations, a > graph library

Re: On macros

2008-10-21 Thread mb
Hi Karl, On 22 Okt., 06:43, Krukow <[EMAIL PROTECTED]> wrote: > user> (eval (list (symbol "Object."))) > [EMAIL PROTECTED] > user> > > This seems to indicate that actually Object. is just a symbol like any > other. So there isn't any special reader support for it, but instead > the compiler handl

Re: Modified doto

2008-10-21 Thread mb
Hello, On 21 Okt., 19:08, Chouser <[EMAIL PROTECTED]> wrote: > Here's my implementation: > > (defmacro >>_ [& exprs] > (list 'let (apply vector (mapcat (fn [expr] (list '_ expr)) exprs)) '_ )) Now this is a nice idea. > I used it a couple times after first writing it, but have since failed > t

Re: Modified doto

2008-10-21 Thread mb
Hi, On 21 Okt., 17:24, Chouser <[EMAIL PROTECTED]> wrote: > I don't see much wrong with "doto->", though "do-with" or "do->" might > be okay.  I'd probably vote against "do-unto-others-as" I would vote for do-with. Sincerely Meikel --~--~-~--~~~---~--~~ You receiv

Re: Modified doto

2008-10-21 Thread mb
Hello Stephen, On 21 Okt., 17:05, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Is the ".." aspect of it the "automatically make a list if it's not   > one" part? This is actually a -> aspect. What I meant was: (.. x (getModel) (getRoot) (state)) is equivalent to (-> x .getModel .getRoot .sta

Re: Modified doto

2008-10-21 Thread mb
Hi, On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote: > (defmacro doto-> The name is actually also up to discussion. doto is already in use and this change is incompatible to "legacy" code. I couldn't come up with a good alter

Modified doto

2008-10-21 Thread mb
Hi, recently I ran in the a limitation of doto, that it only invokes methods. However piping the object with -> does not work also, since it's semantics are more like .. . I'd like to propose the following chimera of doto and ->. (defmacro doto-> [obj & forms] (let [objx (gensym "obj__")]

Re: offtopic - where are you come from? (poll)

2008-10-17 Thread mb
Frankfurt am Main, Germany --~--~-~--~~~---~--~~ 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 this group, send email to [EMAIL PROTECTED]

Re: Ruby => Clojure for Enumerable and Array

2008-10-16 Thread mb
Hi, On 17 Okt., 00:14, Mark McGranaghan <[EMAIL PROTECTED]> wrote: > When I first started working with Clojure a while back I tried to get > my bearings by figuring out how to do some basic things in Clojure > that I had previously done in Ruby.  With all the recent talk about > the seq api, I th

clojure.zip/goto proposal

2008-10-16 Thread mb
Dear Clojurians, I'd like to propose a clojure.zip/goto function. It is basically the inverse of the clojure.zip/path function, ie. it takes a location and a path and walks through the zipper to the given node and returns its loc. (defn goto "Follow along the path from the given loc. In case t

Re: Calling static methods on a variable holding a class

2008-10-16 Thread mb
Hi, On 16 Okt., 09:14, "V.Quixote" <[EMAIL PROTECTED]> wrote: > So after (def OpenGL GL11): > > user=> (.GL_QUADS GL11) > 7 > user=> (.GL_QUADS OpenGL) > java.lang.IllegalArgumentException: No matching field found: GL_QUADS > for class clojure.lang.Symbol (NO_SOURCE_FILE:0) > > Using (def OpenGL

Re: toUpperCase on java.lang.String

2008-10-16 Thread mb
Hi, On 16 Okt., 08:17, Timothy Pratley <[EMAIL PROTECTED]> wrote: > What does 'mix in non-methods' means? I read the (doc ->) but I really > don't follow that explination. -> is more general than .. . .. only works on objects. (.. foo (bar baz) (frob nicate)) is equivalent to (. (. foo ba

Re: (map f coll) using memfn

2008-10-15 Thread mb
Hi, On 16 Okt., 05:13, Timothy Pratley <[EMAIL PROTECTED]> wrote: > Just a few follow on questions... > 1) Is there any way to do away with the input bindings altogether? map > doesn't need input bindings, but memfn does. I don't quite grasp why > they are needed for memfn, or how to construct an

Re: (map f coll) using memfn

2008-10-15 Thread mb
Hi, On 15 Okt., 19:09, "Graham Fawcett" <[EMAIL PROTECTED]> wrote: > > (map f coll (range (count coll))) > > Rather than (range (count coll)), I would use (iterate inc 0), which > incurs no overhead for counting the argument. There is not only the overhead of counting, (count coll) might also d

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread mb
Hi, On 15 Okt., 19:11, CuppoJava <[EMAIL PROTECTED]> wrote: > I'm trying to use this macro to port a game-framework that I've > written in Ruby, to Clojure. > ... > Do you guys have any ideas? Or a direction that I might consider > looking in? I can only offer a general advice: Don't stick

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread mb
Hi, On 15 Okt., 18:33, CuppoJava <[EMAIL PROTECTED]> wrote: > That solution will work for this simple case, but my goal is to make > it possible to create lazy-sequences in a more straight-forward > manner. So that we can use the usual sequence functions (doseq, > dorun, loop) instead of the lazy

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread mb
Hello, On 15 Okt., 17:53, CuppoJava <[EMAIL PROTECTED]> wrote: > What's supposed to do is take an arbitrary-form, and create a lazy > sequence out of calls to "yield". You can construct the inputs in a lazy sequence and then map yield over that: (map yield (lazy-cat (for [i (range 3)]

Re: using libraries

2008-10-15 Thread mb
Hi, On 15 Okt., 09:22, Paul Drummond <[EMAIL PROTECTED]> wrote: > Hmmm.  Now I am getting this: > > (require 'clojure.contrib.zip-filter :as 'zf) > java.lang.ClassCastException: java.lang.Boolean cannot be cast to > clojure.lang.Symbol (NO_SOURCE_FILE:0) > > Any ideas? You might want to try (req

Re: Making a living on Clojure

2008-10-14 Thread mb
Hi, On 14 Okt., 22:13, Fogus <[EMAIL PROTECTED]> wrote: > I am attempting to work Clojure (at least partially) into my job, > but in doing so I wonder how many of you here use it at your own > jobs as opposed to relegating it to hobby. I'm using Clojure at my job, but mainly to make my life easi

Re: Nested Multimethods

2008-10-14 Thread mb
Hello, On 14 Okt., 16:58, Randall R Schulz <[EMAIL PROTECTED]> wrote: > I have heard it claimed (on one of the Scala lists, I think) > that patterns themselves are an anti-pattern... I think there are always patterns. They are just different. In Clojure there is maybe the "Driver Function" patte

Re: Suggest changing update-in to accept additional args for "f"

2008-10-13 Thread mb
Hello, On 13 Okt., 17:02, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: >         user=> (update-in m [:a :b] + 2) ; new >         {:a {:b 3}} I think this is a good idea. This would also be in-line with things like alter and commute. Sincerely Meikel --~--~-~--~~~

Re: First Release of Chimp available

2008-10-09 Thread mb
Hello, On 9 Okt., 06:41, Mitch <[EMAIL PROTECTED]> wrote: > I've been using chimp a little bit, and it works pretty well except > for the \ef command. It gives me the following error: > E119: Not enough arguments for function: 31_EvalFile Please report such issues! Otherwise they can't be fixed.

Re: First Release of Chimp available

2008-10-09 Thread mb
Hello, On 9 Okt., 02:41, Jonas Bengtsson <[EMAIL PROTECTED]> wrote: > It almost works now, however something fishy is going on when it tries > to launch screen from vim. I've done the following setting: Do you also use the VimClojure plugin? Chimp heavily relies on its syntax highlighting. Of cou

Re: A few questions

2008-10-09 Thread mb
Hi, On 9 Okt., 08:39, Krukow <[EMAIL PROTECTED]> wrote: > (str x " loves " y)) > > Now the question is why is it logging 5 times? Is this a bug, or has > something fundamental changed? I checked out Clojure from SVN a few > days ago. Have a look at the implementation of str in boot.clj: ...

Re: gen-class and namespace

2008-10-08 Thread mb
Hi, >> gen-class loads eg. foo/bar/Baz.clj for class foo.bar.Baz. However, >> maybe one also has support functions in the foo.bar namespace. Hence >> one needs also foo/bar/bar.clj. > > I seem to be able to solve the problem by putting this at the top of > Baz.clj: > > (ns foo.bar (:use foo.bar))

Re: Bug in isa??

2008-10-08 Thread mb
Hello again, another thing I noticed: the loop could also stop as soon as ret is false. Because at that point it stays so due to the (and). I assume that the vectors are likely small. So this is maybe not much of a difference... Sincerely Meikel --~--~-~--~~~---~--~-

Bug in isa??

2008-10-07 Thread mb
Hello Rich, in the definition of isa? in boot.clj in the last line (no. 2879), there isa? recurs into the contents of the vectors. It uses implicitely the global-hierarchy instead of the provided one. Shouldn't it be (isa? h (child i) (parent i)) instead of (isa? (child i) (parent i)) Sinc