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
(* sum of list *) | |
let rec sum lst = | |
match lst with | |
[] -> 0 | |
| x :: xs -> x + sum xs | |
(* erase n elements of list *) | |
let rec erase n lst = | |
if n > 0 then erase (n-1) (List.tl lst) else lst | |
(* match lst with *) |
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 cmp = Pervasives.compare | |
(* search : 'a list -> 'a list -> bool *) | |
(* trans 中の ptn 出現を探索 *) | |
let rec search ptn trans = | |
match ptn with | |
[] -> true | |
| head :: tail -> | |
List.mem head trans && search tail trans |
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
/* petdatabase2file2.c */ | |
#include<stdio.h> | |
#include<string.h> | |
#include<stdlib.h> | |
#include<pet.h> | |
#include<owner.h> | |
#include<lstowner.h> | |
#include<lstpet.h> | |
int main(){ |
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
fail |