Skip to content

More examples please #5

Open
Open

Description

@blamario

A side-by-side example of Plutus output and an equivalent hand-written Pluto expression could go a long way to justify the project.

Activity

  1. srid commented on Dec 1, 2021

    @srid
    Member

    For the record, you can get the UPLC for examples/hello.pluto by running cabal run pluto -- run examples/hello.pluto -v in nix-shell.

    For following pluto program,

    -- Hello world
    let 
      defaultGreeting = "Hello";
      greet = (\greeting name -> 
        (greeting +s ", ") +s name
      )
    in 
      greet defaultGreeting "world"

    translates to UPLC:

    Program
      ()
      (Version () 1 0 0)
      (Apply
         ()
         (LamAbs
            ()
            (DeBruijn {dbnIndex = 0})
            (Apply
               ()
               (LamAbs
                  ()
                  (DeBruijn {dbnIndex = 0})
                  (Apply
                     ()
                     (Apply
                        ()
                        (Var () (DeBruijn {dbnIndex = 2}))
                        (Var () (DeBruijn {dbnIndex = 1})))
                     (Constant () (Some (ValueOf string "world")))))
               (Constant () (Some (ValueOf string "Hello")))))
         (LamAbs
            ()
            (DeBruijn {dbnIndex = 0})
            (LamAbs
               ()
               (DeBruijn {dbnIndex = 0})
               (Apply
                  ()
                  (Apply
                     ()
                     (Builtin () AppendString)
                     (Apply
                        ()
                        (Apply
                           ()
                           (Builtin () AppendString)
                           (Var () (DeBruijn {dbnIndex = 2})))
                        (Constant () (Some (ValueOf string ", ")))))
                  (Var () (DeBruijn {dbnIndex = 1}))))))
  2. blamario commented on Dec 1, 2021

    @blamario
    Author

    The benefit of this comparison is the whole justification for the project, so you want to put it up front. Sure anybody with a Plutus repo clone can get the same output but it takes some effort to produce it and visually compare to the hand-written Pluto expression. Speaking of which, do you plan to write a disassembler?

  3. blamario commented on Dec 1, 2021

    @blamario
    Author

    Never mind the last question, I opened issue #4 about that.

  4. added
    documentationImprovements or additions to documentation
    on Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions