From ccd6e9c7548b8097e5503a2087d41366bbf18846 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Mon, 14 Sep 2020 22:20:48 +0200 Subject: Fully implements SetFields{,Computation}. --- data/tests/extra_functionals.fate | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 data/tests/extra_functionals.fate (limited to 'data') diff --git a/data/tests/extra_functionals.fate b/data/tests/extra_functionals.fate new file mode 100644 index 0000000..53c4b33 --- /dev/null +++ b/data/tests/extra_functionals.fate @@ -0,0 +1,39 @@ +(fate_version 1) + +(declare_structure test_struct + (int i) + (float f) + (int j) + (string str) +) + +(global test_struct st0) +(global test_struct st1) + +(set_fields! st0 + (i -1) + (f -5.0) + (j -2) + (str nothing) +) + +(global (lambda test_struct (test_struct)) update_test_struct) + +(set_value update_test_struct + (lambda ( (test_struct s) ) + (if_else (< (var s.i) 10) + (eval + update_test_struct + (set_fields s + (i (+ (var s.i) 1)) + (j (+ (var s.j) 10)) + ) + ) + (var s) + ) + ) +) + +(set_value st1 (eval update_test_struct (var st0))) + +(end) -- cgit v1.2.3-70-g09d2