Skip to content

Commit

Permalink
docs: add example for chaperone-treelist
Browse files Browse the repository at this point in the history
  • Loading branch information
LiberalArtist committed Apr 25, 2024
1 parent a172304 commit ebe7120
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pkgs/racket-doc/scribblings/reference/treelists.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,30 @@ of @racket[prepend-proc] is a chaperone, then that chaperone's
@racket[append-proc] keep returning chaperones, it is possible that
no progress will be made.

}
@examples[
#:eval the-eval
(chaperone-treelist
(treelist 1 "a" 'apple)
#:state 'ignored-state
#:ref (λ (tl pos v state) (code:comment @#,elem{or @racket[#f]})
v)
#:set (λ (tl pos v state)
(values v state))
#:insert (λ (tl pos v state)
(values v state))
#:delete (λ (tl pos state)
state)
#:take (λ (tl pos state)
state)
#:drop (λ (tl pos state)
state)
#:append2 (λ (tl other state other-state) (code:comment @#,elem{or @racket[#f]})
(values other state))
#:append (λ (tl other state)
(values other state))
#:prepend (λ (other tl state)
(values other state)))
]}

@defproc[(treelist-chaperone-state [tl treelist?]
[state-key any/c]
Expand Down

0 comments on commit ebe7120

Please sign in to comment.