1
0

Clean up examples

This commit is contained in:
Jeff 2024-01-30 00:01:16 -05:00
parent 7f30097d45
commit 2588715f98
7 changed files with 8 additions and 80 deletions

View File

@ -1,9 +1,10 @@
cast = (download "https://api.sampleapis.com/futurama/cast")
characters = (download "https://api.sampleapis.com/futurama/characters")
episodes = (download "https://api.sampleapis.com/futurama/episodes")
raw_data = download("https://api.sampleapis.com/futurama/cast")
cast_data = from_json(raw_data)
cast_len = (length (from_json cast))
characters_len = (length (from_json characters))
episodes_len = (length (from_json episodes))
names = []
(output [cast_len, characters_len, episodes_len])
for cast_member in cast_data {
names += cast_member:name
}
assert_equal("Billy West", names:0)

View File

@ -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)

View File

@ -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]

View File

@ -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)
)

View File

@ -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
}

View File

@ -1,6 +0,0 @@
i = 0
while i < 10 {
output(i)
i += 1
}

View File

@ -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)