Skip to content

Instantly share code, notes, and snippets.

@saibakatar
Created October 18, 2018 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saibakatar/daf7d07f210b288f6495a9e8cbc28803 to your computer and use it in GitHub Desktop.
Save saibakatar/daf7d07f210b288f6495a9e8cbc28803 to your computer and use it in GitHub Desktop.
List declaration in Scilla
contract Lists()
field a: List(Int32)= Nil {Int32} (*declaring variable a with no value*)
field b: List(Int32) = let c = Nil {Int32} in
let d = Int32 5 in
Cons{Int32} d c (*declaring variable b with fixed value*)
transition update_value()
(*updating variable a*)
e <- a;
f = let g = Int32 6 in
Cons {Int32} g e; (*declaring variable f with fixed value in the transition *)
a := f; (*variable a now contains list 6<-Nil*)
(*updating variable b*)
h <- b;
i = let j = Int32 7 in
Cons {Int32} j h;
b := i (*variable b now contains list 7<-5<-Nil*)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment