diff options
| author | Abigail <abigail@abigail.be> | 2021-11-17 16:09:09 +0100 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-11-17 19:20:28 +0100 |
| commit | 62167a58d3c55a71f37815381c858fad45825a8d (patch) | |
| tree | c2dab46599fc720673c6f1b4c8378c00e99dfeb2 /challenge-139/abigail/lua/ch-1.lua | |
| parent | 83b91177f7b1aced78863b336bd236a40f7e1aef (diff) | |
| download | perlweeklychallenge-club-62167a58d3c55a71f37815381c858fad45825a8d.tar.gz perlweeklychallenge-club-62167a58d3c55a71f37815381c858fad45825a8d.tar.bz2 perlweeklychallenge-club-62167a58d3c55a71f37815381c858fad45825a8d.zip | |
Solutions for week 139
Diffstat (limited to 'challenge-139/abigail/lua/ch-1.lua')
| -rw-r--r-- | challenge-139/abigail/lua/ch-1.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-139/abigail/lua/ch-1.lua b/challenge-139/abigail/lua/ch-1.lua new file mode 100644 index 0000000000..8a2603a7e8 --- /dev/null +++ b/challenge-139/abigail/lua/ch-1.lua @@ -0,0 +1,21 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-1.lua < input-file +-- + +for line in io . lines () do + local sorted = 1 + local prev = nil + for next in line : gmatch ("[0-9]+") do + if prev ~= nil and prev > next then + sorted = 0 + end + prev = next + end + print (sorted) +end |
