This commit is contained in:
Matthew Davidson 2023-01-04 16:51:26 +01:00
parent ce7411159d
commit 5674c49c3a

View file

@ -26,19 +26,19 @@
(meditations
"A multimethod takes one or more arguments to dispatch on"
(= __
(= "Hello, World!"
(multimethod-without-args :first))
"Though it can be ignored and represented by _ in defmethods"
(= __
(= "Hello there"
(multimethod-without-args :second))
"Alternatively, we can use the arguments in defmethods"
(= __
(= 1
(multimethod-with-args :path-one {:first-opt 1
:second-opt 2}))
"This allows us to do something different in each method implementation"
(= __
(= 6
(multimethod-with-args :path-two {:first-opt 1
:second-opt [0 1 2]})))