Hacker News new | ask | show | jobs
by draegtun 4594 days ago
Rebol comes with first & last but not the others.

  >> a: [1 2 3 4]
  == [1 2 3 4]

  >> first a
  == 1

  >> last a
  == 4
This is how you could add rest & most:

  >> rest: func [s] [next s] 
  >> most: func [s] [copy/part s back tail s]

  >> rest a
  == [2 3 4]

  >> most a                                  
  == [1 2 3]
Rebol unifies all this under what it calls a series - http://www.rebol.com/docs/core23/rebolcore-6.html