Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!SOPHIST.UCHICAGO.EDU!goer
From: goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz)
Newsgroups: comp.lang.icon
Subject: removing one or more elements from a list
Message-ID: <8909241809.AA17945@sophist.uchicago.edu>
Date: 24 Sep 89 18:09:33 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: inet
Organization: The Internet
Lines: 24

Having written some slow and inelegant code, I am left wondering
whether anyone has evolved other solutions to the problem of how
to remove a specific element from a list.

Basically, what I need to do is be able to remove a range of
members from a given list -

      removerange(lst,firstone,secondone)
        # returns lst[1:firstone] ||| lst[secondone+1:0]
        # unless firstone = 1 in which case, it returns
        # lst[secondone + 1:0]
        # same sort of thing when secondone = *lst
      end

Kinda cluttered-looking, when written out in full.  I tried a recur-
sive procedure where one element is removed for each element from
firstone to secondone.  That way I really needed only one procedure
to remove a single element, and one every loop.  But this was slow.

Anyone have any ideas?

                                        -Richard L. Goerwitz
                                        goer@sophist.uchicago.edu
                                        rutgers!oddjob!gide!sophist!goer