Note that there are some explanatory texts on larger screens.

plurals
  1. POUseful alternative control structures?
    primarykey
    data
    text
    <p>Sometimes when I am programming, I find that some particular control structure would be very useful to me, but is not directly available in my programming language. I think my most common desire is something like a "split while" (I have no idea what to actually call this):</p> <pre><code>{ foo(); } split_while( condition ) { bar(); } </code></pre> <p>The semantics of this code would be that <code>foo()</code> is always run, and then the condition is checked. If true, then <code>bar()</code> is run and we go back to the first block (thus running <code>foo()</code> again, etc). Thanks to <a href="http://www.reddit.com/r/programming/comments/eckxw/what_are_some_useful_alternative_control/c17340u" rel="noreferrer">a comment by reddit user zxqdms</a>, I have learned that Donald E. Knuth writes about this structure in his paper <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.103.6084" rel="noreferrer">"Structured programming with <code>go to</code> statements"</a> (see page 279).</p> <p><strong>What alternative control structures do you think are a useful way of organizing computation?</strong></p> <p>My goal here is to give myself and others new ways of thinking about structuring code, in order to improve chunking and reasoning.</p> <p><em>Note</em>: I'm not asking about how to <em>generalize</em> all possible control structures, whether by using <code>jne</code>, <code>if</code>/<code>goto</code>, Lisp macros, continuations, monads, combinators, quarks, or whatever else. I'm asking what <em>specializations</em> are useful in describing code.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload