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
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <string> | |
#include <vector> | |
#define FSC "C:\\Program Files (x86)\\Microsoft SDKs\\F#\\3.0\\Framework\\v4.0\\fsc.exe" | |
int main(int argc, const char *argv[], const char *envp[]) { | |
std::vector<const char *> args; |
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
#r "System" | |
#r "System.Drawing" | |
#r "System.Windows.Forms" | |
open System | |
open System.IO | |
open System.Drawing | |
open System.Drawing.Imaging | |
open System.Windows.Forms |
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
#r "System" | |
#r "System.Drawing" | |
#r "System.Windows.Forms" | |
open System | |
open System.IO | |
open System.Drawing | |
open System.Drawing.Imaging | |
open System.Windows.Forms |
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
open System | |
// expr ::= term (('+' term) | ('-' term))* | |
let rec expr(src:string) = | |
printfn "expr %s" src | |
let mutable t, rest = term src | |
let mutable flag = true | |
while rest <> "" && flag do | |
match rest.[0] with | |
| '+' -> let t', rest' = term rest.[1..] |
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 fs = require("fs"); | |
function convLE(len, v) { | |
var ret = ""; | |
for (var i = 0; i < len; ++i) { | |
ret += String.fromCharCode(v & 0xff); | |
v >>= 8; | |
} | |
return ret; | |
} |
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
module Main where | |
import Test.HUnit | |
import System.IO | |
import Data.Ratio | |
data Expr = N Rational | |
| Var String Rational Rational | |
| Add [Expr] | |
| Mul [Expr] |
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
module DisAsm where | |
import Data.Bits | |
import Data.Char | |
import Hex | |
regs = [reg8, reg16] | |
reg8 = ["al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"] | |
reg16 = ["ax", "cx", "dx", "bx", "sp", "bp", "si", "di"] | |
regad = ["bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"] |
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 counter() { | |
var c = 0; | |
return function() { | |
return ++c; | |
}; | |
} | |
var f = counter(); | |
console.log(f()); | |
console.log(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
{-1-} tmp <- foo | |
bar tmp | |
{-2-} tmp <- foo -- 不正なレイアウト | |
bar tmp | |
{-3-} bar tmp <- foo -- 擬似コード | |
{-4-} bar =<< foo |
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
/** | |
* 指定されたlenだけバイト文字列vをリトルエンディアン変換する | |
* LEはリトルエンディアンの意 | |
* | |
* @method convLE | |
* @param {Int} len バイト数 | |
* @param {ByteString} v バイト文字列 | |
* @return {String} ret リトルエンディアン変換されたバイト文字列 | |
*/ | |
function convLE(len, v) { |