package plato
Python Library Adapted To OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
1.1.3.tar.gz
md5=4857a49b04ceb297c1eb4b2715d5a47a
sha512=daef493c84ce23e11b21f595a3f2f744edcd3741e698f6b21895bcfb79b2c8b36687da3e621ae9bd79612c2bbfdbbd9e624829ea2bb0c118b2c3fbffa2f48d99
doc/src/plato/list.ml.html
Source file list.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
[@@@warning "@A"] let len = Stdcompat.List.length let get (type a) (s: a list) (pos: int) : a = let l = len s in if l <= pos || pos < ~-l then raise (Exn.IndexError "list index out of range") else let pos = if pos >= 0 then pos else l + pos in Stdcompat.List.nth s pos let slice (type a) ?(start: int option) ?(stop: int option) ?(step: int = 1) (l: a list) : a list = if stop = None && step = 1 then let rec aux i l = match i, l with | 0, _ -> l | _, [] -> [] | n, _ :: t -> aux (n - 1) t in match start with | None -> l | Some start -> aux start l else let open Helpers.Slice in slice ?start ?stop ~step Stdcompat.List.length Stdcompat.List.nth (ConcatLeft (fun c s -> c::s)) (fun _ -> []) (fun x -> x) l
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>