Re: common ways to run regex against either Hickory HTML or zippers?

2022-02-02 Thread Mark Nutter
I don't know how common it is, but have you looked at the `tree-seq` function in Clojure? This seems like a good use case for it. Mark On Wed, Feb 2, 2022 at 3:22 PM lawrence...@gmail.com < lawrence.krub...@gmail.com> wrote: > Assume I've been cursed to scrape HTML. If I convert the pages to Hic

Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-25 Thread Mark Nutter
I think at least part of the problem is your use of val in the let statement. Inside the loop, you're testing (not (= val -1)), but val is an immutable value defined above the loop as being the first character read from the buffer, so it will always loop until it reads in the 0xFFF that makes

Re: Why did this compile? It's an obvious syntax mistake

2018-12-26 Thread Mark Nutter
My guess would be that it failed to compile, and the weird behavior is that it swallowed the "Failed" message somehow. That would be consistent with the behavior you saw (couldn't call your start fn). On Wed, Dec 26, 2018 at 11:59 AM wrote: > I'm wondering why this compiled? > > I was supposed t

Re: Doc strings for complex cases?

2017-11-05 Thread Mark Nutter
That actually sounds like a kind of code smell to me. If your different arities/defmethods are doing such disparate things that you can't easily describe them in a single docstring, it's worth asking whether they need to be separate functions. On Sun, Nov 5, 2017 at 7:59 AM, Tim wrote: > I'm see

Re: Is the Learning Guide in Order?

2017-10-11 Thread Mark Nutter
See also https://www.braveclojure.com/. On Tue, Oct 10, 2017 at 9:11 PM, Tomiwa Ademidun wrote: > Hey guys, > > I Finally started learning Lisp/Clojure thanks to inspiration from the > great Paul Graham's essays . First, I > wanted to say I appreciate your wor

Re: Application silently shuts down by itself after running for some hours

2017-03-07 Thread Mark Nutter
I see this thread is going on for a while, and I'll say up front that I don't have any helpful insights. I did see an interesting talk at Abstractions, though, about how to use dtrace to get to the bottom of weird problems like this. The video for that event doesn't seem to be online anywhere, but

Re: What does "Map literal must contain an even number of forms" mean?

2016-12-04 Thread Mark Nutter
​In other languages, curly braces are used to enclose executable statements, so something like { println("Hello world\n"); }​ makes sense. In Clojure, however, curly braces are used to enclose a list of key/value pairs, aka a map. So when you say {hash-map :c "Turd" :d "More Turd"} you are creat

Re: How to do functional programming

2015-10-09 Thread Mark Nutter
Neal Ford has a good talk on "Functional Thinking" https://www.youtube.com/watch?v=7aYS9PcAITQ On Fri, Oct 9, 2015 at 5:13 AM, Colin Yates wrote: > he he. > > Coming from many years of ‘Java Enterprise Applications’ (e.g. Spring, > Hibernate and if you were feeling adventurous maybe free marker

Re: Clojure in Action, Second Edition

2015-10-09 Thread Mark Nutter
The first edition was a tremendous help when I was first learning Clojure. Glad to see there's an update. On Wed, Oct 7, 2015 at 5:16 PM, BarreisR wrote: > New and very useful book by author Amit Rathore. > https://www.manning.com/books/clojure-in-action-second-edition > > -- > You received this

Re: Neighbors function from The Joy of Clojure

2014-11-05 Thread Mark Nutter
​Forgot to add that my usual recommendation is Clojure in Action followed by The Joy of Clojure. Killer combo.​ On Wed, Nov 5, 2014 at 7:34 AM, Mark Nutter wrote: > A bit off the original topic, but this seemed like a good place to give a > shout out to my favorite intro book: Clojure In

Re: Neighbors function from The Joy of Clojure

2014-11-05 Thread Mark Nutter
A bit off the original topic, but this seemed like a good place to give a shout out to my favorite intro book: Clojure In Action ( http://www.manning.com/rathore/). There are a lot of really excellent intro books out there, and I don't want to disparage any of them, but I found this one very readab

Re: [Video] Generative testing in Clojure

2014-01-01 Thread Mark Nutter
Nicely done, I've been looking for a good intro to generative testing. The real-world example at the end nicely illustrates the value of the "shrinking" part of the algorithm. Thanks for publishing this. On Wed, Jan 1, 2014 at 10:58 AM, James Trunk wrote: > Hi everyone, > > Here is an introduct

Re: sending errors to the ui - web development using luminus

2013-08-10 Thread Mark Nutter
I am using Validateur (http://clojurevalidations.info/) as the basis for a custom validation mechanism with Luminus. The validation-set fn gets you about 90% of the way there: it takes a list of rules and returns a function. Pass your data map to the function, and it returns a set of the error mess

Re: run-jetty not working in a virtualbox vm?

2013-07-13 Thread Mark Nutter
Not sure, but "netstat -lanp" as root might get you a more comprehensive port listing. Sounds like you have a process still holding on to the port somehow. As a last resort there's always "killall java". On Sat, Jul 13, 2013 at 7:27 AM, Daniel Higginbotham wrote: > Hmm, I tried using ":join? tr

Lambda Jam ticket available

2013-06-23 Thread Mark Nutter
Due to unexpected expenses, I'm going to be unable to use my early bird ticket to Lambda Jam (July 8-10 in Chicago). I can't get a refund, but I can designate a substitute if anyone's interested. Please contact me off list if so. Thanks. Mark -- -- You received this message because you are sub

Re: Screencast: Clojure development with Sublime Text 2

2013-05-21 Thread Mark Nutter
That's helpful for both clj and non-clj work, thanks. Cygwin Sublime users might be interested in a quick little rc file I wrote to let you use Unix paths with ST2 on the command line: https://gist.github.com/manutter51/5608004 Just a bit OT, but I thought it might be of use to some ST/Clojure f

Re: Best IDE

2012-01-19 Thread Mark Nutter
On Thu, Jan 19, 2012 at 11:42 AM, David Brunell wrote: > How long did it take you to get comfortable with paredit? I keep getting > frustrated and going back to manually matching parens. I had the same experience for a while, but then I realized I just had to remember 3 things: To enclose an ex

Re: Clojure list syntax sugar: f(x) notation

2011-12-27 Thread Mark Nutter
I don't usually reply to this sort of thread, but I'll toss in two cents worth anyway. Speaking as a PHP programmer wading his way through the beginning-to-intermediate stages of Clojure, I have to say that I do not like the proposed "sugar." If I wanted to write PHP in Clojure, I'd just write PHP,

Re: [ANN] Clojure 1.3 Released

2011-09-24 Thread Mark Nutter
Totally awesome, thanks to everyone. I don't like the way github presents the changes.txt file, so I forked a copy and did a teeny bit of markup tweaking so it will display in nice touchy-feely HTML layout, if anyone is interested. https://github.com/manutter51/Clojure-1.3-Changes-text/blob/maste

Re: clojurescript closure problem?

2011-09-22 Thread Mark Nutter
I stand corrected. I guess I'm *too* familiar with JS. I'll have to re-learn a few things. m On Thu, Sep 22, 2011 at 8:34 AM, Meikel Brandmeyer (kotarak) wrote: > Hi, > > Disclaimer: I haven't touched ClojureScript a single time up to now, I only > know the talk of Rich about it. Neither am I J

Re: clojurescript closure problem?

2011-09-22 Thread Mark Nutter
No, because that might not be what you want your code to do. As a JavaScript programmer you have to understand what function scope means, and how to use it appropriately. If "hid" is a variable that's in scope when you define an anonymous function, your functions will refer to that specific variabl

Re: newbie questions

2011-08-30 Thread Mark Nutter
There are some old "Getting Started" steps out there, but you'll probably get a better start if you Google for "leiningen" and "swank-clojure" for a more up-to-date technique. If you need to tell the Clojure process to quit, the syntax is (System/exit 0). Mark On Tue, Aug 30, 2011 at 4:32 PM,

Re: [ANN] clojure.java.jdbc 0.0.5 available

2011-07-20 Thread Mark Nutter
> * Add support for databases that cannot return generated keys (e.g., HSQLDB) >  - insert operations silently return the insert counts instead of > generated keys >  - it is the user's responsibility to handle this if you're using > such a database! If I'm understanding this correctly, this means

Re: another question on macros defining functions

2011-06-04 Thread Mark Nutter
Ok, so what you really want is not to change how your program functions, but how your IDE/editor functions. That means what you really want is not a clojure macro, but an emacs macro--you want to extend the functionality of emacs to make your editing easier. The clojure code you write is not going

Re: another question on macros defining functions

2011-06-03 Thread Mark Nutter
I think you have the right idea, only not quite. :) If you write a macro to define a function whose name is determined at run-time, you end up with either a function that your program will never refer to, or a program that calls functions that may or may not exist, depending on what run-time values

Re: newbie question

2011-04-19 Thread Mark Nutter
Hmm, in your example you say you're code looks like (println "hello") but in your description you say ((println "hello")) Don't know if that's a just a typo or not, but if you actually did type in doubled parens like that it would give a null pointer exception because println returns nil, which

Re: (memoize) and recursive functions (Clojure 1.2)

2011-03-29 Thread Mark Nutter
I just saw this in another thread. Try this version instead: (defn f [n] (println "f called with" n) (if (zero? n) 0 (min (#'f (dec n)) (#'f (dec n) What's happening is that inside the body of f, the "f" is a symbol whose contents point to the anonymous function being def

Re: bindings & lazy-seq

2011-03-26 Thread Mark Nutter
I'll take a stab at this and then someone can tell me if I'm understanding it myself. > (lazy-seq > (binding [*in* in#] ><-- some code -->)) This is inside the definition, so it executes whenever you actually USE the definition--i.e. it binds *in* to in# at the time the lazy seq is used, whi

Re: Grabbing Rotten Tomatoes movie ratings in clojure

2011-01-19 Thread Mark Nutter
Let me also recommend swannodette's excellent Enlive tutorial: https://github.com/swannodette/enlive-tutorial It's a great way to jump into the meat and potatoes. m On Tue, Jan 18, 2011 at 7:05 PM, justinhj wrote: > Thanks for the feedback Stuart > > I'll check out Enliven. I'm currently writi

Re: Wildcards on multimethod matching

2010-10-25 Thread Mark Nutter
> So in this particular case I wouldn't care, but in general I'd expect > the prefer-method stuff to kick in. :) Oops, forgot about prefer-method. My noobishness is showing again. Well, in for a dime in for a dollar. Here's something I whipped up just for the general amusement of the list. It's no

Re: Wildcards on multimethod matching

2010-10-25 Thread Mark Nutter
I tried to have a go at this, but then I realized it's a bit difficult to specify. For example, if you have (defmethod bar [42 _] ..) ; and (defmethod bar [_ 16] ..) which one should be called when you give it (bar 42 16)? Mark On Sat, Oct 23, 2010 at 5:16 PM, Paul Richards wrote: > Hi, > I ha

Re: Newbie: Exceptions and map

2010-10-15 Thread Mark Nutter
Map returns a lazy seq (which I suspect you already knew). Try it with doall instead of do. The "do" only wraps the map expression, it doesn't actually realize the seq. On Fri, Oct 15, 2010 at 11:39 AM, bleibmoritztreu wrote: > Hi group, > > I'm playing around with Clojure for a few weeks now and

Re: Quirk of Map destructuring

2010-09-13 Thread Mark Nutter
On Mon, Sep 13, 2010 at 12:37 PM, Tom Hicks wrote: > > On Sep 12, 10:44 pm, Meikel Brandmeyer wrote: >> >> The default map specifies the default for the symbols which are bound, >> not the source of the values. >> >> (let [{foo :some-key bar "some-other-key" :or {foo 1}} ] ...) > > Sorry Meik

Re: java interop problem

2010-09-13 Thread Mark Nutter
Erg, gmail hiccup. Started to say if you try to use it in code that's *not* being called from the REPL, you'll be scratching your head trying to figure out why aset never gets called. Mark On Mon, Sep 13, 2010 at 12:27 PM, Mark Nutter wrote: > The REPL automatically realizes the

Re: java interop problem

2010-09-13 Thread Mark Nutter
The REPL automatically realizes the lazy sequence in the process of printing it out, but if you try to us On Mon, Sep 13, 2010 at 11:07 AM, Ranjit wrote: > Thanks Armando for catching my stupid mistake. That fixed everything. > > Meikel, I'm not sure I understand what you're saying. When I evalua

Re: clojure.contrib.trace not working on 1.2?

2010-09-08 Thread Mark Nutter
I seem to recall that 1.2 is using "chunked" lazy sequences for performance reasons, and fib is a lazy sequence. I wonder if you'd start seeing intermediate steps using (fib 20) instead of (fib 3)? m On Tue, Sep 7, 2010 at 7:32 PM, Scott Jaderholm wrote: > Why does c.c.trace give different outpu

Re: agents, await and Swing thread

2010-09-07 Thread Mark Nutter
Just a quick thought (and before I've had my coffee no less!), but I think what I'd do is replace the boolean *end-search* with a *search-state* var that could be either :idle, :running or :stopping. Then in search-stops, just set *search-state* to :stopping -- you don't need to actually wait for t

Re: trouble with NetBeans install

2010-08-30 Thread Mark Nutter
This may or may not be related, but I had similar problems when I tried to install from the downloadable .nbm file for enclojure. I solved it by poking around the enclojure.org site -- there's instructions for updating the plugins setup screen so that you can install/update enclojure using the buil

Re: java.lang.OutOfMemoryError

2010-07-27 Thread Mark Nutter
On Mon, Jul 26, 2010 at 9:53 AM, atucker wrote: > Here is my function: > (defn json-seq [] >  (apply concat >         (map #(do (print "f") (str/split (slurp %) #"\nStatusJSONImpl")) >              out-files))) Try removing the "apply concat" at the front, I'm pretty sure that's making your seque

Re: enclojure install killed netbeans 6.8

2010-03-10 Thread Mark Nutter
beans can't just rebuild that directory seeing as > it's not there anymore? > > Josh > > On Mar 9, 2:01 pm, Mark Nutter wrote: >> On Sun, Mar 7, 2010 at 6:44 PM, strattonbrazil >> wrote: >> > I am on Linux.  I have a 6.6 and a 6.8 directory in my .net

Re: enclojure install killed netbeans 6.8

2010-03-09 Thread Mark Nutter
On Sun, Mar 7, 2010 at 6:44 PM, strattonbrazil wrote: > I am on Linux.  I have a 6.6 and a 6.8 directory in my .netbeans > folder.  6.6 still runs.  I have tried moving individual jars in and > out of that dir, but I still get the error.  I even moved the entire > 6.8 dir and still get the same me

Re: enclojure install killed netbeans 6.8

2010-03-07 Thread Mark Nutter
On Fri, Mar 5, 2010 at 11:34 PM, strattonbrazil wrote: > Has anyone had problems with netbeans starting with the enclojure > alpha?  I restarted my session and it died.  Now when I try to run > netbeans, it throws a classpath exception.  Can I remove this plugin > or am I missing something in my i

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-07 Thread Mark Nutter
On Sun, Mar 7, 2010 at 10:40 AM, Meikel Brandmeyer wrote: > So your point boils down to emacs and lein don't work on Windows. I > don't know about emacs, but at least for leiningen there is some > activity at that front (cf. Rob's response). > > So I still think: if you have trouble with clojure

Re: Enclojure plugin Netbeans

2010-02-24 Thread Mark Nutter
I think I know this one: you need NetBeans with the Java module activated. I had the same problems trying to use NetBeans with just PHP. Mark On Wed, Feb 24, 2010 at 8:18 AM, Larry Wykel wrote: > Anyone!!! > > . > > Anyway if your using Enclojure etc in Netbeans let me describe exactly what > h

Re: Neophyte question

2009-10-21 Thread Mark Nutter
Thanks, all, that's enlightening. So if I understand correctly, I designed hexchar? to accept a string argument, which means it needed a CharSequence, right? But instead it was getting a Char, which is not the same thing as a one-character string, and thus was not a CharSequence. Yahrgh, I've bee

Neophyte question

2009-10-21 Thread Mark Nutter
Hi all, newcomer to clojure/lisp/fp here. I'm working my way through the Programming Clojure book (very excellent, well worth the money), and doing some dabbling in the REPL, and I'm seeing something that puzzles me. In the book there's an example of a clojure blank? function that looks like this: