Skip to content

Instantly share code, notes, and snippets.

@odanoburu
Last active May 23, 2018 18:42
Show Gist options
  • Save odanoburu/d4ddb0919b63facaa3376366a0946e64 to your computer and use it in GitHub Desktop.
Save odanoburu/d4ddb0919b63facaa3376366a0946e64 to your computer and use it in GitHub Desktop.
trying to understand how these two forms of `pre` work in GF
resource PhonoPor = open Prelude in {
-- the implementation is wrong, the point is the use of `pre`
oper
a : pattern Str = #("a") ;
o : pattern Str = #("o") ;
elisEm : Str ;
{-- doesn't work, complains about "a" not being a pattern
elisEm = pre {"em" ; "na" / "a" ; "no" / "o"} ;
but this works: --}
elisEm = pre {"em" ; "na" / a ; "no" / o} ;
{-- this works
elisEm = pre {
"a" => "na" ;
"o" => "no" ;
_ => "em"
} ;
-- and so does this
elisEm = pre {
a => "na" ;
o => "no" ;
_ => "em"
} ;
--}
} ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment