rename reversed -> reverse
This commit is contained in:
@@ -71,10 +71,10 @@ class Kiss {
|
||||
"print" => Symbol("Prelude.print"),
|
||||
"sort" => Symbol("Prelude.sort"),
|
||||
"groups" => Symbol("Prelude.groups"),
|
||||
"pairs" => Symbol("Prelude.pairs"), // TODO test pairs
|
||||
"reversed" => Symbol("Prelude.reversed"), // TODO test reversed
|
||||
"memoize" => Symbol("Prelude.memoize"), // TODO test memoize
|
||||
"fsMemoize" => Symbol("Prelude.fsMemoize"), // TODO test fsMemoize
|
||||
"pairs" => Symbol("Prelude.pairs"),
|
||||
"reverse" => Symbol("Prelude.reverse"),
|
||||
"memoize" => Symbol("Prelude.memoize"),
|
||||
"fsMemoize" => Symbol("Prelude.fsMemoize"),
|
||||
"symbolName" => Symbol("Prelude.symbolName"),
|
||||
"symbolNameValue" => Symbol("Prelude.symbolNameValue"),
|
||||
"symbol" => Symbol("Prelude.symbol"),
|
||||
|
@@ -260,7 +260,7 @@ class Prelude {
|
||||
return zipThrow(l1, l2);
|
||||
}
|
||||
|
||||
public static function reversed<T>(l:kiss.List<T>):kiss.List<T> {
|
||||
public static function reverse<T>(l:kiss.List<T>):kiss.List<T> {
|
||||
var c = l.copy();
|
||||
c.reverse();
|
||||
return c;
|
||||
|
@@ -63,7 +63,7 @@
|
||||
realBasins (for =>lp _ realLowPoints (basinAround lp "src/year2021/inputs/day9.txt"))
|
||||
basinSizes (for b realBasins (count b))]
|
||||
(assert (= 480 (apply + (for =>_ height realLowPoints (+ 1 height)))))
|
||||
(assert (= 1045660 (apply * (.slice (reversed (sort basinSizes)) 0 3))))))
|
||||
(assert (= 1045660 (apply * (.slice (reverse (sort basinSizes)) 0 3))))))
|
||||
(day 10
|
||||
(load "day10.kiss")
|
||||
(assert (= 462693 (apply + (map (map (Util.readLines "src/year2021/inputs/day10.txt") getLineType) score))))
|
||||
|
@@ -24,7 +24,7 @@
|
||||
(let [&mut :Float score 0]
|
||||
(case line
|
||||
((Incomplete expected)
|
||||
(doFor char (reversed expected)
|
||||
(doFor char (reverse expected)
|
||||
(*= score 5)
|
||||
(+= score (case char
|
||||
(")" 1)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Silly but fun implementation of a binary->decimal conversion
|
||||
(function :Int binaryStringToDecimal [:String binary &opt :Bool invert]
|
||||
(apply +
|
||||
(for [idx digit] (enumerate (reversed (binary.split "")))
|
||||
(for [idx digit] (enumerate (reverse (binary.split "")))
|
||||
(*
|
||||
(let [digit (Std.parseInt digit)] (if invert (- 1 digit) digit))
|
||||
(^ 2 idx)))))
|
||||
|
@@ -11,7 +11,7 @@
|
||||
e (max start end)]
|
||||
(let [r (collect (range s (+ e 1)))]
|
||||
(if (> start end)
|
||||
(reversed r)
|
||||
(reverse r)
|
||||
r))))
|
||||
|
||||
(function :Array<Point> pointsCoveredBy [:Line line :Bool part2]
|
||||
|
@@ -116,7 +116,7 @@
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<!-- TODO cut this down and add some missing ones -->
|
||||
<string>(?<=\()(?i:\*|\*\*|\*\*\*|\+|\+\+|\+\+\+|\-|/|//|///|/=|<|<=|=|>|>=|and|apply|assert|begin|break|case|catch|concat|cond|continue|count|defMacro|defReaderMacro|defun|defmethod|method|function|defvar|var|defprop|prop|for|doFor|eighth|eval|fifth|first|fourth|localFunction|localVar|symbol|if|load|withFunction|withFunctions|lambda|last|let|loop|map|max|min|ninth|not|nth|setNth|getDict|setDict|or|otherwise|print|rest|return|reversed|second|set|sixth|Some|sort|symbolName|symbolNameValue|tenth|the|third|throw|trace|when|unless|ifLet|whenLet|unlessLet|forCase|doForCase|with[A-Z]\S+)(?=\s+)</string>
|
||||
<string>(?<=\()(?i:\*|\*\*|\*\*\*|\+|\+\+|\+\+\+|\-|/|//|///|/=|<|<=|=|>|>=|and|apply|assert|begin|break|case|catch|concat|cond|continue|count|defMacro|defReaderMacro|defun|defmethod|method|function|defvar|var|defprop|prop|for|doFor|eighth|eval|fifth|first|fourth|localFunction|localVar|symbol|if|load|withFunction|withFunctions|lambda|last|let|loop|map|max|min|ninth|not|nth|setNth|getDict|setDict|or|otherwise|print|rest|return|reverse|second|set|sixth|Some|sort|symbolName|symbolNameValue|tenth|the|third|throw|trace|when|unless|ifLet|whenLet|unlessLet|forCase|doForCase|with[A-Z]\S+)(?=\s+)</string>
|
||||
<key>name</key>
|
||||
<string>keyword.control.kiss</string>
|
||||
</dict>
|
||||
|
@@ -110,7 +110,7 @@
|
||||
(set lastChangeSet (the ChangeSet (Reflect.callMethod null command.handler collectedArgs)))
|
||||
(when lastChangeSet (ui.handleChanges archive lastChangeSet)))]
|
||||
// To facilitate asynchronous arg input via UI, we need to construct an insanely complicated nested callback to give the UI
|
||||
(doFor arg (reversed command.args)
|
||||
(doFor arg (reverse command.args)
|
||||
(set lastCollector (_composeArgCollector collectedArgs arg lastCollector)))
|
||||
(lastCollector)))
|
||||
|
||||
|
Reference in New Issue
Block a user