March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -1,16 +1,19 @@
;#lang racket
#lang racket/base
(define point%
(class object%
(super-new)
(init-field x y)
(define/public (clone) (new this% [x x] [y y]))
(define/public (to-list) (list this% x y))))
(define (copy-struct str)
(define-values (str-struct-info _) (struct-info str))
(define str-maker (struct-type-make-constructor str-struct-info))
(apply str-maker (cdr (vector->list (struct->vector str)))))
(define point/color%
(class point%
(super-new)
(inherit-field x y)
(init-field color)
(define/override (clone) (new this% [x x] [y y] [color color]))
(define/override (to-list) (list this% x y color))))
(struct point (x y) #:transparent)
(struct point/color point (color) #:transparent)
(let* ([original (point 0 0)]
[copied (copy-struct original)])
(displayln copied)
(displayln (eq? original copied)))
(let* ([original (point/color 0 0 'black)]
[copied (copy-struct original)])
(displayln copied)
(displayln (eq? original copied)))

View file

@ -0,0 +1,16 @@
;#lang racket
(define point%
(class object%
(super-new)
(init-field x y)
(define/public (clone) (new this% [x x] [y y]))
(define/public (to-list) (list this% x y))))
(define point/color%
(class point%
(super-new)
(inherit-field x y)
(init-field color)
(define/override (clone) (new this% [x x] [y y] [color color]))
(define/override (to-list) (list this% x y color))))