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: First Release of Chimp available

2008-10-08 Thread Mitch
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 All the other commands work fine though! Thanks for the plugin! -Mitch On Aug 18, 3:47 pm, Meikel Brandmeyer <[EMAIL P

Re: Support for destructuring in clojure/binding

2008-10-08 Thread Stephen C. Gilardi
Rich, This is code from my socket repl that sparked my interest in support for destructuring in clojure/binding. (defn socket-streams ;; returns a vector of 3 streams [s] [(LineNumberingPushbackReader. (InputStreamReader. (.getInputStream s) "UTF-8")) (OutputStreamWriter. (.get

Re: GUIs in Clojure

2008-10-08 Thread Stephen C. Gilardi
On Oct 8, 2008, at 6:19 PM, Michael Beauregard wrote: > The nasty part that I haven't spent any time thinking about is the > LayoutManager gong show in swing. That sounds much harder to solve > declaratively without writing a bunch of LMs that support simplifying > the declarative style. Possibl

Re: GUIs in Clojure

2008-10-08 Thread Stuart Sierra
On Oct 8, 7:55 pm, Ande Turner <[EMAIL PROTECTED]> wrote: > Are there any examples of GUI libraries designed for the functional > programming model that you know of I could go examine first?  Purely > from a syntax point of view.  Lispers?  Is there such as thing > already? There are a handful of

Re: First Release of Chimp available

2008-10-08 Thread Jonas Bengtsson
Hi, Excellent, thanks! It almost works now, however something fishy is going on when it tries to launch screen from vim. I've done the following setting: :let g:chimp#ScreenCommand="/usr/bin/screen" which means that chimp.vim executes: call system('/usr/bin/screen -x 8844.chimp -X eval "sele

Re: gen-class and namespace

2008-10-08 Thread Chouser
On Wed, Oct 8, 2008 at 5:32 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > > 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 p

Re: GUIs in Clojure

2008-10-08 Thread Ande Turner
Personally I've always had a through dislike for Swing, and now I'm looking into its implementation I dislike it even more. Replacing Swing entirely would be something I could seriously delve into! I like the idea of using a XAML style layout-file to create UIs. A threadsafe Swing replacement w

Re: GUIs in Clojure

2008-10-08 Thread Tom Emerson
Putting on a heretical hat, it seems that trying to utilize a GUI library designed for Java's imperative programming model from a functional language is an exercise in frustration trying to pound a square peg through a round whole. While I like Chouser's example (it's very cool, and makes a good d

Re: GUIs in Clojure

2008-10-08 Thread Michael Beauregard
I spent a few hours writing a macro that would allow a more declarative gui than the usual swing approach. I didn't finish it, but concluded that this could be quite doable. For example, I was aiming for a macro that would allow the following declarative style: [Note that I don't have the actual

Re: GUIs in Clojure

2008-10-08 Thread Chouser
On Wed, Oct 8, 2008 at 5:37 PM, Bob <[EMAIL PROTECTED]> wrote: > Does anyone have a non-trivial example of a Swing program done the > Clojure way? This probably only counts as trivial, but it's what I've got, so I hope it helps a little. I wrote it up for a talk I gave, so it can be run a demo,

Re: First Release of Chimp available

2008-10-08 Thread Meikel Brandmeyer
Hello, Am 08.10.2008 um 23:16 schrieb Jonas Bengtsson: Trying to get Chimp running under cygwin. It seems like it depends on the following packages: vim, screen, util-linux (for getopt). I use it at work with a Windows vim and Cygwin screen. The idea is to start clojure with the chimp wrapper.

Re: Transitioning from Java to Clojure

2008-10-08 Thread MikeM
> What project types lend themselves to using Java over Clojure, vice > versa, or in combination? > A project where a GUI-building tool (such as Matisse in Netbeans) is needed would be a case where Java may still be required. Anything done in Java can be done in Clojure quite readily, with proxy

Re: GUIs in Clojure

2008-10-08 Thread Ande Turner
As I've just picked up on Clojure myself. First of all I was wondering if anyone was using the Qt's Jambi bindings for GUIs ? I'm just delving into the details of how Swing is implemented at the moment, can't say I agree with half of the "design" decisions myself. Swing isn't thread safe, althoug

GUIs in Clojure

2008-10-08 Thread Mitch
I'm interested in doing a GUI program in clojure, but the functional style of clojure doesn't seem to blend too well with the normal Java GUI libraries. Does anybody have any advice on using clojure for GUI programming? I've seen Rich's ants demo, but that isn't really an event driven GUI progra

Re: GUIs in Clojure

2008-10-08 Thread Bob
Yes, I'm very interested in this question as well. I'm learning clojure and its my first attempt at functional programming. And I was thinking of writing a swing GUI program to try it out. But it would seem the GUI state is going to be a mass of mutable state which doesn't map well to the funct

Re: regex literal syntax

2008-10-08 Thread Bob
Yes, I like this. The double backslashing is really a pain and confused me at first. Get off that road now while clojure is still pretty new. Bob On Oct 8, 9:03 am, Chouser <[EMAIL PROTECTED]> wrote: > On Wed, Oct 8, 2008 at 8:08 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > Will existing C

gen-class and namespace

2008-10-08 Thread Meikel Brandmeyer
Dear Clojurians, 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. But now we are in trouble, since we have to duplicate any shared initialisation between bar.clj and Baz.clj. We

Re: First Release of Chimp available

2008-10-08 Thread Jonas Bengtsson
Hi Meikel, Trying to get Chimp running under cygwin. It seems like it depends on the following packages: vim, screen, util-linux (for getopt). However, when I try to run chimp, screen flashes only to terminate. Is that the way it's supposed to work? What are the exact steps to use chimp? Is the

Re: two dimensional arrays

2008-10-08 Thread Raoul Duke
> just in clojure, I've ended up implementing something like that in > several languages) - I'd have thought 2d rectangular arrays were a lot > more popular a data structure than that ja, it has always boggled my mind that such things are generally lacking standardization in languages. --~--~---

Re: On Lisp -> Clojure

2008-10-08 Thread Fogus
Chapter 4 now up. http://www.earthvssoup.com/2008/10/08/on-lisp-clojure-chapter-4/ In this episode we see Rich Hickey slap a n00b. ;) -m --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: two dimensional arrays

2008-10-08 Thread Martin DeMello
On Oct 8, 8:06 am, "Mark H." <[EMAIL PROTECTED]> wrote: > > If you don't like vector-of-vectors or maps, you could write some > syntactic sugar for mapping two-dimensional indexing onto a one- > dimensionally-indexed vector, e.g., for an n x n array with Fortran- > style indexing: > > (i, j) -> i

Re: Syntax sugar suggestion for maps and vectors

2008-10-08 Thread James Reeves
On Oct 8, 1:17 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > It conflicts with the default value capability of get: > > ({:a 1 :b 2} :c 5) > > -> 5 Ah, this I didn't know. I've been using (or (map key) default) when I could have been writing (map key default). I guess that means that calling a ha

Re: regex literal syntax

2008-10-08 Thread J. McConnell
On Wed, Oct 8, 2008 at 11:03 AM, Chouser <[EMAIL PROTECTED]> wrote: > > Of course if this change is unacceptable, these proposed rules could > be applied to a new dispatch macro. One option would be something > like #r/foo/ that would allow your choice of delimiters to further > reduce the need f

Re: two dimensional arrays

2008-10-08 Thread Mark H.
On Oct 7, 6:30 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > How do you make a two-dimensional array of a given size? (e.g. (make- > array '(i j)) in common lisp) > > I want to do stuff like, e.g., representing a chessboard, where I can > index into cells and update them. If you don't like vect

Re: regex literal syntax

2008-10-08 Thread Chouser
On Wed, Oct 8, 2008 at 8:08 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > Will existing Clojure regex (consumer) code need to change, i.e. will > people need to modify their existing #"" literals and if so in what > way? Yes, many existing #"" literals would have new meaning or become invalid un

Re: Erlang vs Clojure

2008-10-08 Thread Rich Hickey
On Oct 8, 9:59 am, Krzysztof Kliś <[EMAIL PROTECTED]> wrote: > Due to my interest in Erlang and functional programming in general, > for some time I have been following a blog by Jonas Bonér > athttp://jonasboner.com/ > This guy is an expert on Terracotta and he managed to cluster JRuby > and S

Re: Erlang vs Clojure

2008-10-08 Thread Krzysztof Kliś
Due to my interest in Erlang and functional programming in general, for some time I have been following a blog by Jonas Bonér at http://jonasboner.com/ This guy is an expert on Terracotta and he managed to cluster JRuby and Scala using Terracotta (he described it on his blog). I think it would be

Re: regex literal syntax

2008-10-08 Thread pc
I think this is a great idea. On Oct 8, 5:08 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 7, 11:18 pm, Chouser <[EMAIL PROTECTED]> wrote: > > > > > Is it bad etiquette to reply to myself?  I thought it might be useful > > to compare the proposed syntax with that of other languages with goo

Re: Creating a n-length vector filled with zeroes?

2008-10-08 Thread Rich Hickey
On Oct 8, 7:53 am, "Simo Melenius" <[EMAIL PROTECTED]> wrote: > 2008/10/8 CuppoJava <[EMAIL PROTECTED]>: > > > > > I'm very new to clojure, and I'm just wondering what's the most > > efficient way of creating a vector of zeroes. > ... > > It looks pretty bad to me. My java code is more terse tha

Re: Creating a n-length vector filled with zeroes?

2008-10-08 Thread Simo Melenius
2008/10/8 CuppoJava <[EMAIL PROTECTED]>: > I'm very new to clojure, and I'm just wondering what's the most > efficient way of creating a vector of zeroes. ... > It looks pretty bad to me. My java code is more terse than this. > Thanks for your help. I would write something like this to create a

Re: Syntax sugar suggestion for maps and vectors

2008-10-08 Thread Rich Hickey
On Oct 8, 4:45 am, James Reeves <[EMAIL PROTECTED]> wrote: > Is there any disadvantage to making: > > (map-or-vector :foo "bar" 5) > > Equivalent to: > > (((map-or-vector :foo) "bar") 5) > > For hash maps and vectors? As far as I can see, this doesn't conflict > with any other syntax, and it wou

Re: regex literal syntax

2008-10-08 Thread Rich Hickey
On Oct 7, 11:18 pm, Chouser <[EMAIL PROTECTED]> wrote: > Is it bad etiquette to reply to myself? I thought it might be useful > to compare the proposed syntax with that of other languages with good > regex support. > > I tried all the examples from my previous message in Perl, Python, > Ruby, a

Re: Bug in isa??

2008-10-08 Thread Rich Hickey
On Oct 8, 2:24 am, mb <[EMAIL PROTECTED]> wrote: > 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. > Fixed - thanks for the report,

Re: For socket repl: request redirectable *err* var

2008-10-08 Thread Rich Hickey
On Oct 6, 11:36 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > It's either attached to this message or uploaded to the group as: > > redirectable-stderr.patch > > Thanks, > > --Steve > > On Oct 6, 2008, at 8:42 PM, Rich Hickey wrote: > > > On Oct 6, 8:37 pm, "Stephen C. Gilardi" <

Re: Destructuring bind question

2008-10-08 Thread Rich Hickey
On Oct 7, 9:39 pm, Tom Hicks <[EMAIL PROTECTED]> wrote: > This destructuring on sequences works: > > user=> (let [[:as m] [1 2]] m) > [1 2] > > but this one on associations doesn't (and it seems like it should): > > user=> (let [{:as m} {:b 1 :c 2}] m) > > java.lang.NullPointerException > clojur

Re: Creating a n-length vector filled with zeroes?

2008-10-08 Thread James Reeves
On Oct 8, 4:35 am, CuppoJava <[EMAIL PROTECTED]> wrote: > I'm very new to clojure, and I'm just wondering what's the most > efficient way of creating a vector of zeroes. I'm not sure about efficiency, but I'd write it like: (vec (take cols (constantly 0))) - James --~--~-~--~~--

Re: Creating a n-length vector filled with zeroes?

2008-10-08 Thread Parth Malwankar
On Oct 8, 8:35 am, CuppoJava <[EMAIL PROTECTED]> wrote: > Hi, > I'm very new to clojure, and I'm just wondering what's the most > efficient way of creating a vector of zeroes. This is one way. user=> (vec (replicate 10 0)) [0 0 0 0 0 0 0 0 0 0] also user=> (into [] (replicate 10 0)) [0 0 0 0

Transitioning from Java to Clojure

2008-10-08 Thread Ande Turner
After discovering Clojure I have spent the last few days immersed in it. This question is directed at prominently at Java programmers who have transitioned to Clojure: What project types lend themselves to using Java over Clojure, vice versa, or in combination? Which programs which you would hav

Creating a n-length vector filled with zeroes?

2008-10-08 Thread CuppoJava
Hi, I'm very new to clojure, and I'm just wondering what's the most efficient way of creating a vector of zeroes. This is my current code: (loop [row [] i 0] (if (= i cols) row (recur (assoc row i 0) (inc i It looks pretty bad to me. My java code is more terse than

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 --~--~-~--~~~---~--~-

Syntax sugar suggestion for maps and vectors

2008-10-08 Thread James Reeves
Is there any disadvantage to making: (map-or-vector :foo "bar" 5) Equivalent to: (((map-or-vector :foo) "bar") 5) For hash maps and vectors? As far as I can see, this doesn't conflict with any other syntax, and it would cut down on the brackets when dealing with maps within maps. - James --~