Skip to content

Instantly share code, notes, and snippets.

@fuminashi
fuminashi / shakutori.ml
Last active January 12, 2018 17:36
尺取り法(?)
(* 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 *)
@fuminashi
fuminashi / apriori.ml
Last active February 28, 2017 16:03
ocaml implementation of apriori algorithm
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
@fuminashi
fuminashi / answer?
Last active December 31, 2015 17:29
petdatabase2file2.c
/* 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(){
@fuminashi
fuminashi / fail
Last active December 31, 2015 03:09
fail