diff options
Diffstat (limited to 'common.sml')
-rw-r--r-- | common.sml | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -134,6 +134,15 @@ in fun printf g = Fold.fold ctx g end +fun sprintf g = +let + val buf = ref [] + fun output s = buf := s :: !buf + fun finish _ = String.concat $ rev $ !buf +in + Fold.fold ((false, makePrintfBase output), finish) +end g + fun Printf out g = Fold.fold ((false, out), fn _ => ()) g local |