Skip to content

Instantly share code, notes, and snippets.

View archanpatkar's full-sized avatar

Archan Patkar archanpatkar

View GitHub Profile
@archanpatkar
archanpatkar / itertools.js
Created July 16, 2017 21:37
Using ES6 Generator prototype model to implement lazy chaining. When you set the prototype of multiple Generator Functions to a common prototype you can chain them. Examples at the bottom. (this code currently only works in Firefox Aurora, but will eventually work in all JS engines).
const module = { exports: {} };
let exports = module.exports;
const GeneratorFunction = function*(){}.constructor;
const iteratorSymbol = (typeof Symbol === "function" && Symbol.iterator) || "@@iterator";
const MISSING = {};
/**
* A generator function is always called as a constructor. If multiple
* generators share the same prototype, and you put generators on that shared
import tensorflow as tf
node1 = tf.constant(1);
print(node1);
node2 = tf.constant(3);
print(node2);
node3 = node1 + node2;
print(node3);
with tf.Session() as session: