#!/usr/bin/env clj -Sdeps {:deps,{org.clojure/math.combinatorics,{:mvn/version,"0.1.6"}}} -M
; Explanation for the shebang:
; -Sdeps Specify deps in EDN format
; , Clojure interprets commas as whitespace. Without the commas, the EDN is
; broken up into multiple arguments and the command fails. On the
; command line you can use single quotes around the EDN string, but
; Mac shebangs don't support quoting around arguments.
; -M Run the program as a "main" function
(ns foo
(:use [clojure.math.combinatorics :only (permutations)]))
(dorun (map #(println (apply str %)) (permutations "abcde")))
只有 Linux 的解决方案
#!/usr/bin/env -S clj -Sdeps '{:deps {org.clojure/math.combinatorics {:mvn/version "0.1.6"}}}' -M
; Explanation for the shebang:
; env -S Allow multiple arguments to be passed to the following command
; -Sdeps Specify deps in EDN format
; -M Run the program as a "main" function
(ns foo
(:use [clojure.math.combinatorics :only (permutations)]))
(dorun (map #(println (apply str %)) (permutations "abcde")))