I tried your source code but missed the flash. It worked without problems. What version of Clojure are you using? I tried the following code with Clojure 1.3.
(def command (atom 0)) (defn print-prompt [] (print "prompt> ") ) (defn ask-for-input [] (print-prompt) (let [x (str (read-line))] (println (str "User input: " x)) (reset! command x) ))
Edit: I changed one of your functions, which I copied and tested, and now it works autonomously and works with lein. In the original example, you had (flash).
(defn print-prompt [] (print "prompt> ") (flush) )
From what I can get, println causes a flash, printing does not work, and you need to make a flash after printing. A.
I am adding this information if it can be useful. I have a Clojure project called repl-test. Here is my header for the core.clj file of the repl-test project. Your source, already submitted, is in this file with some other functions not related to your message.
(ns repl-test.core (:gen-class) (:use clojure.contrib.command-line) (:require [clojure.contrib.string :as cstr]) (:require [clojure.contrib.trace :as ctr]) (:require [clojure.string :as sstr]) (:use clojure-csv.core))
And here is the project.clj file:
(defproject repl-test "0.0.1-SNAPSHOT" :description "TODO: add summary of your project" :dependencies [[org.clojure/clojure "1.3.0"] [org.clojure/clojure-contrib "1.2.0"] [clojure-csv/clojure-csv "1.2.4"] [org.clojure/tools.cli "0.1.0"] [clj-http "0.1.3"]] :aot [repl-test.core] :main repl-test.core)
octopusgrabbus
source share