From 85ef9534e370e08105b0a190d1f27cc56992a73c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 9 Jul 2018 17:13:40 -0700 Subject: Added pattern matching for text, and comprehension versions of that and file walking. --- lib/os.nom | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/os.nom') diff --git a/lib/os.nom b/lib/os.nom index 25b47b6..ee8b79b 100644 --- a/lib/os.nom +++ b/lib/os.nom @@ -23,6 +23,16 @@ compile [for file %f in %path %body] to end \(compile as: === stop %f ===) +compile [%expr for file %f in %path] to + Lua value ".." + (function() + local ret = list{} + for \(%f as lua expr) in files.walk(\(%path as lua expr)) do + ret[#ret+1] = \(%expr as lua statements) + end + return ret + end)() + action [write to file %filename %text, to file %filename write %text] lua> ".." local file = io.open(\%filename, 'w') -- cgit v1.2.3