[comp.lang.icon] removing one or more elements from a list

goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) (09/25/89)

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