• 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: I want to convert a list of integers to their negative self
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I want to convert a list of integers to their negative self


  • Subject: Re: I want to convert a list of integers to their negative self
  • From: Emmanuel <email@hidden>
  • Date: Wed, 28 Feb 2001 15:58:56 -0600

At 18:38 -0600 9/05/00, Jacco Rens wrote:
>
>Hi all,
>
>I want to convert a list of integers to their negative self
>
>{"1", "3", "7", "", ""}
>
>To:
>
>{"-1", "-3", "-7", "", ""}

Here is a first start:

------------------------ tested, OS 9.0.4
set theList to {"1", "3", "7", "", ""}
repeat with theItem in theList
set contents of theItem to "" & (-1 * theItem)
end repeat
theList
-- {"-1", "-3", "-7", "0", "0"}
------------------------

This will not do exactly what you expect, because:
- empty strings will turn into zeros
- non-numeric strings will generate errors.

So, you may have to customize a little bit.

HTH
Emmanuel


  • Prev by Date: Re: Display Dialog
  • Next by Date: [OFF] Re: Records
  • Previous by thread: Re: I want to convert a list of integers to their negative self
  • Next by thread: Re: I want to convert a list of integers to their negative self
  • Index(es):
    • Date
    • Thread