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.

Revisions

  1. odanoburu revised this gist May 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PhonoPor.gf
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    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") ;
    @@ -9,7 +10,6 @@ resource PhonoPor = open Prelude in {
    elisEm = pre {"em" ; "na" / "a" ; "no" / "o"} ;
    but this works: --}
    elisEm = pre {"em" ; "na" / a ; "no" / o} ;

    {-- this works
    elisEm = pre {
    "a" => "na" ;
  2. odanoburu revised this gist May 23, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion PhonoPor.gf
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    resource PhonoPor2 = open Prelude in {
    resource PhonoPor = open Prelude in {

    oper
    a : pattern Str = #("a") ;
    @@ -9,6 +9,7 @@ resource PhonoPor2 = open Prelude in {
    elisEm = pre {"em" ; "na" / "a" ; "no" / "o"} ;
    but this works: --}
    elisEm = pre {"em" ; "na" / a ; "no" / o} ;

    {-- this works
    elisEm = pre {
    "a" => "na" ;
  3. odanoburu created this gist May 23, 2018.
    25 changes: 25 additions & 0 deletions PhonoPor.gf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    resource PhonoPor2 = open Prelude in {

    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"
    } ;
    --}
    } ;