02:00
Heptite joined
05:23
Heptite left
08:00
samebchase left
09:01
snonux left
09:35
snonux joined
17:07
Heptite joined
20:10
Heptite left
21:30
Heptite joined
22:44
habere-et-disper joined
|
|||
habere-et-disper | What is the terminology for the different way in which raku performs a reduction compared with uiua? | 22:50 | |
m: (2,2,2,2).reduce( &[!=] ).say | |||
camelia | False | ||
habere-et-disper | uiua gets 1 with `/≠ [2 2 2 2]` | ||
I am confused at how they arrive at different results. | 22:52 | ||
nahita3882 | terminology you are looking for is I think "associativity" of the operator passed to reduce | 23:06 | |
&[!=] has "chain" associativity, so what Raku does is compute 2 != 2 != 2 != 2 chained together: this is False, right? because they are not not-equal to each other all | 23:07 | ||
what uiua (and i assume most other languages) does is assume "left association" no matter what the operator is | 23:08 | ||
then they would do this: first compute two elements' result: 2 != 2 which is False. Now use this result to compute with 3rd element: False != 2 which is True. Now use this result to compute with 4th element: True != 2 which is True, hence the 1 you get in uiua | 23:09 | ||
habere-et-disper | Thanks @nahita3882 | 23:11 | |
nahita3882 | Then, if you pass, for example, * != * as the code object to Raku's reduce, since this is an ordinary WhateverCode object, it has the default association: left | ||
then it will give the same result, i.e., True | |||
m: (2, 2, 2, 2).reduce(* != *).say | |||
Raku eval | True | ||
habere-et-disper | I learnt something. Wonderful -- thank you. | 23:12 | |
nahita3882 | np | ||
i learned about uiua, so thank you too |