Clean up examples
This commit is contained in:
parent
7f30097d45
commit
2588715f98
@ -1,9 +1,10 @@
|
|||||||
cast = (download "https://api.sampleapis.com/futurama/cast")
|
raw_data = download("https://api.sampleapis.com/futurama/cast")
|
||||||
characters = (download "https://api.sampleapis.com/futurama/characters")
|
cast_data = from_json(raw_data)
|
||||||
episodes = (download "https://api.sampleapis.com/futurama/episodes")
|
|
||||||
|
|
||||||
cast_len = (length (from_json cast))
|
names = []
|
||||||
characters_len = (length (from_json characters))
|
|
||||||
episodes_len = (length (from_json episodes))
|
|
||||||
|
|
||||||
(output [cast_len, characters_len, episodes_len])
|
for cast_member in cast_data {
|
||||||
|
names += cast_member:name
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal("Billy West", names:0)
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
raw_data = download("https://api.sampleapis.com/futurama/cast")
|
|
||||||
cast_data = from_json(raw_data)
|
|
||||||
|
|
||||||
names = []
|
|
||||||
|
|
||||||
for cast_member in cast_data {
|
|
||||||
names += cast_member:name
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_equal("Billy West", names:0)
|
|
@ -1,12 +0,0 @@
|
|||||||
foo_or_bar = match random:boolean() {
|
|
||||||
true => "foo"
|
|
||||||
false => "bar"
|
|
||||||
}
|
|
||||||
|
|
||||||
num = match random:integer() {
|
|
||||||
1 => "one",
|
|
||||||
2 => { "two" },
|
|
||||||
* => "neither",
|
|
||||||
}
|
|
||||||
|
|
||||||
[foo_or_bar, num]
|
|
@ -1,22 +0,0 @@
|
|||||||
create_user = (fn email <str>, name <option(str)>) <map> {
|
|
||||||
{
|
|
||||||
email = email
|
|
||||||
username = (either_or name email)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
(assert_equal
|
|
||||||
{
|
|
||||||
email = "bob@example.com"
|
|
||||||
username = "bob"
|
|
||||||
},
|
|
||||||
(create_user "bob@example.com" some("bob"))
|
|
||||||
)
|
|
||||||
|
|
||||||
(assert_equal
|
|
||||||
{
|
|
||||||
email = "sue@example.com"
|
|
||||||
username = "sue@example.com"
|
|
||||||
},
|
|
||||||
(create_user "sue@example.com" none)
|
|
||||||
)
|
|
@ -1,10 +0,0 @@
|
|||||||
x = 1
|
|
||||||
y = "hello dust!"
|
|
||||||
z = 42.0
|
|
||||||
list = [3, 2, x]
|
|
||||||
big_list = [x, y, z, list]
|
|
||||||
foo = {
|
|
||||||
x = "bar"
|
|
||||||
y = 42
|
|
||||||
z = 0
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
i = 0
|
|
||||||
|
|
||||||
while i < 10 {
|
|
||||||
output(i)
|
|
||||||
i += 1
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
add_one = (numbers <[int]>) <[int]> {
|
|
||||||
new_numbers = []
|
|
||||||
|
|
||||||
for number in numbers {
|
|
||||||
new_numbers += number + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
new_numbers
|
|
||||||
}
|
|
||||||
|
|
||||||
foo = [1, 2, 3] -> add_one
|
|
||||||
|
|
||||||
assert_equal([2 3 4] foo)
|
|
Loading…
Reference in New Issue
Block a user