This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void Main(string[] args) { | |
| //-1) Maybe monad usage: input regular string, intermediate result int... | |
| var maybeM = new MaybeM<string>("I'm a string, wrapped up in the Maybe Monad!"); | |
| var result1 = maybeM.Bind(ExtractVowels) | |
| .Bind(Length); | |
| WriteLine("Result is: \{result1.Show()}"); | |
| //-2) Maybe monad usage: null string | |
| maybeM = new MaybeM<string>(null); | |
| var result2 = maybeM.Bind(ExtractVowels) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //pseudo code... not compiling | |
| var h = Cycle.h | |
| var FooModel = Cycle.createModel(intent => | |
| { /*...*/ } | |
| ) | |
| var FooView = Cycle.createView(model => | |
| { /*...*/ } | |
| ) | |
| var FooIntent = Cycle.createIntent(view => | |
| { /*...*/ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Verifying that +srdjan is my openname (Bitcoin username). https://onename.com/srdjan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //scala | |
| vertx.createHttpServer().requestHandler({ req: HttpServerRequest => | |
| req.response() | |
| .putHeader("Content-Type", "text/html") | |
| .end("<html><body><h1>Hello from Vert.x!" + | |
| "</h1></body></html>") | |
| }).listen(8080) | |
| //groovy | |
| vertx.createHttpServer().requestHandler({ req -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*eslint-env es6 */ | |
| // Inspired by the paper "A tutorial on the universality and | |
| // expressiveness of fold" by Graham Hutton (available at | |
| // http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic | |
| // list handling functions in JavaScript in terms of `fold`. | |
| // Personally I had an enlightnening moment when I realised the | |
| // beautiful interplay of cons lists and foldr during the FP101x | |
| // Haskell course. JavaScript's syntax doesn't make this very apparent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -----BEGIN PGP MESSAGE----- | |
| Version: Keybase OpenPGP v2.0.49 | |
| Comment: https://keybase.io/crypto | |
| wcFMA8NHQqEvqEzYAQ/+OjIJxVjUf1J6bbk7y6RBDrOTeKpryZYA7At4j9VT/3pr | |
| bNrsir9UbnRz1JIE9NE+yHE/rSq/xRaolkXo9Rlh8OAj1FYhfHhti7Z7knKl6fJy | |
| Ene3oo8HiJlFXmRSO0W9/nxyffNyL7RL2jgH4ITsArBm75/zkonstXzdO15yASb3 | |
| HWxPyb/kw68ixcUIW75n6MGgzmWwXyJov6gJalV6qq0s1eKNUe5VzCrgZr7oxeHL | |
| G/KsFKq1tWMrqZx3B5OpcoFGX6DkjDj6pLvVrO0yIZ0XUcYgNE6ALeYD2LJZbFbl | |
| kMEdCpscXwCTO1x/0lOat62im1qbN0f2g6RZUV4FpJEPD+Uxeu77h6tmLtooP4v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Request<'i,'o,'k> = 'i * ('o -> 'k) | |
| let bindRequest bind f (s,k) = s, fun v -> bind(k v,f) | |
| type Id = int | |
| type Entity<'e> = Entity of Id option * 'e | |
| [<Measure>] type money | |
| type User = {name : string; email : string; ballance : int<money>} | |
| type Product = { name : string; quantity : int; price : int<money>} | |
| type Email = {body:string; subject : string} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const reg = new RegExp("([^?=&]+)(=([^&]*))?", "g") | |
| function qs (uri) { | |
| const obj = {} | |
| uri = uri.replace(/^.*\?/, '') | |
| uri.replace(reg, map) | |
| return obj | |
| function map (a0, a1, a2, a3) { | |
| obj[decodeURIComponent(a1)] = decodeURIComponent(a3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 100+ different js counter apps... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CATEGORY THEORY FOR PROGRAMMERS | |
| Category Theory 1.1: Motivation and Philosophy | |
| https://www.youtube.com/watch?v=I8LbkfSSR58&index=1&list=PLbgaMIhjbmEnaH_LTkxLI7FMa2HsnawM_ | |
| Composability, Abstraction, Reusability | |
| Category Theory is a higher-level language. | |
| Not a practical, executable language. |