Re: the Holy Grail of AppleScript lists
Re: the Holy Grail of AppleScript lists
- Subject: Re: the Holy Grail of AppleScript lists
- From: Paul Skinner <email@hidden>
- Date: Thu, 20 Mar 2003 08:46:21 -0500
On Wednesday, March 19, 2003, at 05:38 PM, has wrote:
Paul Skinner wrote:
-->list of 8291 items.
Nothing very remarkable in this. Despite what the Standard Additions
dictionary might claim, the 'do shell script' command returns Unicode
text, not a string. The ~4000-item stack overflow problem only affects
the latter type.
You say that as if it's common knowledge. Did I miss the memo?
This is a constant issue for me and I'm sure it is for others. Being
able to side step it just by adding 'as unicode text' seems far better
than chunking through 4k items at a time.
I'm glad to see things like this are getting resolved. It's
embarrassing to have to explain these issues to perl people...'you have
to do WHAT?'
Other stuff:
- Re. using the shell to sort: while quicker at sorting strings than a
native sort routine, it'll never make a good general-purpose list sort
for AppleScript, given that what comes out isn't necessarily what went
in. The shell's own sort command's usefulness in sorting text is also
limited, given that it reserves the line feed character for its own
nefarious purposes and only understands characters in the ASCII 0-127
range anyway. If you attempt to sort text containing any other
characters, you'll get bad results - Perl or Python might be a better
bet.
Perl is the way I plan to go for a full featured sort handler.
However, the shell sort is very useful. Very frequently I sort a short
list of text or numbers. sort has less overhead than perl and handles
simple sorts fast and easily.
'both please.'
- Remember to use 'quoted form of theString' when including it in the
shell script. (Every 'do shell script' user should get this reminder
tattooed on their hands where they won't keep forgetting it.)
Too true. In my OP I was trying to pare the script down to the minimum
required to reproduce the effect that I was finding.
- I fail to see your problem with using Serge's quicksort library just
because the code behind it is large and complicated. (I can assure you
that the code behind the sort commands in the shell, Python, Perl,
etc. is a heck of a lot larger and more complicated than this.) It's
not like you have to look at any of it - never mind understand it all
- in order to use it. Its interface may not be perfect, but it's well
documented and easy enough to use, and it takes just one more line of
code to bind it to your script:
property SortLib : load script (alias "path to quicksort library")
...
set sortedList to SortLib's quicksort(myList)
(Perl and Python users, for example, have absolutely no problem with
libraries, so - lack of a convenient 'import' command for the
terminally lazy notwithstanding - I'm not sure why so many AS users
should have such a hangup over the things. Go figure.)
has
has, I assure you that I have no such hangups. I also have no problem
with Serge's quicksort. Perhaps I shouldn't have used the word
'colossal' in describing it. How about 'robust', 'well documented' and
'full featured' hmmm... 'big boned', 'great personality' ; )?
Applescript is not the most powerful text processing language; I'm
just trying to play to my available application's strengths.
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.