Content deleted Content added
Jerryobject (talk | contribs) m Cut needless carriage return whitespace characters in sections: standardize, aid work via small screens. |
Jerryobject (talk | contribs) Template:Infobox programming language, WP:REFerence WP:CITation parameters: reorders, update-standardizes, underscores > spaces, adds, fills, respaces, conform to master templates. MOS:BADEMPHASIS MOS:FONTSIZE MOS:SMALLFONT cuts. WP:LINKs: update-standardizes, needless: WP:PIPEs > WP:NOPIPEs, adds. Small WP:COPYEDITs WP:EoS: WP:TERSE, clarify. |
||
Line 6:
|logo =
|paradigm = [[functional programming|functional]], [[logic programming|logic]], non-strict, modular
|designer = Michael Hanus, Sergio Antoy, et al.
|developer =
|released =
|
|latest release date = ({{wikidata|qualifier|P348|P577}})
|latest preview version =
|latest preview date =
|typing = [[static typing|static]], [[
|implementations = [https://www.informatik.uni-kiel.de/~pakcs PAKCS] (with [[
|dialects =
|influenced =
|influenced by = [[
|operating_system =
|license =
|website = [https://curry.pages.ps.informatik.uni-kiel.de/curry-lang.org/ Curry]
}}
'''Curry''' is an experimental [[functional logic programming]] language,<ref>{{cite web |editor-last=Hanus |editor-first=Michael |title=Curry: A Truly Integrated Functional Logic Language |url=http://www.curry-lang.org/}}</ref><ref>{{cite journal |last1=Sergio |first1=Antoy |last2=Hanus |first2=Michael |year=2010 |title=Functional Logic Programming |journal=Communications of the ACM |volume=53 |issue=4 |pages=74–85 |publisher=ACM |doi=10.1145/1721654.1721675 |s2cid=14578759}}</ref> based on the [[Haskell]] language. It merges elements of functional and logic programming,<ref name="Curry and Curl programming languages">
▲ }}</ref> based on the [[Haskell (programming language)|Haskell]] language. It merges elements of functional and logic programming,<ref name="Curry and Curl programming languages">{{cite web |title=Curry experimental programming language |url=https://www.mvps.net/docs/curry-and-curl-programming-languages |website=MVPS.net |access-date=2 September 2021}}</ref> including [[constraint programming]] integration.
It is nearly a superset of Haskell, lacking support mostly for overloading using [[Polymorphism (computer science)#Subtyping|type classes]], which some implementations provide anyway as a language extension, such as the Münster Curry Compiler.<ref>[http://danae.uni-muenster.de/curry/ The Münster Curry Compiler]</ref>
==Foundations of functional logic programming==
===Basic concepts===
A functional program is a set of functions defined by equations or rules. A functional computation consists of replacing subexpressions by equal (with regard to the function definitions) subexpressions until no more replacements (or reductions) are possible and a value or normal form is obtained. For instance, consider the function double defined by
Line 56 ⟶ 43:
'double (1+2)' → (1+2)+'(1+2)' → '(1+2)'+3 → '3+3' → 6
In this case, both derivations lead to the same result, a property known as [[Confluence (term rewriting)|confluence]]. This follows from a fundamental property of pure functional languages, termed [[referential transparency]]: the value of a computed result does not depend on the order or time of evaluation, due to the absence of [[Side effect (computer science)|side effects]]. This simplifies
As many functional languages like [[
<syntaxhighlight lang="haskell">
data Bool = True | False
Line 71 ⟶ 58:
not '(not False)' → 'not True' → False
More complex [[data
the type variable {{Mono|a}}), is either the empty list “{{Mono|[]}}” or the non-empty list “{{Mono|x:xs}}” consisting of a first element {{Mono|x}} and a list {{Mono|xs}}:
<syntaxhighlight lang="haskell">
Line 91 ⟶ 78:
===Narrowing===
Narrowing is a mechanism whereby a variable is [[name binding|bound]] to a value selected from among alternatives imposed by constraints.
Narrowing is useful because it allows a function to be treated as a relation: its value can be computed "in both directions".
As noted in the
|
|
|
|
|
|
|
|
|
|
| s2cid
===Functional patterns===
Line 114 ⟶ 101:
last (ys++[e]) = e
</syntaxhighlight>
Haskell does not allow such a declaration since the pattern in the left-hand side contains a defined function ({{Mono|++}}). Such a pattern is also called ''functional pattern''.<ref>{{cite journal |last1=Sergio |first1=Antoy |last2=Hanus |first2=Michael |year=2006 |doi=10.1007/11680093_2 |
===Non-determinism===
Line 122 ⟶ 109:
x ? y = y
Thus, the evaluation of the expression {{Mono|0 ? 1}} returns {{Mono|0}} as well as {{Mono|1}}. Computing with non-deterministic operations and computing with free variables by narrowing has the same expressive power.<ref>{{cite journal |last1=Sergio |first1=Antoy |last2=Hanus |first2=Michael |year=2006 |doi=10.1007/11799573_9 |
The rules defining {{Mono|?}} show an important feature of Curry: all rules are tried in order to evaluate some operation. Hence, one can define by
Line 140 ⟶ 127:
==References==
{{
==External links==
Line 146 ⟶ 133:
*[http://smap.informatik.uni-kiel.de/ Smap] - A web-based execution environment for Curry and Haskell with various example programs
*[http://danae.uni-muenster.de/curry/ MCC] - The Münster Curry Compiler, which uses [[C (programming language)|C]] as the target
*[http://www.informatik.uni-kiel.de/~pakcs/ PAKCS] A major Curry implementation with a WWW interface, which uses [[
*[http://www-ps.informatik.uni-kiel.de/kics2/ KiCS2] A Curry implementation, which uses [[
*[https://www-ps.informatik.uni-kiel.de/currywiki/documentation/mailing Curry Mailing List]
*[http://www.informatik.uni-kiel.de/~mh Michael Hanus's home page]
* ''[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.524 Purely Functional Lazy Non-deterministic Programming]'' (Fischer, Kiselyov, Shan, 2009), ''[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.157.4578 Transforming Functional Logic Programs into Monadic Functional Programs]'' (Braßel, Fischer, Hanus, Reck, 2010) on modeling lazy non-deterministic (logic) programming (like in Curry) in a purely functional language ([[
{{Authority control}}
|