{"action":"closed","issue":{"url":"https://api.github.com/repos/ramda/ramda/issues/1230","labels_url":"https://api.github.com/repos/ramda/ramda/issues/1230/labels{/name}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1230/comments","events_url":"https://api.github.com/repos/ramda/ramda/issues/1230/events","html_url":"https://github.com/ramda/ramda/issues/1230","id":91177645,"number":1230,"title":"R.min and R.max should be binary functions","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ramda/ramda/labels/proposal","name":"proposal","color":"66cc66"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-26T07:16:24Z","updated_at":"2015-07-05T22:30:15Z","closed_at":"2015-07-05T22:30:15Z","body":"There are (at least) two ways in which these functions may be used:\r\n\r\n  - to find the min/max value in a list of arbitrary length; or\r\n  - to limit a value.\r\n\r\nThe current functions are perfect for the first use case but a poor fit for the second. In fact, several times I've found myself using `R.partial(Math.max, 0)` or even defining my own `max` function: `var max = R.curry(Math.max);`.\r\n\r\nIt's easier to derive the list form from the binary form than vice versa.\r\n\r\nCurrent API:\r\n\r\n```javascript\r\n// :: [a] -> a\r\nvar f = R.max;\r\n\r\n// :: Number -> Number\r\nvar g = R.compose(R.max, R.concat([0]), R.of);\r\n```\r\n\r\nProposed API:\r\n\r\n```javascript\r\n// :: [a] -> a\r\nvar f = R.reduce(R.max, -Infinity);\r\n\r\n// :: Number -> Number\r\nvar g = R.max(0);\r\n```\r\n\r\nWere we to take the same approach with `R.minBy` and `R.maxBy` we'd avoid the difficult question of what to return given the empty list, as the user is *forced* by `R.reduce` to specify a default value! :)\r\n\r\nAlso, I expect these functions to work for any ordered type. Currently `R.max(['a', 'b', 'c'])` gives `-Infinity` rather than `'c'`.\r\n"}}