Script Library: 1213 scripts


REBOL [ Library: [ level: 'beginner platform: 'all type: 'function domain: 'ui tested-under: [ [View 1.3.2 on WinXP by Gregg] ] support: none license: 'MIT ] title: "Insert - Most Recently Used list idiom" file: %insert-mru.r author: "Gregg Irwin" email: %greggirwin--acm--org date: 30-Apr-2007 version: 0.0.1 purpose: { Insert an item in a series, where the series is treated as an MRU list. That is, the newest item is at the head, there are no duplicates (inserting a value removes the previous instance of that value if it exists), and the series may be limited to a specific size. If a new item causes the series to grow beyond that size, the last item is removed. It is often used with menus of recently accessed files. } ] insert-MRU: func [ "Insert value in series, removing first existing instance." series [series!] value /limit size [integer!] "Limit the series to the given size by removing the last item." ] [ remove find/only series value insert/only series value if all [size size < length? series] [remove back tail series] series ]
halt ;; to terminate script if DO'ne from webpage
  • email address(es) have been munged to protect them from spam harvesters. If you are a Library member, you can log on and view this script without the munging.
  • (greggirwin:acm:org)