Skip to content

Instantly share code, notes, and snippets.

@raven-rock
Last active June 20, 2019 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raven-rock/33d49dc9a18adab55d1b5cfca5d874f1 to your computer and use it in GitHub Desktop.
Save raven-rock/33d49dc9a18adab55d1b5cfca5d874f1 to your computer and use it in GitHub Desktop.
Clojure-Shell Analogs
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment