List
Use literals
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the exit status should be 0.
Examples
value |
---|
() |
(1) |
(1 2) |
(1 2 3) |
((1) (2 2) (3 3 3)) |
Create a pair
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the exit status should be 0.
Create a pair with a non-cons cdr
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the exit status should be 0.
Create a list
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the exit status should be 0.
Use a for-each
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “ABC”.
Use a for-each
procedure with two lists
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “BDF”.
Use a for-each
procedure with three lists
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “FIL”.
Use a map
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “ABC”.
Use a map
procedure with two lists
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “BDF”.
Use a map
procedure with three lists
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “FIL”.
Use a map
procedure with uneven lists
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “BDF”.
Use an append
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
values | output |
---|---|
’(65) | A |
’(65) ‘(66) | AB |
’(65) ‘(66) ‘(67) | ABC |
’(65 66) ‘(67 68) | ABCD |
Share the last argument in an append
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “AAAB”.
Use a memq
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
value | values | output |
---|---|---|
1 | B | |
1 | 1 | A |
2 | 1 | B |
1 | 1 2 | A |
2 | 1 2 | A |
3 | 1 2 | B |
1 | 1 2 3 | A |
4 | 1 2 3 | B |
Use a memv
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
value | values | output |
---|---|---|
#\A | B | |
#\A | #\A | A |
#\B | #\A | B |
#\A | #\A #\B | A |
#\B | #\A #\B | A |
#\C | #\A #\B | B |
#\A | #\A #\B #\C | A |
#\D | #\A #\B #\C | B |
Use a member
procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
value | values | output |
---|---|---|
’(1) | B | |
’(1) | (1) | A |
’(2) | (1) | B |
’(1) | (1) (2) | A |
’(2) | (1) (2) | A |
’(3) | (1) (2) | B |
’(1) | (1) (2) (3) | A |
’(4) | (1) (2) (3) | B |
Get a value from an association list
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “A”.
Examples
procedure |
---|
assq |
assv |
assoc |
Get a value from an association list of characters
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “A”.
Examples
procedure |
---|
assv |
assoc |
Check if a value is a pair
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
value | output |
---|---|
#f | B |
’() | B |
’(1) | A |
’(1 2) | A |
(cons 1 2) | A |
Check if a value is null
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
value | output |
---|---|
#f | B |
’() | A |
’(1) | B |
’(1 2) | B |
(cons 1 2) | B |
Check if a value is a list
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “<output>”.
Examples
value | output |
---|---|
#f | B |
’() | A |
’(1) | A |
’(1 2) | A |
(cons 1 2) | B |
Apply a cxr procedure
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “A”.
Examples
procedure | value |
---|---|
car | (65) |
cdr | (66 . 65) |
caar | ((65)) |
cadr | (66 65) |
cdar | ((66 . 65)) |
cddr | (66 66 . 65) |
caaar | (((65))) |
caadr | (66 (65)) |
cadar | ((66 . (65))) |
caddr | (66 66 65) |
cdaar | (((66 . 65))) |
cdadr | (66 (66 . 65)) |
cddar | ((66 66 . 65)) |
cdddr | (66 66 66 . 65) |
cadddr | (66 66 66 65) |
Copy a list
Given a file named “main.scm” with:
When I successfully run scheme main.scm
Then the stdout should contain exactly “A”.
Examples
value |
---|
#f |
’() |
‘(1) |
‘(1 . 2) |
‘(1 2) |
‘(1 2 . 3) |