Updated to use 'set' syntax instead of ": yes"
This commit is contained in:
parent
c5ea506acc
commit
81fda96301
@ -15,11 +15,11 @@ test:
|
|||||||
%visited = {}
|
%visited = {}
|
||||||
for %i = %x in %list:
|
for %i = %x in %list:
|
||||||
%visited.%i = (yes)
|
%visited.%i = (yes)
|
||||||
assume (%visited == {1: yes, 2: yes, 3: yes, 4: yes, 5: yes})
|
assume (%visited == {1, 2, 3, 4, 5})
|
||||||
%visited = {}
|
%visited = {}
|
||||||
for %x in %list:
|
for %x in %list:
|
||||||
%visited.%x = (yes)
|
%visited.%x = (yes)
|
||||||
assume (%visited == {1: yes, 2: yes, 3: yes, 4: yes, 5: yes})
|
assume (%visited == {1, 2, 3, 4, 5})
|
||||||
assume ((%list::2 nd to last) == 4)
|
assume ((%list::2 nd to last) == 4)
|
||||||
assume ((%list::first) == 1)
|
assume ((%list::first) == 1)
|
||||||
assume (%list::has 3)
|
assume (%list::has 3)
|
||||||
|
@ -54,7 +54,7 @@ test:
|
|||||||
..all compile to:
|
..all compile to:
|
||||||
# If %when_true_expr is guaranteed to be truthy, we can use Lua's idiomatic
|
# If %when_true_expr is guaranteed to be truthy, we can use Lua's idiomatic
|
||||||
equivalent of a conditional expression: (cond and if_true or if_false)
|
equivalent of a conditional expression: (cond and if_true or if_false)
|
||||||
if {Text: yes, List: yes, Dict: yes, Number: yes}.(%when_true_expr.type):
|
if {"Text", "List", "Dict", "Number"}.(%when_true_expr.type):
|
||||||
return (Lua "(\(%condition as lua expr) and \(%when_true_expr as lua expr) or \(%when_false_expr as lua expr))")
|
return (Lua "(\(%condition as lua expr) and \(%when_true_expr as lua expr) or \(%when_false_expr as lua expr))")
|
||||||
..else:
|
..else:
|
||||||
# Otherwise, need to do an anonymous inline function (yuck, too bad lua
|
# Otherwise, need to do an anonymous inline function (yuck, too bad lua
|
||||||
|
Loading…
Reference in New Issue
Block a user