From 935301f9a7442252de2a3f5c07e8eda44b993f5b Mon Sep 17 00:00:00 2001 From: carp-lang Date: Sat, 9 Apr 2022 05:16:19 +0000 Subject: [PATCH] Docs generated from: feat: Adds Dynamic.sort & improves output of failing dynamic tests (#1411) * feat: Adds Dynamic.sort * test: Adds tests for Dynamic.sort * refactor: Makes dynamic test handler display diff of expected vs actual instead of displaying "true" : "true" * test: Removes complex implementation of list-equal-unordered Replaces it with sort + equal. While this is less "correct", having complex untested functions within test files is undesirable. This implementation is "good enough" for lists of integers. --- core/Dynamic.html | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/core/Dynamic.html b/core/Dynamic.html index d9914d5..04357e6 100644 --- a/core/Dynamic.html +++ b/core/Dynamic.html @@ -3457,6 +3457,31 @@

sets an environment variable.

Example Usage:

(set-env "CARP_WAS_HERE" "true")
+
+ +

+ +
+ +

+ sort +

+
+
+ dynamic +
+

+ Dynamic +

+
+                        (sort l compare)
+                    
+

+

Sorts a list using the provided predicate. It is not a stable sort. +Example:

+
(sort '(1 3 4 2 5 4) <) ; => (1 2 3 4 4 5)
+(sort '(1 3 4 2 5 4) >) ; => (5 4 4 3 2 1)
+(sort '("one" "two---" "three" "four") (fn [a b] (< (String.length a) (String.length b)))) ; => ("one" "four" "three" "two---")