diff --git a/app/Gyehoek/Sexp.hs b/app/Gyehoek/Sexp.hs index 5c25a6f..0ff2ba8 100644 --- a/app/Gyehoek/Sexp.hs +++ b/app/Gyehoek/Sexp.hs @@ -52,8 +52,8 @@ parseSexps f = marshal . SexpLoc.parseSexps f . view lazy . encodeUtf8 nonEmptyGrammar :: Grammar p (NonEmpty x :- t) (List x :- x :- t) nonEmptyGrammar = IGB.Iso - (\((x:|xs) :- t) -> xs :- x :- t) - (\(xs :- x :- t) -> (x:|xs) :- t) + (\((x:|xs) :- t) -> reverse xs :- x :- t) + (\(xs :- x :- t) -> (x :| reverse xs) :- t) nonempty :: SexpGrammar a -> SexpGrammar (NonEmpty a) nonempty a = diff --git a/play/t.anf b/play/t.anf index 6102161..2ab7790 100644 --- a/play/t.anf +++ b/play/t.anf @@ -1,4 +1,4 @@ ;;; -*- mode:scheme -*- -(let ((x0 (prim:cons 4 2)) (x3 (prim:write x2)) (x2 (prim:* 3 x1)) (x1 (prim:cdr x0))) x3) +(let ((x0 (prim:cons 4 2)) (x1 (prim:cdr x0)) (x2 (prim:* 3 x1)) (x3 (prim:write x2))) x3)