Little LISPer and Ten Commandments

2010-09-22 Thread ax2groin
Newbie here, to both LISP and Clojure. A friend has lent me a copy of "The Little LISPer" and I've started working through it, using some web resources to translate it into clojure. My questions: How relevant are the ten commandments? What modification need to be made ... either to the commandment

Re: Little LISPer and Ten Commandments

2010-10-01 Thread ax2groin
Yeah, it has been a good educational resource for working through. I'm not finished, but I've put the Clojure version of all the code up here: https://www.assembla.com/code/little_clojure/subversion/nodes Looking forward to those last couple chapters. msd -- You received this message because

Re: Good book on migrating from (Java) OO to FP

2011-07-29 Thread ax2groin
Can you provide a more detailed review? How did it help you? What area(s) that it focused on did you find most useful? I've been playing with Clojure for nearly a year now, but it has just been on my own. At work, however, it is just Java and C#. Of course, I've also got several computer books wai

Re: Stanford AI Class

2011-08-16 Thread ax2groin
The NYTimes article on the class also mentions two other classes being offered for free: * Machine Learning, by Andrew Ng * Introductory course on database software, by Jennifer Widom I'm not sure of the official website for either of these, but the Machine Learning class sounds promising and di

not= counterintuitive?

2011-09-02 Thread ax2groin
This code doesn't return the value I intuitively expect: user=> (not= 1 2 1) true When I write that, I was expecting the equivalent of (and (= 1 2) (= 1 1)), but the macro expansion is essentially (not (= 1 2 1)). Note: This came out of the :while condition of a (for) expression not returnin

Re: not= counterintuitive?

2011-09-02 Thread ax2groin
That's what I get for posting a question while feeding a 1-year-old child and getting ready to leave for lunch. I was trying to put together a (for) construct to output the combinations of a set, and my logic was flawed. Here's what I really wanted [for sets of 3]: (for [m x n x o x :while (and

Re: not= counterintuitive?

2011-09-06 Thread ax2groin
The clojure.contrib.combinatorics/combinations does do exactly what I was trying to do, although I was doing the problem as an exercise in how to do it, and not in really needing combinations for something else. The combinatorics library certainly does it in a more generic way. Since I knew that I

Recursion/Algorithm Question

2011-09-21 Thread ax2groin
I've been working through algorithm problems to learn the language a little better. I'm currently struggling with the question about a "robot" traversing a grid. If the grid is completely open, then the answer to "how many possible ways to traverse the grid?" is simply the math for combinations usi

Re: Recursion/Algorithm Question

2011-09-22 Thread ax2groin
Thanks, Nathan, that did help. I'm still stuck, however, figuring out how to return the values as a flat sequence of vectors. Maybe I'm just missing the right function from the API. Here's where I'm at right now: (defn get-paths ([n] (get-paths n [0 0] '())) ([n point path] (cond (points-equ

Re: Recursion/Algorithm Question

2011-09-23 Thread ax2groin
Thanks, That (along with returning the completed path via (list)) nailed it. I thought I'd tried concat at some point, but that might have been with another problem I've been tackling. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: Tailing a file in Clojure

2010-12-04 Thread ax2groin
Does any familiar with this NIO Watch service know if it handles NFS issues? We have an in-house log monitoring tool at work (doesn't everyone) which is written in Java, but the two big issues are message framing (knowing when a multi-line message has ended) and getting null bytes when tailing an N

Loading JNI

2010-12-31 Thread ax2groin
I'm having trouble formulating a method to load JNI libraries into System. I'm just getting started, so this is a newbie question. I want something like this: (defn get-jni-path "Derive the path to DLLs from environmental variables" [] (let [path (System/getenv "APP_CONFIG_DIR")] (str (

Re: Loading JNI

2011-01-03 Thread ax2groin
Hmm, I see that the final draft of my question missed an essential element, I am using Eclipse. In any case, I've tried something really basic, and it fails: (try (System/load "C:\\app/bin/coms.dll") (println "Native code library failed to load.")) The file is there (I checked with an exists() c

Re: Loading JNI

2011-01-03 Thread ax2groin
Of course not. I mentioned I'm new at this, right? It seems I was doing that part right before. I'm getting InvocationTargetException and NoClassDefFoundError, so I tried to work my way from the start to see if I was missing something (which I thought was a valid assumption, if exceptions were bei

Re: Loading JNI

2011-01-04 Thread ax2groin
Thanks for the suggestions. I'll look at the JNA soon to see if that fits. But I already have working examples of Java code which uses the JNI wrapper classes (generated by swig - by someone else). I'm not making direct JNI calls myself, but trying to instantiate the Java classes that are a part of

Re: Loading JNI

2011-01-06 Thread ax2groin
Sorry for the late response, but I haven't had time to play with things in a couple days. First discovery is that I probably cannot use the library path variable, because some of the DLLs have to be loaded in a specific order. Specifically, there is a "clientswig.dll" that has to be loaded last. G

Re: Creating prime? function

2011-02-16 Thread ax2groin
This is just my copy of something I pulled together from other sources while working of Project Euler problems and perhaps refined a little: (defn prime? [n] (cond (or (= n 2) (= n 3)) true (even? n) false :else (let [sqrt-n (Math/sqrt n)] (loop [i 3] (cond (d