Skip to content

Instantly share code, notes, and snippets.

Require Import String List.
Import ListNotations.
Inductive Action : Type := action : string -> Action.
CoInductive Process : Type :=
| process : list (Action * Process) -> Process.
Inductive mu_derivative : Action -> Process -> Process -> Prop :=
| derivative_here : forall a q l, mu_derivative a (process ((a, q) :: l)) q
@amutake
amutake / RingBenchmarks.scala
Last active August 29, 2015 14:02
ring-benchmarks
package me.amutake
import akka.actor._
object RingBenchmarks {
sealed trait Msg
case class Start(n: Int, t: Int) extends Msg
case class Next(next: ActorRef) extends Msg
case object End extends Msg
Require Import Coq.Strings.Ascii.
Require Import Ssreflect.ssreflect Ssreflect.eqtype Ssreflect.ssrbool.
Definition eqascii (a a' : ascii) : bool :=
match a, a' with
| Ascii b0 b1 b2 b3 b4 b5 b6 b7, Ascii b0' b1' b2' b3' b4' b5' b6' b7' =>
(b0 == b0') && (b1 == b1') && (b2 == b2') && (b3 == b3') &&
(b4 == b4') && (b5 == b5') && (b6 == b6') && (b7 == b7')
end.
#!/usr/bin/env runghc
import Distribution.Simple.InstallDirs -- Cabal package
( platformTemplateEnv
, fromPathTemplate, toPathTemplate
, substPathTemplate
)
import Distribution.System (buildPlatform) -- Cabal package
import System.Process -- process package
( shell
import Control.Applicative
import Control.Monad
import Data.List
main = do
[m, n] <- map read . words <$> getLine
s <- forM [1..m] (\x -> getLine)
putStrLn $ show $ s !! n

test

# test2

main = putStrLn "helloworld"
@amutake
amutake / alalog_serial.c
Created November 22, 2015 08:03
PIC16F1827 で Analog In の値をシリアル通信で送ってくれるやつ
/*
* File: main.c
* Author: amutake
*
* Created on November 22, 2015, 1:43 PM
*
* シリアル通信で、なんかデータ (char 型) を送ると Analog In の値を送り返してくる。
* 使うピンは以下の通り
*
* RB1: RX
module Main where
import Control.Applicative ((<$>))
import Control.Monad (forM)
type Pos = (Int, Int)
main :: IO ()
main = do
n <- read <$> getLine
@amutake
amutake / DeBruijn.hs
Last active December 18, 2015 22:59
An evaluator for De Bruijn Index
module DeBruijn where
import Data.List
data Expr = Var Int | App Expr Expr | Abs Expr deriving (Eq, Show)
subst :: Expr -> Int -> Expr -> Expr
subst (Var n) m e
| n == m = e
| otherwise = Var n
@amutake
amutake / Main.scala
Created December 19, 2015 22:14
bug of finch-0.9.2 (this is fixed by #485)
package finch.bug
import io.finch._
import com.twitter.io.Buf
import com.twitter.finagle.http._
import com.twitter.util.{ Await, Duration }
object Main extends App {
val string = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"