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 Data.Nim | |
(Nim) | |
where | |
import Data.Bits | |
class Nim a where | |
(+^*) :: a -> a -> a | |
(*^*) :: a -> a -> a | |
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
[work06]$ vim mffp.hs | |
[work06]$ ghci | |
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help | |
Loading package ghc-prim ... linking ... done. | |
Loading package integer-gmp ... linking ... done. | |
Loading package base ... linking ... done. | |
Prelude> :l mffp.hs | |
[1 of 1] Compiling Main ( mffp.hs, interpreted ) | |
Ok, modules loaded: Main. | |
*Main> :t answer |
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
-- | |
-- Excerpt from Monads for functional programming | |
-- http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf | |
-- | |
-- 2.1 Variation zero: The basic evaluator | |
-- | |
data Term = Con Int | Div Term Term | |
eval :: Term -> Int |
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
-- | |
-- Excerpt from Monads for functional programming | |
-- http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf | |
-- | |
-- 2.1 Variation zero: The basic evaluator | |
-- | |
data Term = Con Int | Div Term Term | |
eval :: Term -> Int |
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
-- | |
-- Excerpt from Monads for functional programming | |
-- http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf | |
-- | |
-- 2.1 Variation zero: The basic evaluator | |
-- | |
data Term = Con Int | Div Term Term deriving (Show) | |
eval :: Term -> Int |
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
*Main> eval2 answer | |
("eval(Con 1972) <- 1972\n eval(Con 2) <- 2\n eval(Div (Con 1972) (Con 2)) <- 986\n eval(Con 23) <- 23\n eval(Div (Div (Con 1972) (Con 2)) (Con 23)) <- 42\n ",42) | |
*Main> |
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
import System.IO | |
import qualified Data.ByteString.Lazy as BL | |
import Data.Binary.Get | |
test_binary :: IO () | |
test_binary = do | |
rh <- openFile "test.ppm" ReadMode | |
i <- BL.hGetContents rh | |
let d = runGet (getWord8) i | |
putStr $ show d |
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
import java.util.ArrayList; | |
import java.util.List; | |
public class AssignIntegerBetweenMinAndMax { | |
public static void main(String[] args) { | |
Block block = new Block(); | |
block.setMin(10); |
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
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
public class GroupingBefore8 { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
</head> | |
<body> | |
<table id='t' border='10'> | |
<tr><td id='c00'>北海道</td><td id='c01'>5,400</td><tr> | |
<tr><td id='c10'>青森</td><td id='c11'>1,321</td></tr> | |
<tr><td id='c20'>岩手</td><td id='c21'>1,284</td></tr> |
OlderNewer