Logo

Programming-Idioms

History of Idiom 5 > diff from v360 to v361

Edit summary for version 361 by Dodopod:
New Scheme implementation by user [Dodopod]

Version 360

2017-02-07, 22:13:40

Version 361

2017-06-06, 15:09:03

Idiom #5 Create a 2D Point data structure

Declare a container type for two floating-point numbers x and y

Illustration

Idiom #5 Create a 2D Point data structure

Declare a container type for two floating-point numbers x and y

Illustration
Code
(define (create-point x y)
  (cons x y))
(define (point-x p)
  (car p))
(define (point-y p)
  (cdr p))