SICP with Julia/Pluto

Contact

Prof. Dr. Claus Möbus

Room: A02 2-226


Secretary

Manuela Wüstefeld

Room: A02 2-228

Tel: +49 441 / 798-4520

SICP with Julia/Pluto

Quotes

Two Julia pearls

*While trying once again to find if there was any Julia version of the Classic Computer Science Problems by David Kopec (there are versions in Python, Java, Rust, JavaScript and others in GitHub - davecom/ClassicComputerScienceProblemsInPython: Source Code for the Book Classic Computer Science Problems in Python 9), I found these very important pearls from @CMoebus in JULIA Projects // University of Oldenburg 25 a Julia application of the SICP and of the ISLR2, both using Pluto.jl.*

https://discourse.julialang.org/t/two-julia-pearls/116352

SICP/JP = Problem-solving with Julia/Pluto

A Self-study Guide

This is a personal learning-diary when exploring Julia by exploiing SICP. I used Lisp and especially Scheme regularly from time to time. I loved Scheme for its elegance and minimalism. But for production purposes in various scientic projects I had to use other languages for pragmatic reasons, like Fortran, Prolog, R, Javascript, Bugs, Stan, WebPPL and even Python. But I was always looking for a language as elegant as Scheme but with a greater usability and usefulness. Several year ago David Barber gave advice to give Julia a try. In the end I stumbled across the fascinating probabilistic programming languages Gen and Turing, both embedded in Julia. That was the starting point to deal with Julia to have a solid fundament for modeling in Gen and Turing.

Here we present transpilations of SICP-Scheme-scripts into Julia as well as alternatives exploiting idiomatic JULIA constructs within a Pluto.jl-embedding. Pluto.jl offers reactive notebooks very suitable for educational purposes.

We use Pluto.jl as a learning environment for self-guided learning Julia. The original SICP is expected to be the accompanying study-guide. All SICP-Scheme-scripts are reconstructed in Julia in a stepwise manner. Furthermore idiomatic Julia scripts are added to demonstrate solutions made possible by advanced Julia features.

In the end it is guaranteed that the learner has acquired several competencies. S|he is competent in understanding CS-concepts, reading Scheme-scripts, and developing new scripts in Julia/Pluto.jl.

Learners expecting a gamified learning environment (https://en.wikipedia.org/wiki/Gamification_of_learning) will be disappointed. This is a rather academic (dry ;) ) learning experience. So your intrinsic motivation in studying Julia should be rather high.

The time investment needed is not trivial. Of course this depends on the preknowledge and the aspiration of the learner. We estimate that a newbee to programming needs 1-2 hours/day over a 12 month period (2 semesters), whereas an expert (in say Python) will need only a few weeks.

C.M.

P.S.: The electronic version of SICP can be found here (https://sarabander.github.io/sicp/html/Foreword.xhtml#Foreword) and here (https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/index.html).

New content beyond SICP is denoted by nonSICP.

 

Topics of SICP/JP

  1.   Building Abstractions with Procedures
    1. The Elements of Programming
      1. Expressions
      2. Naming and the Environment
      3. Evaluating Combinations
      4. Compound Procedures
      5. The Substitution Model for Procedure Application
      6. Conditional Expressions and Predicates
      7. Example: Square Roots by Newton's Method
      8. Procedures as Black-Box Abstractions
    2. Procedures and the Processes They Generate
      1. Linear Recursion and Iteration
      2. Tree Recursion
      3. Orders of Growth
      4. Exponentiation
      5. Greatest Common Divisors
      6. Example: Testing for Primality
    3. Formulating Abstractions with Higher-Order Procedures
      1. Procedures as Arguments
        1. Basics
        2. nonSICP: Cantor Set
        3. nonSICP: Lebesgue Integration
        4. nonSICP: Stochastic First Choice Voting Models
      2. Constructing Procedures Using Lambda
        1. Basics
        2. nonSICP: Omega Combinator and Continuation Passing Style (CPS)
      3. Procedures as General Methods
      4. Procedures as Returned Values
      5. nonSICP: Removing Recursion by Fixed Point Operator Y
      6. nonSICP: You Could Have Invented Monads I
  2. Building Abstractions with Data
    1. Introduction to Data Abstraction
      1. Example: Arithmetic Operations for Rational Numbers
      2. Abstraction Barriers
      3. What Is Meant by Data?
      4. Extended Exercise: Interval Arithmetic
    2. Hierarchical Data and the Closure Property
      1. Representing Sequences
      2. Hierarchical Structures
      3. Sequences as Conventional Interfaces
      4. Example: A Picture Language
    3. Symbolic Data
      1. Quotation
      2. Example: Symbolic Differentiation
      3. Example: Representing Sets
      4. Example: Huffman Encoding Trees
    4. Multiple Representations for Abstract Data
      1. Representations for Complex Numbers
      2. Tagged data
      3. Data-Directed Programming and Additivity
      4. nonSICP: Message Passing
    5. Systems with Generic Operations
      1. Generic Arithmetic Operations
      2. Combining Data of Different Types
        1. Cross-type Operations
        2. Coercion
        3. Hierarchies of Types
        4. Inadequacies of Hierarchies
      3. Example: Symbolic Algebra
  3. Modularity, Objects, and State
    1. Assignment and Local State
      1. Local State Variables
      2. The Benefits of Introducing Assignment
        1. nonSICP: Monte Carlo I
        2. nonsSICP: Monte Carlo II
      3. The Costs of Introducing Assignment
    2. The Environment Model of Evaluation
      1. The Rules for Evaluation
      2. Applying Simple Procedures
      3. Frames as the Repository of Local State
      4. Internal Definitions
    3. Modeling with Mutable Data
      1. Mutable List Structure
      2. Representing Queues
        1. FIFOs
        2. with Data Structures
      3. Representing Tables
        1. Representing Tables
        2. nonSICP: OLS-Regression with Data Matrices
      4. A Simulator for Digital Circuits
        1. Simulation of Basic Gates
        2. Simulation of Basic Circuits
      5. Propagation of Constraints
    4. Concurrency: Time Is of the Essence
      1. The Nature of Time in Concurrent Systems
      2. Mechanisms for Controlling Concurrency
    5. Streams
      1. Streams Are Delayed Lists
      2. Infinite Streams
      3. Exploiting the Stream Paradigm
      4. Streams and Delayed Evaluation
      5. Modularity of Functional Programs and Modularity of Objects
Webmaster (Changed: 11 May 2025)  Kurz-URL:Shortlink: https://uol.de/p100420en | # |
Zum Seitananfang scrollen Scroll to the top of the page