I may have missed this in the R5RS document but how do I create a list of lists in (Chicken) Scheme? I want to be able to take a list, a
, invoke (list-ref a b)
, assign the result to c
, and then invoke (list-ref c d)
, where b
and d
are index values.
Edit: For clarification, suppose I have these lists:
(define citrus (list "oranges" "limes"))
(define apples (list "macintosh" "rome" "delicious"))
And then I want to create a list called fruit
with the citrus
and apples
as list entries.
If you want to make a list containing those lists, just call list
with them as arguments:
(define fruit (list citrus apples))
(list-ref (list-ref fruit 0) 1)
=> "lime"