rep

func rep(ls : List+String, n : Integer) -> List+String 
  return reduce(`+', [[]]+[all ls for i in [1..n]]) when ls in List
  return reduce(`+', [`']+[all ls for i in [1..n]])

Replicates a given list or string. For example:
  rep(`ab' 3) = `ababab'
  rep([1 2 3] 4) = [1 2 3 1 2 3 1 2 3 1 2 3]
  rep([1 2 3 4] 0) = []
  rep(`abc' -3) = `'

Herman Venter

This is Slim documentation as snarfed on 27 May 1999 by dB.