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
5
Task/Compound-data-type/Axe/compound-data-type-1.axe
Normal file
5
Task/Compound-data-type/Axe/compound-data-type-1.axe
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Lbl POINT
|
||||
r₂→{r₁}ʳ
|
||||
r₃→{r₁+2}ʳ
|
||||
r₁
|
||||
Return
|
||||
1
Task/Compound-data-type/Axe/compound-data-type-2.axe
Normal file
1
Task/Compound-data-type/Axe/compound-data-type-2.axe
Normal file
|
|
@ -0,0 +1 @@
|
|||
POINT(L₁,5,10)
|
||||
12
Task/Compound-data-type/EchoLisp/compound-data-type.echolisp
Normal file
12
Task/Compound-data-type/EchoLisp/compound-data-type.echolisp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(lib 'struct)
|
||||
(struct Point (x y))
|
||||
(Point 3 4)
|
||||
→ #<Point> (3 4)
|
||||
|
||||
;; run-time type checking is possible
|
||||
(lib 'types)
|
||||
(struct Point (x y))
|
||||
(struct-type Point Number Number)
|
||||
(Point 3 4)
|
||||
(Point 3 'albert)
|
||||
❌ error: #number? : type-check failure : albert → 'Point:y'
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Type Point
|
||||
As Integer x, y
|
||||
End Type
|
||||
|
||||
Dim p As Point = (1, 2)
|
||||
Dim p2 As Point = (3, 4)
|
||||
Print p.x, p.y
|
||||
Print p2.x, p2.y
|
||||
Sleep
|
||||
3
Task/Compound-data-type/LFE/compound-data-type.lfe
Normal file
3
Task/Compound-data-type/LFE/compound-data-type.lfe
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(defrecord point
|
||||
x
|
||||
y)
|
||||
14
Task/Compound-data-type/Lasso/compound-data-type.lasso
Normal file
14
Task/Compound-data-type/Lasso/compound-data-type.lasso
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
define Point => type {
|
||||
parent pair
|
||||
|
||||
public onCreate(x,y) => {
|
||||
..onCreate(#x=#y)
|
||||
}
|
||||
|
||||
public x => .first
|
||||
public y => .second
|
||||
}
|
||||
|
||||
local(point) = Point(33, 42)
|
||||
#point->x
|
||||
#point->y
|
||||
8
Task/Compound-data-type/Lingo/compound-data-type-1.lingo
Normal file
8
Task/Compound-data-type/Lingo/compound-data-type-1.lingo
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- parent script "MyPoint"
|
||||
property x
|
||||
property y
|
||||
on new (me, px, py)
|
||||
me.x = px
|
||||
me.y = py
|
||||
return me
|
||||
end
|
||||
3
Task/Compound-data-type/Lingo/compound-data-type-2.lingo
Normal file
3
Task/Compound-data-type/Lingo/compound-data-type-2.lingo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
p = script("MyPoint").new(23, 42)
|
||||
put p.x, p.y
|
||||
-- 23 42
|
||||
4
Task/Compound-data-type/Lingo/compound-data-type-3.lingo
Normal file
4
Task/Compound-data-type/Lingo/compound-data-type-3.lingo
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- in some movie script
|
||||
on MyPoint (x, y)
|
||||
return script("MyPoint").new(x, y)
|
||||
end
|
||||
3
Task/Compound-data-type/Lingo/compound-data-type-4.lingo
Normal file
3
Task/Compound-data-type/Lingo/compound-data-type-4.lingo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
p = MyPoint(23, 42)
|
||||
put p.x, p.y
|
||||
-- 23 42
|
||||
4
Task/Compound-data-type/Nim/compound-data-type.nim
Normal file
4
Task/Compound-data-type/Nim/compound-data-type.nim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
type Point = tuple[x, y: int]
|
||||
|
||||
var p: Point = (12, 13)
|
||||
var p2: Point = (x: 100, y: 200)
|
||||
1
Task/Compound-data-type/Oforth/compound-data-type.oforth
Normal file
1
Task/Compound-data-type/Oforth/compound-data-type.oforth
Normal file
|
|
@ -0,0 +1 @@
|
|||
Object Class new: Point(x, y)
|
||||
15
Task/Compound-data-type/Phix/compound-data-type.phix
Normal file
15
Task/Compound-data-type/Phix/compound-data-type.phix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
enum x,y
|
||||
type point(object p)
|
||||
return sequence(p) and length(p)=y and atom(p[x]) and atom(p[y])
|
||||
end type
|
||||
|
||||
point p = {175,3.375}
|
||||
|
||||
p[x] -= p[y]*20
|
||||
|
||||
puts(1,"point p is ")
|
||||
?p
|
||||
printf(1,"p[x]:%g, p[y]:%g\n",{p[x],p[y]})
|
||||
|
||||
p[x] = 0 -- fine
|
||||
p[y] = "string" -- run-time error
|
||||
1
Task/Compound-data-type/Ring/compound-data-type-1.ring
Normal file
1
Task/Compound-data-type/Ring/compound-data-type-1.ring
Normal file
|
|
@ -0,0 +1 @@
|
|||
see new point {x=10 y=20} class point x y
|
||||
2
Task/Compound-data-type/Ring/compound-data-type-2.ring
Normal file
2
Task/Compound-data-type/Ring/compound-data-type-2.ring
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
x: 10.000000
|
||||
y: 20.000000
|
||||
4
Task/Compound-data-type/Shen/compound-data-type-1.shen
Normal file
4
Task/Compound-data-type/Shen/compound-data-type-1.shen
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(datatype point
|
||||
X : number; Y : number;
|
||||
====================
|
||||
[point X Y] : point;)
|
||||
2
Task/Compound-data-type/Shen/compound-data-type-2.shen
Normal file
2
Task/Compound-data-type/Shen/compound-data-type-2.shen
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(2+) (@p 1 2)
|
||||
(@p 1 2) : (number * number)
|
||||
3
Task/Compound-data-type/Sidef/compound-data-type.sidef
Normal file
3
Task/Compound-data-type/Sidef/compound-data-type.sidef
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
struct Point {x, y};
|
||||
var point = Point(1, 2);
|
||||
say point.y; #=> 2
|
||||
19
Task/Compound-data-type/Swift/compound-data-type.swift
Normal file
19
Task/Compound-data-type/Swift/compound-data-type.swift
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Structure
|
||||
struct Point {
|
||||
var x:Int
|
||||
var y:Int
|
||||
}
|
||||
|
||||
// Tuple
|
||||
typealias PointTuple = (Int, Int)
|
||||
|
||||
// Class
|
||||
class PointClass {
|
||||
var x:Int!
|
||||
var y:Int!
|
||||
|
||||
init(x:Int, y:Int) {
|
||||
self.x = x
|
||||
self.y = y
|
||||
}
|
||||
}
|
||||
1
Task/Compound-data-type/jq/compound-data-type-1.jq
Normal file
1
Task/Compound-data-type/jq/compound-data-type-1.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"x":1, "y":2}
|
||||
1
Task/Compound-data-type/jq/compound-data-type-2.jq
Normal file
1
Task/Compound-data-type/jq/compound-data-type-2.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"x":1, "y":2, type: "Point"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue