Jump to content

Icon+Unicon/Intro: Difference between revisions

m
m (→‎Introduction: and purpose)
Line 9:
 
====Prelude about Goal-Directed Evaluation and Generators====
 
Some of this should likely belong under [[:Category:Programming_paradigm/Logic_Programming]]
 
A central feature of Icon and Unicon is what is known as Goal-Directed Evaluation, and the intimately related concept of Generators. Without trying to be a tutorial, the idea is that expressions can yield more than one result (Generators) and if a further part of the expression results in failure, the earlier Generators will be driven to yield more results. The effect is not unlike the backtracking found in Prolog or Regular Expressions, however the feature is built into the very core of the language. Prolog programmers will find it very familiar but of course with differences because Icon and Unicon do not use the functional language pattern matching technique of Prolog.
 
Line 14 ⟶ 17:
 
Another way of looking at it is to understand that every expression can yield a ''result sequence'' that can be empty; any code using this expression may choose to ask for more results, gather them into a container or aggregate, or choose to use one value and then move on without asking for all possible results.
 
====goto====
Does not exist in the Icon or Unicon language.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.