Re: General subsequence function

2012-06-27 Thread Devin Walters
Warren, I would ask myself (quite seriously, no snark intended) whether or not a fixation on ordered collections or sub-collections woven throughout a program (as you seem to be describing) is a language feature, or the responsibility of the programmer. Larry, Ulises, and Michael have all offe

Re: [ANN] C2 v0.2.0: now with cljs data binding

2012-06-27 Thread Kevin Lynagh
Of course, you may want a link to the library itself: https://github.com/lynaghk/c2 As always, to use from Clojure/ClojureScript just add this to your `project.clj`: [com.keminglabs/c2 "0.2.0"] -- You received this message because you are subscribed to the Google Groups "Clojure" grou

[ANN] C2 v0.2.0: now with cljs data binding

2012-06-27 Thread Kevin Lynagh
This release contains backwards-incompatible changes in the both the API and philosophy. The primary change is that the imperative `unify!` function has been removed in favor of a `unify` datatype that represents the same idea: "these children should match up with this template function run acr

Re: Reducers

2012-06-27 Thread Sean Corfield
On Wed, Jun 27, 2012 at 4:57 PM, Leif wrote: > Min, like intersection, has a noncomputable "identity" value -- infinity. > And max and min are used in many more algorithms than intersection, so maybe > this will start some discussion. It seems to me the reducers framework is clearly documented to

Re: Reducers

2012-06-27 Thread Devin Walters
Christian: Thank you for asking for additional reading material. Nicolas: Thank you for providing additional reading material. On Thursday, May 10, 2012 at 7:02 AM, nicolas.o...@gmail.com wrote: > I can describe the background to understand my last email. > > From the programming point of view,

Re: General subsequence function

2012-06-27 Thread Warren Lynn
It seems the name "append" has not yet been taken. How about we do this with Clojure: 1. add a new function "append", which splices multiple ordered collection together and always returns the result in the concrete type of its first argument. So: (append [1] '(2 3)) => [1 2 3] (append '(1) [2

Re: General subsequence function

2012-06-27 Thread Warren Lynn
Again, everything I wrote here is "in my view". (think of :injection ("In my view")). Thanks. I am certainly sure it is doable with Clojure, as you just did it. The unpleasant thing is Clojure does not provide a built-in function for that (which might be much more efficient), and the "sequence

[ANN] Leiningen 2.0.0-preview7

2012-06-27 Thread Phil Hagelberg
I'm happy to announce the release of Leiningen version 2.0.0-preview7. This release introduces mirror support as well as the ability to sign deployments and verify signatures and changes to credentials. ## 2.0.0-preview7 / 2012-06-27 * Fix a bug where failed javac wouldn't abort. (Michael Klish

Re: Reducers

2012-06-27 Thread Leif
OK, the complete silence leads me to believe that not many people reduce with set/intersection. However, I thought of a couple of other functions that don't work with the new framework: max and min. user> (require '[clojure.core.reducers :as r]) user=> (reduce min [1 2]) 1 user=> (r/reduce min

Re: General subsequence function

2012-06-27 Thread Larry Travis
Something like this will give you what you want: (defn subseqx [s start end] (cond (instance? clojure.lang.IPersistentVector s) (subvec s start end) (instance? java.lang.String s) (subs s start end) :else (let [slice (dr

Re: [ANN] clojure.java.jdbc 0.2.3 available on Maven Central

2012-06-27 Thread Kevin Downey
that is very interesting, I've played around with generating sql from datalog queries, but stopped when I ran up against generating queries for recursive datalog rules because I wasn't aware of WITH RECURSIVE On Tue, Jun 26, 2012 at 6:29 PM, Chas Emerick wrote: > Random thought: recursive queries

Re: General subsequence function

2012-06-27 Thread Warren Lynn
Thanks, but this does not keep the concrete type. On Wednesday, June 27, 2012 3:42:25 PM UTC-4, Ulises wrote: > > > I'd forgotten that 'into adds things in the "default" place for whatever > type you're using, hence the reversal on lists. I'm not sure if there's a > simple way to get the same ty

Re: General subsequence function

2012-06-27 Thread Warren Lynn
> > Ordering problem aside, I'd argue this is not an unreasonable amount of > code for what seems to me a pretty rare set of requirements. Most people > who want a same-type segment from the middle of an ordered collection > (which is already uncommon in my experience) are probably either usin

Re: General subsequence function

2012-06-27 Thread Ulises
> I'd forgotten that 'into adds things in the "default" place for whatever type > you're using, hence the reversal on lists. I'm not sure if there's a simple > way to get the same type out again while preserving order. How about: (defn sub-seq [start end coll] (take (- end start) (drop start

Re: General subsequence function

2012-06-27 Thread Michael Gardner
On Jun 27, 2012, at 1:02 PM, Warren Lynn wrote: > Do you mean something like this: > > (defn subseqx [s start end] (into (empty s) (drop-last (- (count s) end) > (drop start s > > Two things I don't like it: > > 1. It does not work > (subseqx [1 2 3] 1 3) => [2 3] > (subseqx '(1 2 3) 1 3)

Re: General subsequence function

2012-06-27 Thread Warren Lynn
You can combine 'drop and 'drop-last to get a seq version of subvec (but > lazy and O(n)). As for the issue of concrete types: in general, clojure's > sequence functions return seqs, not instances of whatever concrete type you > gave them. If you need a specific type, you normally just pour t

Re: General subsequence function

2012-06-27 Thread Michael Gardner
On Jun 27, 2012, at 9:39 AM, Warren Lynn wrote: > I am surprised that there seems to be no general sub-sequence function that > will return a segment of a sequence without changing the underlying concrete > type. I found "subvec", but it works only on vectors. "subseq" is not what I > thought i

Re: Anyone using Sublime Text 2 + SumblimeREPL with Windows?

2012-06-27 Thread Jacobo Polavieja
On Wednesday, June 27, 2012 5:07:05 PM UTC+2, Niels van Klaveren wrote: > > This combination of Sublime -text & -REPL looks pretty useful, with little > extra configuration (except that decommenting part :) ). > When I have the REPL launched, when returning values I get a lot of lines > with BS..

Re: Anyone using Sublime Text 2 + SumblimeREPL with Windows?

2012-06-27 Thread Jacobo Polavieja
On Wednesday, June 27, 2012 2:38:39 PM UTC+2, Lapcjonak wrote: > > On Jun 24, 9:20 pm, Jacobo Polavieja > wrote: > > > My current development environment is that: Sublime Text 2 editor with > > the fabulous SublimeREPL plugin to be able to copy code into the Clojure > > REPL. > > > > As absu

Re: Anyone using Sublime Text 2 + SumblimeREPL with Windows?

2012-06-27 Thread Niels van Klaveren
This combination of Sublime -text & -REPL looks pretty useful, with little extra configuration (except that decommenting part :) ). When I have the REPL launched, when returning values I get a lot of lines with BS..BS sequences. Any idea how to get rid of those ? On Monday, June 25, 2012 4:09:00

General subsequence function

2012-06-27 Thread Warren Lynn
I am surprised that there seems to be no general sub-sequence function that will return a segment of a sequence without changing the underlying concrete type. I found "subvec", but it works only on vectors. "subseq" is not what I thought it is. Did I miss anything? Or is there a simple idiomati

Re: Anyone using Sublime Text 2 + SumblimeREPL with Windows?

2012-06-27 Thread Zmitro Lapcjonak
On Jun 24, 9:20 pm, Jacobo Polavieja wrote: > My current development environment is that: Sublime Text 2 editor with > the fabulous SublimeREPL plugin to be able to copy code into the Clojure > REPL. > > As absurd as it may seem... I can't find the combination of keys to send > functions or selec