|
|
|
|
|
by dxbydt
5120 days ago
|
|
or in scala: val snake = Map("name"->"Sammy", "dist"->"5m","move"->" slithers ")
val horse = Map("name"->"Tommy", "dist"->"45m","move"->" gallops ")
def move(m: Map[String,String]) = println( m("name") + m("move" ) + m("dist")
scala> move (snake)
Sammy slithers 5m
scala> move (horse)
Tommy gallops 45m
If FP = OO via dictionaries, then yeah, ok :)) |
|
We use CoffeeScript for node.js and browser client code. I think classes more useful for control patterns, like EventEmitter in node.js, and much less for wrapping of data, as done in traditional Java/C++ -style OOP or ORM models.
I'll chip in Erlang (real production-grade code with type-specs, not a short REPL example):