erlang: lists flatten/1 + max/1 + min/1 (833/833)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 58s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 58s
Structural/aggregate ops in lib/erlang/lists-ext.sx: flatten/1 deep flatten, max/1 and min/1 by full Erlang term order (badarg on empty). Extreme-finder uses er-ext-lt?'s SX boolean directly in if (er-truthy? only recognises Erlang bool atoms). lists_ext suite 52 -> 62. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -205,3 +205,36 @@
|
||||
|
||||
(er-lx-test "splitwith empty"
|
||||
(er-lx-nm "lists:splitwith(fun(_) -> true end, []) =:= {[],[]}") "true")
|
||||
|
||||
;; ── lists:flatten/1 ───────────────────────────────────────────────
|
||||
(er-lx-test "flatten nested"
|
||||
(er-lx-nm "lists:flatten([1,[2,[3,4]],5]) =:= [1,2,3,4,5]") "true")
|
||||
|
||||
(er-lx-test "flatten already flat"
|
||||
(er-lx-nm "lists:flatten([1,2,3]) =:= [1,2,3]") "true")
|
||||
|
||||
(er-lx-test "flatten empty"
|
||||
(er-lx-nm "lists:flatten([]) =:= []") "true")
|
||||
|
||||
(er-lx-test "flatten deep empties"
|
||||
(er-lx-nm "lists:flatten([[],[1],[[]]]) =:= [1]") "true")
|
||||
|
||||
(er-lx-test "flatten length"
|
||||
(erlang-eval-ast "length(lists:flatten([[1,2],[3],[4,5,6]]))") 6)
|
||||
|
||||
;; ── lists:max/1 ───────────────────────────────────────────────────
|
||||
(er-lx-test "max ints"
|
||||
(erlang-eval-ast "lists:max([3,1,4,1,5,9,2,6])") 9)
|
||||
|
||||
(er-lx-test "max single"
|
||||
(erlang-eval-ast "lists:max([7])") 7)
|
||||
|
||||
(er-lx-test "max atoms term order"
|
||||
(er-lx-nm "lists:max([a,c,b]) =:= c") "true")
|
||||
|
||||
;; ── lists:min/1 ───────────────────────────────────────────────────
|
||||
(er-lx-test "min ints"
|
||||
(erlang-eval-ast "lists:min([3,1,4,1,5])") 1)
|
||||
|
||||
(er-lx-test "min mixed term order"
|
||||
(er-lx-nm "lists:min([a,1,b]) =:= 1") "true")
|
||||
|
||||
Reference in New Issue
Block a user