@@ -193,7 +193,7 @@ Matrix of methods/types(data-structures)
193193
194194Consider an existing matrix of data and functions:
195195| data \ methods | find_food | eat! | | | |
196- | --- | ---- | ---- | --- | - --- | --- |
196+ | --- | --- | --- | --- | --- | --- |
197197| Wolf | | | | | |
198198| Sheep | | | | | |
199199| Grass | | | | | |
@@ -383,13 +383,12 @@ Why so complicated? Wasn't original tree structure better?
383383| --- | --- | --- | --- |
384384| birds | penguin | eagle | kiwi |
385385| mammal | dolphin | bat | sheep,wolf|
386+ | insect | backswimmer | fly | beetle|
386387
387388Single type hierarchy will not work. Other approaches:
388389 - interfaces
389390 - parametric types
390391
391- Julia Solution: Types can be parametric!
392-
393392 Analyze what features of animals are common and * compose* the animal:
394393``` julia
395394abstract type HeatType end
@@ -403,9 +402,7 @@ mutable struct Animal{H<:HeatType,M<:MovementType,C<:ChildCare}
403402end
404403```
405404
406- This approach allows
407-
408- Now, we can define methods dispatching on parameters.
405+ Now, we can define methods dispatching on parameters of the main type.
409406
410407# # Interfaces
411408
@@ -456,6 +453,6 @@ aslist(::Nonlist, x) = [x]
456453```
457454
458455Many packages:
459- https: // github. com/ andyferris/ Traitor. jl
460- https: // github. com/ mauro3/ SimpleTraits. jl
461- https: // github. com/ tk3369/ BinaryTraits. jl
456+ - https: // github. com/ andyferris/ Traitor. jl
457+ - https: // github. com/ mauro3/ SimpleTraits. jl
458+ - https: // github. com/ tk3369/ BinaryTraits. jl
0 commit comments