{"action":"created","issue":{"url":"https://api.github.com/repos/ramda/ramda/issues/865","labels_url":"https://api.github.com/repos/ramda/ramda/issues/865/labels{/name}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/865/comments","events_url":"https://api.github.com/repos/ramda/ramda/issues/865/events","html_url":"https://github.com/ramda/ramda/pull/865","id":59605485,"number":865,"title":"transducers initial commit","user":{"login":"kedashoe","id":719519,"avatar_url":"https://avatars.githubusercontent.com/u/719519?v=3","gravatar_id":"","url":"https://api.github.com/users/kedashoe","html_url":"https://github.com/kedashoe","followers_url":"https://api.github.com/users/kedashoe/followers","following_url":"https://api.github.com/users/kedashoe/following{/other_user}","gists_url":"https://api.github.com/users/kedashoe/gists{/gist_id}","starred_url":"https://api.github.com/users/kedashoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kedashoe/subscriptions","organizations_url":"https://api.github.com/users/kedashoe/orgs","repos_url":"https://api.github.com/users/kedashoe/repos","events_url":"https://api.github.com/users/kedashoe/events{/privacy}","received_events_url":"https://api.github.com/users/kedashoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-03T07:32:05Z","updated_at":"2015-03-03T19:51:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ramda/ramda/pulls/865","html_url":"https://github.com/ramda/ramda/pull/865","diff_url":"https://github.com/ramda/ramda/pull/865.diff","patch_url":"https://github.com/ramda/ramda/pull/865.patch"},"body":"Well, I'll start very briefly with some good bits:\r\n\r\n- Everyone gets to write the same awesome Ramda code they've always been writing, only difference is now behind the scenes you'll find transducers for some operations.\r\n- We can get rid of `mapObj`, `mapObjIndexed` (all transducer callbacks will get `value`, `key` and `collection`), `filterIndexed`, etc.\r\n- It is very easy to add support for anything that follows the iterator protocol (Immutable.js already supported, need to have a discussion about how to generalize), streams, etc. (#695, #860, etc)\r\n- Transducer speed scales very well to large data structures.\r\n\r\nThe bad (one of the? the worst?) part: the code I think is quite difficult to follow. I *really* wanted to find a way to properly visualize the code paths before submitting this PR, but I haven't come up with a great solution. However, I believe things are more or less working so that the core contributors can get an idea of what is going on, decide if you'd like to move in this direction, another direction with transducers, or somewhere else.\r\n\r\nYou can see some basic usage in `test/transduce.js`. I have simply been running\r\n\r\n`make && ./node_modules/.bin/mocha test/transduce.js`\r\n\r\nduring development. I've also included in `dist/` some examples that follow a couple different code paths (obviouly these would be deleted if any of this is ever merged). I've added a `debugger;` line so if you open up the html examples in a browser and have your console open it should break before it starts doing anything important and you can step through to get a better idea of what's happening. I've started building some UML-ish diagrams as well which I think will be pretty nice when they are done, but not sure when that will be.\r\n\r\n### Some notes in no particular order\r\n\r\nAs http://clojure.org/transducers tells us,\r\n\r\n> Composition of the transformer runs right-to-left but builds a transformation stack that runs left-to-right\r\n\r\nNow, if you've got pipes and compositions and some of their constituent functions are transducers and some are not, things could get really weird really fast. So all transducers in a **composition** are **piped** left-to-right so that they run right-to-left as you would expect in a composition (actually I've only implemented pipe as that is what I used in my work, we can just deprecate `compose`, right? Jokes! :stuck_out_tongue_winking_eye:  I just did not take the time to implement `compose` as it is simply the mirror of pipe). Let's look at a quick example here. Say you build a pipe\r\n\r\n`pipe(a, b, c, d, e, f)`\r\n\r\nwhere a-f are functions. If b, c and d are transducers, they will be composed when the pipe is built, so that when the pipe is actually run you still get a -> (b -> c -> d transducer stack) -> e -> f.\r\n\r\nI haven't used this PR to re-implement everything that might possibly be a transducer yet, just \r\n\r\n- `map` and `filter` cause everyone loves mapping and filtering\r\n- `take` to test terminating transduction\r\n- `partitionBy` and `mapcat` because we use those in our implementation\r\n\r\nNeed to implement curry anywhere since we are \"manually\" currying.\r\n\r\nThis also causes problems with `checkForMethod` as currently used (`filter` tests for this and fails), I've just removed that call while the PR is under review.\r\n\r\nI took out stream stuff as the default output collection (a write stream?) deserves some discussion.\r\n\r\nThere are some nice helper functions that are easy to implement like `into` (convert anything to anything else), `toList` (convert anything to a list), `toMap` (you get the idea) which I've not included.\r\n\r\nAlright, it's getting late, I'm sure I'm forgetting plenty and regardless there are more todos and questions, but I figured it's best to just get this up and let you guys take the lead from here."},"comment":{"url":"https://api.github.com/repos/ramda/ramda/issues/comments/77020605","html_url":"https://github.com/ramda/ramda/pull/865#issuecomment-77020605","issue_url":"https://api.github.com/repos/ramda/ramda/issues/865","id":77020605,"user":{"login":"buzzdecafe","id":716260,"avatar_url":"https://avatars.githubusercontent.com/u/716260?v=3","gravatar_id":"","url":"https://api.github.com/users/buzzdecafe","html_url":"https://github.com/buzzdecafe","followers_url":"https://api.github.com/users/buzzdecafe/followers","following_url":"https://api.github.com/users/buzzdecafe/following{/other_user}","gists_url":"https://api.github.com/users/buzzdecafe/gists{/gist_id}","starred_url":"https://api.github.com/users/buzzdecafe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buzzdecafe/subscriptions","organizations_url":"https://api.github.com/users/buzzdecafe/orgs","repos_url":"https://api.github.com/users/buzzdecafe/repos","events_url":"https://api.github.com/users/buzzdecafe/events{/privacy}","received_events_url":"https://api.github.com/users/buzzdecafe/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T19:51:15Z","updated_at":"2015-03-03T19:51:15Z","body":"it's not clear to me from just reading the code if this will work with external transducer libraries?"}}