Skip to content

Instantly share code, notes, and snippets.

Avatar

Ting-gan LUA banacorn

  • Academia Sinica
  • Taipei, Taiwan
View GitHub Profile
View list.c
//
// HASKELL FTW
//
typedef const int Int;
typedef const int Bool;
// data List a = Cons a (List a) | Nil
typedef const enum ListType { Nil, Cons } ListType;
typedef const struct List {
View banana.hs
import Control.Monad (mapM_)
import System.Random
import System.Cmd
import System.Environment (getArgs)
import Data.List (intercalate, nub)
type Size = Int
type Constraint = (Variable, Variable)
data Variable = Variable Int deriving (Eq)
data Map = Map Size Size [Constraint]
View Reihe8.md

Reihe 8

Verben

  • telegrafieren telegrafiert
  • gratulieren gratuliert
  • wuenschen wuenscht
  • schicken schickt
  • gefallen gefaellt
  • bringen bringt
View reihe9.md

Reihe 9

Verben

  • steigen steigt // to climb
  • umsteigen umsteigt
  • aussteigen aussteiget
  • liegen liegt // to lie
  • legen legt
  • stehen steht
View reihe10.md

Reihe 10

Verben

  • fühlen
  • ändern // to change
  • leisten // to afford
  • überlegen // to think throughly
  • wünschen // to wish
  • vorstellen // to introduce / to imagine
View svedka.hs
data Tree a = Nil | Node a (Tree a) (Tree a) deriving (Eq)
data Inbalance = Balanced | LL | RR | LR | RL deriving (Show, Eq)
(+++) :: (Eq a, Ord a) => Tree a -> a -> Tree a
(+++) = insert
instance (Show a, Eq a) => Show (Tree a) where
show tree = draw tree (height tree) ++ "\n pre: " ++ show (preorder tree) ++ "\n in: " ++ show (inorder tree)
where
View cedartrunk-wai.hs
{-# LANGUAGE OverloadedStrings #-}
import Network.Wai
import Network.Wai.Handler.Warp (run)
import Network.HTTP.Types (status200)
cedartrunk request = do
case referer of
Nothing -> return $ ResponseFile status200 [("Content-Type", "text/html")] "index.html" Nothing
Just _ -> return $ ResponseFile status200 [] path Nothing
where path = tail . tail . init . show . rawPathInfo $ request
View cedartrunk-scotty.hs
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Network.Wai (requestHeaders, pathInfo)
import Data.Text (intercalate, unpack)
import Data.Text.Encoding (decodeUtf8)
import Data.Text.Lazy (fromStrict)
import Network.Mime (defaultMimeLookup)
import Control.Applicative ((<$>))
import Control.Monad.Trans (liftIO)
View algebra-recap.md

Group

  • Closed
  • Associative
  • Identity
  • Inverse

Subgroup

Definition

View catamorphism.hs
module Catamorphism where
import Prelude hiding (sum)
data Mu f = InF { outF :: f (Mu f) }
catamorphism :: Functor f => (f a -> a) -> Mu f -> a
catamorphism f = f . fmap (catamorphism f) . outF
--------------------------------------------------