http://winavr.sourceforge.net/
Determine what bits using http://www.engbedded.com/fusecalc
| // Polyfill for Object.create | |
| function create(proto) { | |
| function Ctor() {} | |
| Ctor.prototype = proto; | |
| return new Ctor(); | |
| } | |
| // Always returns an instance of constructor | |
| function getInstance(self, constructor) { | |
| return self instanceof constructor ? self : create(constructor.prototype); |
| case class GenericCache[A[_,_], B, C](instance: A[B,C], getf: B=>C, putf: (B,C)=>Unit) { | |
| def retrieve(b: B) = getf(b) | |
| def insert(b: B, c: C) = putf(b,c) | |
| } | |
| //Notice how neither cache implementations have to even be aware of the existnace of the typeclass. much more flexible than inheritance | |
| class FastCache[A,B] { | |
| private var m = Map[A,B]() //excuse mutability for illustration purposes | |
| def add(a: A, b: B): Unit = { | |
| m = m + (a->b) |
http://winavr.sourceforge.net/
Determine what bits using http://www.engbedded.com/fusecalc
| I did a small project in C# recently, and I basically assumed | |
| that coming from Scala I could enjoy all the benefits of a | |
| (more) mainstream language and a polished, integrated | |
| ecosystem. | |
| Boy was I wrong. | |
| My experience starts with installing Microsoft's latest Visual | |
| Studio 2013 Express Desktop IDE which went really smooth. |
A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)
I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.
A functor is something that supports map.