A Haskell Recursion Tutor

A Haskell Recursion Tutor

MASTER'S THESIS A Haskell Recursion Tutor Nicasi, K (Kevin) Award date: 2020 Link to publication General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain • You may freely distribute the URL identifying the publication in the public portal ? Take down policy If you believe that this document breaches copyright please contact us at: [email protected] providing details and we will investigate your claim. Downloaded from https://research.ou.nl/ on date: 30. Sep. 2021 Open Universiteit www.ou.nl AHASKELL RECURSION TUTOR Master Thesis Software Engineering Open University of the Netherlands Faculty of Science Author: Kevin Nicasi Student number: Course code: IM9906 Presentation date: November 2, 2020 Thesis committee: prof. dr. Johan Jeuring (chairman), Open University of the Netherlands dr. Bastiaan Heeren (supervisor), Open University of the Netherlands ABSTRACT Recursion is not an easy subject to learn. In this thesis the literature is examined on the common difficulties and misconceptions students encounter when trying to understand recursion in the functional paradigm, and on the available tools for teaching and visual- izing recursion. It is found that experts possess the copies model as their mental model and that novices often hold misconceptions about the passive flow and have difficulties identifying a correct base case or recursive step. The examined intelligent tutoring systems and visualizations show a variety of different approaches to illustrate code execution: some use graphical representations while others are text-based. Research indicates that some of the tools encourage students to spend more time with the learning material which leads to greater learning gains. A prototype tool is proposed that supports the learning of recursion in Haskell through the step-wise evaluation of recursive functions and the displaying of the subsequent func- tion calls in function tables. The prototype is aimed at alleviating the identified difficulties and misconceptions. The copies model is illustrated through the use of function tables that display the different instantiations of the function in the table rows. The passive flow is shown through step-wise normalization of the rows in the tables. The prototype has a unique way of illustrating the copies model and displays the passive flow explicitly. In the future the prototype could be augmented with additional features such as the handling of input and feedback. 3 ACKNOWLEDGMENTS First and foremost I would like my supervisor Bastiaan Heeren for his valuable input and inspiration. This thesis would not have been possible without his guidance. I would also like to thank Johan Jeuring for his valuable input and critical comments. I would also like to thank my girlfriend Beatrix for her patience, love and enduring sup- port. 5 CONTENTS 1 Introduction........................................9 1.1 Contribution.................................... 10 1.2 Thesis overview.................................. 12 2 Related Work........................................ 13 2.1 Recursion in Haskell............................... 13 2.2 Evaluation in Haskell............................... 14 2.3 Mental Models and Conceptual Models................... 15 2.4 The Notional Machine.............................. 18 2.5 Intelligent Tutor Systems............................ 20 2.6 The Haskell Expression Evaluator and The IDEAS framework...... 23 2.7 Literature reviews................................. 23 3 Research Design...................................... 25 3.1 Research questions................................ 25 3.2 Research method................................. 25 4 Difficulties and misconceptions about recursion.................. 27 4.1 Mental models of recursion by Kahney.................... 27 4.2 Mental models of recursion by Götschi et al.................. 28 4.3 Limitations of the classification of mental models............. 30 4.4 Difficulties and misconceptions found by Hamouda et al......... 31 4.5 Phenomenographic perspective by Booth.................. 32 4.6 Pedagogical suggestions............................. 32 4.7 Summary...................................... 33 5 How do current educational tools illustrate recursion?............... 35 5.1 Visualizations tools................................ 36 5.2 Tutoring Systems................................. 38 5.3 Level of Engagement............................... 43 5.4 Effectiveness.................................... 44 5.5 Summary...................................... 45 7 6 A tutor for recursion in Haskell............................. 47 6.1 Using function tables to illustrate rewrite steps............... 47 6.2 Architecture of the prototype.......................... 48 6.3 Using algebraic data types to define and evaluate expressions...... 48 6.4 Walk-through................................... 53 6.5 Getting the sub-expression form a path.................... 54 6.6 Summary...................................... 57 7 Discussion......................................... 59 7.1 Comparison with WinHIPE and HEE..................... 59 7.2 Limitations and Future Work.......................... 63 8 Conclusions........................................ 69 References............................................ 71 8 1. INTRODUCTION Learning to program is challenging (Carter & Jenkins, 1999; Lahtinen, Ala-Mutka, & Järvi- nen, 2005). Introductory courses on programming often fail to deliver: a lot of students struggle to produce a working program after a first course, independent of the institution (Venables, Tan, & Lister, 2009; Guzdial, 2011). One of the hardest subjects to learn is recursion (Roberts, 1986; Gal-Ezer & Harel, 1998; Lahtinen et al., 2005). Students often struggle when they encounter the concept of recur- sion for the first time, it is a difficult concept to grasp. A lot of research in the field of computing education research has been done concerning the misconceptions and diffi- culties students run into when learning recursion (Kahney, 1983; Wu, Dale, & Bethel, 1998; Du Boulay, O’Shea, & Monk, 1999; Götschi, Sanders, & Galpin, 2003; AlZoubi, Fossati, Di Eu- genio, & Green, 2014). Recursion is an important programming technique (McCracken, 1987). Several algo- rithms, such as a search in a binary tree, are recursive in nature and are thus coded effi- ciently using recursion. Recursion is also used as an iteration construct in functional pro- gramming languages such as Haskell and Scheme. To aid novices in the understanding of code execution several intelligent tutoring sys- tems (ITS) and program visualization tools have been introduced over the past decades (Sorva, 2012). Research suggests that using ITS for teaching can be very effective (VanLehn, 2011). By using an ITS a student can study independently requiring less help from a teacher (Odekirk-Hash & Zachary, 2001). The systems are often able to give immediate feedback, which is not always possible in a classroom setting. Research suggests that immediate feed- back is preferable to delayed feedback (Mory, 2004). Some of the proposed tools have been targeted at recursion while others have a broader focus. Most of these tools are focused on the object-oriented paradigm and only a few are focused on the functional paradigm. None of those are specifically designed for teaching recursion. The focus of this thesis lies within the subject of computing education: the teaching of recursion in the functional programming language Haskell. The goal of this research is to document what has been done by the community of programming educators on recursion and to design a prototype for an intelligent tutoring system that helps in the understanding of recursion by leveraging the widespread familiarity with mathematical function tables. Function tables are a widely used visualization method in mathematics education (Martinez & Brizuela, 2006). Because of its widespread use it is an promising notation to leverage for illustrating function application, particularly for the demonstration of recur- sion. To document the community’s effort the available literature is studied focusing on two subjects: the difficulties encountered by students when introduced to recursion and the developed ITS and program visualization tools for teaching recursion. The output of the literature studies is used as inspiration for the prototype. The tutor prototype is aimed at novices learning the functional language Haskell. The 9 basic method of computation in Haskell is function application (Hutton, 2017). Function evaluation can be viewed as a form of term rewriting (Pareja-Flores, Urquiza-Fuentes, & Velázquez-Iturbide, 2007). Several functional program visualizations tools illustrate the process of function evaluation as repeated term rewriting. The proposed prototype also follows this approach, but focuses on recursion and additionally displays function invoca- tions and results in function tables. 1.1. CONTRIBUTION The research proposed in this thesis makes a step towards helping students, who are new to Haskell, to understand recursion. The main research question we aim

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    75 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us