mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 03:05:29 -05:00
demonstrate the Sequence.map construct on S-expressions
This commit is contained in:
parent
ac2fb8129c
commit
10df563bd8
1 changed files with 5 additions and 1 deletions
6
tests.ml
6
tests.ml
|
|
@ -45,5 +45,9 @@ let _ =
|
|||
Format.printf "%dx1 = %d@." n sum;
|
||||
assert (n=sum);
|
||||
let s = Sexpr.of_seq (Sexpr.lex (Sequence.String.to_seq sexpr)) in
|
||||
Format.printf "parse @[<h>%s@] into @[<h>%a@]@." sexpr (Sexpr.pp_sexpr ~indent:false) s;
|
||||
let s = Sexpr.of_seq (Sequence.map
|
||||
(function | `Atom s -> `Atom (String.capitalize s) | tok -> tok)
|
||||
(Sexpr.traverse s))
|
||||
in
|
||||
Format.printf "@[<hov2>transform @[<h>%s@] into @[<h>%a@]@]@." sexpr (Sexpr.pp_sexpr ~indent:false) s;
|
||||
()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue