sequences: add sigma and count
parent
a1a252320a
commit
e815494578
|
@ -722,3 +722,8 @@ PRIVATE>
|
|||
dup [ length ] map infimum
|
||||
swap [ [ nth-unsafe ] with { } map-as ] curry { } map-as
|
||||
] unless ;
|
||||
|
||||
: sigma ( seq quot -- n ) [ + ] compose 0 swap reduce ; inline
|
||||
|
||||
: count ( seq quot -- n ) [ 1 0 ? ] compose sigma ; inline
|
||||
|
||||
|
|
Loading…
Reference in New Issue