Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
UGhghrhrh
Browse files Browse the repository at this point in the history
  • Loading branch information
Abigail Magalhães committed Mar 28, 2020
1 parent 804994b commit b3755ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/data/set.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ let singleton x = S (T.singleton x)
(** Construct a 'set' from the elements of a 'list' *)
let from_list (xs : list _) = S (T.from_foldable xs)

(** Construct a 'list' from the elements of a 'set', in ascending order *)
let to_list (S xs) = T.inorder_fold (::) [] xs

(** Insert an element into a 'set'. *)
let insert x (S tree) = S (T.insert x tree)

Expand Down
1 change: 1 addition & 0 deletions lib/prelude.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ let print = Io.print
let flip f x y = f y x
let x |> f = f x
let f # g = fun x -> f (g x)
let map f x = f <$> x

0 comments on commit b3755ce

Please sign in to comment.