Re: How do I do this in clojure?

2009-02-17 Thread Jesse Aldridge
[:font {:color "#cc"} (subs cell 0 1)] >               (subs cell 1)])])])) > > (defn make-grid [col-size data] >   (partition col-size >     (filter #(not= % "") data))) > > (print-table >   (make-grid 3 ["cat" "dog" "" "rab

Re: How do I do this in clojure?

2009-02-17 Thread Jesse Aldridge
> Jesse, > Could I see your own version. Haha, I was afraid someone would say this. Here is my embarrassingly bad (but working) version: (defn build-table [] (def num-cols 3) (def selected-row 0) (def selected-col 0) (def all-strings ["apple" "cat" "dog" "" "frog" "elephant" "gorilla"])

Re: How do I do this in clojure?

2009-02-16 Thread Jesse Aldridge
Alright, I got it working. Thanks for the replies. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send e

How do I do this in clojure?

2009-02-16 Thread Jesse Aldridge
I'm trying to port some Python code to Clojure. I'm new to functional programming and I hit a function that is causing my brain to melt. The python function looks something like this: def build_table(): num_cols = 3 selected_row = 0 selected_col = 0 strings = ["cat", "dog", "",

How to port a mixin to clojure

2009-02-11 Thread Jesse Aldridge
I'm trying to re-implement some python stuff in clojure. Here's how it works: I have a class called ArrowKeySelection. I use this class as a mixin with various gui classes. The class adds some abstract logic for handling keys - the arrow keys move a selector around a matrix and the enter key

The wiki

2009-02-11 Thread Jesse Aldridge
I notice the front page of the wiki has had some changes awaiting review: http://en.wikibooks.org/wiki/Clojure_Programming Apparently they've been waiting for almost a month now? I also noticed this comment on the discussion page: "The approved revision mechanism is killing this wiki. I'm avoid

Wiki -> Concepts -> Libraries -> clojure/ns

2009-02-10 Thread Jesse Aldridge
Here in the wiki: http://en.wikibooks.org/wiki/Clojure_Programming/Concepts#Libraries The examples make use of the clojure/ns command, for example: (clojure/ns example.ourlib) I had to get rid of the "clojure/" part to make it work. Is the wiki wrong? If so, could somebody update it? --~--~

Re: Problems with "gen-and-load-class" (defn user-exception-test [] (try (throw (new user.UserException "msg: user exception was here!!")) (catch user.UserException e (prn "caught exception" e)) (fi

2008-12-19 Thread Jesse Aldridge
It would be nice if someone updated the wiki with a new example. I don't understand how the gen-class stuff is supposed to work. Why doesn't the following work? (gen-class :name MyException :extends [Exception]) (defn user-exception-test [] (try (throw (new MyException "msg: user excepti

Re: Superficial barriers to entry

2008-12-18 Thread Jesse Aldridge
Regarding the editor part, Scite could be a good option, especially for beginners. It's a whole hell of a lot simpler than emacs and vim. All you really have to do by way of configuration is go to "Options" - > "Open User Options File" and paste in the following lines: --- file.patterns.lisp=*