Still kinda pissed that map in #Scheme is not a generic function in the functor typeclass. Does #Racket fix this? I don't wanna manually rewrite map or append every time I switch an underlying data structure.

@grainloom Why not? I don't want to guess what the map is that call each time. Overloading bad.

@amiloradovsky There aren't many reasonable ways to implement map. Overloading is only bad when it leads to ambiguity, but when there is just one implementation of functor for the given type, there is no ambiguity.

@amiloradovsky Like, there is no important difference between mapping over a cons list vs a vector vs a string.
But I might use all three in an algorithm and switch between them until I figure out which one is optimal.

@grainloom @amiloradovsky

You could use CLOS to define your "types" and associated methods

Or you could use transducers

@AbbieNormal @grainloom Yep, generic functions in Common Lisp. Not sure what would be the most elegant realization in Scheme.

@AbbieNormal @amiloradovsky @grainloom Anyway, vlist-map in Guile is too tempting. I want to use it. 😅

Sometimes I wonder if Scheme had integerinteger+ integerfloat+ floatfloat+.

@veer66 @AbbieNormal @grainloom The arithmetic is already "polymorphic":

> (+ (sqrt -1) 1)
$1 = 1.0+1.0i

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!