6.4 Data Definitions
- 章节名:6.4 Data Definitions
;; a movie is a structure: ;; (make-movie symbol symbol) (define-struct movie (title producer)) ;; a boyfriend is a structure: ;; (make-boyfriend symbol symbol symbol number) (define-struct boyfriend (name hair eyes phone)) ;; a cheerleader is a structure: ;; (make-cheerleader symbol number) (define-struct cheerleader (name number)) ;; a CD is a structure: ;; (make-CD symbol symbol number) (define-struct CD (artist title price)) ;; a sweater is a structure ;; (make-sweater symbol number symbol) (define-struct sweater (material size producer)) 难道Racket的类型声明是非显式的?
[已註銷]对本书的所有笔记 · · · · · ·
-
Programs are Function Plus Variable Definitions
A variable is a placeholder that stands for an unknown quantity. Programs are Function ...
-
4.3 Conditionals and Conditional Functions
(cond [(<= n 1000) .040] [(<= n 5000) .045] [(<= n 10000) .055] [(> n 10000...
-
6.4 Data Definitions
-
Figure 11: The design recipe for compound data: A complete example
;; Data Analysis & Definitions: (define-struct student (last first teacher)) ;; A s...
-
7.2 Designing Functions for Mixed Data
(define (f a-shape) (cond [(square? a-shape) ...] [(circle? a-shape) ...])) (error 'che...
说明 · · · · · ·
表示其中内容是对原文的摘抄