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
let _8 = fun _9 -> _9 in | |
let rec _0 _1 _10 = | |
let _11 = fun _3 -> _10 _3 in | |
if _1 < 0 then | |
_11 0 | |
else | |
_0 (_1 - 1) (fun _6 -> _11 (_1 + _6)) | |
in (_0 10) (fun _2 -> _8 _2) |
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
hamming :: [Int] | |
hamming = filter p [1..] | |
where | |
p :: Int -> Bool | |
p x | x `mod` 5 == 0 = p (x `div` 5) | |
| x `mod` 3 == 0 = p (x `div` 3) | |
| x `mod` 2 == 0 = p (x `div` 2) | |
| otherwise = x == 1 | |
main :: IO () |
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
{-# LANGUAGE DeriveDataTypeable #-} | |
module Main where | |
import Data.Generics | |
import Data.Data | |
import Data.Typeable | |
data Exp = Add Exp Exp | Sub Exp Exp | Val Int | |
deriving (Show, Eq, Typeable, Data) | |
eval :: Exp -> Exp |
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
type (_, _) eql = Refl : ('a, 'a) eql | |
type _ type_rep = .. | |
module type TYPEABLE = | |
sig | |
type t | |
val type_rep : unit -> t type_rep | |
val eqty : 's type_rep -> (t, 's) eql option | |
end |
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
find . -name "*.ml" -exec emacs --batch {} --eval '(progn (indent-region (point-min) (point-max) nil) (save-buffer))' \; |
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
(* | |
* Extensible VariantsとClassによるOpen-Recursionを用いた拡張可能なインタプリタ | |
* [author] linerlock | |
* [update] 2017/05/18 | |
*) | |
module type SYNTAX = sig | |
type var | |
type tpe = .. | |
type exp = .. |
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
(* | |
* Copyright (c) 2017 Takahisa Watanabe <[email protected]> All rights reserved. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
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
(* | |
* Copyright (c) 2017 Takahisa Watanabe <[email protected]> All rights reserved. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
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 type SYM_base = sig | |
type 'a repr | |
val lam: ('a repr -> 'b repr) -> ('a -> 'b) repr | |
val app: ('a -> 'b) repr -> 'a repr -> 'b repr | |
end | |
module type SYM_bool = sig | |
include SYM_base | |
val bool: bool -> bool repr | |
val not_: bool repr -> bool repr |
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
namespace ExpressionProblem { | |
using System; | |
interface Exp<E> where E: Exp<E> { } | |
class Int<E>: Exp<E> where E: Exp<E> { | |
public int Value { get; set; } | |
} | |
class Add<E>: Exp<E> where E: Exp<E> { | |
public E Operand0 { get; set; } |