5 ms·
So did I. So why have append for lists, and string-append for strings? Well, Scheme implementors were early on (still are) interested in writing efficient c
by soegaard 12y ago
So did I. So why have append for lists, and string-append for strings? Well, Scheme implementors were early on (still are) interested in writing efficient compilers - that affects the naming choices.
- gus_massa 12y agoIn the "Racket2" wish list ( https://github.com/plt/racket/wiki/Racket2 https://github.com/plt/racket/wiki/Racket2 ) there is an idea to use more generics: > Generic programming by default: map, fold, and friends are generic [in Racket2] and not specialized to lists. I have something similar in my private "language" that I use for internal projects, it also use that for append and length (actually len, because length is too verbose). And I use only list-append or string-append in the few cases where the speed is critical. If something like this is implemented, the transformation from append to list-append or string-append could be made automatically in some cases by the Typed Racket optimizer (or the core optimizer).
- davexunit 12y ago>So why have append for lists, and string-append for strings? Because concatenating two lists and concatenating 2 strings are distinctly different operations on different data types, and it helps that they are named as such.
- copsarebastards 12y ago> Because concatenating two lists and concatenating 2 strings are distinctly different operations on different data types, and it helps that they are named as such. "Named" is the wrong word for that sentence. Names are for people, boats, pets, not data structures. You probably meant "data type named".