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
1
Task/Enforced-immutability/8th/enforced-immutability.8th
Normal file
1
Task/Enforced-immutability/8th/enforced-immutability.8th
Normal file
|
|
@ -0,0 +1 @@
|
|||
123 const var, one-two-three
|
||||
7
Task/Enforced-immutability/Nim/enforced-immutability.nim
Normal file
7
Task/Enforced-immutability/Nim/enforced-immutability.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
var x = "mutablefoo" # Mutable variable
|
||||
let y = "immutablefoo" # Immutable variable, at runtime
|
||||
const z = "constantfoo" # Immutable constant, at compile time
|
||||
|
||||
x[0] = 'M'
|
||||
y[0] = 'I' # Compile error: 'y[0]' cannot be assigned to
|
||||
z[0] = 'C' # Compile error: 'z[0]' cannot be assigned to
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
Object Class new: MyClass(a, b)
|
||||
|
||||
MyClass method: setA(value) value := a ;
|
||||
MyClass method: setB(value) value := b ;
|
||||
|
||||
MyClass method: initialize(v, w) self setA(v) self setB(w) ;
|
||||
|
||||
MyClass new(1, 2) // OK : An immutable object
|
||||
MyClass new(1, 2) setA(4) // KO : An immutable object can't be updated after initialization
|
||||
MyClass new(ListBuffer new, 12) // KO : Not an immutable value.
|
||||
ListBuffer new Constant new: T // KO : A constant cannot be mutable.
|
||||
Channel new send(ListBuffer new) // KO : A mutable object can't be sent into a channel.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
constant n = 1
|
||||
constant s = {1,2,3}
|
||||
constant str = "immutable string"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
define PI = 3.14159; # compile-time defined constant
|
||||
const MSG = "Hello world!"; # run-time defined constant
|
||||
1
Task/Enforced-immutability/jq/enforced-immutability.jq
Normal file
1
Task/Enforced-immutability/jq/enforced-immutability.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
["a", "b"] as $a | $a[0] = 1 as $b | $a
|
||||
Loading…
Add table
Add a link
Reference in a new issue