{"action":"created","issue":{"url":"https://api.github.com/repos/ramda/ramda/issues/1356","labels_url":"https://api.github.com/repos/ramda/ramda/issues/1356/labels{/name}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1356/comments","events_url":"https://api.github.com/repos/ramda/ramda/issues/1356/events","html_url":"https://github.com/ramda/ramda/pull/1356","id":103149892,"number":1356,"title":"Adds R.around","user":{"login":"scott-christopher","id":8951601,"avatar_url":"https://avatars.githubusercontent.com/u/8951601?v=3","gravatar_id":"","url":"https://api.github.com/users/scott-christopher","html_url":"https://github.com/scott-christopher","followers_url":"https://api.github.com/users/scott-christopher/followers","following_url":"https://api.github.com/users/scott-christopher/following{/other_user}","gists_url":"https://api.github.com/users/scott-christopher/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-christopher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-christopher/subscriptions","organizations_url":"https://api.github.com/users/scott-christopher/orgs","repos_url":"https://api.github.com/users/scott-christopher/repos","events_url":"https://api.github.com/users/scott-christopher/events{/privacy}","received_events_url":"https://api.github.com/users/scott-christopher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-26T01:32:13Z","updated_at":"2015-08-26T05:52:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ramda/ramda/pulls/1356","html_url":"https://github.com/ramda/ramda/pull/1356","diff_url":"https://github.com/ramda/ramda/pull/1356.diff","patch_url":"https://github.com/ramda/ramda/pull/1356.patch"},"body":"As briefly discussed in #1275, this implements:\r\n```\r\naround :: (a -> b) -> (c -> d) -> (b -> c) -> a -> d\r\n```\r\n\r\nFrom the docs:\r\n>\r\nAccepts three functions, `fore`, `hind` and `fn`, and a single value. `R.around` effectively wraps `fn` with `fore` and `hind` by first passing the given value to `fore`, which returns a value that is then passed to `fn`, whose return value is finally passed to `hind`. The return value of `R.around` is the result of this call to `hind`.\r\n\r\n>\r\nThis can be useful for converting some type `a` to be compatible with some function `(b -> b)` and back again, where an isomorphism exists between `a` and `b`: `R.around(aToB, bToA, bFn)`.\r\n\r\nPotential controversy: there isn't a whole lot of difference between this and `compose` or `pipe`, except the difference in parameter order making it nicer to work with under certain scenarios."},"comment":{"url":"https://api.github.com/repos/ramda/ramda/issues/comments/134843910","html_url":"https://github.com/ramda/ramda/pull/1356#issuecomment-134843910","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1356","id":134843910,"user":{"login":"scott-christopher","id":8951601,"avatar_url":"https://avatars.githubusercontent.com/u/8951601?v=3","gravatar_id":"","url":"https://api.github.com/users/scott-christopher","html_url":"https://github.com/scott-christopher","followers_url":"https://api.github.com/users/scott-christopher/followers","following_url":"https://api.github.com/users/scott-christopher/following{/other_user}","gists_url":"https://api.github.com/users/scott-christopher/gists{/gist_id}","starred_url":"https://api.github.com/users/scott-christopher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scott-christopher/subscriptions","organizations_url":"https://api.github.com/users/scott-christopher/orgs","repos_url":"https://api.github.com/users/scott-christopher/repos","events_url":"https://api.github.com/users/scott-christopher/events{/privacy}","received_events_url":"https://api.github.com/users/scott-christopher/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T05:52:39Z","updated_at":"2015-08-26T05:52:39Z","body":"> I think this function should take three arguments and return a function that takes as many arguments as it's last argument.\r\n```js\r\nvar len = R.under(square, sqrt, R.add)\r\nlen(12, 4) //=> compute length of vector\r\n```\r\n\r\nJust to confirm I understand, do you mean that `len(12, 4)` would result in something like (sorry for the dodgy ascii art):\r\n```\r\n(12) => [square] =(144)=> |---|\r\n                          |add| =(160)=> [sqrt] => (12.64)\r\n (4) => [square] ==(16)=> |---|\r\n```\r\nThis feels like it's getting close to arrow territory."}}