Re: parallel sequence side-effect processor

2016-09-23 Thread Mars0i
Thanks very much Francis. So it sounds as if, if my data would already be in a vector, list or sequence (maybe a lazy sequence), doseq will process that structure as fast as possible, but there are other structures that might have faster internal reduce operations. -- You received this

Re: parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
> Francis, thanks for separating out the different types of intermediate > collections. I'm not entirely clear on type 1. It sounds like those are > just collections that are already there before processing them. Or are you > saying that Clojure has to convert them to a seq as such? Why

Re: parallel sequence side-effect processor

2016-09-23 Thread Mars0i
Thanks everyone--I'm very much appreciating the discussion, though I'm not sure I follow every point. Dragan, thank you very much for suggesting (and writing) foldmap. Very nice. I certainly don't mind using a library, though I still think there ought to be something like what I've

Re: Is there a way to alpha 11 or higher, but disable a single spec?

2016-09-23 Thread Alex Miller
I believe that was a bug in ClojureScript itself which is fixed in releases for about the last month. -- 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

Re: parallel sequence side-effect processor

2016-09-23 Thread Dragan Djuric
There are a few typos and defn is missing from fb in my last message, but I hope it is still readable. Sorry, I am typing this on a mobile device while watching the last episode of The Man in the High Castle :) Also, I am talking about the code I wrote years ago from the top of my mind without

Re: parallel sequence side-effect processor

2016-09-23 Thread Dragan Djuric
A couple of things: 1. How fold/foldmap and any other function works, depends on the actual type. For example, if you look at https://github.com/uncomplicate/neanderthal/blob/master/src/clojure/uncomplicate/neanderthal/impl/fluokitten.clj#L396 you can see that there no intermediate

Re: parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
Well, hold on, it is creating seqs for its input collection (allocation item 1 in my list), but it is still better than map because it is not making an intermediate lazy-seqs of output (item 4). (I must amend my earlier message, (map f coll1 col2) only pays 1 and 4) On Friday, September 23,

Re: parallel sequence side-effect processor

2016-09-23 Thread Timothy Baldridge
Yeah, I have to call you out on this one Dragan. I ran the following code: (ns fold-test (:require [uncomplicate.fluokitten.core :refer [foldmap]])) (defn fa [& args] (println "fa " args) 1) (defn fb [& args] (println "fb " args) 1) (defn test-fold [] (foldmap fa nil fb [1 2 3] [4 5 6]))

Re: parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
There are a few intermediate collections here: 1. The source coll may produce a seq object. How costly this is depends on the type of coll and the quality of its iterator/ireduce/seq implementations. 2. You may need to collect multiple source colls into a tuple-like thing to

Re: Keywords with colon on the backside?

2016-09-23 Thread John Mastro
Timothy Baldridge wrote: > The syntax (I think) comes from Ruby although they call keywords "symbols". The reader syntax for Common Lisp's keywords has the leading colon too. John -- You received this message because you are subscribed to the Google Groups

Re: parallel sequence side-effect processor

2016-09-23 Thread Dragan Djuric
fluokitten does not have anything to do with haskell, or how haskell does those things. It is completely tailored to clojure. Regarding marsi0's task, now I see that, actually, foldmap is what should be used, and not fold. so, it's something like (foldmap dummy-nil-accumulating-fn nil

Re: parallel sequence side-effect processor

2016-09-23 Thread Timothy Baldridge
How is this done, I searched the source, but there was so much indirection I can't find it. I'm familiar with how Haskell does rfold vs lfold, but one of those does create allocations, they may be in the form of closures, but they are allocations none the less. So does fold use iterators or

Re: parallel sequence side-effect processor

2016-09-23 Thread Dragan Djuric
fluokitten's fold is MUCH better than (map f a b) because it does NOT create intermediate collections. just use (fold f a b) and it would fold everything into one thing (in this case nil). If f is a function with side effects, it will invoke them. No intermediate collection is created AND the

Re: parallel sequence side-effect processor

2016-09-23 Thread Timothy Baldridge
But that would print 1 to 32 items depending on a ton of things. No the correct way to write code like that is (doseq [s coll] (println s)) If you need to iterate over multiple items then use (map f a b). Also I would suggest benchmarking things, sure (map f coll) is slower than a transducer,

Re: parallel sequence side-effect processor

2016-09-23 Thread William la Forge
I've run into this when I wanted to print each item in a seq. Since println returns nil, I just did (first (keep println coll)). --Needed the first here because keep returns a lazy seq. On Friday, September 23, 2016 at 12:02:09 AM UTC-4, Mars0i wrote: > > This is almost the same as an issue I

Re: Keywords with colon on the backside?

2016-09-23 Thread Gregg Reynolds
On Sep 23, 2016 4:40 PM, wrote: > > > > On Friday, September 23, 2016 at 4:22:04 PM UTC-4, tbc++ wrote: >> >> >> So that would be my rationale for it..it's easy to see by the first character of a term what data structure the term will become (

Re: Keywords with colon on the backside?

2016-09-23 Thread tabcomputing
On Friday, September 23, 2016 at 4:22:04 PM UTC-4, tbc++ wrote: > > > So that would be my rationale for it..it's easy to see by the first > character of a term what data structure the term will become ( > https://en.wikibooks.org/wiki/Learning_Clojure/Reader_Macros). And that's > just one of

Re: Is there a way to alpha 11 or higher, but disable a single spec?

2016-09-23 Thread Sean Corfield
I just searched the LightTable code base and I can’t find that code so either it was fixed a while back (and you’ll need to ask the maintainers to release an update) or it’s an error from some other project that you are using within LightTable? Check this list and see if you’re using any

Re: parallel sequence side-effect processor

2016-09-23 Thread Timothy Baldridge
How is fluokitten's fold any better than using seqs like (map f a b) would? Both create intermediate collections. On Fri, Sep 23, 2016 at 11:40 AM, Dragan Djuric wrote: > If you do not insist on vanilla clojure, but can use a library, fold from > fluokitten might enable you

Re: Is there a way to alpha 11 or higher, but disable a single spec?

2016-09-23 Thread Boris V. Schmid
Because Lighttable is updated about once a year. It might be a while before a PR makes it to a release. Anyway, the same may be true for other clojure projects; that is why I wondered if there was some way around it by excluding a spec. On Friday, September 23, 2016 at 10:11:49 PM UTC+2, tbc++

Re: Keywords with colon on the backside?

2016-09-23 Thread Timothy Baldridge
Almost all of Clojure's reader macros are prefix driven. For example, 'foo quotes the symbol "foo", a string "foo" starts with a prefix quote and terminates with another string. Same for lists (prefixed with a parentheses), vectors, maps, etc. Even var literals #'my-var are prefixed. So it's very

Keywords with colon on the backside?

2016-09-23 Thread tabcomputing
The last four days have been in exercise in frustration as I have tried four different static site generators, all of which gave me serious fits with one exception: Cryogen.* That has led me consider that it might be a good time to dive into Clojure. Though I am new to Clojure, I've been

Re: definterface odd error

2016-09-23 Thread adrian . medina
Hey Jeff, The problem is that the code in that blog post is not amenable to copy/paste. The ellipses are standing in for other parts of the code they are leaving out. The exception you're seeing is basically saying that the symbol "..." cannot be treated like an indexed collection. The syntax

Re: Is there a way to alpha 11 or higher, but disable a single spec?

2016-09-23 Thread Timothy Baldridge
Why not submit a PR against Lighttable as that's where the real bug is? On Fri, Sep 23, 2016 at 2:08 PM, Boris V. Schmid wrote: > lighttable has some trouble with the newer alpha's, in that it throws this > error: > > >> Call to clojure.core/ns did not conform to spec:

Re: definterface odd error

2016-09-23 Thread Timothy Baldridge
Two things: a) I don't think the "..." need to be there. I think that was probably placeholder text from a tutorial? b) I'd suggest using defprotocol (http://clojure.org/reference/protocols) protocols have a number of benefits over interfaces. Timothy On Fri, Sep 23, 2016 at 1:21 PM, Jeff Murphy

Is there a way to alpha 11 or higher, but disable a single spec?

2016-09-23 Thread Boris V. Schmid
lighttable has some trouble with the newer alpha's, in that it throws this error: > Call to clojure.core/ns did not conform to spec: ... ((require > [clojure.string :as string] [cljs.source-map.base64 > > It seems like the spec doesn't like "require" there (but rather wants the :require

definterface odd error

2016-09-23 Thread Jeff Murphy
Hi, I'm working with Clojure for the first time and am following a post to implement a binary tree. However, the code results in an error that I've been unable to figure out. Post is here http://macromancy.com/2014/04/09/data-structures-clojure-trees.html Error is Exception in thread

Re: [ANN] clojure-future-spec, a backport of clojure.spec for 1.8

2016-09-23 Thread Matan Safriel
Nikita, this is cool, e.g. as lighttable does not yet fully support 1.9. Can you say something about how are these backports derived? so that I can get an intuition into how much it is at par with the real thing? Does it involve a lot of code rewrite to backport each 1.9 alpha version? On

Re: parallel sequence side-effect processor

2016-09-23 Thread Dragan Djuric
If you do not insist on vanilla clojure, but can use a library, fold from fluokitten might enable you to do this. It is similar to reduce, but accepts multiple arguments. Give it a vararg folding function that prints what you need and ignores the first parameter, and you'd get what you asked

Re: parallel sequence side-effect processor

2016-09-23 Thread Mars0i
On Friday, September 23, 2016 at 11:11:07 AM UTC-5, Alan Thompson wrote: > > ​Huh. I was also unaware of the run! function.​ > > I suppose you could always write it like this: > > (def x (vec (range 3))) > (def y (vec (reverse x))) > > (run! > (fn [[x y]] (println x y)) > > (map vector x y))

Re: parallel sequence side-effect processor

2016-09-23 Thread Alan Thompson
​Huh. I was also unaware of the run! function.​ I suppose you could always write it like this: (def x (vec (range 3))) (def y (vec (reverse x))) (run! (fn [[x y]] (println x y)) (map vector x y)) > lein run 0 2 1 1 2 0 although the plain old for loop with dotimes looks simpler:

Re: Adding JDBC drivers to Clojars

2016-09-23 Thread Francis Avila
Leinigen uses maven repos to satisfy project clj dependencies, but there is nothing stopping you from putting your jar directly on the classpath. The idiom for local jars is to put them in "libs/". In this case you do *not* mention this dependency in your project.clj, but the jar will be on

Re: Adding JDBC drivers to Clojars

2016-09-23 Thread Eddie
Good to know! Thanks for the info on the alternatives. I have used lein-localrepo before, but was hoping for something that could be more easily shared with others. Looks like it is still the best course. Thanks! On Friday, September 23, 2016 at 11:58:39 AM UTC-4, Sean Corfield wrote: > >

WAT: JavaScript & Ruby

2016-09-23 Thread Alan Moore
Thanks for the laugh! Waiting for the Clojure and Scala version. :-} Alan -- 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

Re: Adding JDBC drivers to Clojars

2016-09-23 Thread Sean Corfield
Some JDBC drivers are not available in public Maven-style repositories (such as Microsoft’s Type 4 SQL Server JDBC driver) and that’s usually because there are restrictions on distribution, preventing third party sites from hosting them legally. I searched Maven and you seem to be correct

Re: Adding JDBC drivers to Clojars

2016-09-23 Thread Eddie
Thanks for the reply. I was under the impression that the jdbc driver (or any jar you want to use as a dependency) needs to be hosted on some kind of maven repository. Am I wrong about that? Here is the official download link for the Vertica jdbc driver:

Re: Adding JDBC drivers to Clojars

2016-09-23 Thread Walter van der Laan
There is no need to push jdbc drivers to clojars. I have never used Vertica but perhaps it helps if I show you how to add the two jdbc-drivers that I do use. Example 1; postgres The details for the postgres-driver can be found here: http://mvnrepository.com/artifact/org.postgresql/postgresql

Adding JDBC drivers to Clojars

2016-09-23 Thread Eddie
I have a Clojure project that require the use of the Vertica JDBC driver . When I search for "Vertica" on clojars I see two results. The first ( org.clojars.prepor/vertica-jdbc ) is a

Re: parallel sequence side-effect processor

2016-09-23 Thread Mars0i
On Friday, September 23, 2016 at 1:47:45 AM UTC-5, Francis Avila wrote: > > It's not crystal clear to me what you are after, either from this post or > the one you link to. I think you want a map that does not produce > intermediate collections and accepts multiple colls as input at a time?

parallel sequence side-effect processor

2016-09-23 Thread Francis Avila
It's not crystal clear to me what you are after, either from this post or the one you link to. I think you want a map that does not produce intermediate collections and accepts multiple colls as input at a time? Do you have some pseudocode example so we can be precise? What about (run!