Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Extend-your-language/Lasso/extend-your-language-1.lasso
Normal file
23
Task/Extend-your-language/Lasso/extend-your-language-1.lasso
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Create a type to handle the captures
|
||||
|
||||
define if2 => type {
|
||||
data private a, private b
|
||||
public oncreate(a,b) => {
|
||||
.a = #a
|
||||
.b = #b
|
||||
thread_var_push(.type,self)
|
||||
handle => { thread_var_pop(.type)}
|
||||
return givenblock()
|
||||
}
|
||||
public ifboth => .a && .b ? givenblock()
|
||||
public else1 => .a && !.b ? givenblock()
|
||||
public else2 => !.a && .b ? givenblock()
|
||||
public else => !.a && !.b ? givenblock()
|
||||
}
|
||||
|
||||
// Define methods to consider givenblocks
|
||||
|
||||
define ifboth => thread_var_get(::if2)->ifboth => givenblock
|
||||
define else1 => thread_var_get(::if2)->else1 => givenblock
|
||||
define else2 => thread_var_get(::if2)->else2 => givenblock
|
||||
define else => thread_var_get(::if2)->else => givenblock
|
||||
14
Task/Extend-your-language/Lasso/extend-your-language-2.lasso
Normal file
14
Task/Extend-your-language/Lasso/extend-your-language-2.lasso
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
if2(true,true) => {
|
||||
ifboth => {
|
||||
bothConditionsAreTrue
|
||||
}
|
||||
else1 => {
|
||||
firstConditionIsTrue
|
||||
}
|
||||
else2 => {
|
||||
secondConditionIsTrue
|
||||
}
|
||||
else => {
|
||||
noConditionIsTrue
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue