Skip to content

Instantly share code, notes, and snippets.

View yihuang's full-sized avatar
🏠
Working from home

yihuang yihuang

🏠
Working from home
  • crypto.com
  • Shenzhen, China
View GitHub Profile
@yihuang
yihuang / class.lua
Created December 27, 2015 12:55 — forked from jzrake/class.lua
Partial implementation of the Python class model for Lua
--------------------------------------------------------------------------------
--
-- Partial implementation of the Python class model for Lua
--
-- Copyright (c) 2012, Jonathan Zrake
--
--------------------------------------------------------------------------------
--
-- Exports the following functions:
--
@yihuang
yihuang / lazy_vs_st.hs
Created March 27, 2012 00:51 — forked from qzchenwl/lazy_vs_st.hs
lazy vs ST
{-# LANGUAGE BangPatterns #-}
module Main (fib1, fib2, fib3, fib4, main) where
import Control.Monad
import Control.Monad.ST
import Data.STRef
import Criterion.Main
fib1 :: Int -> Integer
fib1 n = fst $ fib' n
where fib' 0 = (1, 1)