Confused???
[1/6] from: edanaii:cox at: 14-Jul-2002 12:33
I've created a small program to scan emails from my inbox. It works
fine until I try and remove them. Without the REMOVE command, it parses
all emails in the inbox. Once I add the REMOVE command, it takes several
passes to get everything cleared out.
The script looks like this:
Inbox: Open Load %Mailbox.r
Print [ Length? Inbox "messages on server." ]
ForAll Inbox [
Mail: Import-email First Inbox
Print [ Index? Inbox Mail/Subject ]
Remove Inbox
]
close inbox
The results look like this:
>> do %Test.r
5 messages on server.
1 And now, a massage from the Swedish Prime Minister!
2 She sells sea shells by the sea shore.
3 And now, for something completely different!
>> do %Test.r
2 messages on server.
1 Ask not what you can do for your country!
>> do %Test.r
1 messages on server.
1 Inna gadda davida, baby!
>> do %Test.r
0 messages on server.
Even if I wait five minutes, It still does this, so it's not a latency
issue.
What gives? Am I missing the obvious?
--
Sincerely, | The problems of two little people don't amount to
Ed Dana | a hill of beans in this crazy mixed-up world! But
Software Developer | this is OUR hill, and these are OUR beans!
1Ghz Athlon Amiga | -- Naked Gun via Casablanca.
[2/6] from: greggirwin:mindspring at: 14-Jul-2002 14:03
Hi Ed,
<< I've created a small program to scan emails from my inbox. It works
fine until I try and remove them. Without the REMOVE command, it parses
all emails in the inbox. Once I add the REMOVE command, it takes several
passes to get everything cleared out. >>
It's a combination of FORALL and REMOVE that's trippnig you up. FORALL steps
through the series (you can see the source for it BTW. It's a mezzanine)
using NEXT and REMOVE returns the series at the location *after* the remove,
so you're skipping every other element when you combine them.
>> b: [1 2 3 4 5 6]
== [1 2 3 4 5 6]
>> forall b [print first b remove b]
1
3
5
HTH!
--Gregg
[3/6] from: edanaii:cox at: 14-Jul-2002 13:47
Gregg Irwin wrote:
>Hi Ed,
>It's a combination of FORALL and REMOVE that's trippnig you up. FORALL steps
<<quoted lines omitted: 10>>
>5
>HTH!
Well it kinda helps. It tell's me why. But it don't tell me how to fix
the problem. :)
So what do you recomment I use to parse a mailbox if not ForAll? ForEach
won't work, unless I'm using it wrong. Which is quite possible.
--
Sincerely, | Tell me, tell me, where I'm going; I don't know
Ed Dana | where I've been. Tell me, tell me. Oh won't you
Software Developer | tell me, and then tell me again! My body's aching,
1Ghz Athlon Amiga | my heart is breaking and I don't know where to go!
| So tell me, tell me, why don't you tell me? I just
| gotta know! - Styx, Crystal Ball
[4/6] from: nitsch-lists::netcologne::de at: 14-Jul-2002 23:05
Am Sonntag, 14. Juli 2002 21:33 schrieb Ed Dana:
> I've created a small program to scan emails from my inbox. It works
> fine until I try and remove them. Without the REMOVE command, it parses
<<quoted lines omitted: 8>>
> Remove Inbox
> ]
(not tested)
while[not empty? Inbox] [
Mail: Import-email First Inbox
Print [ Index? Inbox Mail/Subject ]
Remove Inbox
]
if you don't want to remove everything
while[not empty? series][
either i-want-to-keep-it[
series: next series
][
remove series
]
]
> close inbox
> The results look like this:
<<quoted lines omitted: 14>>
> issue.
> What gives? Am I missing the obvious?
-Volker
[5/6] from: edanaii:cox at: 14-Jul-2002 14:46
Volker Nitsch wrote:
>(not tested)
> while[not empty? Inbox] [
<<quoted lines omitted: 10>>
> ]
> ]
That did the trick!
Thanks Volker.
I forgot all about the while loop. But I guess that's what happens when
you only get to spend about an hour a week on a new language. :)
--
Sincerely, |
Ed Dana | Courage is fear holding on a minute longer.
Software Developer | -- General George S. Patton
1Ghz Athlon Amiga |
[6/6] from: carl:cybercraft at: 15-Jul-2002 9:37
On 15-Jul-02, Ed Dana wrote:
> Gregg Irwin wrote:
>> Hi Ed,
<<quoted lines omitted: 17>>
> ForEach won't work, unless I'm using it wrong. Which is quite
> possible.
You could perhaps use while instead...
>> b: [1 2 3 4 5 6]
== [1 2 3 4 5 6]
>> while [not empty? b][print first b remove b]
1
2
3
4
5
6
== []
--
Carl Read
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted