After applying these transformation steps to all rules in the program, we obtain a program without sections and λ-abstractions where all local declarations contain only free variables. Note that partial applications are not eliminated since they can be treated as shown in Section D.5. The final program might not be a valid <strong>Curry</strong> program due to the transformation of where declarations into let declarations. In order to obtain a valid <strong>Curry</strong> program, we can perform the following final transformations: Transform l = let decls in (c|r) into l | c = r where decls and l = let decls in r into l = r where decls The latter transformation is only necessary if r is not of type Success. 77
References [1] H. Aït-Kaci. <strong>An</strong> Overview of LIFE. In J.W. Schmidt and A.A. Stogny, editors, Proc. Workshop on Next Generation Information System Technology, pp. 42–58. Springer LNCS 504, 1990. [2] H. Aït-Kaci, P. Lincoln, and R. Nasr. Le Fun: <strong>Logic</strong>, equations, and Functions. In Proc. 4th IEEE Internat. Symposium on <strong>Logic</strong> Programming, pp. 17–23, San Francisco, 1987. [3] S. <strong>An</strong>toy. Definitional Trees. In Proc. of the 3rd International Conference on Algebraic and <strong>Logic</strong> Programming, pp. 143–157. Springer LNCS 632, 1992. [4] S. <strong>An</strong>toy. Optimal Non-Deterministic <strong>Functional</strong> <strong>Logic</strong> Computations. In Proc. International Conference on Algebraic and <strong>Logic</strong> Programming (ALP’97), pp. 16–30. Springer LNCS 1298, 1997. [5] S. <strong>An</strong>toy, R. Echahed, and M. Hanus. Parallel Evaluation Strategies for <strong>Functional</strong> <strong>Logic</strong> <strong>Language</strong>s. In Proc. of the Fourteenth International Conference on <strong>Logic</strong> Programming (ICLP’97), pp. 138–152. MIT Press, 1997. [6] S. <strong>An</strong>toy, R. Echahed, and M. Hanus. A Needed Narrowing Strategy. Journal of the ACM, Vol. 47, No. 4, pp. 776–822, 2000. [7] P. Arenas-Sánchez, A. Gil-Luezas, and F.J. López-Fraguas. Combining Lazy Narrowing with Disequality Constraints. In Proc. of the 6th International Symposium on Programming <strong>Language</strong> Implementation and <strong>Logic</strong> Programming, pp. 385–399. Springer LNCS 844, 1994. [8] D. Bert and R. Echahed. Design and Implementation of a Generic, <strong>Logic</strong> and <strong>Functional</strong> Programming <strong>Language</strong>. In Proc. European Symposium on Programming, pp. 119–132. Springer LNCS 213, 1986. [9] S. Bonnier and J. Maluszynski. Towards a Clean Amalgamation of <strong>Logic</strong> Programs with External Procedures. In Proc. 5th Conference on <strong>Logic</strong> Programming & 5th Symposium on <strong>Logic</strong> Programming (Seattle), pp. 311–326. MIT Press, 1988. [10] J. Boye. S-SLD-resolution – <strong>An</strong> Operational Semantics for <strong>Logic</strong> Programs with External Procedures. In Proc. of the 3rd Int. Symposium on Programming <strong>Language</strong> Implementation and <strong>Logic</strong> Programming, pp. 383–393. Springer LNCS 528, 1991. [11] S. Breitinger, R. Loogen, and Y. Ortega-Mallen. Concurrency in <strong>Functional</strong> and <strong>Logic</strong> Programming. In Fuji International Workshop on <strong>Functional</strong> and <strong>Logic</strong> Programming. World Scientific Publ., 1995. [12] M.M.T. Chakravarty, Y. Guo, M. Köhler, and H.C.R. Lock. Goffin - Higher-Order Functions Meet Concurrent Constraints. Science of Computer Programming, Vol. 30, No. 1-2, pp. 157– 199, 1998. [13] L. Damas and R. Milner. Principal type-schemes for functional programs. In Proc. 9th <strong>An</strong>nual Symposium on Principles of Programming <strong>Language</strong>s, pp. 207–212, 1982. 78
- Page 1 and 2:
Curry An Integrated Functional Logi
- Page 3 and 4:
9 Interface to External Functions a
- Page 5 and 6:
and introduces a new n-ary type con
- Page 7 and 8:
tion 3 with σ(t1 . . . tn) = σ(t
- Page 9 and 10:
since the variables occurring in pa
- Page 11 and 12:
tified variable (and, thus, it can
- Page 13 and 14:
such cases, anonymous functions (λ
- Page 15 and 16:
❀ {x=1,y=3} (The empty constraint
- Page 17 and 18:
4.1.3 Functions The type t1 -> t2 i
- Page 19 and 20:
4.1.8 Strings The type String is an
- Page 21 and 22:
g :: [a] -> [b] -> ([a],[b]) g x y
- Page 23 and 24:
In the last translation rule, conca
- Page 25 and 26:
to the module head. For instance, a
- Page 27 and 28: module main where import m1 hiding
- Page 29 and 30: take a character (string) and produ
- Page 31 and 32: which takes a search goal and produ
- Page 33 and 34: instance, if we want to compute the
- Page 35 and 36: Intuitively, a function f declared
- Page 37 and 38: 10 Literate Programming To encourag
- Page 39 and 40: A Example Programs This section con
- Page 41 and 42: A.3 Relational Programming Here is
- Page 43 and 44: A.5 Constraint Solving and Concurre
- Page 45 and 46: A.6 Concurrent Object-Oriented Prog
- Page 47 and 48: B Standard Prelude This section con
- Page 49 and 50: not :: Bool -> Bool not True = Fals
- Page 51 and 52: foldr1 _ [x] = x foldr1 f (x1:x2:xs
- Page 53 and 54: takeWhile _ [] = [] takeWhile p (x:
- Page 55 and 56: enumFromThen n1 n2 = iterate ((n2-n
- Page 57 and 58: putStr [] = done putStr (c:cs) = pu
- Page 59 and 60: owseList (g:gs) = browse g >> putCh
- Page 61 and 62: C.2 Layout Similarly to Haskell, a
- Page 63 and 64: SimplePattern ::= VariableID | _ |
- Page 65 and 66: D Operational Semantics of Curry Th
- Page 67 and 68: Computation step for a single expre
- Page 69 and 70: Eval [e; rule(l | c = r)] ⇒ {id
- Page 71 and 72: to an expression): Eval [ϕ(e1, . .
- Page 73 and 74: Eval [try(g)] ⇒ ⎧ [] if Eval [c
- Page 75 and 76: D.8 Eliminating Local Declarations
- Page 77: f ′′ x1 . . . xk y1 . . . ym =
- Page 81 and 82: [29] T. Johnsson. Lambda Lifting: T
- Page 83 and 84: Index !!, 49 Dom, 64 VRan, 64 (), 1
- Page 85 and 86: higher-order equation, 6 id, 46 if_