3 ms·
> those just add more cognitive burden, in my opinion. Of course that is a valid viewpoint, but remember that using a function (instead of splicing syntax) has
by madmax96 10y ago
> those just add more cognitive burden, in my opinion.
Of course that is a valid viewpoint, but remember that using a function (instead of splicing syntax) has the added advantage of being composable and applicable. These two features are crucial when you're dealing with efficient persistent data structures and separating purity/impurity, so in a very real sense you do need these things as they make life easier in other areas. Python isn't a functional language and doesn't have to concern itself with dealing with persistent data structures efficiently and so they don't mind that to achieve a composable and applicable splicing solution they'd have to wrap the splice in an abstraction. That's fine, because if you're writing Python like that, then you're probably writing Python wrong (in the sense that it wouldn't perform or read as well as it would if you would have just used a functional language.) But if you're writing functionally, you obviously consider that abstraction's standard existence a good thing.
The linguistic philosophies of Clojure and Python are radically different that these functions are a quality for Clojure, while if you're writing Clojure like you'd write Python you would consider them unnecessary.
- icebraining 10y agoYeah, functions have those advantages. That's why Python also has slice(), which you can then apply to any list, in a composable way. But when you don't need those features, the splicing syntax adds less crud than a bunch of function with non-obvious names. Eg. use of slice(): >>> butLast = slice(-1) >>> getitem([7, 8, 9], butLast) [7, 8]
- madmax96 10y ago> But when you don't need those features Ah, in a purely functional language you always need those features :)