Starting with list, map, build- and integer->char

Since Racket grew out of Scheme, and Scheme is a honed Lisp, maybe Learning Racket Through Examples should start with list . It might be fun to introduce some of this on a white-board while learners guess how DrRacket will respond. With four or five procedures (functions?) to play with, how much time would learners like to spend trying out various combinations?

Screenshot of DrRacket: Thinking of a Graded Sequence of Examples for Learning

Would these examples be suggestive enough for English-language learners to think about the meaning of list , map , build , string , character , integer ....

The examples should probably start with 0 and 1 since binary is the base so computing.

code

#lang racket

1

'a

'one

2

(list 1 2 3)

(list 'a 'b 'c)

(list
 (list 1 2 3)
 (list 'a 'b 'c))

(map list
    (list 1 2 3)
    (list 'a 'b 'c))

(map list
    (list 1 2 3)
    (list 'a 'b 'c)
    (list 'ア 'イ 'ウ)
    (list 'あ 'い 'う)
    (list '一 '二 '三))

(map list
    (list 1 2 3)
    (list 'a 'b 'c)
    (list 'ア 'イ 'ウ)
    (list 'あ 'い 'う)
    (list '一 '二 '三)
    (quote (one two three))
    '(いち に さん))

(build-string 3 (lambda (i)(integer->char (+ i 97))))
(build-list 3 values)
(build-list 3 (lambda (n) (+ n 97)))
(build-string 3 (lambda (i) (integer->char (+ i 65))))
(string->list "ABC")
(map char->integer (string->list "ABC"))

(build-list 5 values)
(build-list 5 (lambda (n) (+ n n)))
(build-list 5 (lambda (n) (expt n n)))

#Racket #DrRacket #LearningRacket #Programming #LearningProgramming#Scheme #RacketThroughExamples