Testing private functions from another namespace?

2010-05-08 Thread Mark Engelberg
Is there an easy way to use clojure.test to test private functions of one namespace from another namespace? I remember seeing here that there is some sort of trickery one can do to see the private vars from another namespace, but I don't know how easy that is, or how "unsafe" it is in the context

Question about namespaces

2010-05-08 Thread Mark Engelberg
I've seen people say here that it's relatively easy to break up a namespace into smaller components, so I'm wondering if I'm missing something. I'd appreciate some guidance about how to keep namespaces well-organized. In Python, let's say I have a library "mylibrary.py", and from various files I

Re: Easier way to run Clojure from command line?

2010-05-08 Thread Anne Ogborn
Dunno - on mine it never finds the project's own files. This is with an unmodified install of cascalog, for instance. C:\Documents and Settings\Annie\My Documents\cascalogplay\cascalog>lein repl Clojure 1.1.0 user=> (use 'cascalog.playground) java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0

Re: Easier way to run Clojure from command line?

2010-05-08 Thread gary ng
On Sat, May 8, 2010 at 4:00 PM, Anne Ogborn wrote: > >Have you seen Leiningen? [1]. It seems like it will do what > you want > >with "lein repl", and additionally it has some nice features for > >acquiring dependencies and building a .jar from your project. > > Unfortunately lein repl is apparent

congomongo memory leak?

2010-05-08 Thread Mark Engelberg
A couple days ago, on IRC, I observed some folks talking about a possible memory leak in the somnium congomongo clojure interface to mongoDB. The discussion suggested that each fetch opens the file without closing it, and pretty soon you get an error. Does anyone know what happened with this? Is

Couch-fuse

2010-05-08 Thread ronen
Iv just released the first version of couch-fuse a Couchdb fuse filesystem that is implemented in Clojure, for more details head on to http://github.com/narkisr/couch-fuse. Ronen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Easier way to run Clojure from command line?

2010-05-08 Thread Anne Ogborn
>Have you seen Leiningen? [1]. It seems like it will do what you want >with "lein repl", and additionally it has some nice features for >acquiring dependencies and building a .jar from your project. Unfortunately lein repl is apparently broken on windows. I just spent several hours on private IR

Why Clojure rocks..

2010-05-08 Thread Base
I just replaced 443 lines of java with 61 lines of Clojure. THANK YOU RICH !!! -- 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 moderated - please be pa

Re: code review:replace-first

2010-05-08 Thread gary ng
On Sat, May 8, 2010 at 1:01 PM, Meikel Brandmeyer wrote: > Hi, > > if you want to go low-level you can use lazy-seq. > > (defn replace-first > [needle replacement coll] > (lazy-seq >(when-let [s (seq coll)] > (let [fst (first s)] >(if (= fst needle) > (cons replacement

Re: code review:replace-first

2010-05-08 Thread Meikel Brandmeyer
Hi, if you want to go low-level you can use lazy-seq. (defn replace-first [needle replacement coll] (lazy-seq (when-let [s (seq coll)] (let [fst (first s)] (if (= fst needle) (cons replacement (rest s)) (cons fst (replace-first needle replacement (rest s)

Re: Extending JPanel with gen-class

2010-05-08 Thread Meikel Brandmeyer
Hi, On Fri, May 07, 2010 at 10:03:47PM -0700, cap11235 wrote: > I'm trying to extend JPanel using gen-class, and I can't find a way to > implement a constructor so I can add a KeyListener to it. From what I > can tell, :init is only for setting up the :state reference for the > class, and calling

Re: code review:replace-first

2010-05-08 Thread gary ng
I would use reductions(i.e. Haskell's scanl) given my understanding that clojure sequence is just as lazy as Haskell. (rest (map first (reductions (fn [ [v a b] x ] (if (= a x) [b nil b] [x a b])) [nil 2 3] '(1 1 2 2 3 4 I use nil here as 'something that would not appear in the list', I am su

Re: Easier way to run Clojure from command line?

2010-05-08 Thread gary ng
On Sat, May 8, 2010 at 9:20 AM, Adam Jones wrote: > Have you seen Leiningen? [1]. It seems like it will do what you want > with "lein repl", and additionally it has some nice features for > acquiring dependencies and building a .jar from your project. > > [1] http://github.com/technomancy/leining

Re: Easier way to run Clojure from command line?

2010-05-08 Thread Michael Kohl
On Fri, May 7, 2010 at 10:43 PM, Jason Smith wrote: > How about adding *clojure.bat* to the distribution for us Windows > people.  A shell script for Unix would be nice too... http://bitbucket.org/kasim/clojurew/ http://github.com/citizen428/ClojureX HTH Michael -- You received this message be

Re: Easier way to run Clojure from command line?

2010-05-08 Thread Adam Jones
Have you seen Leiningen? [1]. It seems like it will do what you want with "lein repl", and additionally it has some nice features for acquiring dependencies and building a .jar from your project. [1] http://github.com/technomancy/leiningen#readme On May 7, 1:43 pm, Jason Smith wrote: > So the pr

Re: ClojureCLR and WPF Data Binding

2010-05-08 Thread Anders Rune Jensen
On Sat, May 8, 2010 at 4:10 PM, Mike K wrote: >> Anyone else looking at this sort of thing, or even interested? +1 > I'm very interested although I'm not looking at it right now (still > taking baby steps learning Clojure while waiting for ClojureCLR to > mature a bit) > > ClojureCLR + WPF / Sil

Re: code review:replace-first

2010-05-08 Thread Jeff Valk
On Sat May 08 2010 at 08:38 am, Mark J. Reed wrote: > But there are no doubt better ways to do it, probably built in or in > clojure.core. Using 'split-with' from core seems handy here: clojure.core/split-with ([pred coll]) Returns a vector of [(take-while pred coll) (drop-while pred coll)] S

Re: code review:replace-first

2010-05-08 Thread Craig Andera
> Hi,there! > > I need a function that replaces a first found element of list. > like that, > >>(replace-first :a :b [:c :c :a :c :a] > [:c :c :b :c :a] >       ~~ > ;replace first :a to :b An interesting problem for a Sunday morning when I ought to be cleaning the house. :) Here are my (admittedl

Re: ClojureCLR and WPF Data Binding

2010-05-08 Thread Mike K
> Anyone else looking at this sort of thing, or even interested? I'm very interested although I'm not looking at it right now (still taking baby steps learning Clojure while waiting for ClojureCLR to mature a bit) ClojureCLR + WPF / Silverlight is ultimately where I want to go. Thanks for being a

Re: labrepl updated

2010-05-08 Thread Craig Andera
> Changed my mind and fixed this on the Clojure side [1]. Now you should be > able to bind *err* to any old Writer you like. > > Stu > > [1] > http://github.com/richhickey/clojure/tree/c4eb5719b0f30ea4c113e6e98a1c171c43a01abe Just checked this out. Working fine now. Thanks! I'll let you know if I

Re: code review:replace-first

2010-05-08 Thread Mark J. Reed
You're scanning the list twice, first to find the element position, and then to do the split; it's better to do it all at once. Here's a simple version: (defn replace-first [from to in] (cond (empty? in) in (= (first in) from) (cons to (rest in)) :else (cons (first in) (re

code review:replace-first

2010-05-08 Thread ken.coba
Hi,there! I need a function that replaces a first found element of list. like that, >(replace-first :a :b [:c :c :a :c :a] [:c :c :b :c :a] ~~ ;replace first :a to :b and my code is as follows. ---code begin-- (use '[clojure.contrib.seq-utils]) (de

Extending JPanel with gen-class

2010-05-08 Thread cap11235
I'm trying to extend JPanel using gen-class, and I can't find a way to implement a constructor so I can add a KeyListener to it. From what I can tell, :init is only for setting up the :state reference for the class, and calling super's contructors. I tried having it have "this" as a parameter, but

Easier way to run Clojure from command line?

2010-05-08 Thread Jason Smith
So the proscribed way to run Clojure from the command line is to type: >java -cp clojure.jar clojure.main at the command prompt. How about adding *clojure.bat* to the distribution for us Windows people. A shell script for Unix would be nice too... @echo off cls java -cp %~dp0\clojure.jar cloju

Re: Using swank-clojure with clojure-1.2.0-master-SNAPSHOT

2010-05-08 Thread nipra
Hi, On May 7, 10:01 pm, Benjamin Teuber wrote: > Hi, > > I think many people (including me) have the problem that ELPA-swank > uses clojure's old ^-syntax and therefore breaks with clojure-1.2.0- > master-SNAPSHOT > > Does anyone have a plan what I can do assuming I want to keep both the > new cl

Re: ClojureCLR and WPF Data Binding

2010-05-08 Thread Barry Dahlberg
Progress! I may be talking to myself but I figure I should record any answers beside the question. I now have this XAML: Binding to this map: {:foo "Foo value.", :bar "Bar value."} .Net has custom type descriptors which allow you to tap into the reflection process and mess with

Re: ClojureCLR and WPF Data Binding

2010-05-08 Thread Barry Dahlberg
Binding to: {"Foo" "Bar"} With the slightly modified XAML: Prints "Bar" as expected. Close. -- 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 ar

ClojureCLR and WPF Data Binding

2010-05-08 Thread Barry Dahlberg
Hi, I am doing some experiments to see how ClojureCLR could help with some of the challenges in building WPF applications. My question is, what sort of Clojure object can I use as a data context for WPF data binding? For example, given the following XAML: Using Clojure I would like to set

Re: Pack and unpack

2010-05-08 Thread Michael Jaaka
Btw. serialization of data structures in 1.2 works nicely, comunication by RMI works like a charm :) -- 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

Re: Pack and unpack

2010-05-08 Thread Michael Jaaka
OK, already downloaded. But what with writer in io.clj? In old duck- streams.clj I've just used (let [w (writer z1) r (reader z2)] ... ), but now I get just: commons=> java.lang.Exception: Unable to resolve symbol: writer in this context (NO_SOURCE_FILE:108) commons=> My import is (:require (cloj

Re: Pack and unpack

2010-05-08 Thread Michael Jaaka
http://richhickey.github.com/clojure/ OK, already downloaded. But what with writer in io.clj? In old duck- streams.clj I've just used (let [w (writer z1) r (reader z2)] ... ), but now I get just: commons=> java.lang.Exception: Unable to resolve symbol: writer in this context (NO_SOURCE_FILE:108)