delete_first

func delete_first(ls : List+String) -> (Entity*List)+(Character*String)
  return [first(ls), rest(ls)]

Returns a list consisting of the first element of the given list or string as well as a copy of the given list or string, but without the first element. For example:
  delete_first(`abc') = [`a' `bc']
  delete_first([1 2 3]) = [1 [2 3]]
  delete_first([]) = []
A typical use is as follows:
  while Queue /= []
    head, Queue := delete_first(Queue)
    ...
    if ...
      Queue +:= [f(head), g(head)]
    end
    ...
  loop
See also: delete_last

Herman Venter

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