File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -617,6 +617,16 @@ partition p xs = foldr select { no: Nil, yes: Nil } xs
617
617
then { no, yes: x : yes }
618
618
else { no: x : no, yes }
619
619
620
+ -- | Returns all final segments of the argument, longest first. For example,
621
+ -- |
622
+ -- | ```purescript
623
+ -- | tails (1 : 2 : 3 : Nil) == ((1 : 2 : 3 : Nil) : (2 : 3 : Nil) : (3 : Nil) : (Nil) : Nil)
624
+ -- | ```
625
+ -- | Running time: `O(n)`
626
+ tails :: forall a . List a -> List (List a )
627
+ tails Nil = singleton Nil
628
+ tails list@(Cons _ tl)= list : tails tl
629
+
620
630
-- ------------------------------------------------------------------------------
621
631
-- Set-like operations ---------------------------------------------------------
622
632
-- ------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments