From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from boeygen.nr.no ([156.116.1.2]) by hawkwind.utcs.toronto.edu with SMTP id <2060>; Wed, 15 Sep 1993 16:47:26 -0400 Received: from nr.no by boeygen.nr.no with SMTP (PP) id <19171-0@boeygen.nr.no>; Wed, 15 Sep 1993 22:47:10 +0200 To: rc@hawkwind.utcs.toronto.edu Subject: Re: list operators Date: Wed, 15 Sep 1993 16:47:08 -0400 From: Brynjulv Hauksson Message-ID: <"boeygen.nr.173:15.08.93.20.47.12"@nr.no> When I started using rc I thought it lacked some list operators, and eventually placed these definitions in my `.rcrc': # vshift var [num] -- shift $var num (default 1) places fn vshift {v = $1 n = $2 {* = $$v && shift $n && $v = $*}} # vrev var -- reverse the list in $var fn vrev {v = $1 d = () {* = $$v && for(i in $*){d = ($i $d)} && $v = $d}} # vchop var [num] -- remove last num (default 1) elems of $var fn vchop {v = $1 {vrev $v && vshift $v $2 && vrev $v}} There are probably faster, more elegant and/or more robust ways of doing it. I haven't worried much about it, since it turned out that I almost never use these functions anyway :-) - brynjulv