Phil M wrote:
Well I am a little bothered that the equivalent function was not
created to remove and return the first item of the array. PHP calls
this function array_shift() but I don't think that name describes the
function well enough... what other names can you think of that would
describe a Pop function for the first element in the array?
Chop? Decapitate? :)
Steve
--
Steve Roy <sroy at mac dot com>
<http://homepage.mac.com/sroy>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
From Sat 31 Dec 2005 11:20:29 -0700
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
Received: from lists.realsoftware.com (209.198.132.125) by realsoftware.com
with ESMTP (Eudora Internet Mail Server 3.1.3);
Sat, 31 Dec 2005 12:20:44 -0600
Received: from lists.realsoftware.com (localhost [127.0.0.1])
by lists.realsoftware.com (Postfix) with ESMTP
id B7AD3FA3191; Sat, 31 Dec 2005 12:20:35 -0600 (CST)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from tolisgroup.com (mail.tolisgroup.com [65.104.86.254])
by lists.realsoftware.com (Postfix) with SMTP id 9318DFA3182
for <realbasic-nug at lists dot realsoftware dot com>;
Sat, 31 Dec 2005 12:20:29 -0600 (CST)
Received: (qmail 17333 invoked from network); 31 Dec 2005 18:20:29 -0000
Received: from localhost (127.0.0.1)
by gw.tolisgroup.com (127.0.0.1) with ESMTP; 31 Dec 2005 18:20:29 -0000
Received: from 192.168.2.98 ( [192.168.2.98])
as user tjmac at localhost by 192.168.1.1 with HTTP;
Sat, 31 Dec 2005 11:20:29 -0700
Message-ID: <1136053229 dot 43b6cbed280a1 at 192 dot 168 dot 1 dot 1>
Date: Sat, 31 Dec 2005 11:20:29 -0700
From: tjmac at tolisgroup dot com
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
References: <8A00AF92-22BD-4908-9E90-603492F65776 at mobleybros dot com>
In-Reply-To: <8A00AF92-22BD-4908-9E90-603492F65776 at mobleybros dot com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 3.0
X-Originating-IP: 192.168.2.98
X-Sent-Via: Mitel Networks SME Server
Subject: Re: Do you use Array.Pop?
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com
Quoting Phil M <phil at mobleybros dot com>:
Isn't that a great function? It removes and returns the last element
in an array.
Array.Pop has been a lifesaver in processing the output from an Asynchronous
Shell process that gets line output, but the last line may be a parital line
that must be merged in the next loop's ReadAll call. Here's the code in my
DataAvailable event (thanks to Joe...):
// mBuffer is a String varialbe in the Shell's Parent window.
Self.mBuffer = Self.mBuffer + DefineEncoding(Me.ReadAll, Encodings.UTF8)
Self.runData = Split(Self.mBuffer, EndOfLine)
// take the last line and return it to the mBuffer so the next ReadAll()
// completes a potentially incomplete line.
Self.mBuffer = Self.runData.Pop
// Process the result
ProcessResult(runData)
Well I am a little bothered that the equivalent function was not
created to remove and return the first item of the array. PHP calls
this function array_shift() but I don't think that name describes the
function well enough... what other names can you think of that would
describe a Pop function for the first element in the array?
However, I can also see where a .Shift counterpart cound be a handy tool if
you're processing arguments that have been turned into and array and you want to
remove the ones that have been processed (much like shift in the sh shell).
Tim
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|