Skip to content

Instantly share code, notes, and snippets.

View KeenS's full-sized avatar

κeen KeenS

View GitHub Profile
functor Hamt(X:
sig
eqtype k
val hash: k -> Int32.int
end
): sig
type 'v t
exception HashConflict
val empty: 'v t
use std::ops::{Index, IndexMut};
pub struct User {
id: u64,
name: String,
}
impl User {
pub fn new(id_var: u64, name_var: String) -> Self {
User {
@require: stdjareport
@import: stage0
let-inline \show-int n = embed-string (arabic n)
in
document (|
title = {サンプル文書};
author = {組 版太郎};
|) '<
[| x |] = λk.k x ・・・val
[| λx.t |] = λk.k (λx.[|t|]) ・・・lam
[| π t |] = λk.[|t|] (λa.k (π a)) ・・・app1
[| t1 t2 |] = λk.[|t1|] (λf.[|t2|] (λa.f a k)) ・・・app2
[| Sx.t |] = λk.[x↦λa.λk'.k' (k a)]([|t|] (λv.v))・・・shift
[| <t> |] = λk.k ([|t|] (λv.v)) ・・・reset
変換対象: <add10 (Sx.x (x 100))>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
var = [
{ "id": "hello", "title": "Hello World", "children": [
{ "id": "comment", "title": "コメント", "children": nil },
{ "id": "print", "title": "フォーマットしてプリント", "children": [
{ "id": "print_debug", "title": "デバッグ", "children": nil },
{ "id": "print_display", "title": "ディスプレイ", "children": [
{ "id": "testcase_list", "title": "テストケース: リスト", "children": nil }
] },
{ "id": "fmt", "title": "フォーマット", "children": nil }
running 3 tests
test bench::benth_fib_memo1 ... bench: 5,237 ns/iter (+/- 411)
test bench::benth_fib_memo1_2 ... bench: 2 ns/iter (+/- 0)
test bench::benth_fib_memo2 ... bench: 2 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 3 measured; 0 filtered out
//! parent level doc comments
mod path {
/*! parent level doc comment2 */
pub mod name {
pub type Type = String;
pub const CONSTANT: &'static str = "const";
}
}
struct DbConn;
#[derive(Clone, Copy)]
struct User;
#[derive(Clone, Copy)]
struct Device;
enum Error {
ReadPrivilege,
WritePrivilege,
@KeenS
KeenS / overload.hs
Created June 3, 2018 03:43
GHCで {リスト,スカラ} x {リスト,スカラ}演算のオーバーロード
{-#LANGUAGE TypeFamilies, MultiParamTypeClasses, FlexibleInstances #-}
class Overload a b where
type Out a b :: *
(+):: a -> b -> Out a b
instance Overload Int Int where
type Out Int Int = Int
(+) = (Prelude.+)