Re: newbie Q: how to tweak file-seq (original: how to selectively iterate through a tree of directories) ?

2015-10-03 Thread Gary Verhaegen
Sorry, I meant :when, not :where. Though it won't change the problem. Here's the rub: first file-seq produces its whole seq, then for comes along and filters out some of it. So (ignoring lazyness) file-seq ha already traversed symbolic links (at least for folders) by the time for sees it. I fear

Re: Where do I find javadoc for clojure interfaces?

2015-10-03 Thread Daniel Compton
This has come up before https://groups.google.com/forum/#!topic/clojure/2ZHYa-Bv8UU. Alex's statement on the matter: > The Clojure internal Java interfaces are certainly intended to allow library builders to create useful stuff th

Re: java web start and clojure application

2015-10-03 Thread Jason Zwolak
Fantastic! Thanks for reporting this. Your work helped me get my application working with Clojure code in a webstart environment. I do have a question about security in relation to step 3 where the Policy is set. Is this the strictest policy that will work with Clojure code compiled at runti

Re: 4clojure count problem

2015-10-03 Thread Moe Aboulkheir
Roelof, Unless supplied with an initial value, reduce will use the first value from the collection you supply - every sequence which doesn't start with "1" will give you the wrong answer. Take care, Moe On Sat, Oct 3, 2015 at 9:40 PM, Roelof Wobben wrote: > Hello, > > I have to make a function

Re: 4clojure count problem

2015-10-03 Thread Michael Blume
Reduce can take either two or three arguments; when it takes two arguments, it makes some assumptions about the argument that was left out. You're using reduce with two arguments, so you might want to rethink those assumptions. On Sat, Oct 3, 2015 at 2:19 PM Roelof Wobben wrote: > Hello, > > I h

Re: cond->: Using of threading expression in tests?

2015-10-03 Thread Oliver Hine
You may also find a use for condas-> which I describe in a mini blog post here: http://blog.juxt.pro/posts/condas.html It combines cond-> and as-> which I find super useful when dealing with various fn type signatures. On Saturday, 3 October 2015 15:59:51 UTC+1, ru wrote: > > So am I! Sean, can

4clojure count problem

2015-10-03 Thread Roelof Wobben
Hello, I have to make a function which counts a collection without using count. So I came up with this : (fn [coll] (reduce (fn [counter _ ] (inc counter)) coll))) it works well with coll is [ 1 2 3] but it fails with "Hello World" How can I improve my code to work in both cases. Please

Re: newbie Q: how to tweak file-seq (original: how to selectively iterate through a tree of directories) ?

2015-10-03 Thread hpwei01
The directory structure is /path/top/dir1 /path/top/dir1/f1 /path/top/dir1/f2 /path/top/dir2 -> /another/path/dir2 -- /another/path/dir2/g1 /another/path/dir2/g2 I tried this (following suggestion): (for [file (file-seq dir) :while (.isFile file)] (.getPath file))

Re: macroexpand and syntax-quote

2015-10-03 Thread Gary Verhaegen
This is very much by design. Clojure is somewhere between Common Lisp and Scheme in terms of macro hygiene. Being compatible with Common Lisp is explicitly not a goal for Clojure. Watch out for similarly named functions with different behavior too. On Saturday, 3 October 2015, bentav wrote: > C

Re: Lazy deserialization / reserialization, aatree release 0.3.0

2015-10-03 Thread William la Forge
I've just written the API for aatree: https://github.com/laforge49/aatree/wiki/API Please let me know if anything needs clarification! (I'm way way to close to all this, having worked on similar logic for the past several years.) (We should strive for beauty in the eye of the reader.) -- You

Re: Origin for Clojure using the term 'vector' instead of 'array'?

2015-10-03 Thread Daniel Barlow
Common Lisp also has multi dimensional arrays and one - dimensional vectors. I believe Rich was pretty familiar with that language in a former life http://clhs.lisp.se/Body/t_array.htm On 3 Oct 2015 15:44, "Erik Price" wrote: > I always assumed it was because vectors have similar properties to

Re: newbie question: how to selectively iterate through a tree of directories ?

2015-10-03 Thread Gary Verhaegen
I'm on Windows at the moment, so I can't test, but I think you can filter on isFile: (for [file (file-seq dir) :where (.isFile file)] (.getName file)) should work, I think. On 3 October 2015 at 07:36, wrote: > Under linux, I have a tree of directories like this: > > /path/top > > /path

Re: cond->: Using of threading expression in tests?

2015-10-03 Thread ru
So am I! Sean, can you share code for condp->> too, please. пятница, 2 октября 2015 г., 17:49:28 UTC+3 пользователь ru написал: > > Hi, > > Can I use in tests threading expression of cond->, and how? > > Thanx in advance, > Ru > -- You received this message because you are subscribed to the Go

Re: Where do I find javadoc for clojure interfaces?

2015-10-03 Thread Stuart Sierra
Interfaces like ISeq are internal details of Clojure's implementation. They're not part of the public API, so there is no guarantee that they won't change in future releases. –S On Thursday, October 1, 2015 at 4:59:12 AM UTC-4, crocket wrote: > > http://clojure.github.io/clojure/javadoc/ doesn

Re: Origin for Clojure using the term 'vector' instead of 'array'?

2015-10-03 Thread Erik Price
I always assumed it was because vectors have similar properties to the classic java.util.Vector: they’re variable-length, contain heterogenous objects accessible by integer index, and safe for concurrent access from multiple threads: http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html e

newbie question: how to selectively iterate through a tree of directories ?

2015-10-03 Thread hpwei01
Under linux, I have a tree of directories like this: /path/top /path/top/dir1 (in here there are two files f1, f2) /path/top/dir2 -> /another-path/dir2 (a symbolic link) and under /another-path/dir2 there are two files g1, g2 If I use below code, I would get a list of file

macroexpand and syntax-quote

2015-10-03 Thread bentav
Common Lisp: (defmacro foo () `(defmacro bar () `(baz))) (macroexpand-1 '(foo)) => (DEFMACRO BAR () `(BAZ)) Clojure: (defmacro foo [] `(defmacro bar [] `(baz))) (macroexpand-1 '(foo)) => (clojure.core/defmacro user/bar [] (clojure.core/seq (clojure.core/concat (clojure.c

Re: Help with macro.

2015-10-03 Thread Andrey Antukh
On Sat, Oct 3, 2015 at 5:24 PM, gianluca torta wrote: > Hi, > > the behavior you describe is not specific to macros, but is due to the use > of aliases > > after: > (require '[foo.bar :as b]) > > this will give you false: > (= 'foo.bar/x (first '(b/x))) > > while this will give you true: > (= 'fo

Re: Help with macro.

2015-10-03 Thread gianluca torta
Hi, the behavior you describe is not specific to macros, but is due to the use of aliases after: (require '[foo.bar :as b]) this will give you false: (= 'foo.bar/x (first '(b/x))) while this will give you true: (= 'foo.bar/x (first '(foo.bar/x))) one way to solve it, is comparing the resolved

Help with macro.

2015-10-03 Thread Andrey Antukh
Hi! I have a little trouble writing a macro because I'm getting unexpected (for me) behavior. Let see some code: (ns foo.bar) (defn debug [x] (println "debug:" x) x) (defn debug-expr? [expr] (and (seq? expr) (symbol? (first expr)) *(= 'foo.bar/debug (first expr))*)) (

Re: [ANN] Skyscraper 0.2.0, a library for scraping entire websites

2015-10-03 Thread Daniel Janus
Skyscraper 0.2.0 has been released. New in this release: - Skyscraper now supports pluggable cache backends. - The caching mechanism has been completely overhauled and Skyscraper no longer creates temporary files when the HTML cache is disabled. - Support for capturing scraping resul

Re: Origin for Clojure using the term 'vector' instead of 'array'?

2015-10-03 Thread Tj Gabbour
Yep: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html https://docs.oracle.com/javase/7/docs/api/java/util/Vector.html “The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the si

Re: Origin for Clojure using the term 'vector' instead of 'array'?

2015-10-03 Thread Gary Verhaegen
For people with a C/Java-style background, array typically designates a contiguous piece of memory that has been allocated at once, is thus fixed-size, and can be accessed randomly (i.e. by index). Vectors are typically structures or objects at a higher level, that still present a random-access col