[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] Scan operator has strange behaviour
From: |
Jay Foad |
Subject: |
Re: [Bug-apl] Scan operator has strange behaviour |
Date: |
Fri, 21 Mar 2014 11:55:51 +0000 |
On 21 March 2014 11:48, Elias Mårtenson <address@hidden> wrote:
> OK, I understand your explanation, and I have to say that the spec seems to
> be a bit over-specified here. My (simplistic?) understanding of the
> backslash operator was that it simply applied the given function on the
> first two elements, add the result to the list, and then repeat the process
> with the result of the previous iteration and the next element in the list.
>
> The spec talks about associativity of the function, but given the current
> reading I can't see how associativity would make any difference (it wouldn't
> given my understanding above, either). To me, the sentence only makes sense
> if the work "associativity" is replaced with "side-effect free".
>
> Are there any cases where a side-effect free (but non-associative) function
> applied to the backslash operator would give different results?
>\3 1 2
3 1 1
I think your explanation of scan would lead to the result 3 1 0.
Associativity matters because the last item of the result is 3>1>2,
which means 3>(1>2). But your explanation would lead to (3>1)>2 as the
last item.
Jay.