mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Generalized state
This commit is contained in:
parent
c3e6d4c76d
commit
36685d1592
56 changed files with 64 additions and 65 deletions
|
|
@ -1,3 +1,3 @@
|
|||
global x = read (), y = read (), z = x * y * 3;
|
||||
local x = read (), y = read (), z = x * y * 3;
|
||||
|
||||
write (z)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z;
|
||||
local x, y, z;
|
||||
|
||||
x := read ();
|
||||
y := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y;
|
||||
local x, y;
|
||||
|
||||
x := read ();
|
||||
y := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z;
|
||||
local x, y, z;
|
||||
|
||||
x := read ();
|
||||
y := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z;
|
||||
local x, y, z;
|
||||
|
||||
x := read ();
|
||||
y := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z;
|
||||
local x, y, z;
|
||||
|
||||
x := read ();
|
||||
y := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z;
|
||||
local x, y, z;
|
||||
|
||||
x := 1;
|
||||
y := 2;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global z;
|
||||
local z;
|
||||
|
||||
z := 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9;
|
||||
write (z)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n = 2, k = 10;
|
||||
local n = 2, k = 10;
|
||||
|
||||
{local res = 1;
|
||||
while k > 0 do
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global i, s;
|
||||
local i, s;
|
||||
|
||||
i := 0;
|
||||
s := 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x;
|
||||
local x;
|
||||
|
||||
x:=0;
|
||||
if x
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
n := read ();
|
||||
while n >= 0 do
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n = read ();
|
||||
local n = read ();
|
||||
|
||||
repeat
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
n := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global s, n, p;
|
||||
local s, n, p;
|
||||
|
||||
s := 0;
|
||||
n := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global s, n;
|
||||
local s, n;
|
||||
|
||||
n := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, fib_1, fib_2, fib, i;
|
||||
local n, fib_1, fib_2, fib, i;
|
||||
|
||||
n := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, c, p, q, i, m, d;
|
||||
local n, c, p, q, i, m, d;
|
||||
|
||||
n := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global i, s;
|
||||
local i, s;
|
||||
|
||||
i := 0;
|
||||
s := 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global s, n, p;
|
||||
local s, n, p;
|
||||
|
||||
s := 0;
|
||||
n := read ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, f;
|
||||
local n, f;
|
||||
|
||||
n := read ();
|
||||
f := 1;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, fib_1, fib_2, fib, i;
|
||||
local n, fib_1, fib_2, fib, i;
|
||||
|
||||
n := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global s, n;
|
||||
local s, n;
|
||||
|
||||
s := 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ fun test2 (b) {
|
|||
a := b
|
||||
}
|
||||
|
||||
global x, a, b;
|
||||
local x, a, b;
|
||||
|
||||
x := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, a, b, c;
|
||||
local x, a, b, c;
|
||||
|
||||
fun test1 (a) {
|
||||
write (a)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, a, b, c;
|
||||
local x, a, b, c;
|
||||
|
||||
fun test1 (a) {
|
||||
write (a);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, a, b, c;
|
||||
local x, a, b, c;
|
||||
|
||||
fun print () {
|
||||
write (a);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, i, result;
|
||||
local n, i, result;
|
||||
|
||||
fun fact (n) {
|
||||
if n <= 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global i, n, result;
|
||||
local i, n, result;
|
||||
|
||||
fun fib (n) {
|
||||
local r;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, i;
|
||||
local n, i;
|
||||
|
||||
fun fib (n) {
|
||||
if n <= 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, i;
|
||||
local n, i;
|
||||
|
||||
fun fact (n) {
|
||||
if n <= 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, m, n;
|
||||
local x, m, n;
|
||||
|
||||
fun ack (m, n) {
|
||||
if m == 0 then return (n+1)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x;
|
||||
local x;
|
||||
|
||||
fun test (n, m) {
|
||||
local i, s;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, x, i;
|
||||
local n, x, i;
|
||||
|
||||
fun printString (x) {
|
||||
for i:=0, i<x.length, i:=i+1 do
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, x, i;
|
||||
local n, x, i;
|
||||
|
||||
fun printArray (x) {
|
||||
local elem;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, i, j;
|
||||
local x, y, i, j;
|
||||
|
||||
fun printAS (x) {
|
||||
local i, j;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, x, i;
|
||||
local n, x, i;
|
||||
|
||||
fun sort (x) {
|
||||
local i, j, y, n;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, x, y;
|
||||
local n, x, y;
|
||||
|
||||
fun append (x, y) {
|
||||
case x of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, t;
|
||||
local n, t;
|
||||
|
||||
fun insert (t, x) {
|
||||
case t of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x;
|
||||
local x;
|
||||
|
||||
fun f (x) {
|
||||
case x of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x;
|
||||
local x;
|
||||
|
||||
fun f (a) {
|
||||
case a of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, i;
|
||||
local x, y, i;
|
||||
|
||||
fun f (x) {
|
||||
case x of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x;
|
||||
local x;
|
||||
|
||||
fun sum (x) {
|
||||
case x of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z;
|
||||
local x, y, z;
|
||||
|
||||
fun zip (x) {
|
||||
case x of Pair (x, y) ->
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x;
|
||||
local x;
|
||||
|
||||
fun printString (s) {
|
||||
local i;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
n := read ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
fun collect_ints_acc (v, tail) {
|
||||
local i;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, y;
|
||||
local n, y;
|
||||
|
||||
fun test (n, m) {
|
||||
local i, s;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, y, y2, t;
|
||||
local n, y, y2, t;
|
||||
|
||||
fun test (n, m) {
|
||||
local i, s;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n, x, y;
|
||||
local n, x, y;
|
||||
|
||||
n := read ();
|
||||
x := [1];
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
fun sum (l) {
|
||||
case l of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
fun hd (l) {
|
||||
case l of
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global n;
|
||||
local n;
|
||||
|
||||
infix "===" at "==" (v1, v2) {
|
||||
local s1, s2, i;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global x, y, z, s, i, n;
|
||||
local x, y, z, s, i, n;
|
||||
|
||||
x := y := z := 105;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue