OperationalSemanticsofPureFunctionalLanguagesapplicationbythebodyofthefunctionsubstitutingtheactual Alan Borning2CSE 505 ID: 314229
Download Pdf The PPT/PDF document "Alan Borning1CSE 505" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Alan Borning1CSE 505 OperationalSemanticsofPureFunctionalLanguagesapplicationbythebodyofthefunction,substitutingtheactual Alan Borning2CSE 505 ¥Normalorder-rewritetheleftmostoccurenceofafunction¥Applicative order - rewrite the innermost occurrence of a Alan Borning3CSE 505 Using normal order evaluation:double (average 2 4) =plus (divide 6 2) (average 2 4) =plus 3 (average 2 4) =Notice that(average 2 4) was evaluated twice ... lazyevaluation would cache the results of the first evaluation.Using applicative order evaluation: double (average 2 4) = double (divide (plus 2 4) 2) = double (divide 6 2) = Alan Borning4CSE 505 DifferentSemanticsforNormalandApplicativeOrder Alan Borning5CSE 505 ¥If there is any evaluation order that will terminate and that¥ANYevaluationorderthatterminateswithouterrorwillgive:afunctionfisinanargumentifthatargumentIfafunctionisstrictinanargument,wecansafelyevaluatethe Alan Borning6CSE 505 Wecanuselazyevaluationonanadhocbasis(e.g.for),or