Aw: Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-06-14 Thread Meikel Brandmeyer
Hi, indeed. On the other hand the atom has the advantage of making the loop easily interuptible from the outside. YMMV. :) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-06-14 Thread Albert Cardona
Hi Meikel, it surprised me that you used an atom to run the event loop. A simple loop/recur also works, at least in clojure 1.2.1: (loop [] (let [input (read-line)] (when (pos? (count input)) (println (pick phrases)) (recur Just for the record. Best, Albert -- http://

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-09 Thread Mike Meyer
On Sat, 9 Apr 2011 19:27:13 -0400 Lee Spector wrote: > On Apr 9, 2011, at 6:18 PM, Sean Corfield wrote: > > On Sat, Apr 9, 2011 at 6:46 AM, Lee Spector wrote: > >> But still, I will humbly submit that it's totally freakin' nutso that it > >> should be so hard to do basic user interaction. > > I'

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-09 Thread Lee Spector
On Apr 9, 2011, at 6:18 PM, Sean Corfield wrote: > On Sat, Apr 9, 2011 at 6:46 AM, Lee Spector wrote: >> But still, I will humbly submit that it's totally freakin' nutso that it >> should be so hard to do basic user interaction. > > I'm curious as to what percentage of developers are writing >

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-09 Thread Sean Corfield
On Sat, Apr 9, 2011 at 6:46 AM, Lee Spector wrote: > But still, I will humbly submit that it's totally freakin' nutso that it > should be so hard to do basic user interaction. I'm curious as to what percentage of developers are writing console-based applications (in any language)? What do the p

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-09 Thread Lee Spector
On Apr 8, 2011, at 11:33 PM, Gregg Williams wrote: > ... *How* does the > word "easier" belong in that sentence, when I all I want to do is read > input from the keyboard?! > > My modest proposal: > ... I'm writing to support the sentiment that Gregg expressed here with regard to this issue, a

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Armando Blancas
> My modest proposal: [snip] Have you considered a grant from the National Science Foundation? Dennis Ritchie is still around in what remains of Bell Labs; maybe he could help us read from standard input. -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Gregg Williams
Thanks to all for your helpful replies. Mikel's greet.clj is something that "just works," but it requires invoking Java through the command line. If I go that route, the code that I wrote will work...won't it? (I'll try.) But look at the proposed solutions--for example, "It's easier to do somethin

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Rasmus Svensson
See this tread for why stdin is not directly available with lein: http://groups.google.com/group/leiningen/browse_thread/thread/f9f9ed97eb8a2928/ccab95588ef50d05?lnk=gst&q=stdin "This is currently impossible due to a bug in ant; it just swallows stdin completely, and they seem to have no intentio

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Armando Blancas
> Can anybody suggest anything > that will enable me to write this simple program that any middle- > school student would find, well, basic if written in BASIC? Thanks. Write your own read function to delegate to (read-line) or, in debug mode, read the next line from some file; then keep various f

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Meikel Brandmeyer
Hi, On 8 Apr., 08:52, Gregg Williams wrote: > I assume that running clojure completely manually > from the CLI will work, but honestly, I'd like to have some support > for interactivity and/or debugging this program, which could grow over > time. Ah. Ok. It's a tooling issue. What you can do (a

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Meikel Brandmeyer
Hi, I put that into greet.clj. --8<---8<---8<-- (def state (atom :running)) (println "Where to send the greetings?") (while (= @state :running) (let [guy (read-line)] (if (pos? (count guy)) (println (str "Hello, " guy "!")) (reset! state :stop --8<---8<---8<-- And then sta

Re: help--reading keyboard input from Clojure is surprisingly difficult

2011-04-08 Thread Ken Wesson
On Fri, Apr 8, 2011 at 2:52 AM, Gregg Williams wrote: > Having worked with Clojure for over a year, I can sympathize with > Clojure beginners (like myself) who find it extremely difficult to do > simple things with Clojure. (It took me weeks to get Clojure working > with Emacs, Swank, and the Cloj