[Jprogramming] Comparing pairs
Henry Rich
HenryHRich at nc.rr.com
Fri Aug 14 20:03:37 UTC 2015
The special combinations are also shown in
http://www.jsoftware.com/jwiki/Vocabulary/SpecialCombinations
in this case under
http://www.jsoftware.com/jwiki/Vocabulary/SpecialCombinations#Infixes
Henry Rich
On 8/14/2015 10:45 AM, Roger Hui wrote:
> As for efficiency, see the entry for 2 f/\y in
> http://www.jsoftware.com/help/dictionary/special.htm , with more details in:
>
> http://www.jsoftware.com/help/release/infix2.htm
> http://www.jsoftware.com/help/release/infix2a.htm
>
>
>
>
> On Fri, Aug 14, 2015 at 7:40 AM, Roger Hui <rogerhui.canada at gmail.com>
> wrote:
>
>> What you want is "infix":
>>
>> 2 <\ 3 1 4 1 5 9
>> ┌───┬───┬───┬───┬───┐
>> │3 1│1 4│4 1│1 5│5 9│
>> └───┴───┴───┴───┴───┘
>> 2 -/\ 3 1 4 1 5 9
>> 2 _3 3 _4 _4
>>
>>
>>
>>
>> On Fri, Aug 14, 2015 at 7:30 AM, Yoel Jacobsen <yoel.jacobsen at gmail.com>
>> wrote:
>>
>>> Lately, I find myself repeatedly comparing pairs in arrays.
>>>
>>> I usually do something like:
>>>
>>> d =: 3 : '-/"1 }. y ,. 0 , }: y'
>>>
>>>
>>> d i. 5
>>>
>>> 1 1 1 1
>>>
>>>
>>> It feels like I'm reinventing the wheel but I couldn't find a simpler way
>>> (and more efficient for large arrays) to apply u over each pair of v.
>>>
>>>
>>> Is there a better way?
>>>
>>>
>>> Yoel
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list