/
Closed and Open Recursion RALF HINZE Introduction Recursive functions Recursive objects Closed and Open Recursion RALF HINZE Introduction Recursive functions Recursive objects

Closed and Open Recursion RALF HINZE Introduction Recursive functions Recursive objects - PDF document

celsa-spraggs
celsa-spraggs . @celsa-spraggs
Follow
579 views
Uploaded On 2014-12-25

Closed and Open Recursion RALF HINZE Introduction Recursive functions Recursive objects - PPT Presentation

unibonnde Homepage httpwwwinformatikunibonnderalf July 2007 Pick up the slides at ralftalkshtml56 1 23 brPage 2br Closed and Open Recursion RALF HINZE Introduction Recursive functions Recursive objects Recursive functions revisited Conclusion Ap ID: 29197

unibonnde Homepage httpwwwinformatikunibonnderalf July 2007

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Closed and Open Recursion RALF HINZE Int..." 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.


Presentation Transcript

ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Trinity I functionalcore, I imperativecore, I object-orientedcore, I [modulesystem]. 2/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Dynamicsemantics (fun(x1: 1 ))e)+(fun(x1: 1 ))e)e2+(fun(x1: 1 ))e)letvalx1=e1ineend+ e2e1+ 5/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Recursivefunctions recfun(n: Nat ))ifn 0then1elseself(n�1)n +selfreferstothefunctionitself. 6/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Dynamicsemantics (recfun(x1: 1 ))e)+(fun(x1: 1 ))e)fself7!recfun(x1: 1 ))eg+Therecursiveknotistiedattheearliestpossiblepointintime:theintroductionform. 7/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Objects - object M end - valuesobjectendintroductionobjectmendeliminatione:x 8/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Openfunctions valfac-base=funopen(0: Nat ))1valfac-step=recfunopen(n+1: Nat ))selfn(n+1)valfactorial=fac-baseorfac-step +Anopenfunctionisapartialfunction.+Thecombinatororcombinestwopartialfunctions. 15/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Abstractsyntax e::= openfunctions: jfunopenrnon-recursiveopenfunctionjrecfunopenrrecursiveopenfunctionje1ore2alternationr::=emptyrulejp)esinglerulejr1jr2sequencesofrules 16/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Dynamicsemantics (recfunopenr)+(recfunopenr)e1+(recfunopenr1)e2+(recfunopenr2) e1ore2+recfunopen(r1jr2)e2+(recfunopenr)casee1ofrfself7!recfunopenrgend+ e2e1+ 17/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Application|genericprogramming valsum-nat=funopen h Nat i )funx)xvalsum-pair=recsumfunopen h ( a1 ; a2 ) i )fun(x1;x2))sum h a1 i x1+sum h a2 i x2 +Insteadofacasewehaveatypecase. 18/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Conclusion I Openfunctionsareusefulinconjunctionwithopendatatypes. I Vision:replacementforoverloadingandtypeclasses. I Openrecursivemodules? 19/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Objects|abstractsyntax m Method methoddeclaration m::=emptydeclarationjmethodx=emethodde nitionjm1m2sequenceofdeclarationsjlocaldinmendlocaldeclaration 21/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Objects|dynamicsemantics + (methodx=e)+fx7!egm1+1m2+2 m1m2+1;2d+m+ localdinmend+ 22/23 ClosedandOpenRecursion RALFHINZE Introduction Recursivefunctions Recursiveobjects Recursivefunctionsrevisited Conclusion Appendix Finitemaps WhenXandYaresetsX! nYdenotesthesetof nitemaps fromXtoY.Thedomainofa nitemap'isdenoteddom'. I the singletonmap iswrittenfx7!yg I domfx7!yg=fxg I fx7!yg(x)=y I when'1and'2are nitemapsthemap'1;'2called'1 extended by'2isthe nitemapwith I dom('1;'2)=dom'1[dom'2 I ('1;'2)(x)='2(x)ifx2dom'2'1(x)otherwise 23/23