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
// Exercise1.2 | |
var calc = function(f){ | |
return function(){ | |
var tmp; | |
for (var i = 0; i < arguments.length; i++){ | |
var num = arguments[i]; | |
if (typeof tmp === 'undefined'){ | |
tmp = num; | |
}else{ | |
tmp = f(tmp, 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 Duck where | |
class Duck a where | |
quack :: a -> String | |
feathers :: a -> String | |
data Person = Person deriving(Show) | |
data DomesticDuck = DomesticDuck deriving(Show) |
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
function! Aif(a, ope, b) | |
let a = a:a | |
let ope = a:ope | |
let b = a:b | |
execute 'return ' . a . ope . b . ' ? ' . a . ' :' . b | |
endfunction | |
function! Bigger(a, b) | |
return Aif(a:a, '>', a:b) | |
endfunction |
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
command! -nargs=0 -bar FontReSize call s:changeFontSize() | |
function! s:changeFontSize() | |
let font_size_pat = '(.{-}\S:h)(\d+\.?\d*)(.{-})' | |
let valid_num_pat = '\d+(\.(0|5))?' | |
let current_font_size = substitute(&guifont, '\v^' . font_size_pat . '$', '\2', '') | |
if current_font_size !~ '\v^' . valid_num_pat . '$' | |
return | |
endif | |
" disalbe ime |
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
Algol | |
B | |
C | |
D | |
Erlang | |
F# | |
Go | |
Haskell | |
io | |
Java |
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 Data.List | |
data Sex = Male | Female deriving (Show, Eq, Ord) | |
data Customer = Customer{ sex :: Sex, age :: Int } deriving(Show, Eq, Ord) | |
(|>) :: a -> (a -> b) -> b | |
x |> f = f 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
--haskell | |
foldl (+) 0 $ filter (<5) [1,2,3,4,5,6] | |
--elixiri | |
[1,2,3,4,5,6] |> Enum.filter(&(&1 < 5)) |> List.foldl(0, &(&1 + &2)) |
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 FizzBuzz(fizz, buzz, gizz, hizz) where | |
-- しよういめ~じ | |
-- fizzz . buzz . gizz . hizz $ (542, "") | |
hizz (n, s) = fizzBuzz (n, 9) "Hizz" s | |
gizz (n, s) = fizzBuzz (n, 7) "Gizz" s | |
buzz (n, s) = fizzBuzz (n, 5) "Buzz" s | |
fizz (n, s) = fizzBuzz (n, 3) "Fizz" s |
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
/* 2個の引数を受け取るsomeFuncの定義で一番お勧めなのはどれなんでしょう? */ | |
funcA a b = a * b + (a + b) | |
a `someFunc` b = a `funcA` b | |
someFunc a b = funcA a b | |
someFunc a b = a `funcA` b | |
a `someFunc` b = funcA a 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
" インサートモードに入るか、入力を行った最後の時間変数に保存 | |
autocmd! InsertEnter,InsertChange * :let s:last_action_time = localtime() | |
autocmd! CursorMovedI * :call s:leave_insert_mode() | let s:last_action_time = localtime() | |
autocmd! InsertCharPre * :call s:leave_insert_mode("call feedkeys('" . v:char . "', 'n')", "let v:char = '' ") | |
NewerOlder