>> I agree with your final note.
>> *./0={.y
>> handles both
>> i.0 and i.0 0
>
> And it handles i.1 0
and i.0 1
check:
REF0 rcTest
1 2 _1 _4
2 3 _1 _11
_2 0 _3 22
------
_1 1 _3
4 _5 14
------
_1 2
------
------
shape: 0 1
==============
1 2 _1 _4
0 1 _1 3
0 0 1 _2
with:
REF0=: 3 :0
smoutput '------' [smoutput y
if. *./0=ks=.{.y do. smoutput '==============' [smoutput 'shape: ',": $ y
y return. end.
NB. if. 0 1 -: $ y do. y return. end.
if. 0~:{.ks=.{. y do. r,0,. REF0 y (}.@]-(*{.))"1&}.~r=.(%{.)ks
else. if. 0=#z=. (#~0~:{."1) }.y do. 0,. REF0 }."1 y
else. REF0 (}.y),~ks+{.z end.
end.
)
> i.0 0
=> empty table: containing no elements. [[]] looks like a table, but []
can also be a table. [[]] is a list with one element, which happens to
be an empty list of what? Type signature will tell us. If you write sane
Haskell expressions you did type-signature the expression already:
rowEchelonForm :: (Eq a, Fractional a) => [[a]] -> [[a]]
>
>
> To represent i.0 0 I think you need a different kind of type in Haskell.
Yes. In Haskell you can work with data type Maybe [[a]]. Here i.0 0 will
have the result Nothing.
Perhaps something like:
actie :: (Eq a, Fractional a) => [[a]] -> Maybe [[a]]
actie xss@(xs:_) | null xs = Nothing
| otherwise = Just $ drop 1 xss
*Main> actie [[]]
Nothing
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm