How can i use the functions in "test.clj" automatically once entering the REPL?
In haskell, i can use the functions defined in "test.hs" automatically when entering its interactive environment by cusomizing ~/.ghci .
>cat ~/.ghci
:def hoogle \str -> return $ ":! hoogle --count=15 \"" ++ str ++ "\""
:cd /media/E/www/qachina/db/doc/test
:load test
Now i convert "test.hs" to "test.clj" and use the following script to enter its REPL.
%cat ~/bin/myclj
#!/bin/sh
breakchars="(){}[],^%$#@\"\";:''|\\"
CLOJURE_DIR=/usr/share/clojure
CLOJURE_JAR="$CLOJURE_DIR"/clojure.jar
CONTRIB_JAR="$CLOJURE_DIR"/clojure-contrib.jar
if [ $# -eq 0 ]; then
exec rlwrap --remember -c -b "$breakchars" \
-f "$HOME"/.clj_completions \
java -cp "$CLOJURE_JAR:$CONTRIB_JAR" clojure.main
els开发者_开发知识库e
exec java -cp "$CLOJURE_JAR:$CONTRIB_JAR" clojure.main $1 -- "$@"
fi
Sincerely!
for evaluation + REPL you can use following command:
java -cp ..... clojure.main -i script/run.clj -r
See documentation for clojure.main function. Order of command line options is important!
You could just use Leiningen.
lein new foo
Paste your code into ./foo/src/foo/core.clj and run 'lein repl' in ./foo
That way you can use the functions defined in core.clj in a REPL.
精彩评论