list-util
1 List Utilities
make-list
weave
zip
7.0

list-util

Raymond Racine <[email protected]>

1 List Utilities

 (require list-util) package: list-util

procedure

(make-list len elem)  (Listof A)

  len : Integer
  elem : A
(All (a) Integer a -> (Listof a))

Create a list of length len by repeating the provided elem as necessary.

procedure

(weave elem lst)  (Listof A)

  elem : A
  lst : (Listof A)
(All (a) a (Listof a) -> (Listof a))

Weave an element strictly between two elements of the lst.

procedure

(zip as bs)  (Listof (Pair A B))

  as : (Listof A)
  bs : (Listof B)
(All (A B) (Listof A) (Listof B) -> (Listof (Pair A B)))

Return a list formed by pairing element by element from the two provided lists. The length of the returned list will be the same length of the shortest of the provided lists.