import random | |
#import pylab | |
import copy | |
G = 1.0 | |
H = 3.5 | |
M = 1.0 | |
def ngp(data, n): | |
m = [[0] * (n+1) for i in range(n+1)] |
set src to choose folder | |
set target_files to getFiles(src) | |
tell application "iTunes" | |
repeat with f in target_files | |
try | |
add f | |
delay 1 | |
on error | |
log f | |
end try |
\csname\if11pdfprimitive\fi\endcsname\chardef\x14\relax\pdfprimitive\catcode37\x\let% | |
% | |
% tcclearerr.sty | |
% | |
%% reset code tables | |
\;\relax\let\@\pdfprimitive\@\chardef\x10\;\@\catcode32\x\@\catcode13 5\;% | |
\endlinechar13\;\@\catcode96 12 \@\catcode61 12\;% | |
\ifx\@@par\tcce@undefined \@\par \else \@@par \fi% switch to vmode | |
\@\catcode`\{=1 \@\catcode`\}=2 \@\catcode`\@=11 | |
\@\catcode`\#=6 \@\catcode`\~=13 \@\catcode`\<=12 |
\documentclass{jarticle} | |
\makeatletter | |
% registers are ALWAYS allocated globally (darn!) | |
\newcount\@fuck@i | |
\newcount\@fuck@ii | |
\def\tuple#1{% | |
\begingroup |
Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan
Translated by Yuta Okamoto (@okapies)
- 訳者は JavaScript や Node.js に関する専門知識がほとんどありません。識者のツッコミをお待ちしております。「◯◯が分からない」等も歓迎です。
- 元記事から構成を一部変更しています。また、関数型プログラミングに関する記述のうち、議論の骨子に絡まないものは省略しています。
/** | |
* A monad to abstract dependencies in the code, see https://coderwall.com/p/kh_z5g | |
*/ | |
object Reader { | |
/** | |
* an implicit to convert a function A => B in a Reader[A, B] | |
*/ | |
implicit def reader[C, R](block: C => R): Reader[C, R] = Reader(block) |
The indexed state monad is not the only indexed monad out there; it's not even the only useful one. In this tutorial, we will explore another indexed monad, this time one that encapsulates the full power of delimited continuations: the indexed continuation monad.
The relationship between the indexed and regular state monads holds true as well for the indexed and regular continuation monads, but while the indexed state monad allows us to keep a state while changing its type in a type-safe way, the indexed continuation monad allows us to manipulate delimited continuations while the return type of the continuation block changes arbitrarily. This, unlike the regular continuation monad, allows us the full power of delimited continuations in a dynamic language like Scheme while still remaining completely statically typed.
var socket = io.connect('http://133.242.52.129'); | |
for(p in socket_routes){ | |
socket.on(p, (function(p) { | |
return function(message){ | |
console.log(message.data && 'waku:' + message.data.id, message.data && 'rank:' + message.data.seq) | |
}; | |
})(p)); | |
} |