This file contains hidden or 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 "MyModel.h" | |
MyModel::MyModel(const QStringList &strings, QObject *parent) | |
: QAbstractListModel(parent) | |
{ | |
_list = strings; | |
} | |
// columnCount はデフォルトの実装があるので rowCount のみ実装します。 | |
int MyModel::rowCount(const QModelIndex &) const |
This file contains hidden or 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 "MyModel.h" | |
// お約束として、コンストラクタで親オブジェクトを渡す。 | |
// 親オブジェクトが削除されると子オブジェクトも削除されるしくみ。 | |
MyModel::MyModel(const QStringList &strings, QObject *parent) | |
: QAbstractListModel(parent) | |
{ | |
stringList = strings; | |
} |
This file contains hidden or 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
-- An idea of reversible parser | |
-- todo: String8 Structure | |
{-# OPTIONS -XViewPatterns #-} | |
import Data.Bits | |
import Test.HUnit | |
main = runTestTT $ test [ | |
"bitOf" ~: testBitOf, |
This file contains hidden or 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 Heap where | |
import Test.QuickCheck (verboseCheck) | |
data Heap a = E | T Int a (Heap a) (Heap a) | |
instance Show a => Show (Heap a) where | |
showsPrec _ E = showString "_" | |
showsPrec _ (T r x E E) = showElement r x | |
showsPrec _ (T r x a b) = showChar '(' . showElement r x . showChar ' ' . shows a . showChar ' ' . shows b . showChar ')' |
This file contains hidden or 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
(* | |
Generate Hello World Flash version | |
./outsprite | |
build: | |
ocamlc -g -I ocaml -I ocaml/swflib ocaml/extLib.cma ocaml/swflib/swflib.cma -o abcsprite abcsprite.ml | |
*) | |
open As3 |
This file contains hidden or 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
(* | |
Generate SWF from a ActionScript bytecode file. | |
abc2swf filename.abc [width height] | |
build: | |
ocamlc -g -I ocaml -I ocaml/swflib ocaml/extLib.cma ocaml/swflib/swflib.cma -o abc2swf abc2swf.ml | |
*) | |
open Swf |
This file contains hidden or 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
(* Generate Hello World program in a ABC file *) | |
open As3 | |
let filename = "outabc.abc" | |
let id i = As3parse.magic_index i | |
let idz i = As3parse.magic_index_nz i | |
(* constants *) |
This file contains hidden or 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
// 終端記号の定義 | |
terminals z s | |
// 文法定義 n は z または s n | |
syntax | |
n ::= z | |
| s n | |
// 公理 | |
// judgment 名前 : 式 |
This file contains hidden or 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
-- Test for type classes | |
class Eq a => Point a where | |
radian :: a -> Float | |
coordinates :: Float -> Float -> a | |
x :: a -> Float | |
y :: a -> Float | |
-- Minimal complete definition: radian, coordinates, x, and y | |
(+~) :: Point b => a -> b -> a |
This file contains hidden or 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
// SineSound.as | |
// A simple sine sound. | |
// | |
// compile option | |
// mxmlc -target-player 10.0.0 SineSound.as | |
package { | |
import flash.display.Sprite; | |
import flash.events.SampleDataEvent; | |
import flash.media.Sound; |
NewerOlder