Re: Proposal: libraries should have type hints

2011-11-22 Thread Shantanu Kumar
On Nov 22, 7:30 am, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Nov 21, 2011 at 12:50 PM, Alan Malloy a...@malloys.org wrote: This is way, way faster than using reflection. And all you need in order to remove the duplication is a macro that does the hinting for you: Well, if

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Michael Jaaka
Here is too a problem with building proper path, after M-x clojure- jack-in I got in buffer Debugger entered--Lisp error: (error Could not start swank server: java.lang.NoClassDefFoundError: Files\\Java\\jre6\\lib\\ext\\QTJava/ zip;\;;test;src;C:\\Java\\/lein\\self-installs\\leiningen-1/6/0-

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Michael Jaaka
Maybe I can fix it? Just point me the routine for building path. I will extract it and make unit test which reproduces this error. Than I will fix it. Maybe it will help in both cases - on standalone emacs for windows and emacs in cygwin. On Nov 22, 10:04 am, Michael Jaaka

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Roberto Mannai
The classpath option -cp is not handling correctly the spaces. I'd suggest you to not have spaces in the Windows's paths. Install Java not in c:\Program Files, but for example in c:\develop\Java6 On Tue, Nov 22, 2011 at 10:04 AM, Michael Jaaka michael.ja...@googlemail.com wrote: Here is too a

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Michael Jaaka
I have made some investigation and I noticed a problem at line 56 in test/clojure/test_clojure/java/io.clj There is a difference between toURL and toURI first returns absolute path with spaces, second returns absolute path with %20 in places where the spaces should be now in cygwin and probably

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Michael Jaaka
Sorry the line is 46 not 56 in the file https://github.com/richhickey/clojure/blob/master/test/clojure/test_clojure/java/io.clj On Nov 22, 11:39 am, Michael Jaaka michael.ja...@googlemail.com wrote: I have made some investigation and I noticed a problem at line 56 in

Re: Clojure type selection flowchart: add a translation for your language

2011-11-22 Thread Laurent PETIT
Hmm, wondering if having a formal datastructure representing this flowchart, and then deriving a wizard from this flowchart (text based in REPL, GUI based in CCW), would be fun ? (and maybe also useful ;-) ) 2011/11/17 Chas Emerick cemer...@snowtide.com For those that haven't seen it, I

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Michael Jaaka
Here is the sample code which shows the difference (ns clojure.test-clojure.java.io (:use clojure.test clojure.java.io [clojure.test-helper :only [platform-newlines]]) (:import (java.io File BufferedInputStream FileInputStream InputStreamReader InputStream

*print-dup* and struct maps

2011-11-22 Thread Daniel Janus
Hi, I've encountered this behaviour of *print-dup*: user (defstruct foo :field) #'user/foo user (binding [*print-dup* true] (pr-str (struct foo 10))) #=(clojure.lang.PersistentStructMap/create {:field 10}) user (read-string (binding [*print-dup* true] (pr-str (struct foo 10

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Chris Perkins
I suspect that Windows users are a minority here, and cygwin users are a minority of that minority :) So I'm sure that help with maintaining cygwin compatibility would be appreciated. You should start by sending a contributor agreement: http://clojure.org/contributing - Chris -- You

deprecating butlast?

2011-11-22 Thread Daniel Janus
Hi, Why keep both butlast and drop-last in clojure.core? The latter has the advantage that it's lazy and can drop off more than one element from the end of a seq. In contrast, I can't think of any advantage of butlast, except that it seems to be slightly (ca 20%) faster than (doall (drop-last

Re: Proposal: libraries should have type hints

2011-11-22 Thread Nicolas
Hi ! An interresting point of clojure is that it is dynamically typed. This for a reason. There is a tradeoff in performance but the benefit is that the code is shorter, more expressive and reusable. Type hinting should be exceptionnal and used only in critical areas when you see a huge boost in

Re: Clojure on PyPy

2011-11-22 Thread Dhananjay Nene
On Tuesday, 22 November 2011 12:26:54 UTC+5:30, Andrzej wrote: On 11/22/2011 02:10 PM, Timothy Baldridge wrote: So I got thinking about clojure pypy tonight, and got thinking how easy it would be to adapt my old code to run as a interpreter. So I pulled in a few files, implemented a few

clojure libs and logging

2011-11-22 Thread Keith Irwin
Folks-- I'm working on an experimental library which interfaces with external resources (i.e., not purely functional) and I'd like the library to log things when stuff goes wrong (say, with network connections). I don't want to throw exceptions and let clients handle it because I want to build

Re: clojure libs and logging

2011-11-22 Thread Luc Prefontaine
Hi, Do you have the :disable-implicit-clean option set to false in your project.clj file ? If not, add it to remove the classes from dependencies that otherwise may pollute your target. As far as standard logging in a lib, it might be time to rely on clojure.tools.logging systematically. We

Re: Proposal: libraries should have type hints

2011-11-22 Thread Ben Mabey
On 11/21/11 7:50 AM, Ralph wrote: I want to propose that Clojure libraries should be fully type-hinted -- that is, they should be compiled with the *warn-on-reflection* option turned on and type hints place wherever possible. I understand the argument against type-hinting end-user code until a

Re: Proposal: libraries should have type hints

2011-11-22 Thread Tassilo Horn
Nicolas bousque...@gmail.com writes: An interresting point of clojure is that it is dynamically typed. This for a reason. There is a tradeoff in performance but the benefit is that the code is shorter, more expressive and reusable. Type hinting should be exceptionnal and used only in

Proper parallelism?

2011-11-22 Thread AndyK
I have been using Clojure to write tests on RESTful applications. Since the requests are independent, parallelizing would speed things along. What is the best approach? Using pmap is the obvious first step. Afaik, pmap only creates a small pool of threads. Is there more to gain by going to the

Re: Proper parallelism?

2011-11-22 Thread Linus Ericsson
There's an approach using agents described here: http://travis-whitton.blogspot.com/2009/07/network-sweeping-with-clojure.html It's a bit old, so somethings in the example could be a bit outdated, but the idea may help you forward, /Linus 2011/11/22 AndyK andy.kri...@gmail.com I have been

Re: Can't build clojure cloned from github - 2 tests failed - when running from cygwin

2011-11-22 Thread Michael Jaaka
I'm not and don't feel like an expert to contribute. However I have found that this is a common pitfall Here is the full story described http://maven.apache.org/plugin-developers/common-bugs.html#Converting_between_URLs_and_Filesystem_Paths The same is in official doc from Oracle On 22 Lis,

Re: Use of eval

2011-11-22 Thread vitalyper
Gary, You are probably removing try/catch as well. ClassNonFoundException is expected and silenced with catch. (defn cl-factory Returns a Commons Logging-based implementation of the LoggerFactory protocol, or nil if not available. [] (try (Class/forName foo.bar) ; eval removed

Re: Use of eval

2011-11-22 Thread Gary Trakhman
I think you're confusing compile-time with run-time. A try-catch wouldn't affect the compiler. Perhaps you actually have commons-logging in your classpath? It's pulled in by many libraries. Or you forgot to remove the quote in addition to removing the eval in your testing. Here's the code that

Re: Proposal: libraries should have type hints

2011-11-22 Thread Bill Robertson
I think there is another reasonable case for a type hint. If you've written a function that is not generic, where one type and only one type will do, then why not add a type hint as a form of documentation if nothing else? On Nov 21, 1:58 pm, Nicolas bousque...@gmail.com wrote: Hi ! An

Re: clojure libs and logging

2011-11-22 Thread Keith Irwin
I'm guessing that removing the non-project classes and then just declaring a dependency should work well enough. Couldn't find :disable-implicit-clean in the sample project file technomancy maintains on his github repo, but did use :clean-non-project-classes, which removed the compiled logging

Re: clojure libs and logging

2011-11-22 Thread Phil Hagelberg
On Mon, Nov 21, 2011 at 9:10 PM, Keith Irwin keith.ir...@gmail.com wrote: What's the standard way for including logging in a library? I've included clojure.tools.logging as a dependency, but the resulting jar (lein install), contains clojure.tools.logging classes. Is that okay, given any

Re: Use of eval

2011-11-22 Thread Gary Trakhman
Also I think this line doesn't actually do anything: (Class/forName foo.bar) It will effectively just ask the classloader to load the class. You removed more than the eval in your referenced code, you removed the code that did anything. That code needs to be there. It's eval'd because

Re: Google Maps in Clojurescript

2011-11-22 Thread Sam Ritchie
Roman, I apologize, I never thanked you for this. I finally got around to trying this out last night and put together this small project for anyone else interested: https://github.com/sritchie/contour I'm using Noir server-side. This is just a demo now, but we'll see what comes of it. Here's

Re: Proper parallelism?

2011-11-22 Thread vitalyper
Andy, You can also look into using futures (pmap uses future). In section 11.6.1 of Joy of Clojure there is a recipe how to dispatch multiple RPC calls in parallel using as-futures macro. Obviously, this depends on what you want to do with results of your REST calls. On Nov 22, 11:16 am, AndyK

Re: Use of eval

2011-11-22 Thread vitalyper
Gary, You were right with your initial reply. Sorry I did not get it. Thanks for your help in understanding this. On Nov 22, 1:58 pm, Gary Trakhman gary.trakh...@gmail.com wrote: Also I think this line doesn't actually do anything:  (Class/forName foo.bar) It will effectively just ask the

Re: clojure libs and logging

2011-11-22 Thread Luc Prefontaine
Oups, I'll look at it... we may have well upgraded Lein without reviewing project.clj options. We're about to deliver another version of our software so it's just about time to do that. On Tue, 22 Nov 2011 10:57:47 -0800 Phil Hagelberg p...@hagelb.org wrote: On Mon, Nov 21, 2011 at 9:10 PM,

Re: Proper parallelism?

2011-11-22 Thread Gary Trakhman
Clojure futures use the send-off thread-pool (unbounded), which is defined like this: from Agent.java: final public static ExecutorService soloExecutor = Executors.newCachedThreadPool(createThreadFactory(clojure-agent-send-off-pool-%d, sendOffThreadPoolCounter)); So, it's using executors.

http://immutant.org/

2011-11-22 Thread Owen Dall
We have been exploring TorqueBox with great interest for our JRuby apps. So, It makes sense that the Immutant AS (Based on JBoss 7) has appeared for Clojure Anyone in this group testing it? Cheers, Owen -- You received this message because you are subscribed to the Google Groups Clojure

Re: Google Maps in Clojurescript

2011-11-22 Thread Chris Gray
Hi, Just to add another way of doing the same thing, I used the following when I was using Google Maps in Clojurescript: (def map-opts (extend-object! (js-obj) {zoom 4 center center-of-us mapTypeId types/ROADMAP}))

Re: http://immutant.org/

2011-11-22 Thread Jim Crossley
Hi Owen, I'm one of the devs of TorqueBox and Immutant. We're trying to get the first 2.0 release of TorqueBox out this month, so that's taking up a good chunk of focus, but we're actively hacking on Immutant as well. At this point, we have web (ring), messaging, and daemons mostly working, but

Literate Programming in Emacs?

2011-11-22 Thread Andrew
For those who do Literate Programming in Emacs, what do you use? I was looking at org-babel-clojurehttp://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.htmlwhich says: You will need to install the following packages: clojure-mode, swank-clojure, slime, slime-repl But when

Re: Literate Programming in Emacs?

2011-11-22 Thread Andrew
I should add that I am starting with a working setup (able to M-x clojure-jack-in and compile and execute stuff in the REPL as expected). -- 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

Re: Literate Programming in Emacs?

2011-11-22 Thread Andreas Kostler
It should work as expected if you follow http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html and use the stand-alone version of swank-clojure (Section Connecting with SLIME https://github.com/technomancy/swank-clojure). Looking at ob-clojure.el

Re: http://immutant.org/

2011-11-22 Thread Owen Dall
Thanks for the info, Jim. We are looking forward to testing TorqueBox 2.0 soon -Owen On Tue, Nov 22, 2011 at 4:11 PM, Jim Crossley jcrossl...@gmail.com wrote: Hi Owen, I'm one of the devs of TorqueBox and Immutant. We're trying to get the first 2.0 release of TorqueBox out this month,

use namespace locally in a function

2011-11-22 Thread Igor TN
Is it possible to require or use a namespace as metadata inside the function definition? Something like (defn f {:use '[clojure.set]} [] ... ) If yes, can anybody point me where can I find an exact syntax? If no, why not? Thank you, Igor -- You received this message because you are

Re: Use of eval

2011-11-22 Thread Alan Malloy
If you try to do it without eval and you don't have the apache stuff on your classpath, then you get an exception while compiling, before class/forname is ever called. On Nov 22, 11:33 am, vitalyper vitaly...@yahoo.com wrote: Gary, You were right with your initial reply. Sorry I did not get

Re: use namespace locally in a function

2011-11-22 Thread Sean Corfield
On Tue, Nov 22, 2011 at 2:52 PM, Igor TN igor...@gmail.com wrote: Is it possible to require or use a namespace as metadata inside the function definition? Something like Your looking for the (require ..), (use ..) and (refer ..) functions - see http://clojuredocs.org for details and examples.

Re: use namespace locally in a function

2011-11-22 Thread Sean Corfield
On Tue, Nov 22, 2011 at 3:13 PM, Sean Corfield seancorfi...@gmail.com wrote: On Tue, Nov 22, 2011 at 2:52 PM, Igor TN igor...@gmail.com wrote: Is it possible to require or use a namespace as metadata inside the function definition? Something like Your looking for the (require ..), (use ..)

Re: use namespace locally in a function

2011-11-22 Thread Kevin Downey
On Tue, Nov 22, 2011 at 3:14 PM, Sean Corfield seancorfi...@gmail.com wrote: On Tue, Nov 22, 2011 at 3:13 PM, Sean Corfield seancorfi...@gmail.com wrote: On Tue, Nov 22, 2011 at 2:52 PM, Igor TN igor...@gmail.com wrote: Is it possible to require or use a namespace as metadata inside the

Re: use namespace locally in a function

2011-11-22 Thread Sean Corfield
On Tue, Nov 22, 2011 at 3:18 PM, Kevin Downey redc...@gmail.com wrote: require/use/import etc make global changes to a namespace(compilation environment), best not to hide that inside a function. True. Which is why I went back and re-read the OP's question and realized I'd missed as metadata

Re: use namespace locally in a function

2011-11-22 Thread Kevin Downey
something distasteful I imagine On Tue, Nov 22, 2011 at 3:20 PM, Sean Corfield seancorfi...@gmail.com wrote: On Tue, Nov 22, 2011 at 3:18 PM, Kevin Downey redc...@gmail.com wrote: require/use/import etc make global changes to a namespace(compilation environment), best not to hide that inside a

Re: use namespace locally in a function

2011-11-22 Thread Alex Baranosky
Looks like he'd like to make a namespace available *only* in a local context, which some languages support, like Scala, for one. I never have a need for that, really. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Literate Programming in Emacs?

2011-11-22 Thread Devin Walters
I have a bit of a weird setup I think. I put clojure-1.3.0.jar in ~/.clojure and set a variable for org-mode according to the advanced setup instructions. I also run org-mode from source. As a result I make sure to add org-mode's lisp/ dir to my load path. Sent via mobile On Nov 22, 2011, at

Re: use namespace locally in a function

2011-11-22 Thread Igor TN
Yes, I meant local context. In principle, this could help to avoid namespacing conflicts in certain cases. But not a big deal, just wondering if the language supports that. Apparently not. Cool with me. Thanks everybody! On Nov 22, 6:59 pm, Alex Baranosky alexander.barano...@gmail.com wrote:

noob question about error with tail recursion

2011-11-22 Thread coco
Hi..I've a little problem using recur for recursive calling...I'm trying do the clojure koans and the recursive reverse function [1 2 3 4] - '(4 3 2 1) first I try this code: (defn recursive-reverse [coll] (loop [col coll mem '()] (if (empty? coll) mem ((cons (last col) mem)

Re: noob question about error with tail recursion

2011-11-22 Thread Sean Corfield
On Tue, Nov 22, 2011 at 8:49 PM, coco clasesparticulares...@gmail.com wrote:      ((cons (last col) mem)       (recur (butlast col) mem) ...      ((cons (last col) mem)       (recur col mem) In both of these, you have a function call with (cons (last col) mem) as the function...

Re: noob question about error with tail recursion

2011-11-22 Thread coco
thanks for the answer, well, I rewrote the function lik this: (defn recursive-reverse [coll] (loop [col coll mem '()] (if (empty? col) mem (recur (rest col) (cons (first col) mem)) ))) I've a little logic problem but I fix it thanks On Nov 23, 12:54 am, Sean Corfield

Re: noob question about error with tail recursion

2011-11-22 Thread Sean Corfield
On Tue, Nov 22, 2011 at 9:22 PM, coco clasesparticulares...@gmail.com wrote: thanks for the answer, well, I rewrote the function lik this: (defn recursive-reverse [coll]  (loop [col coll mem '()]    (if (empty? col)      mem      (recur (rest col) (cons (first col) mem)) ))) I've a little

Re: noob question about error with tail recursion

2011-11-22 Thread Tassilo Horn
coco clasesparticulares...@gmail.com writes: thanks for the answer, well, I rewrote the function lik this: (defn recursive-reverse [coll] (loop [col coll mem '()] (if (empty? col) mem (recur (rest col) (cons (first col) mem)) ))) I've a little logic problem but I fix