• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Snippet to remove an item from a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Snippet to remove an item from a list


  • Subject: Re: Snippet to remove an item from a list
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 10 Jul 2001 10:05:12 -0700

On 7/10/01 6:51 AM, "Arthur J Knapp" <email@hidden> wrote:

> Allow me to be even more alternative:
>
> on DeleteAt(lst, x)
> tell lst to if x = 1 then
> rest
> else if (x = length) then
> items 1 thru -2
> else
> (items 1 thru (x - 1)) & (items (x + 1) thru -1)
> end if
> end DeleteAt
>
>
> Here are some new creations:
>
> on InsertAt(lst, x, val)
> tell lst to if x = 1 then
> {val} & it
> else if x > length then
> it & {val}
> else
> items 1 thru (x - 1) & {val} & items x thru -1
> end if
> end InsertAt
>
> on IndexOf(lst, itm)
> set x to 1
> tell no & lst to if {itm} is in it then repeat until item x = itm
> set x to x + 1
> end repeat
> x - 1
> end IndexOf
>


Aaagh! The ghost of richard23 is come again...


--
Paul Berkowitz


References: 
 >Re: Snippet to remove an item from a list (From: Arthur J Knapp <email@hidden>)

  • Prev by Date: Re: Snippet to remove an item from a list
  • Next by Date: Re: verbose logging in SMILE v1.8
  • Previous by thread: Re: Snippet to remove an item from a list
  • Next by thread: Re: Snippet to remove an item from a list
  • Index(es):
    • Date
    • Thread