Content deleted Content added
No edit summary |
|||
Line 50:
The above doesn't seem a good example of extra difficulty. I'm sure there better examples (maybe failure-driven I/O ?); can someone supply one? <small><span class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Pjrm|Pjrm]] ([[User talk:Pjrm|talk]] • [[Special:Contributions/Pjrm|contribs]]) 12:04, 1 February 2009 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->
:My guess is that something like this Prolog code might have been meant:
day_openhours(saturday, 8-15) :- !.
day_openhours(sunday, 9-13) :- !.
day_openhours(_OtherDay, 8-17). % possibly add a check that the first argument is in fact a day
:It's not very pretty, but it gets the job done, is deterministic, and is friendly to clause indexing (i.e., it can possibly compile to smart code that's more efficient than an if-else cascade). Without the cuts, the "default" rule would have to contain some kind of "not one of the days above" condition. That would mean more---redundant!---code, which might justify the "harder to express" judgement. [[Special:Contributions/77.117.184.155|77.117.184.155]] ([[User talk:77.117.184.155|talk]]) 19:04, 2 December 2009 (UTC)
== "Good" principles ==
|