Mercurial > repos > tabletprog
view samples/testarray.tp @ 367:e2c1309ab750
Use dict hash instead of dict linear in JSON parser. Implement basic string escapes in JSON parser.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 09 Aug 2015 18:07:23 -0700 |
parents | 810b6115c1d4 |
children |
line wrap: on
line source
#{ sum <- :arr { cursum <- 0 foreach: arr :idx el { cursum <- cursum + el } cursum } main <- { foo <- #[42 30 28] bar <- #[] bar append: 30 bar append: 28 bar append: 42 print: "" . ((sum: foo) + (sum: bar)) . "\n" val <- bar pop print: "popped off: " . val . ", new length: " . (bar length) . "\n" } }