Generics Asumu Takikawa RacketCon 2012 1 What are generics? 2 - - PowerPoint PPT Presentation

generics
SMART_READER_LITE
LIVE PREVIEW

Generics Asumu Takikawa RacketCon 2012 1 What are generics? 2 - - PowerPoint PPT Presentation

Generics Asumu Takikawa RacketCon 2012 1 What are generics? 2 What are generics? hash-ref assoc hash-set alist-cons hash-remove alist-delete 3 What are generics? hash-ref assoc hash-set alist-cons hash-remove alist-delete


slide-1
SLIDE 1

Generics

Asumu Takikawa RacketCon 2012

1

slide-2
SLIDE 2

What are generics?

2

slide-3
SLIDE 3

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete

3

slide-4
SLIDE 4

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete list-ref vector-ref bytes-ref append vector-append bytes-append

4

slide-5
SLIDE 5

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete list-ref vector-ref bytes-ref append vector-append bytes-append = string=? boolean=? bytes=?

5

slide-6
SLIDE 6

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete list-ref vector-ref bytes-ref append vector-append bytes-append = string=? boolean=? bytes=? dict-ref dict-set dict-remove

6

slide-7
SLIDE 7

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete list-ref vector-ref bytes-ref append vector-append bytes-append = string=? boolean=? bytes=? dict-ref dict-set dict-remove sequence-ref sequence-append

7

slide-8
SLIDE 8

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete list-ref vector-ref bytes-ref append vector-append bytes-append = string=? boolean=? bytes=? dict-ref dict-set dict-remove sequence-ref sequence-append equal?

8

slide-9
SLIDE 9

What are generics?

hash-ref hash-set hash-remove assoc alist-cons alist-delete list-ref vector-ref bytes-ref append vector-append bytes-append = string=? boolean=? bytes=? dict-ref dict-set dict-remove sequence-ref sequence-append equal?

... but can we make our own?

9

slide-10
SLIDE 10

Of course!

10

slide-11
SLIDE 11

Of course!

This is

11

slide-12
SLIDE 12

Of course!

This is Anything is only a require away

12

slide-13
SLIDE 13

Of course!

This is Anything is only a require away

(require racket/generic)

13

slide-14
SLIDE 14

DEMO

https:/ /gist.github.com/3885002

14

slide-15
SLIDE 15

Generics

Now available in 5.3

Credit:

Eli Barzilay Jay McCarthy Vincent St-Amour Claire Alvis Asumu Takikawa

15