forked from pascalabcnet/pascalabcnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1872434
commit 1b61879
Showing
14 changed files
with
739 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
procedure p(f: Func<string, IEnumerable<string>>); | ||
begin | ||
|
||
end; | ||
|
||
procedure p(f: Func<integer, IEnumerable<integer>>); | ||
begin | ||
var res := f(3).ToList(); | ||
assert(res.Count = 4); | ||
assert(res[0] = 0); | ||
assert(res[1] = 1); | ||
assert(res[2] = 4); | ||
assert(res[3] = 9); | ||
end; | ||
|
||
begin | ||
p(x -> Range(0, x).Select(y -> y * y)); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
procedure p(f: Func<integer, IEnumerable<integer>>); | ||
begin | ||
var res := f(5).ToList(); | ||
assert(res.Count = 5); | ||
assert(res[0] = 2); | ||
assert(res[1] = 3); | ||
assert(res[2] = 4); | ||
assert(res[3] = 5); | ||
assert(res[4] = 6); | ||
end; | ||
|
||
begin | ||
p(x -> Seq(1,2,3,4,5).Select(y -> Range(0, y).Select(z -> z).Count())); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
type cl = class | ||
public | ||
procedure p(f: Func<string, IEnumerable<string>>); | ||
begin | ||
|
||
end; | ||
|
||
procedure p(f: Func<integer, IEnumerable<integer>>); | ||
begin | ||
var res := f(3).ToList(); | ||
assert(res.Count = 4); | ||
assert(res[0] = 0); | ||
assert(res[1] = 1); | ||
assert(res[2] = 4); | ||
assert(res[3] = 9); | ||
end; | ||
|
||
procedure tt(); | ||
begin | ||
p(x -> Range(0, x).Select(y -> y * y)); | ||
end; | ||
end; | ||
|
||
begin | ||
(new cl()).p(x -> Range(0, x).Select(y -> y * y)); | ||
(new cl()).tt(); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
type cl = class | ||
public | ||
constructor(f: Func<string, IEnumerable<string>>); | ||
begin | ||
|
||
end; | ||
|
||
constructor (f: Func<integer, IEnumerable<integer>>); | ||
begin | ||
var res := f(3).ToList(); | ||
assert(res.Count = 4); | ||
assert(res[0] = 0); | ||
assert(res[1] = 1); | ||
assert(res[2] = 4); | ||
assert(res[3] = 9); | ||
end; | ||
|
||
end; | ||
|
||
begin | ||
new cl(x -> Range(0, x).Select(y -> y * y)); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
begin | ||
var a := 3; | ||
var ttt := Seq(1,2).Select(x -> begin | ||
var t := 5; | ||
result := Range(1,a+x).Select(y -> begin | ||
var g := 5; | ||
t += 5; | ||
result := Range(1,2).Where(f -> f + a > 0).Select(z -> z + g + t); | ||
end) | ||
end).ToList(); | ||
assert(ttt[0].ToList()[0].ToList()[0] = 31); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
type cl = class | ||
private gg := 9; | ||
public | ||
procedure h(k: integer); | ||
begin | ||
var a := 5; | ||
Seq(1,2,3).Select(x -> begin | ||
var t := 5; | ||
result := Range(1,a).Select(y -> begin | ||
var g := 5; | ||
writeln(a); | ||
result := Range(1,3).Where(f -> f + a > 0).Select(z -> z + g + t); | ||
end) | ||
end); | ||
end; | ||
end; | ||
|
||
begin | ||
(new cl).h(6); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
type cl = class | ||
protected gg:integer := 9; | ||
public | ||
function h(k: integer):string; | ||
begin | ||
var a := 5; | ||
foreach var tt in Seq(1,2,3) do | ||
begin | ||
var d := Seq(1,2,3).Select(x -> begin | ||
var e := 65; | ||
result := e + x + tt + self.gg + Range(1,2).Select(y -> gg + self.gg+y+a + tt).First() | ||
end).ToList(); | ||
assert(d[0] = 100 + (tt * 2 - 1)); | ||
end; | ||
end; | ||
end; | ||
|
||
begin | ||
(new cl).h(5); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
begin | ||
var yy := 5; | ||
Range(1,1).Select(x -> begin | ||
var l := x + yy; //6 | ||
begin | ||
writeln(l); | ||
begin | ||
writeln(l); | ||
end; | ||
end; | ||
writeln(yy); | ||
result := Range(1, x).Select(y -> y + l + yy + Seq(1,2).Select(z -> l + yy).First()) | ||
end); | ||
writeln(yy); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
procedure p<T>(aa: T); where T: class; | ||
begin | ||
var a := Seq(1,2,3).Select(x -> begin | ||
var tt := new List<T>(); | ||
writeln(aa); | ||
tt.Add(aa); | ||
result := tt.Select(y -> begin result := aa; writeln(aa) end).ToList() | ||
end).ToList(); | ||
end; | ||
|
||
begin | ||
p('sss'); | ||
end. |
Oops, something went wrong.