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
import "js.jsx"; | |
import "../lib/js/nodejs.jsx"; | |
native class Buffer { | |
function constructor(size : int); | |
} | |
native __fake__ class FS { | |
function write(fd : variant, buffer : Buffer, offset : int, length : int, position : Nullable.<int>) : void; |
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
;;; Monadic Operators | |
;;; List Monad | |
(define (mappend fn . lists) | |
(apply append (apply map fn lists))) | |
(define (bind monad . funcs) | |
(fold mappend monad funcs)) | |
(define unit list) |
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 <stddef.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <iostream> | |
#include <vector> | |
template<typename T> | |
class Tree { | |
template<typename U> friend class RandomAccessList; |
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-class <pvector> () | |
((size :init-keyword :size) | |
(shift :init-keyword :shift) | |
(root :init-keyword :root))) | |
(define pv:null (make <pvector> :size 0 :shift 0 :root #())) | |
(define (update-vector vec i val) |
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
;; want to add mutable variables | |
;; but how to treat with closures that have free mutable variables? | |
;; a traditional way: using actors | |
;; calling a function equals sending a message to the function, which can be said | |
;; an actor in this meaning. | |
(let ((a 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
Music : コネクト | |
Rank : C | |
Score : 126619 | |
Max Combo : 88 | |
Complete : 22 | |
Solve : 121 | |
Miss : 172 | |
Minus Score : -5162 | |
Corrected Character : 772/1065 | |
Corrected Percent : 72% |
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-class <vlist> () | |
((base :init-keyword :base :accessor base-of) | |
(offset :init-keyword :offset :accessor offset-of) | |
(size :init-keyword :size :accessor size-of) | |
(block :init-keyword :block :accessor block-of))) | |
(define (make-vlist base offset size block) | |
(make <vlist> :base base :offset offset :size size :block block)) | |
(define vlist-null (make-vlist () 0 -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
int main() | |
{ | |
// int a(1); という意味だと解釈されてaのコンストラクタが呼ばれる。 | |
int a = 1; | |
// int b(); b = 1; という意味だと解釈されてbのコンストラクタが呼ばれたあと、bの代入演算子b.operator=(1);が呼ばれる。 | |
int b; | |
b = 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
;;;; **deep binding** | |
;;; look up | |
(cdr (assq 'the-symbol *the-stack*)) | |
;;; funcall | |
; wind... | |
(loop for arg in 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
class Klass { | |
function method(x : int) : int { | |
if (x == 0) { // compiler complains that x is not initialized | |
return 1; | |
} | |
else { | |
var x = 2; | |
return x; | |
} | |
} |