-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Your Name
committed
Nov 11, 2020
1 parent
b4a71cb
commit e7a4d6a
Showing
4 changed files
with
182 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
(type_exception 1) | ||
(define (list? x) (not (atom? x))) | ||
|
||
(define (_display_list x) | ||
(if (null? x) (begin (display_char #\backspace) (display_char #\)) 0) | ||
(begin | ||
(if (list? (car x)) | ||
(begin (display_char #\() (_display_list (car x))) | ||
(display_num (car x))) | ||
(display_char #\space) | ||
(_display_list (cdr x))))) | ||
|
||
(define (display_list x) | ||
(begin | ||
(display_char #\() | ||
(_display_list x))) | ||
|
||
|
||
(define (map proc lst) | ||
(if (null? lst) lst; what indicates an ending? | ||
(cons (proc (car lst)) (map proc (cdr lst))))) | ||
|
||
(define seq (cons 11 (cons 12 13))) | ||
(define result (map (lambda (x) (* x x)) seq)) | ||
(display_list result) |