about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/test_function_calls_in_tables.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_function_calls_in_tables.txt')
-rw-r--r--js/scripting-lang/scratch_tests/test_function_calls_in_tables.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_function_calls_in_tables.txt b/js/scripting-lang/scratch_tests/test_function_calls_in_tables.txt
new file mode 100644
index 0000000..a7c991a
--- /dev/null
+++ b/js/scripting-lang/scratch_tests/test_function_calls_in_tables.txt
@@ -0,0 +1,28 @@
+/* Test function calls in table literals */
+
+/* Test basic function calls */
+mod3 : n -> n % 3;
+mod5 : n -> n % 5;
+
+/* Test individual function calls */
+result1 : mod3 15;
+result2 : mod5 15;
+..out "mod3 15: " + result1;
+..out "mod5 15: " + result2;
+
+/* Test function calls in table */
+table1 : {mod3 15, mod5 15};
+..out "Table with function calls:";
+..out table1;
+
+/* Test with map */
+is_zero : x -> x = 0;
+mapped : map @is_zero table1;
+..out "Mapped table:";
+..out mapped;
+
+/* Test the complete divisibility function */
+divisibility : n -> map @is_zero {mod3 n, mod5 n};
+result : divisibility 15;
+..out "Divisibility result:";
+..out result; 
\ No newline at end of file