- Haskellは天才過ぎて大学行ってる15歳
- RubyはモテモテJK
- Pythonは真面目委員長、風紀委員
- LISPは部活
- Javaは最近あんまり人気無い
- COBOLは用務員のおばあちゃん
- Haskellは天才過ぎて大学行ってる15歳
- RubyはモテモテJK
- Pythonは真面目委員長、風紀委員
- LISPは部活
- Javaは最近あんまり人気無い
- COBOLは用務員のおばあちゃん
- C++はよくわからない怖い大先輩
- Haskellは天才過ぎて大学行ってる15歳
- RubyはモテモテJK
- Pythonは真面目委員長、風紀委員
- LISPは部活
- Javaは最近あんまり人気無い
- COBOLは用務員のおばあちゃん
- C++はよくわからない怖い大先輩
- Perl はひげのおっさん
This file contains 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
(* seiseki : string * string -> string *) | |
let seiseki pair = match pair with | |
(name, score) -> name ^ "'s sore is " ^ score ^ "." |
This file contains 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
(* taisho x : float * float -> float * float *) | |
let taisho_x point = match point with | |
(x, y) -> (x, -. y) |
This file contains 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
(* chuten : float * float -> float * float -> float * float *) | |
let chuten point1 point2 = match point1 with | |
(x1, y1) -> ( match point2 with | |
(x2, y2) -> ((x1 +. x2)/.2.0, (y1 +. y2)/.2.0)) |
This file contains 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
; b) 1つのリストを引数とし、aというシンボルがいくつあるかを返す。 | |
(defun a-ikutu (lst) | |
(if (null lst) | |
0 | |
(+ (if (eql (car lst) 'a) | |
1 | |
0) | |
(a-ikutu (cdr lst))))) |
This file contains 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
(defun a-ikutu (lst) | |
(length (filter #'(lambda (x) (eq x 'a)) lst))) | |
;; filter関数 | |
(defun filter (pred lst) | |
(cond ((null lst) nil) | |
((funcall pred (car lst)) | |
(cons (car ls) (filter pred (cdr lst)))) | |
(t (filter pred (cdr lst))))) |
This file contains 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
(* 目的 : 最大公約数を求める *) | |
let rec euclid m n = | |
if n = 0 then m | |
else if m = n then m | |
else if m > n then euclid n ( m mod n ) | |
else euclid n m | |
(* 目的: 最大公約数を求めて、何回引き算したか(=何回割り算したか) 求める *) | |
(* euclid' :: int -> int -> int -> int *) | |
let rec euclid' c m n = |
This file contains 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
mysort :: [Int] -> [Int] | |
mysort list = case list of | |
[] -> [] | |
first : rest -> insert (mysort rest) first | |
where insert lst n = case lst of | |
[] -> [n] | |
first : rest | |
| first < n -> first : insert rest n | |
| otherwise -> n : lst |
OlderNewer