] if ;
: permutation ( seq -- perm )
- [ natural-sort ] keep [ index ] curry map ;
+ [ sort ] keep [ index ] curry map ;
: (inversions) ( n seq -- n )
[ > ] with count ;
2drop 0 { }
] [
dup permutation inversions -1^ rot *
- swap natural-sort
+ swap sort
] if ;
: wedge ( x y -- x.y )
] map sift 2nip ;
: basis ( generators -- seq )
- natural-sort dup length 2^ <iota> [ nth-basis-elt ] with map ;
+ sort dup length 2^ <iota> [ nth-basis-elt ] with map ;
: (tensor) ( seq1 seq2 -- seq )
[
- [ prepend natural-sort ] curry map
+ [ prepend sort ] curry map
] with map concat ;
: tensor ( graded-basis1 graded-basis2 -- bigraded-basis )