Skip to content

Instantly share code, notes, and snippets.

View cutsea110's full-sized avatar

cutsea110 cutsea110

View GitHub Profile
@cutsea110
cutsea110 / rule_2_18.log
Created November 20, 2021 23:46
applying for rule 2.18
Up to date
Hello, Haskell!
1) Heap [ 13: NPrim Div
12: NPrim Mul
11: NPrim Sub
10: NPrim Add
9: NPrim Neg
8: NSupercomb twice
7: NSupercomb compose
6: NSupercomb S
@cutsea110
cutsea110 / Subfactorial.hs
Created April 12, 2020 23:18
calc exp by using fact and subfact with barbed wire split law
{-# LANGUAGE NPlusKPatterns #-}
{-# LANGUAGE LambdaCase #-}
module Subfactorial where
pair (f, g) x = (f x, g x)
outl (x, _) = x
outr (_, y) = y
type Nat = Integer
@cutsea110
cutsea110 / Subfactorial.hs
Last active April 12, 2020 07:54
Subfactorial and exp
{-# LANGUAGE NPlusKPatterns #-}
{-# LANGUAGE LambdaCase #-}
module Subfactorial where
type Nat = Integer
foldn :: (a, a -> a) -> Nat -> a
foldn (c, f) = u
where u 0 = c
u (n+1) = f (u n)
{-# OPTIONS --guardedness #-}
module coinductive-tutorial where
record Stream (A : Set) : Set where
coinductive
field
hd : A
tl : Stream A
open Stream
@cutsea110
cutsea110 / Utility.cs
Last active June 13, 2018 07:54
ToWareki Method
static private Dictionary<int, string> __eraAbbreviatedEnglishEraNameDict = null;
static private Dictionary<int, string> eraAbbreviatedEnglishEraNameDict
{
get
{
if (__eraAbbreviatedEnglishEraNameDict == null)
{
CultureInfo cultureJp = new CultureInfo("ja-JP", true);
cultureJp.DateTimeFormat.Calendar = new JapaneseCalendar();
@cutsea110
cutsea110 / HOQ.als
Created May 17, 2018 02:44
alloy* is ok, but alloy reject this. since "Analysis cannot be performed since it requires higher-order quantification that could not be skolemized."
sig A {
}
sig B {
S : set A
}
sig C {
R : set B
}
sig A{
S: set A
}
fun id_A : A -> A{
A -> A & iden
}
pred Simple{
~S.S in id_A
}
module fib where
open import Data.Bool
open import Data.Empty
open import Data.Unit
open import Data.Fin renaming (zero to fzero; suc to fsuc) hiding (_+_)
open import Data.Nat
open import Data.Nat.Properties
open import Data.Nat.DivMod
open import Function
@cutsea110
cutsea110 / ByPara.hs
Last active December 5, 2017 08:04
head, tail, init and last implemented by paramorphism
{-# LANGUAGE TypeSynonymInstances,
FlexibleInstances
#-}
module FixPrimeTest where
import Prelude hiding (Functor(..), map, succ, either, head, tail, init, last)
import FixPrime
-- | List a
data ListF a x = Nil | Cons a x deriving (Show)
@cutsea110
cutsea110 / SplitAt.hs
Last active December 5, 2017 00:13
take,drop and splitAt impletemted by using zygomorphism
{-# LANGUAGE LambdaCase #-}
module Take where
import Prelude hiding (take, drop, splitAt)
pair (f, g) x = (f x, g x)
safeTail :: [a] -> [a]
safeTail [] = []
safeTail (_:xs) = xs