package catala
Compiler and library for the literate programming language for tax code specification
Install
dune-project
Dependency
Authors
Maintainers
Sources
1.0.0-alpha.tar.gz
md5=2615968670ac21b1d00386a9b04b3843
sha512=eff292fdd75012f26ce7b17020f5a8374eef37cd4dd6ba60338dfbe89fbcad3443d1b409e44c182b740da9f58dff7e76dcb8ddefe47f9b2b160666d1c6930143
doc/catala.shared_ast/Shared_ast/BoundList/index.html
Module Shared_ast.BoundList
Source
Bound lists are non-empty linked lists where each element is a binder onto the next. They are useful for ordered program definitions, like nested let-ins.
let a = e1 in e2
is thus represented as Cons (e1, {a. Last e2})
.
The following provides a few utility functions for their traversal and manipulation. In particular, map
functions take care of unbinding, then properly rebinding the variables.
Source
val to_seq :
(((_, _, _) Shared_ast__.Definitions.base_gexpr,
_ Shared_ast__.Definitions.mark)
Catala_utils.Mark.ed as 'e,
'elt,
_)
t ->
('e Var.t * 'elt) Seq.t
Note that the boundlist terminator is ignored in the resulting sequence
Source
val of_list :
('e Var.t * 'elt Bindlib.box) list ->
last:'last Bindlib.box ->
('e, 'elt, 'last) t Bindlib.box
Source
val fold_lr :
top:'dacc ->
down:('e Var.t -> 'elt -> 'dacc -> 'dacc) ->
bottom:('last -> 'dacc -> 'uacc) ->
up:('e Var.t -> 'elt -> 'uacc -> 'uacc) ->
('e, 'elt, 'last) t ->
'uacc
Bi-directional fold: down
accumulates downwards, starting from top
; upon reaching last
, bottom
is called; then up
accumulates on the way back up
Source
val map :
f:('e1 Var.t -> 'elt1 -> 'e2 Var.t * 'elt2 Bindlib.box) ->
last:('last1 -> 'last2 Bindlib.box) ->
('e1, 'elt1, 'last1) t ->
('e2, 'elt2, 'last2) t Bindlib.box
Source
val map_last :
f:('e1 Var.t -> 'elt1 -> 'e2 Var.t * 'elt2 Bindlib.box) ->
last:('last1 -> ('e2, 'elt2, 'last2) t Bindlib.box) ->
('e1, 'elt1, 'last1) t ->
('e2, 'elt2, 'last2) t Bindlib.box
A more expressive version of map
that allows extending the tail (e.g. to append new elements)
Source
val fold_map :
f:('ctx -> 'e1 Var.t -> 'elt1 -> 'ctx * 'e2 Var.t * 'elt2 Bindlib.box) ->
last:('ctx -> 'last1 -> 'ret * 'last2 Bindlib.box) ->
init:'ctx ->
('e1, 'elt1, 'last1) t ->
'ret * ('e2, 'elt2, 'last2) t Bindlib.box
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>