Skip to content

Commit

Permalink
std: Remove 'fun' alias for 'partial'
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Sep 5, 2024
1 parent 4d385e8 commit 9b1d88f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
2 changes: 0 additions & 2 deletions core/src/ys/std.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sample/advent/tree.ys
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sample/rosetta-code/100-prisoners.ys
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions sample/rosetta-code/sieve-of-eratosthenes.ys
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 1 addition & 10 deletions ys/test/std.t
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 9b1d88f

Please sign in to comment.