Automata in Scala is moved to https://github.com/everpeace/scalamata
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 util/ordering[State] | |
-- 哲学者 | |
sig Philosopher { | |
-- 左と右には異なる1本のフォークがある | |
disj leftFork, rightFork: one Fork, | |
-- 左と右には異なる哲学者が1人ずついる | |
left, right: one Philosopher | |
} | |
-- フォーク |
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
-- This can be executed by alloy4.2-rc.jar on http://alloy.mit.edu/community/node/1039 | |
-- This version supports unicode identifiers. | |
open util/ordering[システム状態] | |
sig 哲学者 { | |
disj 左フォーク, 右フォーク: one フォーク, | |
左, 右: one 哲学者 | |
} | |
sig フォーク { | |
disj 左, 右: one 哲学者 |
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
package com.github.everpeace | |
import scalaz._ | |
import Scalaz._ | |
/** | |
* BiKleisli arrow | |
* W: comonad | |
* M: monad | |
*/ |
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 2 3 | |
1 2 3 | |
1 2 3 |
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
$ git log --graph --oneline | |
*-. 9010104 Merge branches 'master3' and 'master2' | |
|\ \ | |
| | * dd0ba6d add b2 | |
| * | 75a99a0 add b3 | |
| |/ | |
* | 743ad3b add b1 | |
|/ | |
* 81b919d add a |
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
#!/bin/bash | |
if [ -z $GITHUB_KEYS_DIR ]; then | |
GITHUB_KEYS_DIR="$HOME/github-keys" | |
fi | |
if [ -z $GITHUB_KEY_FILE_NAME ]; then | |
GITHUB_KEY_FILE_NAME="id_rsa" | |
fi |
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
git branch | sed 's/^ /_/' | awk '{desc=""; "git config branch."$2".description"|getline desc ; print $1" "$2" "desc}'|sed 's/^_/ /g' |
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 scala.language.higherKinds | |
// 代数の型クラスの階層があって | |
trait Algebra[E]{ def op(e1:E,e2:E):E } | |
trait SubAlgebra[E] extends Algebra[E] | |
// ある代数の型クラスのオブジェクトがあって | |
object ConcreteAlgebra extends SubAlgebra[Int]{ | |
def op(e1:Int, e2:Int) = e1+e2 | |
} |
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 reflect.macros.Context | |
object Macros{ | |
// on(i){ ... }とやるとblockの中にiをimplicitとして注入するマクロ | |
def on[I, V](i:I)(block:V)= macro impl_on[I,V] | |
def impl_on[I, V](c:Context)(i:c.Expr[I])(block:c.Expr[V]):c.Expr[V] = { | |
import c.universe._ | |
// type of block is |
OlderNewer