On Sun, Oct 23, 2011 at 23:53, Sean Corfield wrote:
> On Sun, Oct 23, 2011 at 1:04 PM, Ben Smith-Mannschott
> wrote:
>> On Sun, Oct 23, 2011 at 21:25, Meikel Brandmeyer wrote:
>>> The idiomatic solution is #(f % a1 a2 a3). I'm failing to see the issue
>>> with “nice” and “expressive”, but that
On Sun, Oct 23, 2011 at 1:04 PM, Ben Smith-Mannschott
wrote:
> On Sun, Oct 23, 2011 at 21:25, Meikel Brandmeyer wrote:
>> The idiomatic solution is #(f % a1 a2 a3). I'm failing to see the issue with
>> “nice” and “expressive”, but that is most likely just me.
> I find myself reaching for partial
On Sun, Oct 23, 2011 at 21:25, Meikel Brandmeyer wrote:
> Hi,
>
> Am 22.10.2011 um 20:49 schrieb Sean Corfield:
>
>> I'm
>> starting to think there's a nice, idiomatic solution lurking somewhere
>> that wouldn't require an extra function...
>
> The idiomatic solution is #(f % a1 a2 a3). I'm failin
Hi,
Am 22.10.2011 um 20:49 schrieb Sean Corfield:
> I'm
> starting to think there's a nice, idiomatic solution lurking somewhere
> that wouldn't require an extra function...
The idiomatic solution is #(f % a1 a2 a3). I'm failing to see the issue with
“nice” and “expressive”, but that is most li
On Sat, Oct 22, 2011 at 8:31 AM, Tyler Perkins wrote:
> Just take an idea from Haskell (as usual!). Function 'flip' returns a
> function taking its first two arguments in order opposite the given
> function:
That works nicely for functions with two arguments but in this
situation I tend to have m
Just take an idea from Haskell (as usual!). Function 'flip' returns a
function taking its first two arguments in order opposite the given
function:
user> (defn flip [f] (fn [a2 a1 & more] (apply f a1 a2 more)))
#'user/flip
user> (- 10 2 3)
5
user> ((flip -) 2 10 3)
5
user> ((partial < 2000) 1000)
How about a potentially ugly workaround:
user> (defn sum [ & {:keys [x y]} ] (+ x y))
#'user/sum
user> (sum :x 1 :y 2)
3
user> (def inc-sum (partial sum :x 1))
#'user/inc-sum
user> (inc-sum :y 1)
2
user> (inc-sum :y 2)
3
user>
I know this is a trivial example, but I do quite fancy named arguments
Hi Miekel,
The main reason is because I feel it is more expressive, and I really love
expressive code :)
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600
On Thu, Oct 20, 2011 at 9:10 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 21.10.2011 um 06:01 schrieb Sean C
Hi,
Am 21.10.2011 um 06:01 schrieb Sean Corfield:
> On Thu, Oct 20, 2011 at 8:15 PM, Wilker wrote:
>>
>> (take-while #(< % 2000) primes)
>
> I was expressing a need for exactly this function the other day on
> IRC. I jokingly called it 'impartial' :)
What is bad about #(< % 2000)? In fact I w
On Thu, Oct 20, 2011 at 8:15 PM, Wilker wrote:
> In the case of <> it's ok because they are reverse of each other, but in
> some circustances there is no reverse function, and you finish can't be
> using partial, instead you do like:
>
> (take-while #(< % 2000) primes)
>
> I mean, there is no such
Hi guys,
I fall out in many situations that I want the partial, but inversed, a
simple example:
Let's say I wanna all primes bellow 2.000:
(take-while (partial > 2000) primes)
In this case, that's ok, but I don't expressed myself write, I because I had
to use the oposite of < to create the part
11 matches
Mail list logo