Arc Forumnew | comments | leaders | submitlogin
1 point by riffraff 6110 days ago | link | parent

Maybe, well, the usual polymorphic dispatch? Take the tipical "foreach" loop in ruby/python/java/c# for var in list dostuff

all rely (through coroutines, lambdas, side effects) on the list to know how to be iterable. If you change from a cons list to an array/file/socket/prime generator it will still work.

Of course, perfectly doable with, say, haskell type classes, but I don't know how to it in arc. Any hints?