Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
28
Task/History-variables/Sidef/history-variables.sidef
Normal file
28
Task/History-variables/Sidef/history-variables.sidef
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
class HistoryVar(v) {
|
||||
|
||||
has history = []
|
||||
has variable = v
|
||||
|
||||
method ≔(value) {
|
||||
history << variable
|
||||
variable = value
|
||||
}
|
||||
|
||||
method to_s {
|
||||
"#{variable}"
|
||||
}
|
||||
|
||||
method AUTOLOAD(_, name, *args) {
|
||||
variable.(name)(args...)
|
||||
}
|
||||
}
|
||||
|
||||
var foo = HistoryVar(0)
|
||||
|
||||
foo ≔ 1
|
||||
foo ≔ 2
|
||||
foo ≔ foo+3
|
||||
foo ≔ 42
|
||||
|
||||
say "History: #{foo.history}"
|
||||
say "Current value: #{foo}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue