cs3110 / textbook

The CS 3110 Textbook, "OCaml Programming: Correct + Efficient + Beautiful"
Other
740 stars 134 forks source link

Fix 5.4 ListStack pretty print example #91

Closed eeff closed 2 years ago

eeff commented 2 years ago

The head of the list representation is the top of the stack, so there is no need to reverse the list.

Instead of:

(* copy from 5.4.3 *)
ListStack.(empty |> push 1 |> push 2)

- : int ListStack.t = top of stack
                      1
                      2
                      bottom of stack

it should be:

- : int ListStack.t = top of stack
                      2
                      1
                      bottom of stack
clarksmr commented 2 years ago

Thank you!