diff --git a/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/list.satyg b/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/list.satyg index 06f0eaabe..bac6abd7f 100644 --- a/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/list.satyg +++ b/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/list.satyg @@ -110,9 +110,9 @@ end = struct val persistent ~fold-indexed-adjacent f init xs = let (_, acc) = - xs |> fold-adjacent (fun (i, acc) x prev-opt next-opt -> ( + xs |> fold-adjacent (fun (i, acc) x prev-opt next-opt -> (i + 1, f acc i x prev-opt next-opt) - )) (0, init) + ) (0, init) in acc @@ -135,22 +135,22 @@ end = struct aux 0 f val persistent ~map-adjacent f xs = - xs |> fold-adjacent (fun acc x prev-opt next-opt -> ( + xs |> fold-adjacent (fun acc x prev-opt next-opt -> f x prev-opt next-opt :: acc - )) [] |> reverse + ) [] |> reverse val persistent ~map-indexed-adjacent f xs = - xs |> fold-indexed-adjacent (fun acc i x prev-opt next-opt -> ( + xs |> fold-indexed-adjacent (fun acc i x prev-opt next-opt -> f i x prev-opt next-opt :: acc - )) [] |> reverse + ) [] |> reverse val persistent ~map-with-ends f xs = - fold-adjacent (fun acc x prev-opt next-opt -> ( + fold-adjacent (fun acc x prev-opt next-opt -> let is-first = Option.is-none prev-opt in let is-last = Option.is-none next-opt in let y = f is-first is-last x in y :: acc - )) [] xs |> reverse + ) [] xs |> reverse val persistent ~rec append xs1 xs2 = match xs1 with diff --git a/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/map.satyg b/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/map.satyg index af3c7b2d4..605becdf0 100644 --- a/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/map.satyg +++ b/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/map.satyg @@ -197,10 +197,10 @@ end = struct end end in - (fun mp -> ( + (fun mp -> let (_, mp-new) = aux mp in mp-new - )) + ) val trim-minimum = let rec aux n = @@ -214,12 +214,12 @@ end = struct (kv-min, rebalance tL n#key n#data n#right) end in - (fun t -> ( + (fun t -> match t with | Empty -> None | Node(n) -> Some(aux n) end - )) + ) % Merges two trees `t1` and `t2`, % where the maximum key in `t1` is less than the minimum key in `t2` @@ -256,12 +256,12 @@ end = struct end end in - (fun mp -> ( + (fun mp -> match aux mp with | None -> mp | Some(mp-new) -> mp-new end - )) + ) val find k = let rec aux mp = @@ -422,7 +422,7 @@ end = struct #[test] val add-test () = - List.iter (fun r -> ( + List.iter (fun r -> let title = r#title in let input = r#input in let expected = r#expected in @@ -431,7 +431,7 @@ end = struct let got = r#operation r#input in let () = assert ?(title = title ^ `: output well-formedness`) (is-well-formed got) in assert-equal ?(title = title) (eq-internal Equality.string) expected got - )) [ + ) [ (| title = `added to the left`, input = diff --git a/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/path.satyh b/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/path.satyh index 53ecdb5a0..2dc30c5f0 100644 --- a/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/path.satyh +++ b/lib-satysfi/packages/stdlib/stdlib.0.0.1/src/path.satyh @@ -99,14 +99,14 @@ end = struct |> close-with-line val poly-line pt-init pts = - pts |> List.fold (fun acc pt -> ( + pts |> List.fold (fun acc pt -> acc |> line-to pt - )) (start-path pt-init) |> terminate-path + ) (start-path pt-init) |> terminate-path val polygon pt-init pts = - pts |> List.fold (fun acc pt -> ( + pts |> List.fold (fun acc pt -> acc |> line-to pt - )) (start-path pt-init) |> close-with-line + ) (start-path pt-init) |> close-with-line val line pt1 pt2 = start-path pt1 |> line-to pt2 |> terminate-path diff --git a/lib-satysfi/packages/stdlib/stdlib.0.0.1/test/list-test.satyg b/lib-satysfi/packages/stdlib/stdlib.0.0.1/test/list-test.satyg index ca2826bed..670e84115 100644 --- a/lib-satysfi/packages/stdlib/stdlib.0.0.1/test/list-test.satyg +++ b/lib-satysfi/packages/stdlib/stdlib.0.0.1/test/list-test.satyg @@ -18,9 +18,9 @@ module ListTest = struct let mutable r <- [3] in let inputs = [1, 4, 1, 5, 9, 2] in let () = - List.iter (fun n -> ( + List.iter (fun n -> r <- n :: !r - )) inputs + ) inputs in let got = !r in let expected = [2, 9, 5, 1, 4, 1, 3] in @@ -28,10 +28,10 @@ module ListTest = struct #[test] val compare-test () = - List.iter (fun r -> ( + List.iter (fun r -> let got = List.compare Int.compare r#input1 r#input2 in assert-equal ?(title = r#title) eq-ordering r#expected got - )) [ + ) [ (| title = `prefix is smaller 1`, input1 = [], @@ -60,10 +60,10 @@ module ListTest = struct #[test] val show-test () = - List.iter (fun r -> ( + List.iter (fun r -> let got = List.show arabic r#input in assert-equal ?(title = r#title) Equality.string r#expected got - )) [ + ) [ (| title = `empty`, input = [], @@ -109,11 +109,11 @@ module ListTest = struct let input = [`a`, `b`, `c`, `d`] in let expected = [`cdY`, `bcd`, `abc`, `Xab`] in let got = - List.fold-adjacent (fun acc s prev next -> ( + List.fold-adjacent (fun acc s prev next -> let s-prev = Option.from `X` prev in let s-next = Option.from `Y` next in (s-prev ^ s ^ s-next) :: acc - )) [] input + ) [] input in assert-equal Equality.(list string) expected got @@ -122,11 +122,11 @@ module ListTest = struct let input = [`a`, `b`, `c`, `d`] in let expected = [`3cdY`, `2bcd`, `1abc`, `0Xab`] in let got = - List.fold-indexed-adjacent (fun acc i s prev next -> ( + List.fold-indexed-adjacent (fun acc i s prev next -> let s-prev = Option.from `X` prev in let s-next = Option.from `Y` next in (arabic i ^ s-prev ^ s ^ s-next) :: acc - )) [] input + ) [] input in assert-equal Equality.(list string) expected got @@ -149,11 +149,11 @@ module ListTest = struct let input = [3, 1, 4, 1, 5, 9, 2] in let expected = [`X31`, `314`, `141`, `415`, `159`, `592`, `92Y`] in let got = - List.map-adjacent (fun n prev next -> ( + List.map-adjacent (fun n prev next -> let s-prev = Option.from `X` (Option.map arabic prev) in let s-next = Option.from `Y` (Option.map arabic next) in s-prev ^ arabic n ^ s-next - )) input + ) input in assert-equal Equality.(list string) expected got