Skip to content

chaosarium/ocaml-fsrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fsrs-ocaml

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.

Setup

opam install cmdliner
opam install ocamlformat
opam install base

Quickstart

open 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_log

Refer to demo.ml for the same example, or run the example by running dune exec demo.

Development

# to build
dune build
# to run unit tests
dune runtest
# to run the quickstart example
dune build && dune exec demo

Or refer to commands in justfile.

Release stuff

Something like

git tag 0.1.0-alpha3
git push --tags
opam publish

Acknowledgements

This implementation is largely based on the Rust implementation rs-fsrs (MIT license).

Footnotes

  1. Who knows if that someone would be ourself some day.

About

OCaml implementation of the FSRS algorithm (scheduler only)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published