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
def f(x): | |
def g(y): | |
def h1(z): | |
nonlocal x,y | |
x = z | |
y = 2*z | |
print(locals()) | |
def h2(z): | |
print(locals()) | |
return z+y+x |
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
(define (make-simple-generator iterable transformer) | |
(define (re-entry return) | |
(define (iter-action element) | |
(define (escaper new-re-entry) | |
(set! re-entry new-re-entry) | |
(return ( transformer element))) | |
(call-with-current-continuation escaper)) | |
(for-each iter-action iterable) | |
(return 'Let-it-end!)) | |
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
//script type="application/javascript;version=1.7" | |
function FactorGenMaker(factor) { | |
let(j=1){for(;;) yield factor*j++}; | |
} | |
function NullGenMaker() { | |
for(;;) yield null; | |
} |
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
//script type="application/javascript;version=1.7" | |
function GenMaker() { | |
let(j=1){for(;;) {yield (yield 'Hola '+j);j++}} | |
} | |
var gen = GenMaker(); | |
console.log(gen.next()+', the deep yield give-out Hola and give-in undefined'); | |
console.log(gen.next()+', now shallow yield return that undefined'); | |
console.log(gen.next()+', now the deep yield: Hola out, undefined in'); | |
console.log(gen.next()+', now the shallow yield: undefined'); |
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
def GenMaker(): | |
j = 1 | |
while True: | |
yield (yield 'Hola '+str(j)) | |
j = j + 1 | |
gen = GenMaker() | |
print( gen.__next__()) | |
print( gen.__next__()) | |
print( gen.__next__()) |
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
def GenMaker(): | |
j = 1 | |
while True: | |
yield (yield 'Hola '+str(j)) | |
j = j + 1 | |
gen = GenMaker() | |
print( gen.send(None)) | |
print( gen.send('Adios')) | |
print( gen.send(None)) |
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
//script type="application/javascript;version=1.7" | |
function GenMaker() { | |
let(j=1){for(;;) {yield (yield 'Hola '+j);j++}} | |
} | |
var gen = GenMaker(); | |
console.log(gen.next()); | |
console.log(gen.send('Adios')); | |
console.log(gen.send(null)); | |
console.log(gen.send('Adios')); |
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 Ajax = (function (){ | |
function AjaxXMLHTTPRequest(){} | |
AjaxXMLHTTPRequest.prototype = {...}; | |
function AjaxActiveX(){} | |
AjaxActiveX.prototype = {}; | |
return (typeof window.ActiveXObject === 'undefined') ? | |
AjaxXMLHTTPRequest: |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Defining a module | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(module (sillymul) | |
;;The body | |
(begin | |
;;Private |
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
/*********************************************************************** | |
Initial Version | |
************************************************************************/ | |
var eventOn = function(type,fn){ win.addEventListener ? | |
win.addEventListener(type,fn,false) : | |
win.attachEvent('on'+type,fn)}, | |
eventOff = function(type,fn){ win.removeEventListener ? | |
win.removeEventListener(type,fn,false) : | |
win.detachEvent('on'+type,fn)}, |
OlderNewer