From 9b1d88f525a8957898ee57c240e6a62f094be3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingy=20d=C3=B6t=20Net?= Date: Thu, 5 Sep 2024 10:03:07 -0700 Subject: [PATCH] std: Remove 'fun' alias for 'partial' --- core/src/ys/std.clj | 2 -- sample/advent/tree.ys | 2 +- sample/rosetta-code/100-prisoners.ys | 2 +- sample/rosetta-code/sieve-of-eratosthenes.ys | 4 ++-- ys/test/std.t | 11 +---------- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/core/src/ys/std.clj b/core/src/ys/std.clj index 64d46217..e6fd79f0 100644 --- a/core/src/ys/std.clj +++ b/core/src/ys/std.clj @@ -57,8 +57,6 @@ (intern 'ys.std 'a clojure.core/identity) -(intern 'ys.std 'fun clojure.core/partial) - (intern 'ys.std 'just clojure.core/identity) (intern 'ys.std 'len clojure.core/count) diff --git a/sample/advent/tree.ys b/sample/advent/tree.ys index 0a320bfc..e07121a4 100644 --- a/sample/advent/tree.ys +++ b/sample/advent/tree.ys @@ -5,7 +5,7 @@ defn main(width=5): defn tree(width): top =: (width .. 1) - .map(fun(line width)) + .map(partial(line width)) .join("\n") trunk =: trunk(width) * 2 diff --git a/sample/rosetta-code/100-prisoners.ys b/sample/rosetta-code/100-prisoners.ys index 0efa0f51..16d90327 100644 --- a/sample/rosetta-code/100-prisoners.ys +++ b/sample/rosetta-code/100-prisoners.ys @@ -72,7 +72,7 @@ defn search-50-random-drawers(prisoner-number drawers): drawers: .shuffle() .take(50) - .filter(fun(== prisoner-number)) + .filter(partial(== prisoner-number)) .count() .eq(1) diff --git a/sample/rosetta-code/sieve-of-eratosthenes.ys b/sample/rosetta-code/sieve-of-eratosthenes.ys index 9362561a..7847b69a 100644 --- a/sample/rosetta-code/sieve-of-eratosthenes.ys +++ b/sample/rosetta-code/sieve-of-eratosthenes.ys @@ -21,6 +21,6 @@ defn primes-up-to(limit): add(i i 1)) : aset(refs j false) cons 2: - map comp(inc fun(* 2)): - filter fun(aget refs): + map comp(inc partial(* 2)): + filter partial(aget refs): range(1 max-i) diff --git a/ys/test/std.t b/ys/test/std.t index 07668dd7..63b91d4a 100644 --- a/ys/test/std.t +++ b/ys/test/std.t @@ -20,16 +20,7 @@ test:: - note: "Short named functions for very common operations" - note: 'Short named functions' -# A is for partials -- code: (fun(+ 1) 41) - want: 42 -- code: call(fun(+ 1) 41) - want: 42 -- code: fun(+ 1).call(41) - want: 42 -- code: -"inc".call(41) - want: 42 - +# Short named functions for very common operations - code: 'just: 123' want: 123 - code: just('123')