Re: code review request: clojure.java.io

2010-05-12 Thread Michael Wood
Hi On 13 May 2010 03:02, Stuart Halloway wrote: >>  * Decidedly, I have bad feelings when I read about the "magic" of >> "coercing" a String first as a URL, and if not possible, fall back and >> consider it a local absolute/relative path. I'm "mitigated" in the >> sense that either it's too magic

Re: ANN: try clojure

2010-05-12 Thread Laurent PETIT
Great ! One remark: could the height of the REPL somehow adapt to the available height of the page ? 2010/5/13 Heinz N. Gies : > Hi people Raynes and me have figured the community has given us so much so it > is time to give something back. We took the effort of making a try-clojure - > hence s

Re: Extremely silly benchmarks, on types, records and maps.

2010-05-12 Thread Rob Lachlan
Ah. That makes sense, thanks very much. Rob On May 12, 10:36 pm, Harvey Hirst wrote: > It's slow because it has to use reflection to determine the type. > Use (set! *warn-on-reflection* true) and you'll see the warning. > > Try something like this and you'll see significantly faster results: >

Re: Extremely silly benchmarks, on types, records and maps.

2010-05-12 Thread Harvey Hirst
It's slow because it has to use reflection to determine the type. Use (set! *warn-on-reflection* true) and you'll see the warning. Try something like this and you'll see significantly faster results: (let [#^testType t (new testType 1 2 3)] (time (dotimes [_ 1000] (.a t))) Harvey -- "You'

ANN: try clojure

2010-05-12 Thread Heinz N. Gies
Hi people Raynes and me have figured the community has given us so much so it is time to give something back. We took the effort of making a try-clojure - hence since we are the sandbox guys who is more made for that then us :P. Anyway, enjoy: http://www.try-clojure.org It is not perfect, but i

Extremely silly benchmarks, on types, records and maps.

2010-05-12 Thread Rob Lachlan
Is there some reason why accessing the values in a type (from deftype) should be slower than for a record? The type seems to be very fast to instantiate, but slow to access. (I was just playing around, trying to get a feel for the relative performance characteristics of types records and maps. )

how to develop patches to libraries

2010-05-12 Thread Brian Wolf
Hi, Whats the idiomatic or best method to develop patches to pre-exisitng libraries using clojars, do I git the source to my computer, put put [lein-clojars "0.5.0"] in project file, obviously renaming the project, and do I take original dependenicies out, or leave in, or am I on the wrong track?

Reader and octal numbers

2010-05-12 Thread Mibu
Do people use the octal number format in Clojure programming (zero on the left)? (Have no idea what I'm talking about? You're not alone. Try this at your REPL: (* 2 010). If you expected to get 20, welcome to the world of octal numbers.) It's confusing to read in source code because it's rare, no

Re: code review request: clojure.java.io

2010-05-12 Thread Stuart Halloway
Hi Laurent, Thanks for the detailed feedback! Responses inline (and updated in a new patch with #311). * Shouldn't IOFactory protocol have a docstring to describe the possible options ? (So that it is possible to extend the protocol even further, e.g. when working with Eclipse IFile, IResou

Re: dump html with clojure

2010-05-12 Thread Nurullah Akkaya
Since you don't need coordination or keep some sort of state, IMHO future is better suited for this. Following gist is my take, it first reads the file that contains the list of URLs to be downloaded then splits the list into number of thread pieces. Each future object gets a piece of the list and

Leaky configuration with multi-methods

2010-05-12 Thread Steven Devijver
Hey, I have this multi-method setup: (defmulti dsl-walk :Rule) (defmulti component-constructor :Component) (defmethod dsl-walk :SymbolPlus [r] (let [children (map dsl-walk (:recurrent r))] (apply component-constructor (list {:Component (keyword (:symbol r)) :children chi

Re: code review request: clojure.java.io

2010-05-12 Thread Peter Schuller
> I would like to stop following symlinks, but It doesn't appear that the File > API has any ability to detect symlinks. How were you thinking about doing > this? Argh, you are right of course. I somehow believed that *testing* for whether a path is a symlink was part of File's API, but I failed t

dump html with clojure

2010-05-12 Thread nickikt
Hallo all, A friend of mine ask if there is a smart way to get the html code of couple thousand links but with a script, it takes for ever since it always has takes a couple of seconds to get the connection. I needs to be multi threaded so we can use all of the download rate. So I sad I could tr

Re: Dumbest test Q you ever heard

2010-05-12 Thread Quzanti
Found an :each example using binding - is that the suggested option? Would still be really grateful for a link to the best examples of using the test framework out there. Thanks. On May 12, 7:10 pm, Quzanti wrote: > Hi > > Now I am a bit baffled as how to store a fixture (eg a parsed xml > zipp

Re: Dumbest test Q you ever heard

2010-05-12 Thread Quzanti
Hi Now I am a bit baffled as how to store a fixture (eg a parsed xml zipper) As a fixture is a function you can't do a def within it? Instead of me carrying on asking dumb questions I would be really grateful if someone could point me to some source code or examples where the test framework is h

Re: code review request: clojure.java.io

2010-05-12 Thread Stefan Bodewig
On 2010-05-12, Stuart Halloway wrote: > I would like to stop following symlinks, but It doesn't appear that > the File API has any ability to detect symlinks. It sounds as if Java7 will finally support dealing with symlinks via NIO.2

Re: Calling apply on java methods

2010-05-12 Thread Aravindh Johendran
On May 11, 1:39 pm, Alexandre Patry wrote: > I am trying to call a java method using apply, like : > > (apply .println [System/out "hello" "world"]) > > But I get an error: "Unable to resolve symbol: .println in this context" > > Am I missing something? The apply method takes a Clojure function

Re: My First Clojure Program -- Can Someone Critique It?

2010-05-12 Thread Daniel
I made a few minor adjustments to get it to work on Mac OS X 10.6 and posted it to: http://gist.github.com/398122 Daniel On May 9, 7:42 am, Tim Morgan wrote: > I picked up Programming Clojure by Stuart Halloway last week and am > working through the book. I'm coming from a Perl/Python/Ruby > bac

Re: How to visualise relations, bahavior and so on in functional programming ?

2010-05-12 Thread Fabio Kaminski
exploring the ideia of seeing the code visually i would try something like "Pig" (IN) (all functions like boxes with function names on it , and nest one-another, when you click in the box you see his source and all the box(functions) inside it ) "Sausage" (Out) looks a good "functional-u

Re: Calling apply on java methods

2010-05-12 Thread Aravindh Johendran
On May 11, 1:39 pm, Alexandre Patry wrote: > I am trying to call a java method using apply, like : > > (apply .println [System/out "hello" "world"]) > > But I get an error: "Unable to resolve symbol: .println in this context" > > Am I missing something? The semantics (meaning of the syntax/code)

Re: Block on structure until some data appear

2010-05-12 Thread patrik karlin
there is a way to subscribe to reference types in clojure via the add-watch function. you can with wherry little hackering make a call me once function that under the hod whill hock upp and remove the watcher when called this whill not be syncronus butt its easy to do !!!EXAMPLE (get-data-once M

Re: Block on structure until some data appear

2010-05-12 Thread Meikel Brandmeyer
Hi, On 12 Mai, 15:37, Michael Jaaka wrote: > I have atom, which is some structure (my hashmap). > > Now periodically some data are assoc to my hashmap with swap! > (producer). > > Also there is a consumer of these added data, which takes the data (in > fact it just re-organize my hashmap, to mar

Block on structure until some data appear

2010-05-12 Thread Michael Jaaka
Hi! Let me tell you my problem: I have atom, which is some structure (my hashmap). Now periodically some data are assoc to my hashmap with swap! (producer). Also there is a consumer of these added data, which takes the data (in fact it just re-organize my hashmap, to mark the fact that somethin

Re: code review request: clojure.java.io

2010-05-12 Thread Stuart Halloway
I would like to stop following symlinks, but It doesn't appear that the File API has any ability to detect symlinks. How were you thinking about doing this? Following symlinks in delete-file-recursively sounds like a recipe for disaster to me. Sorry, I should have been more explicit. The

Re: Adding docstrings to def?

2010-05-12 Thread Benjamin Teuber
Hi, > We could promote defvar from clojure.contrib.def? I don't like defvar having the docstring last, while all other definers have them directly after the name - this should be consistent. Also, I think the default-def should be "the right and good one" - because def is just the best name. Eve

Re: Adding docstrings to def?

2010-05-12 Thread Meikel Brandmeyer
Hi, On 12 Mai, 13:45, Benjamin Teuber wrote: > What do you think? We could promote defvar from clojure.contrib.def? Sincerely Meikel -- 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 Not

Re: code review request: clojure.java.io

2010-05-12 Thread Peter Schuller
> i.e. I agree with you, but am also against allowing this behaviour as > an option, unless others feel it's a good option to have. I can definitely buy that. -- / Peter Schuller -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Adding docstrings to def?

2010-05-12 Thread Benjamin Teuber
Hi, I think def should support docstrings, as ^{:doc "foo"} is 8 characters longer then "foo" - not to mention consistency across definers as well as readability. Therefore, I created a ticket and patch at http://www.assembla.com/spaces/clojure/tickets/280-def-should-support-an-optional-doc-strin

Re: How to use clojure-contrib library

2010-05-12 Thread Meikel Brandmeyer
Hi, On 12 Mai, 13:06, Luc Préfontaine wrote: > I checked and yes it's a 1.2 feature in contrib. So check out the master > branch of both projects (clojure and clojure-contrib) and build them > to get the latest snapshots. Beware that the jar file names will not be > the same so change your class

Re: How to use clojure-contrib library

2010-05-12 Thread Luc Préfontaine
I checked and yes it's a 1.2 feature in contrib. So check out the master branch of both projects (clojure and clojure-contrib) and build them to get the latest snapshots. Beware that the jar file names will not be the same so change your class path accordingly. Luc On Tue, 2010-05-11 at 22:57 -07

Re: How to visualise relations, bahavior and so on in functional programming ?

2010-05-12 Thread Jeff Rose
The value of any given diagram really depends on what level of understanding you are trying to communicate. A simple block diagram that outlines the major components of the system can be helpful to describe the general structure of an app. In Clojure this would probably correspond roughly to the

Re: code review request: clojure.java.io

2010-05-12 Thread Michael Wood
On 11 May 2010 23:16, Peter Schuller wrote: >> Following symlinks in delete-file-recursively sounds like a recipe for >> disaster to me. > > Sorry, I should have been more explicit. The (delete-file-recursively > ...) in the patch *does* follow symlinks (implicitly, because > isDirectory() returns

Re: How to visualise relations, bahavior and so on in functional programming ?

2010-05-12 Thread Rubén Béjar
I have not found anything really obvious (i.e. DFD+Lisp or DFD+FP) in a quick google search. You can start with the wikipedia page on Data Flow Diagramas to see if they may fit what you had in mind. DFDs allow to model a system as a set of "processes", which transform data, "entities", external t