Content from Why Learn Scheme
Last updated on 2025-07-05 | Edit this page
Estimated time: 12 minutes
Overview
Questions
- Why learn Scheme?
Objectives
- Understand how Scheme relates to other programming languages
- Know about some Scheme implementations
Introduction
What you need to know is that there are three sections required for a valid Carpentries lesson template:
-
questions
are displayed at the beginning of the episode to prime the learner for the content. -
objectives
are the learning objectives for an episode displayed with the questions. -
keypoints
are displayed at the end of the episode to reinforce the objectives.
Inline instructor notes can help inform instructors of timing challenges associated with the lessons. They appear in the “Instructor View”
OUTPUT
Hello World!
Challenge 2: how do you nest solutions within challenge blocks?
You can add a line with at least three colons and a
solution
tag.
Callout sections can highlight information.
They are sometimes used to emphasise particularly important points but are also used in some lessons to present “asides”: content that is not central to the narrative of the lesson, e.g. by providing the answer to a commonly-asked question.
- Scheme is a part of the Lisp family of programming languages
- There are several implementations of Scheme, choose one appropriate for your needs
Content from Variables and Procedures
Last updated on 2025-07-05 | Edit this page
Estimated time: 12 minutes
Overview
Questions
- How do you use variables and procedures in Scheme?
Objectives
- Explore differences between Gambit Scheme and Guile Scheme
Introduction
An alternative implementation of the exercies in variables and procedres section of the Spritely Scheme Primer ported to Gambit Scheme.
SCHEME
(define (chatty-add chatty-name . nums)
(string-append chatty-name ", If you add these together you get " (number->string (apply + nums)) "!\n"))
SCHEME
(define (shopkeeper thing-to-buy
#!optional (how-many 1)
(cost 20)
#!key (shopkeeper "Sammy")
(store "Plentiful Great Produce"))
(display
(string-append "You walk into "
store
", grab something from the shelves,\n"
"and walk up to the counter.\n\n"
shopkeeper
" looks at you and says "
"'"
(number->string how-many)
" "
thing-to-buy
", eh? That will be "
(number->string (* cost how-many))
" coins!'\n")))
OUTPUT
You walk into Plentiful Great Produce, grab something from the shelves,
and walk up to the counter.
Sammy looks at you and says '1 apples, eh? That will be 20 coins!'
OUTPUT
You walk into Plentiful Great Produce, grab something from the shelves,
and walk up to the counter.
Sammy looks at you and says '10 bananas, eh? That will be 280 coins!'
OUTPUT
You walk into Horace's Hardware, grab something from the shelves,
and walk up to the counter.
Horace looks at you and says '3 screws, eh? That will be 6 coins!'
Need newer version of interpreter for let-values
# https://stackoverflow.com/questions/77866133/how-to-use-let-values-in-gambit-scheme
- Scheme implementations may differ in exact functionality offered
Content from Conditionals and Predicates
Last updated on 2025-07-05 | Edit this page
Estimated time: 12 minutes
Overview
Questions
- How do you control how your program executes?
Objectives
- Explain how to check whether something is true or false
Introduction
- Program flow can be controlled by evaluating statements and checking conditions