-
文脈を持った値に関数を適用する
f aに(a -> b)を適用したい
-
r -> aからr -> bにfmap :: (Functor f) => (a -> b) -> f a -> f b
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
| // | |
| // KVOSampleTests.m | |
| // KVOSampleTests | |
| // | |
| // Created by taiki on 2014/02/25. | |
| // | |
| // | |
| #import <XCTest/XCTest.h> |
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
| {- | |
| - 数nを受け取り,3の倍数か3のつく数字のときにアホになる | |
| - リストを返す関数を再帰を使って書きなさい. | |
| - | |
| - ex) | |
| - > ahoMaker 40 | |
| - ["1","2","AHO","4","5","AHO","7","8","AHO","10", | |
| - "11","AHO","AHO","14","AHO","16","17","AHO","19","20", | |
| - "AHO","22","AHO","AHO","25","26","AHO","28","29","AHO", | |
| - "AHO","AHO","AHO","AHO","AHO","AHO","AHO","AHO","AHO", |
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
| SDK = 'iphoneos7.0' | |
| PRODUCT_NAME = '' | |
| CODE_SIGN_IDENTITY = '' | |
| PROVISIONING_PROFILE_UUID = '' | |
| TESTFLIGHT_API_TOKEN = '' | |
| TESTFLIGHT_TEAM_TOKEN = '' | |
| desc "Clean build dir" |
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.Environment (getArgs) | |
| import Data.Char (digitToInt) | |
| spare = (==) '/' | |
| strike = (==) 'X' | |
| updateBonus r (b1, b2) | |
| | spare r = (b2 + 1, 0) | |
| | strike r = (b2 + 1, 1) | |
| | otherwise = (b2, 0) |
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.Environment (getArgs) | |
| main = do | |
| (x:_) <- getArgs | |
| mapM_ putStrLn $ createFizzBuzz $ read x | |
| createFizzBuzz :: Int -> [String] | |
| createFizzBuzz 0 = [] | |
| createFizzBuzz x = map fizzbuzz [1..x] |
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 <Foundation/Foundation.h> | |
| @interface YSNetwork : NSObject | |
| @property (readonly) NSURL *URL; | |
| @property (strong, nonatomic) NSURLRequest *request; | |
| @property (strong, nonatomic) NSString *userAgent; | |
| @property (strong, nonatomic, readonly) NSData *responseData; | |
| @property (strong, nonatomic, readonly) NSDictionary *responseHeader; | |
| @property (strong, nonatomic) void (^completion)(NSDictionary *responseHeader, NSData *responseData); | |
| @property (strong, nonatomic) void (^failure)(NSError *error); |
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.Environment (getArgs) | |
| import Prelude hiding (head, tail) | |
| import Data.Char (ord) | |
| sudden :: String -> String | |
| sudden s = unlines [head s, body s, tail s] | |
| body :: String -> String | |
| body s = "> 突然の" ++ s ++ " <" |