This file contains 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
import Text.Regex | |
type State s a = s -> (a, s) | |
comb :: State s a -> (a -> State s b) -> State s b | |
comb m k = \s -> let (x1, s') = m s in k x1 s' | |
comb_ :: State s a -> State s b -> State s b | |
comb_ m n = m `comb` \_ -> n |
This file contains 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
drop var persons; | |
drop var groups; | |
drop var assignments; |
This file contains 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
// 人 | |
var persons base | |
relation { p_id integer | |
, p_name character | |
, p_gender integer | |
, p_age integer} | |
key {p_id}; | |
persons := |
This file contains 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
import Data.Time | |
import System.Locale | |
dayAndTime :: ZonedTime -> (Day, TimeOfDay) | |
dayAndTime zt = let lt = zonedTimeToLocalTime zt | |
day = localDay lt | |
time = localTimeOfDay lt | |
in (day, time) | |
day = fst . dayAndTime |
This file contains 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
import Data.Time.Calendar | |
data Person = P { p_id :: Int | |
, name :: String | |
, gender :: Int | |
, age :: Int | |
} deriving (Show, Eq) | |
data Group = G { g_id :: Int | |
, gname :: String |
This file contains 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
import Data.Time.Calendar | |
import Control.Monad | |
import Data.List | |
data Person = P { p_id :: Int | |
, name :: String | |
, gender :: Int | |
, age :: Int | |
} deriving (Show, Eq) |
This file contains 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
import Data.Time.Calendar | |
import Control.Monad | |
data Person = P { p_id :: Int | |
, name :: String | |
, gender :: Int | |
, age :: Int | |
} deriving Show | |
data Group = G { g_id :: Int |
This file contains 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
data Person = P { p_id :: Int | |
, name :: String | |
, gender :: Int | |
, age :: Int | |
} deriving Show | |
persons = [ P 1 "Tarou" 1 10 | |
, P 2 "Hanako" 2 20 | |
, P 3 "Jirou" 1 30 | |
, P 4 "Saburou" 1 40] |
This file contains 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
public class Cons<A> implements IList<A> { | |
/** | |
* リストの先頭要素 | |
*/ | |
private A x; | |
/** | |
* リストの残りの要素 | |
*/ | |
private IList<A> xs; // 型変数を忘れないように! |
This file contains 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
/** | |
* 人 | |
*/ | |
var person = function(spec){ | |
var that = {}; | |
var toString = function(){ | |
return spec.name + " " + spec.age.toString(); | |
}; | |
that.toString = toString; |