Re: Type hint Java array of your own Java class

2009-02-05 Thread Christian Vest Hansen
On Thu, Feb 5, 2009 at 7:33 AM, Christophe Grand wrote: > > Chouser a écrit : >> (defn foobar [#^#=(array-of MyClass) myarray]) >> >> Again, I apologize for even suggesting this > Wow what a clever (ab)use of reader macros! This is where a raptor jumps in from the left and eats someone :) > > -

anyone going to FOSDEM?

2009-02-05 Thread rb
Hi, are any clojure developers going to FOSDEM, next week-end in Brussels (Belgium)? It would be cool to meet there. (I'm a complete newbie at clojure, but that would make it the more interesting for me to meet other clojure developers:-) Cheers Raphaël --~--~-~--~~~--

Re: Stumped - Java hangs when using Swing in Slime

2009-02-05 Thread David
I've got the same problem as srolls24 and CuppoJava on Windows XP, using Emacs 23 and versions of Clojure, Slime and Swank fetched today. Also, when starting Slime, it opens a connection to *inferior-lisp*, but keeps polling for Swank until I hit return in the inferior-lisp buffer. After that, i

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 1, 7:22 pm, David Nolen wrote: > I've changed the name of my project since that was a joke > anyway.http://github.com/swannodette/spinoza/tree/master > > Spinoza isn't just for people who want object oriented behaviors.  It's also > for anyone who plans on instantiating many structs.  S

Re: Questions about a Clojure Datalog

2009-02-05 Thread Rich Hickey
On Feb 4, 5:22 pm, John Fries wrote: > Guaranteed-termination is very desirable. However, you can have guaranteed > termination with an open-world assumption just as well. And I think an > open-world assumption does a better job of mimicking human reasoning. > Do you have a specific reasoner/

Re: Map from generator?

2009-02-05 Thread Rich Hickey
On Feb 4, 10:36 pm, Conrad wrote: > It is useful to build a map from a list of keys and a value generator > function. Of Course, such a function is easy to write: > > (defn genmap [keys fun] > (zipmap keys (map fun keys))) > > In fact, it seems so useful that it must be in the standard API >

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread Laurent PETIT
Hello, Please accept my apologizes if the following remarks/questions sound stupid or silly to you, but I can't resist ask/remark in order to gain a better understanding of what you meant when writing the following : 2009/2/5 mikel > On Feb 1, 7:22 pm, David Nolen wrote: > > > > (time (dotime

Re: Map from generator?

2009-02-05 Thread Mark McGranaghan
I frequently use a more general version of this function that reduces a seq to a map, mapping each element in the seq to a [key value] pair for the map. I use this in several different libs: (defn mash "Reduce a seq-able to a map. The given fn should return a 2-element tuple representing a ke

clojure.core/import fix

2009-02-05 Thread Tomasz
Test case: --- (add-classpath "file:///home/user/.maven/repository/commons-io/jars/ commons-io-1.4.jar") (ns import-testcase (:refer-clojure) (:import (org.apache.commons.io FileUtils))) --- Loading code above results in java.lang.ClassNotFoundException. This is beacuse clojure.core/impor

Re: London Clojurians

2009-02-05 Thread Rich Hickey
On Feb 4, 8:25 am, H Durer wrote: > 2009/2/3 AndrewC. : > [...] > > > The people at Scheme UK have (very) occasional meetings in Shoreditch. > > We could join up with them and get a few more people, perhaps. > > >http://upcoming.yahoo.com/group/4654/ > > > Perhaps someone could do an introducto

Re: how to reason about two dimentional array(vector) like...

2009-02-05 Thread wubbie
for simplicity, first tried to create two dimentional array(vector) of numbers. On Feb 5, 1:58 am, Emeka wrote: > Where did 'ref' go in your own implementation? > > Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

test-is: (is (thrown? ...)) & exceptions & REPL

2009-02-05 Thread Frantisek Sodomka
Hello Stuart and all! There is something strange going on with (is (thrown? ...)) form: user=> (use 'clojure.contrib.test-is) nil user=> (is (= 2 2)) true ; this works user=> (/ 1 0) java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0) user=> (is (thrown? ArithmeticException (/ 1 0))

Re: London Clojurians

2009-02-05 Thread Tom Ayerst
Another option would be to do a session at one of the erlounges at Erlang Traing and Consulting.The only issue is that someone would have to do a presentation for the erlang people there and I, for one, am not knowledgeable enough to present on Clojure yet. Tom 2009/2/3 AndrewC. > > On Feb 3, 1

Re: Stumped - Java hangs when using Swing in Slime

2009-02-05 Thread Shawn Hoover
On Thu, Feb 5, 2009 at 4:52 AM, David wrote: > > I've got the same problem as srolls24 and CuppoJava on Windows XP, > using Emacs 23 > and versions of Clojure, Slime and Swank fetched today. > > Also, when starting Slime, it opens a connection to *inferior-lisp*, > but keeps polling > for Swank u

Re: test-is: (is (thrown? ...)) & exceptions & REPL

2009-02-05 Thread Jeffrey Straszheim
>From a quick glance, it looks like the exceptions that are *not* being caught are those generated by the compiler, who can't understand the code. test-is can't find those because the code doesn't even run in that case. On Thu, Feb 5, 2009 at 8:33 AM, Frantisek Sodomka wrote: > Hello Stuart and

Re: test-is: (is (thrown? ...)) & exceptions & REPL

2009-02-05 Thread Frantisek Sodomka
user=> (deftest test-if (is (thrown? Exception (if java.lang.Exception: Too few arguments to if (NO_SOURCE_FILE:35) user=> (deftest test-div (is (thrown? ArithmeticException (/ 1 0 #'user/test-div Yes, looks like it. Compile-time and run-time exceptions - will have to remember that ;-)

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-05 Thread prhlava
> 2) The current directory (parent of gui2) is in the class-path -cp > option when launching Clojure Updated the guide with note about CLASSPATH - basicaly, I have current directory (".") listed in it. Also, replaced quote character with "quote" word in the code. Updated version so far only her

Re: Indy .NET programmers discover parentheses

2009-02-05 Thread Chouser
On Thu, Jan 29, 2009 at 10:50 AM, Shawn Hoover wrote: > Heartland Clojure Users, > > I'm giving a presentation on Clojure next month for the Indianapolis ALT.NET > group. The talk is aimed at .NET programmers, introducing Clojure and > showing them why they might care. > > More description and me

Re: test-is: (is (thrown? ...)) & exceptions & REPL

2009-02-05 Thread Stuart Sierra
On Feb 5, 9:28 am, Jeffrey Straszheim wrote: > From a quick glance, it looks like the exceptions that are *not* being > caught are those generated by the compiler, who can't understand the code. >  test-is can't find those because the code doesn't even run in that case. Yes. In the current impl

Re: test-is: (is (thrown? ...)) & exceptions & REPL

2009-02-05 Thread Stuart Sierra
On Feb 5, 9:59 am, Frantisek Sodomka wrote: > PS: I still wonder why REPL has that "(" char after exception. Bug? It's the lazy sequence thing again. The REPL starts printing the sequence, beginning with the "(", before the exception gets thrown. Here's a more obvious example: user=> (map #(/

Re: test-is: (is (thrown? ...)) & exceptions & REPL

2009-02-05 Thread Jeffrey Straszheim
Laziness is sometimes confusing :) On Thu, Feb 5, 2009 at 11:02 AM, Stuart Sierra wrote: > > On Feb 5, 9:59 am, Frantisek Sodomka wrote: > > PS: I still wonder why REPL has that "(" char after exception. Bug? > > It's the lazy sequence thing again. The REPL starts printing the > sequence, begin

Re: anyone going to FOSDEM?

2009-02-05 Thread David Nolen
Raphaël, I will be there presenting the open source meta web project ShiftSpace ( http://shiftspace.org) at the art festival Artefact ( http://www.artefact-festival.be/). Unfortunately this project isn't really Clojure related, it's primarily written in Javascript :) However, two people (including

Re: Questions about a Clojure Datalog

2009-02-05 Thread John Fries
Yes. I can make a strong endorsement for Kodkod, a Java-based relational model finder. http://alloy.mit.edu/kodkod/ I used it fairly extensively last year to solve scheduling problems, and I've corresponded with its creator. One problem with Datalog-style reasoners is that, because they want to g

New York Hadoop User Group, Feb. 10

2009-02-05 Thread Stuart Sierra
Hello, New York! If you're interested, I'm presenting at the New York Hadoop User Group [1] next Tuesday, February 10, at 6:30. I'll talk about using Clojure with Hadoop, among other things. [1] http://www.meetup.com/Hadoop-NYC/ -Stuart Sierra --~--~-~--~~~---~--~--

Macro defining Macros issue.

2009-02-05 Thread Nathanael Cunningham
I've been working on a def-casemacro macro and I've run into some trouble. The macro defines smaller macros based on a supplied name and test function. Each one evaluates the first argument and then uses the test to compare the result to each supplied case, evaluating whatever returns true or raisi

Re: My SLIME installation diary

2009-02-05 Thread Tom Emerson
On Wed, Feb 4, 2009 at 4:36 PM, chris wrote: [snip] > My slime setup currently fails completely on windows, however. The > slime repl never starts; is there a way to get slime to dump all of > its communication (both ways, not just sending) to a file? Ditto, I'm still busted on Windows with the

Re: Macro defining Macros issue.

2009-02-05 Thread Meikel Brandmeyer
Hi, first things first: what you want to do is available as condp in the core library of Clojure. That said, here some things I noticed in your macro. You should not capture variables in your macros. That's bad style and might lead to clashes of names. Clojure provides the foo# notation to gener

Re: Macro defining Macros issue.

2009-02-05 Thread Stuart Sierra
On Feb 5, 1:04 pm, Nathanael Cunningham wrote: > I've been working on a def-casemacro macro and I've run into some trouble. > The macro defines smaller macros based on a supplied name and test function. > Each one evaluates the first argument and then uses the test to compare the > result to each

Re: My SLIME installation diary

2009-02-05 Thread chris
I haven't seen a clear argument about the classpath variable one way or another. I also haven't figured out an elegant way to deal with it. I have no problem running a shell script from a terminal I want to develop with to setup classpath to be exactly what I expect it to be on a unix system. O

Re: New York Hadoop User Group, Feb. 10

2009-02-05 Thread Vincent Foley
Do you have slides for those of us who cannot attend? On Feb 5, 12:33 pm, Stuart Sierra wrote: > Hello, New York!  If you're interested, I'm presenting at the New York > Hadoop User Group [1] next Tuesday, February 10, at 6:30. > > I'll talk about using Clojure with Hadoop, among other things. >

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread chris
A protocol is a level of abstraction above an interface. Java (and c++) virtual dispatch is one implementation of a meta-object protocol, where dispatch is dynamic upon the first argument to the function and object derivation means a certain order of function overriding, etc. Most likely mikel i

Denver/Boulder Clojure users

2009-02-05 Thread chris
Are there any existing clojure users in the Denver/Boulder area (other than me)?. Chris --~--~-~--~~~---~--~~ 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 T

Re: Denver/Boulder Clojure users

2009-02-05 Thread Brian Doyle
I live in southeast Denver and have been doing some Clojure on my own for a few months now. On Thu, Feb 5, 2009 at 12:39 PM, chris wrote: > > Are there any existing clojure users in the Denver/Boulder area (other > than me)?. > > Chris > > > --~--~-~--~~~---~--~~

Re: Macro defining Macros issue.

2009-02-05 Thread Nathan Cunningham
Yup, that solves it. A while back the blah# didn't support working in nested back ticks. I hadn't realized they fixed it. Or for that matter added condp :) Thanks! On Feb 5, 1:42 pm, Meikel Brandmeyer wrote: > Hi, > > first things first: what you want to do is available as condp in > the core l

assert-args private?

2009-02-05 Thread Jeffrey Straszheim
Is there a reason the assert-args macro is private to core? It seems like it would be generally useful. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Seattle Clojurians

2009-02-05 Thread Phil Hagelberg
I realize this comes a day late since the meeting just happened, but after seeing all these local group threads, I thought I'd mention that the Seattle Functional Group meets every month or so at various locations around Seattle: SeaFunc is Seattle. SeaFunc is functional. Functional language.

Clojure Simulation Redux (more on Clojure Optimization)

2009-02-05 Thread David Nolen
For those who are interested in Clojure performance, I've updated my flocking example from earlier, which uses Roland's excellent Processing library. http://github.com/swannodette/clojure-stuff/blob/80035bb3b76c21d39d6f8011e9a27aa1116b/flocking.clj It is twice as fast as the previous version a

Re: Questions about a Clojure Datalog

2009-02-05 Thread Rich Hickey
Thanks for the pointer to Kodkod - it looks very interesting. I wonder if we aren't talking apples and oranges though. Datalog may be a basic reasoner, but it's a simple recursive query language for data. Can you even get all results out of a SAT solver or do they stop when satisfiable? It's for

Re: My SLIME installation diary

2009-02-05 Thread chris
http://bitbucket.org/shoover/clojure-box-swank-clojuremq/src/11bec919b978/hack-repl-hang This might fix it for your windows box. Check this thread: http://groups.google.com/group/clojure/browse_thread/thread/6c195c35ae9a7eb8/29dec28f8e8fafd5?lnk=gst&q=windows+slime+hang#29dec28f8e8fafd5 Chris

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > I don't argue that this model is better than what you're doing with > Spinoza, but for years (see > http://www.mactech.com/articles/frameworks/8_2/Protocol_Evins.html > from 1994) I've wanted an object model that explicitly separates > structure from protocol, and since I partially built one in

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
(isa? [:spinoza-example-one/circle] [:spinoza/object]) ;; true Just to note, the above shows that protocols could have their own inheritance chain. This is insanely powerful and could be implemented very quickly. --~--~-~--~~~---~--~~ You received this message bec

Re: Questions about a Clojure Datalog

2009-02-05 Thread Jeffrey Straszheim
There is no reason to have just one option. On Thu, Feb 5, 2009 at 3:59 PM, Rich Hickey wrote: > > Thanks for the pointer to Kodkod - it looks very interesting. > > I wonder if we aren't talking apples and oranges though. Datalog may > be a basic reasoner, but it's a simple recursive query langu

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 6:36 am, Laurent PETIT wrote: > Doesn't that sound  like multifunctions whose dispatching is tied to the > type ('model') of a 'thing' ? Yes, but see below. > Once again, does'nt this correspond to the introduction of the interface > concept in java ? No. I think the article I li

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 3:01 pm, David Nolen wrote: > > I don't argue that this model is better than what you're doing with > > Spinoza, but for years (see > >http://www.mactech.com/articles/frameworks/8_2/Protocol_Evins.html > > from 1994) I've wanted an object model that explicitly separates > > structure

Pretty Printer

2009-02-05 Thread Jeffrey Straszheim
Is there a pretty printer out there for Clojure anywhere? I'm crying now without one. --~--~-~--~~~---~--~~ 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: android app development with clojure

2009-02-05 Thread Remco van 't Veer
I've managed to get to startup time down from 12 seconds to 7 on the emulator and hope get it below 4 seconds tomorrow. A lot of time is spend in LispReader when the core constants are initialized. I've altered the compiler to emit type specific code for the basic cases, thus bypassing LispReade

map-method

2009-02-05 Thread kyle smith
I often need to call a java method on each element in a collection. I didn't find anything on the group, so I wrote a macro. (defmacro map-method [method coll & args] "Calls the given method on each item in the collection." `(map (fn [x#] (. x# ~@(if args (concat (li

Re: Pretty Printer

2009-02-05 Thread Tom Faulhaber
I'm about half-way through creating one at http://github.com/tomfaulhaber/cl-format/tree/pprint It should be ready in a week or two, depending on how much work and family intrude on my hacking. Any particular features folks are interested in? Tom On Feb 5, 3:59 pm, Jeffrey Straszheim wrote:

Re: Pretty Printer

2009-02-05 Thread Jeffrey Straszheim
I would like it if it could handle sets and hashes well, including nested sets of hashes (relations in Clojure speak). So we'd get something like: #{ { :name "Fred" :department :accounting } { :name "Sally" :department :engineering } { :name "Dinesh" :department :man

Re: Pretty Printer

2009-02-05 Thread Laurent PETIT
Hello, Really naive questions concerning the features : Will it be able to work on large chunks of code, such as an entire file ? Will it have to run on the runtime of the pretty printed code, or will it be able to pretty print any code given as a String ? How would it handle the case of ncorrect

Re: map-method

2009-02-05 Thread Jeffrey Straszheim
Would memfn not work for you? http://clojure.org/java_interop On Thu, Feb 5, 2009 at 7:24 PM, kyle smith wrote: > > I often need to call a java method on each element in a collection. I > didn't find anything on the group, so I wrote a macro. > > (defmacro map-method [method coll & args] > "

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > I'm not looking for a way to statically define protocols in which > classes participate. Consider an example similar to the one I gave in > my reply to Laurent: Static defining of anything is just a matter of chose, especially in Clojure. For example in Spinoza you have pose-as which changes

Re: map-method

2009-02-05 Thread Nathan Kitchen
Or anonymous function literals? user=> (map #(.length %) ["mary" "had" "a" "little" "lamb"]) (4 3 1 6 4) user=> (map #(.indexOf % (int \a)) ["mary" "had" "a" "little" "lamb"]) (1 1 0 -1 1) On Feb 5, 5:05 pm, Jeffrey Straszheim wrote: > Would memfn not work for you? > > http://clojure.org/java_

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > The fly in the ointment is: what happens if both > protocols specialize frob? Then Clojure will complain that it can't > tell which method to call. In order to resolve that problem, we must > use prefer-method to declare that one protocol or the other is > preferred. > > But what if I want to

Re: Pretty Printer

2009-02-05 Thread Tom Faulhaber
Yup, it will handle all Clojure data types in arbitrary nesting. It will be customizable if you don't like the defaults (though that might not be documented or finalized right away). With the cl-format stuff (and this is a branch of the same project since it shares a bunch of code and I didn't wa

Re: map-method

2009-02-05 Thread kyle smith
Of course those would work, but I got sick of typing them over and over. (map-method length ["mary" "had" "a" "little" "lamb"]) (map-method indexOf ["mary" "had" "a" "little" "lamb"] (int \a)) I find typing # and % repetitive, so this is just a little syntactic sugar. --~--~-~--~~---

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 7:12 pm, David Nolen wrote: > > I'm not looking for a way to statically define protocols in which > > classes participate. Consider an example similar to the one I gave in > > my reply to Laurent: > > Static defining of anything is just a matter of chose, especially in > Clojure.  For

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 7:44 pm, David Nolen wrote: > >  The fly in the ointment is: what happens if both > > protocols specialize frob? Then Clojure will complain that it can't > > tell which method to call. In order to resolve that problem, we must > > use prefer-method to declare that one protocol or the

Re: New York Hadoop User Group, Feb. 10

2009-02-05 Thread Stuart Sierra
On Feb 5, 2:12 pm, Vincent Foley wrote: > Do you have slides for those of us who cannot attend? I'll post a link when I finish them. :) But my slides tend to be images, not outlines. I don't think this meetup is recorded. -Stuart Sierra --~--~-~--~~~---~--~~ You

Re: Pretty Printer

2009-02-05 Thread Jeffrey Straszheim
Please hurry :) But seriously, that sounds great! On Thu, Feb 5, 2009 at 8:48 PM, Tom Faulhaber wrote: > > Yup, it will handle all Clojure data types in arbitrary nesting. It > will be customizable if you don't like the defaults (though that might > not be documented or finalized right away). >

Re: map-method

2009-02-05 Thread Jeffrey Straszheim
Good point, and a good reason for a macro. On Thu, Feb 5, 2009 at 8:50 PM, kyle smith wrote: > > Of course those would work, but I got sick of typing them over and > over. > > (map-method length ["mary" "had" "a" "little" "lamb"]) > (map-method indexOf ["mary" "had" "a" "little" "lamb"] (int \a)

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-05 Thread AlamedaMike
Vlad, thanks for updating the guide. I've saved the new version. Tim, thanks for the ideas. I've tried both and both work well. It did get me thinking that it would be great to have a way to interrogate an open gui app from the command line, or perhaps, from a separate area in the app itself (s

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-05 Thread Timothy Pratley
> It did get me thinking that it would be great to have a way to > interrogate an open gui app from the command line, or perhaps, from a > separate area in the app itself (say, a special "debugging" tab in the > main window). Having a standard way to alter the app while it's > running would be som

Re: test-is: is called? [PATCH]

2009-02-05 Thread Allen Rohner
On Jan 6, 10:06 pm, Allen Rohner wrote: > I had to revisit my test stubbing/expectation code after the recent > changes to test-is. The good news is, because of the excellent change > to make "is" a multi-method, the expectation code easily fits into > test-is. The following patch adds a new asse

Newbie: Trying to defer evaluation of unbound variable arguments until needed with macros

2009-02-05 Thread samppi
I tried asking about this yesterday, but it seems like I expressed my problem poorly. Anyways, here's another shot. :) I have a little parser library. With its metafunctions, one can create rules that accept tokens and spit out a result or nil if the tokens it receives are invalid. For instance,

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > (prefer-method frob ::idea ::thing) > (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing]) (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea]) Provide a dispatch fn that extracts the runtime tag. --~--~-~--~~~---~--~~ You received th

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
Have thoughts about this, will have to collect them, will reply soon. On Thu, Feb 5, 2009 at 9:06 PM, mikel wrote: > > > > On Feb 5, 7:12 pm, David Nolen wrote: > > > I'm not looking for a way to statically define protocols in which > > > classes participate. Consider an example similar to the

Question about clojure.lang.RT.load() code

2009-02-05 Thread Laurent PETIT
Hello, Is there a reason for the test for (classURL==null) being one of the condition to try loading the class, in the code of RT.load() (see below the line with the comment at its end) ? I think the code will work because there is a catch clause in loadClassForName, but I can't see any reason to

Re: New York Hadoop User Group, Feb. 10

2009-02-05 Thread H Durer
On Fri, Feb 6, 2009 at 03:05, Stuart Sierra wrote: > On Feb 5, 2:12 pm, Vincent Foley wrote: >> Do you have slides for those of us who cannot attend? > > I'll post a link when I finish them. :) But my slides tend to be > images, not outlines. I don't think this meetup is recorded. That's a sh