Re: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
On Fri, Aug 28, 2015 at 11:51 PM, Alan Thompson wrote: > I have become very partial to a simple adaptation of as-> from the Tupelo > Core library. I almost always like > to be explicit about the location the previous value, since either -> or > ->> can someti

Re: Generalizing -> and ->> forms

2015-08-28 Thread Matching Socks
The parameter order of as-> makes it convenient to use *inside *-> so you can name the threaded parameter only where it needs naming: (-> "UFOT" (reverse) (->> (apply str)) (string/lower-case) (as-> x (string/replace "slip on a tofu" x "banana peel"))) On Friday, August 28,

Re: Generalizing -> and ->> forms

2015-08-28 Thread Alan Thompson
I have become very partial to a simple adaptation of as-> from the Tupelo Core library. I almost always like to be explicit about the location the previous value, since either -> or ->> can sometimes be difficult if the threading forms don't always want the arg

Re: Generalizing -> and ->> forms

2015-08-28 Thread Akhil Wali
​Good one! On Fri, Aug 28, 2015 at 6:34 PM, Moe Aboulkheir wrote: > The function is actually shorter without cond->: (conj (if first? args > (vec args)) x) -- Akhil Wali # https://github.com/darth10 # https://darth10.github.io -- You received this message because you are subscribed to t

Re: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
The function is actually shorter without cond->: (conj (if first? args (vec args)) x) Take care, Moe On Fri, Aug 28, 2015 at 1:59 PM, Akhil Wali wrote: > That's pretty neat! > But then -> will be implemented using cond->, which is slightly off. > > On Friday, August 28, 2015 at 6:07:46 PM UTC+5

Re: Generalizing -> and ->> forms

2015-08-28 Thread Akhil Wali
That's pretty neat! But then -> will be implemented using cond->, which is slightly off. On Friday, August 28, 2015 at 6:07:46 PM UTC+5:30, Moe Aboulkheir wrote: > > On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali > wrote: > >> >> This does work, but it's a bit of whammy. >> Anyone with suggestions

Re: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali wrote: > > This does work, but it's a bit of whammy. > Anyone with suggestions for improvement? > I went over this quickly, though it seems to work OK: (defn threading [x first? forms] (reduce (fn [x form] (if (seq? form) (let [[op &

Re: Generalizing -> and ->> forms

2015-08-28 Thread Akhil Wali
> > It doesn't appear to work for simple cases (where the expressions > aren't function calls w/ additional arguments), e.g. (-> 1 inc) Thanks for that one. How silly of me :P Here's a better version of threading. (defmacro threading [a b x forms] (loop [x x forms forms] (if fo

Re: Generalizing -> and ->> forms

2015-08-28 Thread Akhil Wali
​On Fri, Aug 28, 2015 at 5:33 PM, Atamert Ölçgen wrote: > Also, you know about as->, don't you? ​Well, I'm aware of all other threading forms like some->, as->, etc. This is just something I'm trying ​with -> and ->>, and thought I'd discuss. Perhaps the definition of as-> can be used as a be

Re: Generalizing -> and ->> forms

2015-08-28 Thread Atamert Ölçgen
Hi, threading doesn't need to be a macro. In fact it would be easier to test if it's just a function. Also, you know about as->, don't you? On Fri, Aug 28, 2015 at 2:37 PM, Akhil Wali wrote: > I've been trying to refactor the -> and ->> forms to use a common macro > form. > Ended up with this

Re: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali wrote: > This does work, but it's a bit of whammy. > Anyone with suggestions for improvement? It doesn't appear to work for simple cases (where the expressions aren't function calls w/ additional arguments), e.g. (-> 1 inc) Take care, Moe -- You re

Generalizing -> and ->> forms

2015-08-28 Thread Akhil Wali
I've been trying to refactor the -> and ->> forms to use a common macro form. Ended up with this. (defmacro threading [a b x forms] (loop [x x forms forms] (if forms (let [form (first forms) f (first form) r (rest form) threaded (if (seq? f

Re: Generalizing -> & ->>

2009-12-13 Thread Dmitry Kakurin
Thanks for a great idea Andrew! I was slightly annoyed by the lack of consistency in parameter ordering of Clojure collections API (cons vs conj, get/assoc vs filter/ map/take). IMHO the input collection should ALWAYS be the last param. Then simple ->> macro would be sufficient in most cases. Out o

Re: Generalizing -> & ->>

2009-12-07 Thread Cliff Wells
On Sat, 2009-12-05 at 13:14 +0100, Konrad Hinsen wrote: > On 4 Dec 2009, at 23:23, Cliff Wells wrote: > > > What isn't clear to me is exactly what a piece of paper provides > > that an > > electronic form doesn't (aside from inconvenience). I don't see any > > A clear legal status all over th

Re: Generalizing -> & ->>

2009-12-05 Thread MarkSwanson
Just a thought: maybe this is a sign a clearer message should be placed on the Clojure contributing page. In any case, it can't hurt to be more clear can it? FYI I've submitted a couple of small patches to this group and read the contributors agreement and the SCA FAQ. After going through this pro

Re: Generalizing -> & ->>

2009-12-05 Thread Rich Hickey
On Dec 5, 7:34 am, John Harrop wrote: > On Fri, Dec 4, 2009 at 2:49 PM, Richard Newman wrote: > > > The problem is that it is an unreasonably high barrier to entry. > > > There MUST be an electronic-only way (and it must not require a cell > > > phone, CC#, &c.) if the full potential of this co

Re: Generalizing -> & ->>

2009-12-05 Thread John Harrop
On Fri, Dec 4, 2009 at 2:49 PM, Richard Newman wrote: > > The problem is that it is an unreasonably high barrier to entry. > > There MUST be an electronic-only way (and it must not require a cell > > phone, CC#, &c.) if the full potential of this community is to be > > unleashed upon clojure-cont

Re: Generalizing -> & ->>

2009-12-05 Thread Meikel Brandmeyer
Hi, Am 04.12.2009 um 13:33 schrieb John Harrop: >> Eg. in Germany > > I'm not in Germany. No. You are not. And I am not in the US. So what? This should just be an example, that legal things are not easy. And local differences in laws should be taken into account. (Knowing them is too much, bu

Re: Generalizing -> & ->>

2009-12-05 Thread Konrad Hinsen
On 4 Dec 2009, at 23:23, Cliff Wells wrote: > What isn't clear to me is exactly what a piece of paper provides > that an > electronic form doesn't (aside from inconvenience). I don't see any A clear legal status all over the world. A signed statement on paper is recognized everywhere. The l

Re: Generalizing -> & ->>

2009-12-04 Thread David Brown
On Sat, Dec 05, 2009 at 01:38:36AM +0300, Ivan Sagalaev wrote: >Cliff Wells wrote: >> I am >> unable to see why someone shouldn't be able to receive a signed PDF via >> email and achieve a similar level of confidence that the signor was >> legitimate. > >BTW Canonical does exactly that[1]. I've jus

Re: Generalizing -> & ->>

2009-12-04 Thread Ivan Sagalaev
Cliff Wells wrote: > I am > unable to see why someone shouldn't be able to receive a signed PDF via > email and achieve a similar level of confidence that the signor was > legitimate. BTW Canonical does exactly that[1]. I've just recently signed their CCA which consisted of downloading a PDF from

Re: Generalizing -> & ->>

2009-12-04 Thread Cliff Wells
On Fri, 2009-12-04 at 11:49 -0800, Richard Newman wrote: > > The problem is that it is an unreasonably high barrier to entry. > > There MUST be an electronic-only way (and it must not require a cell > > phone, CC#, &c.) if the full potential of this community is to be > > unleashed upon cloju

Re: Generalizing -> & ->>

2009-12-04 Thread Brendan Ribera
> I'm not in Germany. I presume the concern isn't about you, but rather about the Germans who can't consider the code as free to use. I imagine the idea is to make the source truly open, everywhere. > The problem is that it is an unreasonably high barrier to entry. There MUST > be an electronic-

Re: Generalizing -> & ->>

2009-12-04 Thread Richard Newman
> The problem is that it is an unreasonably high barrier to entry. > There MUST be an electronic-only way (and it must not require a cell > phone, CC#, &c.) if the full potential of this community is to be > unleashed upon clojure-contrib. In particular, there should be a way > to participa

Re: Generalizing -> & ->>

2009-12-04 Thread John Harrop
On Fri, Dec 4, 2009 at 8:57 AM, Miron Brezuleanu wrote: > On Fri, Dec 4, 2009 at 2:33 PM, John Harrop wrote: > > The problem is that it is an unreasonably high barrier to entry. There > MUST > > be an electronic-only way (and it must not require a cell phone, CC#, > &c.) > > if the full potentia

Re: Generalizing -> & ->>

2009-12-04 Thread Miron Brezuleanu
Hello, On Fri, Dec 4, 2009 at 2:33 PM, John Harrop wrote: > > > On Fri, Dec 4, 2009 at 6:51 AM, Meikel Brandmeyer wrote: >> >> Hi, >> >> On 4 Dez., 05:17, John Harrop wrote: >> > > The rules on contrib are that the work must be original to the author. >> > > Even >> > > with Andrew's disclaimer

Re: Generalizing -> & ->>

2009-12-04 Thread John Harrop
On Fri, Dec 4, 2009 at 6:51 AM, Meikel Brandmeyer wrote: > Hi, > > On 4 Dez., 05:17, John Harrop wrote: > > > The rules on contrib are that the work must be original to the author. > Even > > > with Andrew's disclaimer that it be considered public domain, he would > still > > > need a contributo

Re: Generalizing -> & ->>

2009-12-04 Thread Meikel Brandmeyer
Hi, On 4 Dez., 05:17, John Harrop wrote: > > The rules on contrib are that the work must be original to the author. Even > > with Andrew's disclaimer that it be considered public domain, he would still > > need a contributor agreement in place to get this incorporated into contrib. > > Why? > > (

Re: Generalizing -> & ->>

2009-12-04 Thread John Harrop
On Thu, Dec 3, 2009 at 10:41 AM, Stephen C. Gilardi wrote: > > On Dec 3, 2009, at 10:31 AM, Roman Roelofsen wrote: > > Are there any plans to add -$> to core or contrib? > > The rules on contrib are that the work must be original to the author. Even > with Andrew's disclaimer that it be considered

Re: Generalizing -> & ->>

2009-12-03 Thread Wojciech Kaczmarek
On Thu, Dec 3, 2009 at 17:02, Meikel Brandmeyer wrote: > >>> Are there any plans to add -$> to core or contrib? >> >> The rules on contrib are that the work must be original to the author. Even >> with Andrew's disclaimer that it be considered public domain, he would still >> need a contributor

Re: Generalizing -> & ->>

2009-12-03 Thread Meikel Brandmeyer
Hi, On Dec 3, 4:41 pm, "Stephen C. Gilardi" wrote: > > Are there any plans to add -$> to core or contrib? > > The rules on contrib are that the work must be original to the author. Even > with Andrew's disclaimer that it be considered public domain, he would still > need a contributor agreemen

Re: Generalizing -> & ->>

2009-12-03 Thread Stephen C. Gilardi
On Dec 3, 2009, at 10:31 AM, Roman Roelofsen wrote: > Are there any plans to add -$> to core or contrib? The rules on contrib are that the work must be original to the author. Even with Andrew's disclaimer that it be considered public domain, he would still need a contributor agreement in plac

Re: Generalizing -> & ->>

2009-12-03 Thread Roman Roelofsen
Are there any plans to add -$> to core or contrib? 2009/11/13 Laurent PETIT : > Oh yes, thanks for refreshing my memory. > And indeed it makes sense to place the question mark in the "questioned" side > :) > > 2009/11/13 Wilson MacGyver : >> Yes, it's groovy, and it's "?." It's called safe naviga

Re: Generalizing -> & ->>

2009-11-12 Thread Laurent PETIT
Oh yes, thanks for refreshing my memory. And indeed it makes sense to place the question mark in the "questioned" side :) 2009/11/13 Wilson MacGyver : > Yes, it's groovy, and it's "?." It's called safe navigation operator > > http://groovy.codehaus.org/Operators#Operators-SafeNavigationOperator%28

Re: Generalizing -> & ->>

2009-11-12 Thread Wilson MacGyver
Yes, it's groovy, and it's "?." It's called safe navigation operator http://groovy.codehaus.org/Operators#Operators-SafeNavigationOperator%28%3F.%29 On Thu, Nov 12, 2009 at 6:03 PM, Laurent PETIT wrote: > 2009/11/3 Alex Osborne : >> >> Sean Devlin wrote: >>> This is slightly unrealted, but how d

Re: Generalizing -> & ->>

2009-11-12 Thread Laurent PETIT
2009/11/3 Alex Osborne : > > Sean Devlin wrote: >> This is slightly unrealted, but how does one pronounce ->, ->> and the >> like?  Is this documented? > > The doc-strings usually give you a nice hint.  I usually use "thread" > for -> and "thread last" for ->>.  The actual symbols I think of as > "

Re: Generalizing -> & ->>

2009-11-03 Thread AndrewC.
On Nov 3, 1:43 am, Alex Osborne wrote: > Sean Devlin wrote: > > This is slightly unrealted, but how does one pronounce ->, ->> and the > > like?  Is this documented? > > The doc-strings usually give you a nice hint.  I usually use "thread" > for -> and "thread last" for ->>.  The actual symbols I

Re: Generalizing -> & ->>

2009-11-02 Thread Alex Osborne
Sean Devlin wrote: > This is slightly unrealted, but how does one pronounce ->, ->> and the > like? Is this documented? The doc-strings usually give you a nice hint. I usually use "thread" for -> and "thread last" for ->>. The actual symbols I think of as "arrow" and "double arrow". Then -?

Re: Generalizing -> & ->>

2009-11-02 Thread Sean Devlin
This is slightly unrealted, but how does one pronounce ->, ->> and the like? Is this documented? On Oct 31, 8:37 am, John Harrop wrote: > On Sat, Oct 31, 2009 at 9:13 AM, Daniel Werner < > > daniel.d.wer...@googlemail.com> wrote: > > > On Oct 29, 9:35 pm, "AndrewC." wrote: > > > Here's a macro

Re: Generalizing -> & ->>

2009-10-31 Thread John Harrop
On Sat, Oct 31, 2009 at 9:13 AM, Daniel Werner < daniel.d.wer...@googlemail.com> wrote: > > On Oct 29, 9:35 pm, "AndrewC." wrote: > > Here's a macro that generalizes the two 'threading' macros -> and ->>. > > There have been multiple discussions on this group where similar > operators have been p

Re: Generalizing -> & ->>

2009-10-31 Thread Daniel Werner
On Oct 29, 9:35 pm, "AndrewC." wrote: > Here's a macro that generalizes the two 'threading' macros -> and ->>. There have been multiple discussions on this group where similar operators have been proposed, with some implementations very closely matching this one. If the demand is so high, maybe

Generalizing -> & ->>

2009-10-29 Thread AndrewC.
Here's a macro that generalizes the two 'threading' macros -> and ->>. It works by using the idea of 'nesting marker' (from Oz) to specify where the result of the previous form should be nested in the subsequent form. (defmacro -$> "Threads the expr through the forms. Inserts x into the firs