Skip to content

Instantly share code, notes, and snippets.

STUDY IN STEREOPHONIC HIGH FIDELITY SOUND
AUDIO FIDELITY.
study in high fidelity sound
SOUNDS
import Control.Monad.State
loop = do
(a,b,s,ps,n,i) <- get
liftIO $ print (a,b,s,ps,n,i)
if i == 10
then return ()
else do
if s > b
then do
put (a,b,s,ps,n-1,i+1)
@index333
index333 / m.hs
Last active February 21, 2020 20:19
import System.FilePath.Posix
import System.Process
getC :: IO (String, Double)
getC = do
c <- getContents
let a:b:_ = lines c
return (a, read b)
f d n = do
let t = d / n
@index333
index333 / a.hs
Created February 21, 2020 02:27
import System.Environment
import System.Process
main = do
[a] <- getArgs
putStrLn a
import System.Random
toD :: IO Double
toD = do
putStrLn $ "分 秒"
r <- getLine
let a:b:_ = words r
return $ (read a * 60) + read b
f d n = do
let t = d / n
if t < 300
import Data.Complex
import System.Environment
import System.Random
import Turtle
rotate d a b = (cos d :+ sin d) * (b - a) + a
iDiv m n a b = (m * a + n * b) / (m + n)
r :: IO Int
r = do
n <- getStdRandom (randomR (0,1))
return n
import Turtle
koch l d i = do
if i == 0
then do
setheading d
forward l
left 60
forward l
right 120
forward l
@index333
index333 / t2.hs
Last active April 23, 2019 18:30
import Turtle
import System.Environment
sg2 x n = do
mapM_ (\_ -> do forward x
left 120
if n == 0 then return ()
else sg2 (x / 2) (n -1))
[1,2,3]
getN :: IO Int
getN = do
["00000000","00000001","00000010","00000011","00000100","00000101","00000110","00000111","00001000","00001001","00001010","00001011","00001100","00001101","00001110","00001111","00010000","00010001","00010010","00010011","00010100","00010101","00010110","00010111","00011000","00011001","00011010","00011011","00011100","00011101","00011110","00011111","00100000","00100001","00100010","00100011","00100100","00100101","00100110","00100111","00101000","00101001","00101010","00101011","00101100","00101101","00101110","00101111","00110000","00110001","00110010","00110011","00110100","00110101","00110110","00110111","00111000","00111001","00111010","00111011","00111100","00111101","00111110","00111111","01000000","01000001","01000010","01000011","01000100","01000101","01000110","01000111","01001000","01001001","01001010","01001011","01001100","01001101","01001110","01001111","01010000","01010001","01010010","01010011","01010100","01010101","01010110","01010111","01011000","01011001","01011010","01011011","01011100",
module Rule where
import Data.Bits
import GHC.Word
rule :: Int -> Int -> Bool
rule = testBit
bk,wt :: (GHC.Word.Word8, GHC.Word.Word8, GHC.Word.Word8)
bk = (0,0,0)
wt = (255,255,255)
b,w :: Bool
b = True