Re: Type hints for expressions and a problem

2008-09-10 Thread Mike Hinchey
Right, you need to import or qualify the packages: (defn load-image [name] #^BufferedImage (. javax.imageio.ImageIO (read (new java.io.File name However, since it didn't give me an error for BufferedImage, I think the compiler is just ignoring it in either of your examples. Clojure doesn't

Re: Clojure Poll 09/2008

2008-09-10 Thread Rastislav Kassak
On 9/11/08, jim <[EMAIL PROTECTED]> wrote: > > What I'm doing? > > Learning functional programming concepts (monads, monad transformers, > arrows) > Learning logic programming concepts. > Implementing state machine, parsing and relational algebra/calculus > libraries. > HTML, Javascript and

Re: Clojure Poll 09/2008

2008-09-10 Thread Apurva Sharan
> What are you doing with Clojure? Still learning the language in my spare time :) > What 3 features would you most like to see added next? 1) Like most people, more specific error messages. Error messages that point out the faulty sub-expression would be helpful. 2) Packaging infrastruct

Re: Method dispatch on class - "ns-*" functions accepting symbols

2008-09-10 Thread Stephen C. Gilardi
On Sep 10, 2008, at 2:08 PM, Rich Hickey wrote:It would work, but it seems like overkill. In particular, there's nointention to extend it any further, and all symbol versions do thesame thing, call find-ns and delegate, so maybe just adding a letlevel to the existing fns is best:(let [ns (the-ns ns

Re: Type hints for expressions and a problem

2008-09-10 Thread .Bill Smith
Did you import ImageIO? Bill --~--~-~--~~~---~--~~ 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 PROTEC

Type hints for expressions and a problem

2008-09-10 Thread Alex Charlton
After discovering Clojure, reading everything I could about it, and loving everything I saw, the next logical step was to start playing with it. Being a complete Java novice, I have absolutely no experience with its libraries and was hoping to become more acquainted with them. One of the first th

Re: Clojure Poll 09/2008

2008-09-10 Thread jim
What I'm doing? Learning functional programming concepts (monads, monad transformers, arrows) Learning logic programming concepts. Implementing state machine, parsing and relational algebra/calculus libraries. HTML, Javascript and CSS generators. Writing a net server framework; have an HTTP serve

Re: Clojure Poll 09/2008

2008-09-10 Thread Randall R Schulz
On Wednesday 10 September 2008 16:15, Shawn Hoover wrote: > ... > >1. A native executable would be preferred to launching with java > or a batch file (on Windows, especially, where you're always left > with an extra Y/N prompt after you Ctrl-c out of the REPL). Explore the difference between

Re: Clojure Poll 09/2008

2008-09-10 Thread Shawn Hoover
On Wed, Sep 10, 2008 at 11:40 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > As we rapidly approach 500 members on the group (!) I thought it would > be a good time to conduct another poll: > > > What are you doing with Clojure? > Exploring Lisp and Clojure's functional approach and concurrency t

Re: local functions?

2008-09-10 Thread Meikel Brandmeyer
Hi, Am 11.09.2008 um 00:07 schrieb Allen Rohner: Maybe the solution is to use defn-. Scheme made me used to the local function approach for encapsulation. I don't have a problem with doing (defn foo [x] (defn bar [y] "doc string") (defn baz [z] "doc string2") (do_stuff

Re: Bug: in-ns

2008-09-10 Thread Ben Kearns
Thanks. I missed that when I was reading the reader documentation. On Wed, Sep 10, 2008 at 5:48 PM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: > > On Sep 10, 2008, at 5:37 PM, Ben Kearns wrote: > > user=> (in-ns '1foo) > (in-ns '1foo) > java.lang.NumberFormatException: Invalid number: 1foo >

Re: local functions?

2008-09-10 Thread Allen Rohner
On Sep 10, 5:01 pm, Allen Rohner <[EMAIL PROTECTED]> wrote: > > For very short functions one can use the cut notation: #(...). In case > > there are several functions or functions going over several lines, this > > is a sign that they should go into an own defn(-) with appropriate > > docstring.

Re: local functions?

2008-09-10 Thread Allen Rohner
> For very short functions one can use the cut notation: #(...). In case > there are several functions or functions going over several lines, this > is a sign that they should go into an own defn(-) with appropriate > docstring. Maybe the solution is to use defn-. Scheme made me used to the loca

Re: Bug: in-ns

2008-09-10 Thread Stephen C. Gilardi
On Sep 10, 2008, at 5:37 PM, Ben Kearns wrote: > user=> (in-ns '1foo) > (in-ns '1foo) > java.lang.NumberFormatException: Invalid number: 1foo > > Is there some reason that this is disallowed and should be avoided? Yes, the argument to in-ns is a symbol and symbol names cannot begin with a numb

Re: Clojure Poll 09/2008

2008-09-10 Thread Ozzi Lee
> What are you doing with Clojure? Some simple web stuff, nothing exciting so far. What 3 features would you most like to see added next? 1. Better error messages. 2. Better error messages. 3. Better error messages :-) --~--~-~--~~~---~--~~ You received this me

Re: Clojure Poll 09/2008

2008-09-10 Thread Raoul Duke
total n00b still, here. if chances come up to speed-up the compiler (e.g. would something like Scala's fsc be something one could create for Clojure?), i'd never say no to such changes. :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed

Bug: in-ns

2008-09-10 Thread Ben Kearns
First off, great language. I've not posted before but have been lurking a while and was at one of Rich's talks in NY a while back. I'm still getting my head around what is and isn't allowed in the language and ran across what I think is a bug either in my thinking or in the reader. user=> (in-n

Re: WHILE macro

2008-09-10 Thread wwmorgan
The best solution using the API that I could come up with would be something like (doseq r (take-while identity (repeatedly #(side-effects with many args))) (pr r)) It's useful in the situation where 1. You have a function which can return different values when invoked with the same arguments,

Re: Clojure Poll 09/2008

2008-09-10 Thread Jamie Brandon
> 1. Not a good way to READ from a string, (read (PushbackReader. (StringReader. my-string))) > I've noticed functions can only refer to those previously defined, so you > couldnt have 2 that depend on one another This is because symbols are looked up at compile time. So what you can do is (d

Re: Clojure Poll 09/2008

2008-09-10 Thread John Hodge
> What are you doing with Clojure? Nothing yet, still learning. > > What 3 features would you most like to see added next? > > Just two I can think of: 1) a persistent priority queue 2) a persistent deque, modeled perhaps on Haskell's Data.Sequence. Thanks, Jack --~--~-~--~~---

Re: Clojure Poll 09/2008

2008-09-10 Thread Meikel Brandmeyer
Hi, Am 10.09.2008 um 20:40 schrieb Rich Hickey: What are you doing with Clojure? At home mostly pet projects to learn different aspects of programming: - lazy-map started as closure became a proxy and will finally end up in Java. => Java to Clojure Interface - parser (parser combinator libra

Re: Clojure Poll 09/2008

2008-09-10 Thread Randall R Schulz
On Wednesday 10 September 2008 11:40, Rich Hickey wrote: > As we rapidly approach 500 members on the group (!) I thought it > would be a good time to conduct another poll: > > > What are you doing with Clojure? Tinkering. Contemplating an extensibility mechanism for my theorem prover. > What 3

Re: Clojure Poll 09/2008

2008-09-10 Thread PJ Durai
On Wed, Sep 10, 2008 at 12:40 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > As we rapidly approach 500 members on the group (!) I thought it would > be a good time to conduct another poll: > > > What are you doing with Clojure? For now, java scripting. I love Clojure and LFE (Lisp Flavoured Er

Re: Clojure Poll 09/2008

2008-09-10 Thread .Bill Smith
I use Clojure for informal scripting and for testing Java code. Bill --~--~-~--~~~---~--~~ 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

Re: local functions?

2008-09-10 Thread Meikel Brandmeyer
Hi, Am 10.09.2008 um 21:43 schrieb Allen Rohner: Is there a cleaner way to create local functions than (let [foo (fn [x] ...)] (foo 42)) ? In which way would another notation be cleaner? I think this is mainly an issue of personal taste. So here is mine: For very short funct

Re: Clojure Poll 09/2008

2008-09-10 Thread Michael Reid
Hi, On Wed, Sep 10, 2008 at 2:40 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > What are you doing with Clojure? > Currently I'm working on writing extensions to JSF (JavaServer Faces) that allow seamless use from Clojure. One offshoot of this is to experiment with a browser-based Clojure IDE. >

Re: Clojure Poll 09/2008

2008-09-10 Thread Rastislav Kassak
Yeah, CQL (Clojure Query Language) is that data manipulation example I was mentioning. :) On 9/10/08, Allen Rohner <[EMAIL PROTECTED]> wrote: > > > > What are you doing with Clojure? > > > A webapp using compojure + statistics ( bayes probability, > clustering ) > > > > What 3 features would y

Re: Clojure Poll 09/2008

2008-09-10 Thread Tom Emerson
One possibility would be to come up with a wrapper around SleepyCat's Java DBD implementation... basically it is providing the low-level features you mention on top of which one could build a bunch of different things. On Wed, Sep 10, 2008 at 3:28 PM, Allen Rohner <[EMAIL PROTECTED]> wrote: > > >

Re: Clojure Poll 09/2008

2008-09-10 Thread Raoul Duke
> There are many subtle nuances that have to > be understood, and many things you initially try to do are the 'wrong > way' etc. request-to-all from this newbie: pretty please add even succinct notes about those things to the wiki. somewhere consistent, so other newbies can find them. > 2) > An

Re: Clojure Poll 09/2008

2008-09-10 Thread noahr
I'm actually building a production application with it for the company where I work, which is quite exciting. (Until my permission to do so gets revoked, of course). That's also why I'll no doubt be spamming the list with so many questions :p The application will be of the server-side message dis

Re: local functions?

2008-09-10 Thread Allen Rohner
I apologize for the double post. An emacs shortcut didn't work very well in my firefox edit window. :-). Now to actually finish what I was trying to type. I was considering putting this in Rich's Clojure poll, but I wasn't sure it was broken yet. Is there a cleaner way to create local functions

local functions?

2008-09-10 Thread Allen Rohner
I was considering putting this in Rich's Clojure poll, but I wasn't sure it was broken yet. Is there a cleaner way to create local functions than (let [foo (fn [x] ...)] (foo 42)) ? I find that syntax to be slightly annoying, because you could end up with multiple lines and a

Re: Clojure Poll 09/2008

2008-09-10 Thread Allen Rohner
> What are you doing with Clojure? A webapp using compojure + statistics ( bayes probability, clustering ) > What 3 features would you most like to see added next? 1. friendlier compiler error messages 2. better stack traces (maybe a "clojure-only" mode that only prints the lines in the stack

Re: Clojure Poll 09/2008

2008-09-10 Thread Rastislav Kassak
On 9/10/08, Rich Hickey <[EMAIL PROTECTED]> wrote: > > As we rapidly approach 500 members on the group (!) I thought it would > be a good time to conduct another poll: > > > What are you doing with Clojure? Nothing ATM, not enough time. :) > > > What 3 features would you most like to see add

Clojure Poll 09/2008

2008-09-10 Thread Rich Hickey
As we rapidly approach 500 members on the group (!) I thought it would be a good time to conduct another poll: What are you doing with Clojure? What 3 features would you most like to see added next? Thanks, Rich --~--~-~--~~~---~--~~ You received this messag

Re: Bug: self require -> stack overflow

2008-09-10 Thread Rich Hickey
On Sep 10, 10:32 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Sep 10, 2008, at 7:43 AM, Rich Hickey wrote: > > > If you don't want to wait, submit a patch (and a CA if you haven't > > already), and I'll look at it. I will say that the "silent ignore" > > path is not an option - cycli

WHILE macro

2008-09-10 Thread noahr
I've found the following macro very useful: (similar to a standard language while loop) (defmacro while[v cnd & body] `(loop[] (let [~v ~cnd] (when ~v [EMAIL PROTECTED] (recur) Basically it repeatedly executes BODY while CND (which is constantly re-evaluated) i

Java3D + Clojure comments + questions

2008-09-10 Thread Timothy Pratley
Hi, Firstly I just want to say "Wow" I really like what you have created here. The (.method object args) form is just fantastic! JVM direct access like this seems overpowered. Being able to call anything and everything is such a big win. Being a complete novice I was able to bang the Java3D spin

Re: Method dispatch on class - "ns-*" functions accepting symbols

2008-09-10 Thread Rich Hickey
On Sep 9, 8:17 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Rich mentioned a desire for the "ns-*" functions to accept either a > symbol or a namespace for arguments where they currently accept a > namespace. > > Using a multimethod that dispatches on the class of that argument is > one

Bug in clojure.zip/up?

2008-09-10 Thread Christophe Grand
Hello, I'm playing with zippers (and zip filters) and I think there's a bug when you replace the root: user=> (-> [:before] zip/vector-zip (zip/replace [:after]) zip/up) [[[:after]] nil] Changing (when path ...) to (when pnodes ...) in clojure.zip/up seems to fix it. Christophe --~--~--

Re: Nested (defn)

2008-09-10 Thread Rich Hickey
On Sep 10, 11:33 am, "Michael Reid" <[EMAIL PROTECTED]> wrote: > Hi folks, > > There was a thread a little while back > (http://groups.google.com/group/clojure/browse_thread/thread/8c4bea212...) > about implementing true data hiding by nesting defns under a let, > e.g.: > > (let [hidden-ref (re

Nested (defn)

2008-09-10 Thread Michael Reid
Hi folks, There was a thread a little while back (http://groups.google.com/group/clojure/browse_thread/thread/8c4bea21298693ca) about implementing true data hiding by nesting defns under a let, e.g.: (let [hidden-ref (ref 10)] (defn get-secret [] @hidden-ref)) This was mentioned to be bad st

Re: Bug: self require -> stack overflow

2008-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 4:32 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > The enclosed patch modifies "load" to detect and prevent loading a   > resource while another load of the same resource is pending in the   > same thread. It works at the "load" level using paths so the   > protection is compreh

Re: Bug: self require -> stack overflow

2008-09-10 Thread Stephen C. Gilardi
On Sep 10, 2008, at 7:43 AM, Rich Hickey wrote: > If you don't want to wait, submit a patch (and a CA if you haven't > already), and I'll look at it. I will say that the "silent ignore" > path is not an option - cyclic dependencies are an error you can't > leave in place. There will be other tool

Re: clojure -> javascript

2008-09-10 Thread Randall R Schulz
On Tuesday 09 September 2008 22:37, Chouser wrote: > On Wed, Aug 20, 2008 at 3:06 AM, Rastislav Kassak <[EMAIL PROTECTED]> wrote: > > I'm not sure, if it compiles from class files, at least it probably > > wasn't true in the beginning (when I was studying GWT). > > GWT appears to still compile fr

Re: string-split, help me make it a string again :)

2008-09-10 Thread Chouser
On Wed, Sep 10, 2008 at 9:07 AM, ssecorp <[EMAIL PROTECTED]> wrote: > > So this string-splitting function works but it doesn't look very > aesthetic and returns a list of lists of \char. > > I know I can do (map str list) to turn the chars(?) into strings again > but how do I append them? In gene

string-split, help me make it a string again :)

2008-09-10 Thread ssecorp
So this string-splitting function works but it doesn't look very aesthetic and returns a list of lists of \char. I know I can do (map str list) to turn the chars(?) into strings again but how do I append them? And can it be made to look nicer? I don't find it very readable. (defn split [str del

Re: Bug: self require -> stack overflow

2008-09-10 Thread Rich Hickey
On Sep 10, 1:38 am, ntupel <[EMAIL PROTECTED]> wrote: > On Tue, 2008-09-09 at 23:57 +1000, Brett Morgan wrote: > > On Tue, Sep 9, 2008 at 10:31 PM, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > > > On Sep 9, 11:26 am, "Brett Morgan" <[EMAIL PROTECTED]> wrote: > > >> For C, protection agai