More specifically, any language that has goto, conditional jumps, or continuations can be used to implement loops if they don't have native loops. Any language which can build and walk a tree or list can be used to implement a loop, too. Any language in which one can attach arbitrary actions to an iterator has a basic looping construct. Any language that can both increment or decrement an integer value and evaluate data as code can be used to implement loops.

Things equivalent to loops in one situation or another include recursion, vector operators, iterators, and repetition operators. Tail recursion or mutual recursion between two subroutines can be converted into a looping construct. Vector operators are made up of loops unless they are using special explicitly parallel hardware. Iterators can both be the basis of a loop and can be implemented using a loop or some loop equivalent. Repetition operators are usually implemented as loops, but could be implemented using recursion, conditional jumps, lists, set manipulations, vector ops, or continuations. Any language in which you can construct, transform, and test arbitrary sets in arbitrary ways can be used as an equivalent to loops, too.

SQL is a declarative set specification and transformation language. Where the loops in SQL are is obvious if you look at the issue sideways: they are implicit. SELECT, UPDATE, and DELETE are vector operators and WHERE confines the members of the vector to some subset of the master set. INSERT is a vector operator which adds to the master set. Each SQL statement (barring special functions) is a subset specification, set growth or shrinkage operation, or transformation on (sub)set members. There generally is an iterative or recursive program in charge of getting you the proper results for your requested set. You're just not writing it. It's the product of translation and happens inside the database software's planning and execution engines. Still, since SQL can store, transform, and test arbitrary sets in arbitrary ways, it can be used equivalently to a language with explicit loops in regards to those sets.


In reply to Re^4: OT: Mathematics for programming (again) by mr_mischief
in thread OT: Mathematics for programming (again) by vrk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.