.. _FP9: .. raw:: html .. |--| unicode:: U+2013 .. en dash .. |---| unicode:: U+2014 .. em dash, trimming surrounding whitespace :trim: .. This file is part of the OpenDSA eTextbook project. See .. http://algoviz.org/OpenDSA for more details. .. Copyright (c) 2012-13 by the OpenDSA Project Contributors, and .. distributed under an MIT open source license. .. avmetadata:: :author: David Furcy and Tom Naps =========================================== Functional Programming - Part 9 =========================================== .. (M 2/29/16) RP 13 part 1 ------------ Topics of the day: 1. Continuations 2. Continuation-passing style programming The review problem set for today contains five review problems. This first problem is about a recursive function to compute the greatest common divisor (or :math:`gcd`) of two integers. .. avembed:: Exercises/PL/RP13part1.html ka :module: FP9 :long_name: RP set #13, question #1 :points: 1.0 :required: True :threshold: 1.0 :exer_opts: JXOP-debug=true&JOP-lang=en&JXOP-code=java_generic RP 13 part 2 ------------ This review problem is the first one in a sequence of three problems that require you to complete the implementation of a recursive function that uses continuation-passing style programming. This problem uses the :math:`gcd` function introduced in the first problem in this set, but you do not need to remember how it was implemented. .. avembed:: Exercises/PL/RP13part2.html ka :module: FP9 :long_name: RP set #13, question #2 :points: 1.0 :required: True :threshold: 1.0 :exer_opts: JXOP-debug=true&JOP-lang=en&JXOP-code=java_generic RP 13 part 3 ------------ This review problem is the second one in a sequence of three problems that require you to complete the implementation of a recursive function that uses continuation-passing style programming. This problem uses the :math:`gcd` function introduced in the first problem in this set, but you do not need to remember how it was implemented. .. avembed:: Exercises/PL/RP13part3.html ka :module: FP9 :long_name: RP set #13, question #3 :points: 1.0 :required: True :threshold: 1.0 :exer_opts: JXOP-debug=true&JOP-lang=en&JXOP-code=java_generic RP 13 part 4 ------------ This review problem is the last one in a sequence of three problems that require you to complete the implementation of a recursive function that uses continuation-passing style programming. This problem uses the :math:`gcd` function introduced in the first problem in this set, but you do not need to remember how it was implemented. .. avembed:: Exercises/PL/RP13part4.html ka :module: FP9 :long_name: RP set #13, question #4 :points: 1.0 :required: True :threshold: 1.0 :exer_opts: JXOP-debug=true&JOP-lang=en&JXOP-code=java_generic RP 13 part 5 ------------ This randomized review problem will give you more practice writing recursive functions in the continuation-passing style. To get credit for it, you must solve it correctly three times in a row. .. avembed:: Exercises/PL/RP13part5.html ka :module: FP9 :long_name: RP set #13, question #45 :points: 1.0 :required: True :threshold: 3.0 :exer_opts: JXOP-debug=true&JOP-lang=en&JXOP-code=java_generic