Timeline for How can I make threading more flexible?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 1, 2014 at 13:40 | vote | accept | Simon Woods | ||
Sep 15, 2013 at 13:43 | history | edited | Simon Woods | CC BY-SA 3.0 |
improved code and explanation
|
Apr 16, 2013 at 19:54 | history | edited | Simon Woods | CC BY-SA 3.0 |
added 28 characters in body
|
Apr 16, 2013 at 19:44 | comment | added | Simon Woods |
It won't work with heads other than List - I should put an ?ArrayQ check in the pattern.
|
|
Apr 16, 2013 at 19:42 | comment | added | Simon Woods |
@Rojo, your first two examples are as expected. The output has to be the same shape as one of the inputs, normally whichever one has the greater ArrayDepth , but if they both have the same depth the output takes the shape of the first input.
|
|
Apr 16, 2013 at 18:29 | comment | added | Rojo |
Also, check the output of smartThread@f[h@1, {2}]
|
|
Apr 16, 2013 at 18:18 | comment | added | Rojo |
I'm still trying to get a clear idea of the general behaviour expected. For example, is the output of smartThread@f[{{x[1], x[2]}}, {{y[1]}, {y[2]}}] and smartThread@f[{{x[1]}, {x[2]}}, {{y[1], y[2]}}] what you expect? I mean, the dimensions of the output can depend on the order of the lists? Or is that a bonus case that doesn't need to be handled?
|
|
Apr 16, 2013 at 18:10 | comment | added | Simon Woods |
I've patched it up using a third argument to indicate if a and b have been swapped, but I'm trying to think of a neater way to handle it.
|
|
Apr 16, 2013 at 18:07 | history | edited | Simon Woods | CC BY-SA 3.0 |
added 80 characters in body
|
Apr 16, 2013 at 18:00 | comment | added | Simon Woods |
Thanks, @Rojo, good catch. I must have only tested it on Orderless functions...
|
|
Apr 16, 2013 at 17:28 | comment | added | Rojo |
By the way, smartThread[f[{a}, {{b}, {c}}]] swaps the order and returns {{f[b, a]}, {f[c, a]}}
|
|
Apr 16, 2013 at 15:39 | history | answered | Simon Woods | CC BY-SA 3.0 |