This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
-
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
Showing
5 changed files
with
81 additions
and
100 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
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 |
---|---|---|
@@ -1,10 +1 @@ | ||
mod http | ||
|
||
def Status | ||
OK | ||
NotFound | ||
BadRequest | ||
|
||
InternalServerError | ||
GatewayError | ||
end | ||
mod http |
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 |
---|---|---|
@@ -1 +1,10 @@ | ||
mod math | ||
mod math | ||
|
||
// Return the max of two numbers. | ||
def (a + b: int) max -> int | ||
if a > b | ||
ret a | ||
nf | ||
ret b | ||
end | ||
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 |
---|---|---|
@@ -1,56 +1,38 @@ | ||
mod str | ||
|
||
def Iter | ||
def (char) *count -> int | ||
|
||
def () *first -> char | ||
def () *back -> char | ||
def () *size -> int | ||
// Return the count of character in string | ||
def (src: str, tar: char) count -> int | ||
def count: int | ||
|
||
for i: int = 0; i < len(src); i += 1 | ||
if src[i] == tar | ||
count += 1 | ||
end | ||
end | ||
ret count | ||
end | ||
|
||
def And | ||
def (str) *add -> str | ||
def () *split -> []char | ||
// Return the front character of string | ||
def (src: str) front -> char | ||
ret src[0] | ||
end | ||
|
||
def String <- Iter + And | ||
def val: str | ||
|
||
def (x: char) count -> int | ||
if len(val) == 0 | ||
ret 0 | ||
end | ||
|
||
def i: int | ||
def c: int | ||
// Return the back character of string | ||
def (src: str) back -> char | ||
ret src[len(src) - 1] | ||
end | ||
|
||
def l: int = len(val) | ||
aop l > i | ||
if val[len(val) - l] == x | ||
c += 1 | ||
end | ||
l -= 1 | ||
// Loop to generate some random string | ||
def (lp: int) random_str -> []str | ||
if lp > 20 | ||
ret [] | ||
nf | ||
def res: [20]str | ||
|
||
for i: int = 0; lp > 0; lp -= 1 | ||
res[i] = randomStr(20, T) | ||
i += 1 | ||
end | ||
end | ||
ret c | ||
end | ||
|
||
def (x: str) add -> str | ||
ret val + x | ||
end | ||
|
||
def () first -> char | ||
ret val[0] | ||
end | ||
|
||
def () back -> char | ||
ret val[len(val) - 1] | ||
end | ||
|
||
def () size -> int | ||
ret len(val) | ||
end | ||
|
||
def () split -> []char | ||
ret [val[0], val[1], val[2]] | ||
end | ||
ret res | ||
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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
def Foo | ||
def () show | ||
puts("SHOW TIME!!") | ||
end | ||
def () show | ||
puts("SHOW TIME!!") | ||
end | ||
end | ||
|
||
do | ||
def i: int = 0 | ||
for i < 100 | ||
new Foo.show() | ||
i += 1 | ||
end | ||
def i: int = 0 | ||
aop i < 100 | ||
new Foo.show() | ||
i += 1 | ||
end |