Re: Remove-first function

2010-07-24 Thread ataggart
To add one small addendum to Mark's excellent comment, if you use lazy- seq then you don't need to worry about the nil from when On Jul 24, 12:01 pm, Mark Engelberg wrote: > On Sat, Jul 24, 2010 at 11:45 AM, Mark Engelberg > > wrote: > > The simplest translation is to wrap a lazy-seq around the

Re: Feedback on Clojure web development post

2010-07-24 Thread Ryan Waters
Thank you, Mark. It's awesome when someone has the patience, time and interest in putting something like this together so others may learn faster. I know I'll benefit from it. - Ryan (irc nick arkh) On Sat, Jul 24, 2010 at 2:30 AM, Mark McGranaghan wrote: > Hi All, > > I recently posted to my

Re: Remove-first function

2010-07-24 Thread Mark Engelberg
On Sat, Jul 24, 2010 at 11:45 AM, Mark Engelberg wrote: > The simplest translation is to wrap a lazy-seq around the last line to > avoid the stack overflows. Just to clarify, there are at least three reasonable places to place the call to lazy-seq. You can put lazy-seq around the full body of th

Re: Remove-first function

2010-07-24 Thread Mark Engelberg
The simplest translation is to wrap a lazy-seq around the last line to avoid the stack overflows. On Sat, Jul 24, 2010 at 8:41 AM, nickikt wrote: > (defn scheme-remove-first [syb lst] >  (if (empty? lst) >    '() >    (if (= (first lst) syb) >      (rest lst) >      (cons (first lst) (scheme-remo

Re: Remove-first function

2010-07-24 Thread Andrew Boekhoff
Hi, One way to prevent the stack overflows is to wrap it in a lazy seq. For example: (defn remove-first [x coll] (lazy-seq (when (seq coll) (let [[y & ys] coll] (if (= target y) ys (cons y (remove-first x ys))) On Saturday 24 July 2010 11

Re: Anyone working with Eclipse and log4j? I have a beginner labrepl question...

2010-07-24 Thread Shantanu Kumar
This is a well-known Log4j issue (but don't worry, this is only a warning not an error). See here: http://www.avajava.com/tutorials/lessons/how-do-i-initialize-log4j-in-a-web-application.html http://www.avajava.com/tutorials/lessons/what-is-log4j-and-how-do-i-use-it.html The easiest way to initi

Re: Anyone working with Eclipse and log4j? I have a beginner labrepl question...

2010-07-24 Thread j-g-faustus
You can safely ignore them. What you are seeing is the startup log for the web/application server, and it complains about the server log configuration. But there's nothing there that stops the labrepl from working or that you need to do anything about. Regards jf On Jul 24, 6:58 am, Victor S wr

Re: Remove-first function

2010-07-24 Thread Randy Hudson
Here's my take: (defn remove-first [x coll] (let [[pre post] (split-with #(not= x %) coll)] (concat (pre (rest post On Jul 24, 11:41 am, nickikt wrote: > Hallo all, > > I'm working trough Essentials of Programming Languages. I'm trying to > right a function like this one: > > (defn sch

Re: java gui is flashing

2010-07-24 Thread Brian Schlining
I see 2 things: 1) It's best to explicitly start your Swing UI on Swing's event dispatch thread. The java code to do this is: SwingUtilities.invokeLater(new Runnable() { public void run() { new App(); // OR whatever you're started UI code is }

Re: java gui is flashing

2010-07-24 Thread Nurullah Akkaya
It is probably happening because a bare bones JPanel is a white canvas every time swing paints it, it paints a white canvas than your routines paint over that giving you the flashing behavior, right way to paint on a JPanel is to extend it using proxy and overwrite paintComponent method, this is th

Remove-first function

2010-07-24 Thread nickikt
Hallo all, I'm working trough Essentials of Programming Languages. I'm trying to right a function like this one: (defn scheme-remove-first [syb lst] (if (empty? lst) '() (if (= (first lst) syb) (rest lst) (cons (first lst) (scheme-remove-first syb (rest lst)) in a idiom

java gui is flashing

2010-07-24 Thread Mate Toth
Hi, my problem is that during execution my presentation java applet is flashing. There are many components which paint to a JPanel using it's Graphics (.getGraphics). I think maybe the problem is that I don't have any "paint everything now" routine..(I don't know which Java routine to use, how I h

Re: Anyone working with Eclipse and log4j? I have a beginner labrepl question...

2010-07-24 Thread Victor S
Well so far it works, I'm just confused by some of these java errors... - V On Jul 23, 7:26 am, Laurent PETIT wrote: > And may I add that "crazy easy labrepl installation for ccw" is around the > corner:http://github.com/smuehlst/ccw/tree/labrepl-sample-project! > > 2010/7/23 Victor S > > > >

Re: filtering with multiple predicates

2010-07-24 Thread Cameron
Hi Bill, How about something like... (filter #(every? true? ((juxt f g h) %)) my-list) In the character sense it's not more terse than your original example, but it is a little nicer to add additional functions to compare with. Throwing it in a function could be useful too (defn multi-filter

Re: Feedback on Clojure web development post

2010-07-24 Thread David Nolen
On Sat, Jul 24, 2010 at 3:30 AM, Mark McGranaghan wrote: > > http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html This is great! :) The tools and libraries have come a long way, now we just need more killer documentation like this. Thanks for taking the time to do thi

Re: filtering with multiple predicates

2010-07-24 Thread Mark Triggs
j-g-faustus writes: > I was apparently too late. Oh well :) My apologies for pre-emptively stealing your idea :) -- Mark Triggs -- 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 Note th

Feedback on Clojure web development post

2010-07-24 Thread Mark McGranaghan
Hi All, I recently posted to my blog on the process of developing and deploying a simple Clojure web application: http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html The purpose of this post is twofold. The first is to provide some documentation in the form of a compl

Re: filtering with multiple predicates

2010-07-24 Thread j-g-faustus
On Jul 24, 8:53 am, Mark Triggs wrote: > I cheated and used 'every?' :) I was apparently too late. Oh well :) -- 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 Note that posts from new memb

Re: filtering with multiple predicates

2010-07-24 Thread Meikel Brandmeyer
Am 24.07.2010 um 08:23 schrieb Meikel Brandmeyer: > (defn and-pred > [& preds] > (if-let [preds (seq preds)] >(fn [x] > (seq (drop-while identity (map #(% x) preds >(constantly true))) Ok. Switch brain on. Second try. (defn and-pred [& preds] (fn [x] (not (seq (drop-w

Re: filtering with multiple predicates

2010-07-24 Thread j-g-faustus
On Jul 23, 11:27 pm, ".Bill Smith" wrote: > (filter #(and (f %) (g %) (h %)) my-list) Here's another one, just to add to the collection: (defn andp [& fns] (fn [& args] (every? #(apply % args) fns))) (filter (andp f g h) my-list) -- You received this message because you are subscribed t