Clojure | Shell | Notes |
---|---|---|
butlast |
sed '$d' |
|
clojure.string/lower-case |
tr A-Z a-z |
|
clojure.string/upper-case |
tr a-z A-Z |
|
count |
wc -l |
|
distinct |
perl -ne 'print unless $seen{$_}++' |
Note that Clojure's distinct behavior is different than the shell's uniq . |
drop n |
sed '1,$n' |
|
first |
head -1 |
|
last |
tail -1 |
|
nth coll n |
head -$n | tail -1 |
|
range 1 10 |
seq 1 10 |
|
range 1 2 10 |
seq 1 2 10 |
|
rest |
sed 1d |
|
reverse |
tac |
|
second |
head -2 | tail -1 |
|
sort |
sort |
|
take n |
head -$n |
|
take-last n |
tac | head -$n | tac |
Last active
June 20, 2019 03:50
-
-
Save raven-rock/33d49dc9a18adab55d1b5cfca5d874f1 to your computer and use it in GitHub Desktop.
Clojure-Shell Analogs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment