Re: Newbie Design Question

From: Frode Vatvedt Fjeld (frodef_at_cs.uit.no)
Date: 11/23/03


Date: Sun, 23 Nov 2003 10:50:18 +0100

jmkatcher@yahoo.com (Jeff Katcher) writes:

> I'm back to LISP after having been away for a long, long time (it's
> _hard_ to break the SETQ habit :).

Welcome back. And please, try at least as hard to lose the dangling
parens. Indentation is the visual code-block delimiter in Lisp, and
the parens merely tell your editor how to indent things. And a
paren-aware editor /is/ essential.

> Anyway, I have a function in my current program which is a planner
> of sorts. It takes a list of stuff as a parameter and builds lists
> of candidates for action.

I wasn't able to understand much from your pseudo-code, but from this
description it seems to me that what you'd want is something like

  (remove-if (complement #'eligible-p) stuff-list :start start :end end)

Or, if you need more control:

  (loop for stuff in stuff-list as position upfrom 0
     when (and (eligible-p stuff)
               (blabla stuff start))
     collect (figure-out-action stuff position))

Perhaps if you explain why this doesn't work, we can help you more.

-- 
Frode Vatvedt Fjeld


Relevant Pages

  • Re: Logo as an alternative to Python?
    ... > replace parentheses. ... of a number of ways to contain the number of parens in Scheme, ... My first implemented solution was a preprocessor to convert indentation ... at each colon, open a parens; ...
    (comp.lang.lisp)
  • Re: indenting lists (in bind, etc)
    ... There are many style rules of Lisp indentation but one of the fundamental ... inside a set of parens to the left of the open paren containing it. ... It is right that Emacs manual editing exists to help you around the rules ... semantics, and I guess this is a tough problem. ...
    (comp.lang.lisp)
  • Re: indenting lists (in bind, etc)
    ... GP lisper writes: ... There are many style rules of Lisp indentation but one of the fundamental ... inside a set of parens to the left of the open paren containing it. ... It is right that Emacs manual editing exists to help you around the rules ...
    (comp.lang.lisp)
  • Re: What are your favorite Ruby features?
    ... I'm sure there are people who did not come to Ruby after using Java ... or C and still think the parens make the code easier to work with. ... def foo; ... for creative use of parameter lists. ...
    (comp.lang.ruby)
  • Re: Square brackets?
    ... I was under the impression that any experienced Schemer ... It becomes difficult to handle when there is a lot of indentation. ... parens give you the opportunity to do things to avoid this. ... I do A by counting parens from the left of the current line and typing ...
    (comp.lang.scheme)