APL Parrot Target Practice #25

Who does the dispatch?

With many runtime types, you end up having to code a lot of :multi subs.

.sub unicode:"\u2374" :multi(Int, APLVector)       #⍴
.sub unicode:"\u2374" :multi(APLVector, APLVector) #⍴
.sub unicode:"\u2374" :multi(Int, String)          #⍴
.sub unicode:"\u2374" :multi(APLVector, String)    #⍴

By eliminating our choice of String as a type used by APL, we eliminate two code paths in this simple example. The real savings were much bigger.

Tradeoff…

 2×'3'
DOMAIN ERROR
Copyright © 2006 Will Coleda & Patrick Michaud