I no longer mantain this list. There are lots of other very comprehensive JavaScript link lists out there. Please see those, instead (Google "awesome JavaScript" for a start).
| var Immutable = require('immutable'); | |
| var todos = OrderedMap(); | |
| var TodoStore = createStore({ | |
| getAll() { return todos; } | |
| }); | |
| Dispatcher.register(function(action) { | |
| if (action.actionType === "create") { | |
| var id = createGUID(); |
| Bacon = require('baconjs') | |
| Imm = require('immutable') | |
| React = require('react') | |
| window.Actions = | |
| changeFirstName: new Bacon.Bus() | |
| changeLastName: new Bacon.Bus() | |
| changeCountry: new Bacon.Bus() | |
| addCountryBird: new Bacon.Bus() | |
| addFriend: new Bacon.Bus() |
I personally like to have discussions in the spirit of the Socratic method. Instead of declaring my opinion, I ask a relevant question. How about this situation? What about this case? This has two possible outcomes.
- The other person explains to me how things work in that case. I realize that I misunderstood, and we both come out enriched and in agreement.
- The other person realizes that those situations are not covered. They realize they misunderstood, and we both come out enriched and in agreement.
In both cases, it could have been a conflict, egos crashing together. But by asking questions, it becomes a collaboration to find the best answer. Even the simple act of asking a question in the first place says, "I care what you have to say, we can agree on this." That said, I have noticed that it is definitely still possible for things to go wrong within this framework. How can this happen?
There was a passage from [The
| /* Name of Gist */ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| (function privateName(i) { | |
| if (i === 0) | |
| return; | |
| console.log(i); | |
| privateName(i - 1); | |
| })(5); |
| var cluster = require('cluster'); | |
| if (cluster.isWorker) { | |
| console.log('Worker ' + process.pid + ' has started.'); | |
| // Send message to master process. | |
| process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
| // Receive messages from the master process. |
I'll throw my opinion in here, but take it with a pretty large grain of salt as I've done no professional development in a functional language yet. Just tinkering with (quite a few of) them in my spare time. Some of the patterns I spotted are irrespective of type systems (static, dynamic).
- lists, sequences or similar primitives are ubiquitous
- abstract away duplicate code using higher-order functions
- no iteration constructs, recursion is the only way to traverse lists
- watch out your recursion, be sure it's tail-recursive
- abstract over this tail-recursive pattern with a higher-order function:
foldLeftorfoldRight. So, know your language's equivalent offoldLeft/foldRightand prefer these over explicit recursion. - abstract over folds in an even more general way and provide folding functions for arbitrary data structures, not just list, e.g., trees.
- provide a few convenience higher-order functions (implementable using fold) like:
map,filter,any/some,all/every,zip, `zipWith