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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"strings" | |
) | |
func init() { | |
http.HandleFunc("/", handler) |
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
-- | |
-- http://www.grabmueller.de/martin/www/pub/Transformers.pdf | |
-- | |
module Transformers where | |
import Control.Monad.Identity | |
import Control.Monad.Error | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Control.Monad.Writer | |
import Data.Maybe |
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
-- | |
-- http://d.hatena.ne.jp/kazu-yamamoto/20080604/1212573964 | |
-- | |
data List a = Nil | Cons a (List a) deriving (Show) | |
cons :: a -> List a -> List a | |
cons x xs = Cons x xs | |
type Counter = 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
module Transformers where | |
import Control.Monad.Identity | |
import Control.Monad.Error | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Control.Monad.Writer | |
import Data.Maybe | |
import qualified Data.Map as Map | |
-- |
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
#include "mpc.h" | |
#include <editline/readline.h> | |
enum { LERR_DIV_ZERO, LERR_BAD_OP, LERR_BAD_NUM }; | |
enum { LVAL_NUM, LVAL_ERR }; | |
typedef struct { | |
int type; | |
long num; |
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 Main where | |
import Data.Char | |
main = interact capitalWords | |
shortLinesOnly :: String -> String | |
shortLinesOnly input = | |
let allLines = lines input | |
shortLines = filter (\line -> length line < 10) allLines |
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.*; | |
class User { | |
final String name; | |
final int age; | |
User(String name, int age) { | |
this.name = name == null ? "" : name; | |
this.age = age; | |
} | |
} |
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
# >> を * | |
# >>= を bind | |
# return を self.new | |
# mplus を + | |
# mzero を self.zero | |
# | |
# に見立てて Maybe モナド書いてみた | |
# bind に渡す block で Maybe と書きたくないので第二引数に型情報を付加してみた。 | |
class Monad | |
def *(m) |
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
package com.mdaisuke.sample; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.text.Editable; | |
import android.text.TextWatcher; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import android.view.View; | |
import android.widget.Button; |