slack1
2017-12-17 20:13:12

A bit of a silly question, but why do people prefer an interface of (fn proc data) and not (fn data proc)


samth
2017-12-17 20:15:09

@slack1 we’ve moved toward the latter, but the former is the historical tradition (ie map)


brendan
2017-12-17 20:16:46

I’m not sure if this influences Racket’s choice, but (map proc data) is nicer with partial application, since you can do (define increment-all (map add1))


slack1
2017-12-17 20:17:52

ah I see


slack1
2017-12-17 20:18:47

I also didn’t know that things were auto-curried like that


slack1
2017-12-17 20:18:53

I thought you had to curry map


brendan
2017-12-17 20:20:02

They aren’t afaik. I was just saying that if things are autocurried, e.g. In haskell or hackett, then the order of map/filter/fold’s arguments seems more natural


notjack
2017-12-17 21:58:08

the current rule in racket “functions that operate on some abstract type foo? use the prefix foo- in their names and take the foo? input as the first argument”


samth
2017-12-17 22:15:11

also it’s easier to extend to multiple arguments if the function comes first (as in map)


samth
2017-12-17 22:15:49

but in general the rule is as @notjack says