A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
2
Task/Enumerations/Fantom/enumerations-1.fantom
Normal file
2
Task/Enumerations/Fantom/enumerations-1.fantom
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// create an enumeration with named constants
|
||||
enum class Fruits { apple, banana, orange }
|
||||
7
Task/Enumerations/Fantom/enumerations-2.fantom
Normal file
7
Task/Enumerations/Fantom/enumerations-2.fantom
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// create an enumeration with explicit values
|
||||
enum class Fruits_
|
||||
{
|
||||
apple (1), banana (2), orange (3)
|
||||
const Int value
|
||||
private new make (Int value) { this.value = value }
|
||||
}
|
||||
11
Task/Enumerations/Groovy/enumerations.groovy
Normal file
11
Task/Enumerations/Groovy/enumerations.groovy
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
enum Fruit { apple, banana, cherry }
|
||||
|
||||
enum ValuedFruit {
|
||||
apple(1), banana(2), cherry(3);
|
||||
def value
|
||||
ValuedFruit(val) {value = val}
|
||||
String toString() { super.toString() + "(${value})" }
|
||||
}
|
||||
|
||||
println Fruit.values()
|
||||
println ValuedFruit.values()
|
||||
6
Task/Enumerations/Icon/enumerations.icon
Normal file
6
Task/Enumerations/Icon/enumerations.icon
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fruits := [ "apple", "banana", "cherry", "apple" ] # a list keeps ordered data
|
||||
fruits := set("apple", "banana", "cherry") # a set keeps unique data
|
||||
fruits := table() # table keeps an unique data with values
|
||||
fruits["apple"] := 1
|
||||
fruits["banana"] := 2
|
||||
fruits["cherry"] := 3
|
||||
1
Task/Enumerations/Inform-7/enumerations-1.inf
Normal file
1
Task/Enumerations/Inform-7/enumerations-1.inf
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fruit is a kind of value. The fruits are apple, banana, and cherry.
|
||||
6
Task/Enumerations/Inform-7/enumerations-2.inf
Normal file
6
Task/Enumerations/Inform-7/enumerations-2.inf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[sentence form]
|
||||
Fruit is a kind of value. The fruits are apple, banana, and cherry.
|
||||
A fruit has a number called numeric value.
|
||||
The numeric value of apple is 1.
|
||||
The numeric value of banana is 2.
|
||||
The numeric value of cherry is 3.
|
||||
8
Task/Enumerations/Inform-7/enumerations-3.inf
Normal file
8
Task/Enumerations/Inform-7/enumerations-3.inf
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[table form]
|
||||
Fruit is a kind of value. The fruits are defined by the Table of Fruits.
|
||||
|
||||
Table of Fruits
|
||||
fruit numeric value
|
||||
apple 1
|
||||
banana 2
|
||||
cherry 3
|
||||
4
Task/Enumerations/J/enumerations-1.j
Normal file
4
Task/Enumerations/J/enumerations-1.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
enum =: cocreate''
|
||||
( (;:'apple banana cherry') ,L:0 '__enum' ) =: i. 3
|
||||
cherry__enum
|
||||
2
|
||||
1
Task/Enumerations/J/enumerations-2.j
Normal file
1
Task/Enumerations/J/enumerations-2.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
fruit=: ;:'apple banana cherry'
|
||||
4
Task/Enumerations/J/enumerations-3.j
Normal file
4
Task/Enumerations/J/enumerations-3.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
2 { fruit
|
||||
+------+
|
||||
|cherry|
|
||||
+------+
|
||||
2
Task/Enumerations/J/enumerations-4.j
Normal file
2
Task/Enumerations/J/enumerations-4.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fruit i.<'banana'
|
||||
1
|
||||
4
Task/Enumerations/J/enumerations-5.j
Normal file
4
Task/Enumerations/J/enumerations-5.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(<'banana') +&.(fruit&i.) <'banana'
|
||||
+------+
|
||||
|cherry|
|
||||
+------+
|
||||
2
Task/Enumerations/JScript.NET/enumerations.net
Normal file
2
Task/Enumerations/JScript.NET/enumerations.net
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
enum fruits { apple, banana, cherry }
|
||||
enum fruits { apple = 0, banana = 1, cherry = 2 }
|
||||
6
Task/Enumerations/M4/enumerations.m4
Normal file
6
Task/Enumerations/M4/enumerations.m4
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
define(`enums',
|
||||
`define(`$2',$1)`'ifelse(eval($#>2),1,`enums(incr($1),shift(shift($@)))')')
|
||||
define(`enum',
|
||||
`enums(1,$@)')
|
||||
enum(a,b,c,d)
|
||||
`c='c
|
||||
11
Task/Enumerations/Mathematica/enumerations.mathematica
Normal file
11
Task/Enumerations/Mathematica/enumerations.mathematica
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
MapIndexed[Set, {A, B, F, G}]
|
||||
->{{1}, {2}, {3}, {4}}
|
||||
|
||||
A
|
||||
->{1}
|
||||
|
||||
B
|
||||
->{2}
|
||||
|
||||
G
|
||||
->{4}
|
||||
4
Task/Enumerations/Metafont/enumerations-1.metafont
Normal file
4
Task/Enumerations/Metafont/enumerations-1.metafont
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
vardef enum(expr first)(text t) =
|
||||
save ?; ? := first;
|
||||
forsuffixes e := t: e := ?; ?:=?+1; endfor
|
||||
enddef;
|
||||
5
Task/Enumerations/Metafont/enumerations-2.metafont
Normal file
5
Task/Enumerations/Metafont/enumerations-2.metafont
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
enum(1, Apple, Banana, Cherry);
|
||||
enum(5, Orange, Pineapple, Qfruit);
|
||||
show Apple, Banana, Cherry, Orange, Pineapple, Qfruit;
|
||||
|
||||
end
|
||||
1
Task/Enumerations/Modula-3/enumerations-1.mod3
Normal file
1
Task/Enumerations/Modula-3/enumerations-1.mod3
Normal file
|
|
@ -0,0 +1 @@
|
|||
TYPE Fruit = {Apple, Banana, Cherry};
|
||||
1
Task/Enumerations/Modula-3/enumerations-2.mod3
Normal file
1
Task/Enumerations/Modula-3/enumerations-2.mod3
Normal file
|
|
@ -0,0 +1 @@
|
|||
fruit := Fruit.Apple;
|
||||
2
Task/Enumerations/Modula-3/enumerations-3.mod3
Normal file
2
Task/Enumerations/Modula-3/enumerations-3.mod3
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
ORD(Fruit.Apple); (* Returns 0 *)
|
||||
VAL(0, Fruit); (* Returns Fruit.Apple *)
|
||||
Loading…
Add table
Add a link
Reference in a new issue