dispatch - Julia-style multiple dispatch in Racket
“Multiple dispatch is the ability to define multiple implementations of a function, chosen at runtime based on the arguments to each call. The dispatch package brings this to Racket, allowing lexically separate but associated definitions: https://racket.discourse.group/t/julia-style-multiple-dispatch/1936?u=spdegabrielle
Julia-style multiple dispatch
Multiple dispatch is the ability to define multiple implementations of a function, chosen at runtime based on the arguments to each call. The dispatch package brings this to Racket, allowing lexically separate but associated definitions: (define/dispatch (add [l1 list?] [l2 list?]) (append l1 l2)) (define/dispatch (add [n1 number?] [n2 number?]) (+ n1 n2)) > (add 1 2) 3 > (add '(one two) '(three four)) '(one two three four) Source is here, any ...
