OCaml implementation of the FSRS algorithm.
For OCaml practice... and for... if someone on planet Earth ever wants an SRS library for their OCaml project1.
opam install cmdliner
opam install ocamlformat
opam install baseopen Models
let () =
let params = Parameters.default () in
let fsrs = Fsrs.create params in
let card = Models.new_card () in
let record_log = Fsrs.repeat fsrs card (Timedesc.Timestamp.now ()) in
Models.RatingMap.iter (fun rating sched_info ->
Printf.printf "If you answer \"%s\":\n" (Models.show_rating rating);
Printf.printf " Next card: %s\n" (Models.show_card sched_info.card);
Printf.printf " Review log: %s\n" (Models.show_review_log sched_info.review_log);
print_endline ""
) record_logRefer to demo.ml for the same example, or run the example by running dune exec demo.
# to build
dune build
# to run unit tests
dune runtest
# to run the quickstart example
dune build && dune exec demoOr refer to commands in justfile.
Something like
git tag 0.1.0-alpha3
git push --tags
opam publishThis implementation is largely based on the Rust implementation rs-fsrs (MIT license).
Footnotes
-
Who knows if that someone would be ourself some day. ↩