Re: Multivalue tail recursion?



David Trudgett wrote:

Is there any advantage to using ITERATE (and/or SERIES) instead of
LOOP?

Iterate:

Well, iterate just plain looks nicer/lispier than loop (subjective), and
you might therefore find it easier to read. It also has
pseudo-generators and a defined means of extension (e.g. iterating
over db query results or whatever).
http://common-lisp.net/project/iterate/doc/Differences-Between-Iterate-and-Loop.html

The iterate manual has comparisons:
http://common-lisp.net/project/iterate/doc/Don_0027t-Loop-Iterate.html

Series:

Waters' Series, dating originally from the 1980s, is a different way of
writing code, centered around series, perhaps best considered an early
instance of the lazy/infinite data structure idea later vastly
elaborated in Haskell. Iterate _looks_ like a traditional (but
powerful) imperative looping construct, just like loop itself, whereas
series code looks functional. You might consider that an advantage:

"In particular, algorithms that are expressed as compositions of
functions operating on series/vectors/streams of data elements are much
easier to understand and modify than equivalent algorithms expressed as
loops. Unfortunately, many programmers hesitate to use series
expressions, because they are typically implemented very inefficiently.
A Common Lisp macro package (OSS) has been implemented which supports a
restricted class of series expressions, obviously synchronizable series
expressions, which can be evaluated very efficiently by automatically
converting them into loops"
- Richard C. Waters, AIM-1082, 1989, MIT.

http://series.sourceforge.net/ - beware, some annoying dead links
coupled with general sourceforge braindamage. Who is maintaining
series now? Any chance of it moving officially to common-lisp.net ?
I know the asdf-packaging project is the least painful way to install
series nowadays: http://common-lisp.net/project/asdf-packaging/

Some 'problems' of Haskell are shared by Series e.g. your code might
suddenly become much less efficient through a very minor-looking
change, and your code might seem a little too concise and hifalutin'
for some people (if they won't or can't learn series themselves
of course).







.



Relevant Pages

  • Re: Symbol clashes: how to avoid them. Part 2
    ... It is _much_ better than loop. ... with iterate - it is truly lispy sublanguage and it obeys all lisp ... All this code is not a final package. ... using many different libraries in one project. ...
    (comp.lang.lisp)
  • Re: How do I delete the result of a Select statement from the original datatable?
    ... but you can with an index based loop. ... Am I going to have to iterate each row in the datatable and compare the ... For Each strItem In wsVIP ... If Not recCount = 0 Then ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: formula to count charcter in a range
    ... you use of the word "effectively" is meant to cover the fact that, for example, in "*w*w*", once one 'w' is found, the search loop must continue on in order to look for the next 'w'. ... Your formula would iterate through range as many times as there are ... argument contains wildcards isn't as simple as my SUBSTITUTE call. ... in range, A were the number of sequential entries in instance_array, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: DataTable weirdness
    ... > If I iterate through all the elements of a table in thread A, ... > correct assuming that the lock in thread B will block until the ... the collection will now have a gap between ... This causes problems for any loop that started with the assumption ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Infinite loop
    ... Besides the problem with the for loop, the expressions and ... some processing time. ... floating point operations because you forget to include decimal points. ...
    (comp.lang.c)