josh@planchet.rutgers.edu (J Storrs Hall) (09/20/90)
In J, function rank seems to be set to 0 when functions are composed even though it was originally something else, e.g. (5&{.)&(5&*) i.10 gives the same result as (5&{.)"0 (5&*) i.10 and NOT the same as (5&{.) (5&*) i.10 as one would expect. Is this a bug or a feature (or an implementation limitation)? --JoSH ps-- the third line is equivalent to 5{.5*i.10 giving 0 5 10 15 20 as expected, but the first two yield 0 0 0 0 0 5 0 0 0 0 10 0 0 0 0 15 0 0 0 0 20 0 0 0 0 25 0 0 0 0 30 0 0 0 0 35 0 0 0 0 40 0 0 0 0 45 0 0 0 0
news@usc.edu (09/20/90)
In article <Sep.20.02.36.50.1990.11172@planchet.rutgers.edu> josh@planchet.rutgers.edu (J Storrs Hall) writes: In J, function rank seems to be set to 0 when functions are composed even though it was originally something else, e.g. (5&{.)&(5&*) i.10 gives the same result as (5&{.)"0 (5&*) i.10 and NOT the same as (5&{.) (5&*) i.10 as one would expect. Is this a bug or a feature (or an implementation limitation)? It has to be a feature. Composition produces a single function. You're doing 5 take of the result of 5 times. Since times is a scalar function (rank 0 verb), the composition is also rank 0.
josh@klaatu.rutgers.edu (J Storrs Hall) (09/21/90)
In article <12060@chaph.usc.edu>, news@usc.edu writes: ... > It has to be a feature. > Composition produces a single function. You're doing 5 take of the > result of 5 times. Since times is a scalar function (rank 0 verb), > the composition is also rank 0. That can't be right. The composition of two functions of different rank should be the higher rank, because of the very problem I mentioned originally. Suppose you tried composing plus reduction and 5 plus. 5 plus has rank 0, so by your logic the composition should have rank 0. But this leaves plus reduction coerced to rank 0, rendering it the identity function. But on the other hand, it's quite easy to have a function of *lower* rank operate within the context of a higher rank, and you'd get the right answer. --JoSH ps: by "right answer" I just mean the definition, ie, f&g h <==> f g h