This file contains 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
fibs = -> | |
[a, b] = [-1, 1] | |
-> | |
[a, b] = [b, a + b] | |
b |
This file contains 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
fibs = 0:1: zipWith (+) fibs (tail fibs) |
This file contains 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
# 1. lookup values within objects | |
from datetime.datetime import now | |
print "minutes = {0.minutes}".format(now()) | |
# 2. %s or %r == __str__() or __repr__() | |
# 3 | |
print "{0:>10}".format("some") | |
print "{0:>10}".format("some"1) | |
# will print out |
This file contains 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
// Simple implementation of funciton for autocurrying other functions | |
// accepst function as a parameter | |
function curry(f) { | |
return function(){ | |
var args = Array.prototype.slice.call(arguments); | |
if (args.length >= f.length){ | |
return f.apply(this, args) | |
} else { | |
return curry(args.reduce(function(f, arg){return f.bind(this, arg)}, f)); |
This file contains 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
function caller(f) { | |
f(); | |
} | |
class A { | |
constructor(name) { | |
this.name = name; | |
} |
This file contains 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
/* @flow */ | |
class Monad<M> { | |
bind(f: (a: any) => Monad<M>): Monad<M> { | |
return this // tmp stub, don't know how to implement interface in flow without implementation. | |
} | |
} | |
class Maybe<T> extends Monad<Maybe> { | |
val: T; |
This file contains 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
function getDelayedMessages(stream, scheduler) { | |
return stream.delay(100, scheduler) | |
} |
This file contains 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 chai = require('chai'); | |
const rxAssert = require('chai-rx-assert'); | |
chai.use(rxAssert); | |
const expect = chai.expect; | |
const {TestScheduler, ReactiveTest: {onNext, onCompleted}} = require('rx'); | |
describe('Test delay', () => { | |
it('test getDelayedMessages', () => { | |
const scheduler = new TestScheduler(); |
This file contains 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
/******/ (function(modules) { // webpackBootstrap | |
/******/ // install a JSONP callback for chunk loading | |
/******/ var parentJsonpFunction = window["webpackJsonp"]; | |
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { | |
/******/ // add "moreModules" to the modules object, | |
/******/ // then flag all "chunkIds" as loaded and fire callback | |
/******/ var moduleId, chunkId, i = 0, resolves = [], result; | |
/******/ for(;i < chunkIds.length; i++) { | |
/******/ chunkId = chunkIds[i]; | |
/******/ if(installedChunks[chunkId]) { |
This file contains 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
// var a = 5; | |
// { | |
// let a = 7; | |
// console.log(`scoped ${a}`) | |
// } | |
// function test() { | |
// console.log(a); | |
// } |