Newbie Design Question

From: Jeff Katcher (jmkatcher_at_yahoo.com)
Date: 11/23/03


Date: 22 Nov 2003 20:08:28 -0800

I'm back to LISP after having been away for a long, long time (it's
_hard_ to break the SETQ habit :). BTW, this is not homework of any
sort.

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.

Pseudo-code:
(defun chain-stuff (stuff-list start end level)
   (if (<= start end)
      (dolist (stuff stuff-list)
         (when (eligible-p stuff start)
            (chain-stuff stuff-list (+ start 5) end
               (append level stuff))
         )
      ) level
   )
)

What I'd like to return is a list of the accumulated lists (which
would be "level" at the if-else case), but can't think of a way to
do it other than appending to something outside the function's scope.
(Which I viscerally recognize as abhorrent...:)

Thanks in advance,

Jeffrey Katcher



Relevant Pages

  • RE: Incident investigation methodologies
    ... However, what sort of reaction ... Speculation gets you nowhere. ... > malware we encounter. ... > of what makes public lists useful - you can get some ...
    (Incidents)
  • Re: Detailed explanation of how a QuickSort Works
    ... Firstly, if you consider the simple "Bubble Sort" algorithm, it works by running through the entire data set, one item at a time, comparing each item to the previous item and swapping them if they are not already in the correct order. ... by simply running through the entire list just once (and splitting it into two smaller lists) you have cut the sorting time in half. ...
    (microsoft.public.vb.general.discussion)
  • Re: Ordering Products
    ... algorithms. ... lists with constrained item transpositions. ... I think while the built in sort works as a convenience, ... Overall it's about 10 times slower than pythons built in sort for large ...
    (comp.lang.python)
  • Re: Ordering Products
    ... > Kay Schluehr wrote: ... >> It would be interesting to examine some sorting algorithms on factor ... >> lists with constrained item transpositions. ... > I think while the built in sort works as a convenience, ...
    (comp.lang.python)
  • Re: Educated guesses for efficiency?
    ... it is comparatively rare for a program to run too slowly because an algorithm with the wrong big-O analysis was chosen. ... of things tended to be stored in lists). ... built-in sort function. ... Programmers *will* use algorithms with high complexities. ...
    (comp.lang.c)