1. Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 418 views
This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C3D89F.4EEED320 charset="iso-8859-1" Hello all, Two function for delimited data, one uses match( ) recursively and the other find( ). (The first came from an idea by Brian Broker the second, Ron Austin) Maybe someday, someone will test which one wins..? If there are faster ways, I would appreciate the hand up... global function sDelimited(sequence s, integer delimiter) -- returns: sequence containing indices of all matches -- if unsuccessful return empty sequence {} object found sequence dl, dseq integer start, endx dl = repeat(dl, 1) found = match(dl, s) if found then found &= found + sDelimited(s[found+1..length(s)], delimiter) else return {} end if dseq = {} start = 1 for i = 1 to length(found) do endx = found[i] dseq &= {s[start...endx]} start = endx + 1 end for return dseq end function global function sDelimited(sequence s, integer delimiter) integer len, start, endx sequence dseq len = length(s) dl = repeat(delimiter, 1) start = 1 for i = 1 to len do if equal(s[i..i],dl) then endx = i - 1 dseq &= {s[start..endx]} start = i + 1 end if end for return dseq end function Purpose: to return nested sequence using delimiter chars salted throughout a flat sequence. Regards, Euman ------=_NextPart_000_0005_01C3D89F.4EEED320 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1276" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Hello all,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Two function for delimited data, one uses match( ) recursively and the other find( ).</FONT></DIV> <DIV><FONT face=Arial size=2>(The first came from an idea by Brian Broker the second, Ron Austin)</FONT></DIV> <DIV><FONT face=Arial size=2><FONT size=3> </FONT></FONT></DIV> <DIV><FONT face=Arial size=2>Maybe someday, someone will test which one wins..?</FONT></DIV> <DIV><FONT face=Arial size=2>If there are faster ways, I would appreciate the hand up...</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>global function sDelimited(sequence s, integer delimiter)<BR>-- returns: sequence containing indices of all matches<BR>-- if unsuccessful return empty sequence {}<BR> object found <BR> sequence dl, dseq<BR> integer start, endx<BR> <BR> dl = repeat(dl, 1)<BR> found = match(dl, s)<BR> if found then<BR> found &= found + sDelimited(s[found+1..length(s)], delimiter)<BR> else<BR> return {}<BR> end if<BR> dseq = {}<BR> start = 1<BR> for i = 1 to length(found) do<BR> endx = found[i]<BR> dseq &= {s[start...endx]}<BR> start = endx + 1<BR> end for<BR> return dseq<BR>end function</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>global function sDelimited(sequence s, integer delimiter)<BR>integer len, start, endx</FONT></DIV> <DIV><FONT face=Arial size=2>sequence dseq</FONT></DIV><FONT face=Arial size=2> <DIV><BR> len = length(s)<BR> dl = repeat(delimiter, 1)<BR> start = 1<BR> for i = 1 to len do<BR> if equal(s[i..i],dl) then<BR> endx = i - 1<BR> dseq &= {s[start..endx]}<BR> start = i + 1<BR> end if<BR> end for<BR> return dseq<BR>end function</DIV> <DIV> </DIV> <DIV>Purpose: to return nested sequence using delimiter chars salted throughout a flat sequence.</DIV> <DIV> </DIV> <DIV>Regards,</DIV> ------=_NextPart_000_0005_01C3D89F.4EEED320--
2. Re: Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 413 views
This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C3D8A0.313045C0 charset="iso-8859-1" Hello again all, Two function for delimited data, one uses match( ) recursively and the other equal( ). (The first came from an idea by Brian Broker the second, Ron Austin) find isnt used here, sorry Purpose: to return nested sequence using delimiter chars salted throughout a flat sequence. Whoops ----- Original Message ----- From: Euman To: EuForum at topica.com Sent: Monday, January 12, 2004 12:02 AM Subject: Faster please.... Hello all, Two function for delimited data, one uses match( ) recursively and the other find( ). (The first came from an idea by Brian Broker the second, Ron Austin) Maybe someday, someone will test which one wins..? If there are faster ways, I would appreciate the hand up... global function sDelimited(sequence s, integer delimiter) -- returns: sequence containing indices of all matches -- if unsuccessful return empty sequence {} object found sequence dl, dseq integer start, endx dl = repeat(dl, 1) found = match(dl, s) if found then found &= found + sDelimited(s[found+1..length(s)], delimiter) else return {} end if dseq = {} start = 1 for i = 1 to length(found) do endx = found[i] dseq &= {s[start...endx]} start = endx + 1 end for return dseq end function global function sDelimited(sequence s, integer delimiter) integer len, start, endx sequence dseq len = length(s) dl = repeat(delimiter, 1) start = 1 for i = 1 to len do if equal(s[i..i],dl) then endx = i - 1 dseq &= {s[start..endx]} start = i + 1 end if end for return dseq end function Regards, Euman ------=_NextPart_000_0005_01C3D8A0.313045C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1276" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2> <DIV><FONT face=Arial size=2>Hello again all,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Two function for delimited data, one uses match( ) recursively and the other equal( ).</FONT></DIV> <DIV><FONT face=Arial size=2>(The first came from an idea by Brian Broker the second, Ron Austin)</FONT></DIV> <DIV> </DIV> <DIV>find isnt used here, sorry</DIV> <DIV>Purpose: to return nested sequence using delimiter chars salted throughout a flat sequence.</DIV> <DIV> </DIV> <DIV>Whoops</DIV> <DIV> </DIV> <DIV> </DIV></FONT></DIV> <DIV style="FONT: 10pt arial">----- Original Message ----- <DIV style="BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A title=euman at bellsouth.net href="mailto:euman at bellsouth.net">Euman</A> </DIV> <DIV><B>To:</B> <A title=EuForum at topica.com href="mailto:EuForum at topica.com">EuForum at topica.com</A> </DIV> <DIV><B>Sent:</B> Monday, January 12, 2004 12:02 AM</DIV> <DIV><B>Subject:</B> Faster please....</DIV></DIV> <DIV><BR></DIV> <DIV><FONT face=Arial size=2>Hello all,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Two function for delimited data, one uses match( ) recursively and the other find( ).</FONT></DIV> <DIV><FONT face=Arial size=2>(The first came from an idea by Brian Broker the second, Ron Austin)</FONT></DIV> <DIV><FONT face=Arial size=2><FONT size=3></FONT></FONT> </DIV> <DIV><FONT face=Arial size=2>Maybe someday, someone will test which one wins..?</FONT></DIV> <DIV><FONT face=Arial size=2>If there are faster ways, I would appreciate the hand up...</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>global function sDelimited(sequence s, integer delimiter)<BR>-- returns: sequence containing indices of all matches<BR>-- if unsuccessful return empty sequence {}<BR> object found <BR> sequence dl, dseq<BR> integer start, endx<BR> <BR> dl = repeat(dl, 1)<BR> found = match(dl, s)<BR> if found then<BR> found &= found + sDelimited(s[found+1..length(s)], delimiter)<BR> else<BR> return {}<BR> end if<BR> dseq = {}<BR> start = 1<BR> for i = 1 to length(found) do<BR> endx = found[i]<BR> dseq &= {s[start...endx]}<BR> start = endx + 1<BR> end for<BR> return dseq<BR>end function</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>global function sDelimited(sequence s, integer delimiter)<BR>integer len, start, endx</FONT></DIV> <DIV><FONT face=Arial size=2>sequence dseq</FONT></DIV><FONT face=Arial size=2> <DIV><BR> len = length(s)<BR> dl = repeat(delimiter, 1)<BR> start = 1<BR> for i = 1 to len do<BR> if equal(s[i..i],dl) then<BR> endx = i - 1<BR> dseq &= {s[start..endx]}<BR> start = i + 1<BR> end if<BR> end for<BR> return dseq<BR>end function</DIV> <DIV> </DIV> <DIV>Regards,</DIV> ------=_NextPart_000_0005_01C3D8A0.313045C0--
3. Re: Faster please....
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 12, 2004
- 401 views
On Mon, 12 Jan 2004 00:02:03 -0500, Euman <euman at bellsouth.net> wrote: >If there are faster ways... Well, first you need to download and install the interpreter from www.rapideuphoria.com Then you need to copy the code into a text editor. Notepad or the one which comes with euphoria (ed) is fine. For some hints, see http://www.rapideuphoria.com/what2do.htm I think you're old enough/not too old to have your bottom smacked for posting completely untested code on the forum... er no, that's not an offer, besides, <lie mode>I live in Peru</lie mode>. >Purpose: to return nested sequence using delimiter chars salted throughout a >flat sequence. To say that is as clear as mud is an insult to mud. Actually, why not just use sprint and get? HTH, Pete
4. Re: Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 415 views
You are absolutly correct Pete, I should have tested the routines thoroughly. Here are two version (that run fine) Im hopeing for a challenger that will provide a faster routine or tweak the existing code (below) Have fun! global function sDelimited1(sequence s1, sequence s2) integer len, start, endx sequence dseq,dl -- didn't define dl dseq=3D{} -- didn't initialize this len =3D length(s2) start =3D 1 for i =3D 1 to len do if equal(s2[i..i],s1) then endx =3D i - 1 dseq &=3D {s2[start..endx]} start =3D i + 1 end if end for return dseq end function function sNest(sequence s1, sequence s2) integer start, endx sequence dseq dseq =3D {} start =3D 1 for i =3D 1 to length(s1) do endx =3D s1[i] dseq &=3D {s2[start..endx-1]} start =3D endx + 1 end for return dseq end function function sDelimited( sequence s1, sequence s2 ) object found found =3D match( s1, s2 ) if found then found &=3D found + sDelimited( s1, s2[found+1..length(s2)] ) else return {} end if return found end function ----------- test function --------- sequence dl, test object data integer stop atom t dl=3Drepeat(127,1) t =3D time() for i =3D 1 to 10000 do test =3D "Euman"&dl&"Euphoria"&dl&"Programmer"&dl&"this is a test"&dl --uncomment to run the other method (which is only a few hundredths of a se= c -- faster than the first routine...) --data=3DsNest(sDelimited("=7F", test), test) -- make sure you comment out the next line when running the above routine! data=3DsDelimited1("=7F", test) end for t =3D time() - t puts(1, sprintf("%2.3f", t)&'\n') for i=3D1 to 4 do puts(1, data[i]&'\n') end for stop=3Dgetc(0) Euman
5. Re: Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 420 views
What the hell put those 3D characters in there? > dseq=3D{} > > len =3D length(s2) > start =3D 1 > for i =3D 1 to len do > if equal(s2[i..i],s1) then > endx =3D i - 1 > dseq &=3D {s2[start..endx]} > start =3D i + 1
6. Re: Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 401 views
Darned Outlook, now it shouldnt have those 3D in there, Im now sending plaintext instead of html. I dont know how that couldve changed on its own.. Heres the code again for the last time global function sDelimited1(sequence s1, sequence s2) integer len, start, endx sequence dseq,dl -- didn't define dl dseq=3D{} -- didn't initialize this len =3D length(s2) start =3D 1 for i =3D 1 to len do if equal(s2[i..i],s1) then endx =3D i - 1 dseq &=3D {s2[start..endx]} start =3D i + 1 end if end for return dseq end function function sNest(sequence s1, sequence s2) integer start, endx sequence dseq dseq =3D {} start =3D 1 for i =3D 1 to length(s1) do endx =3D s1[i] dseq &=3D {s2[start..endx-1]} start =3D endx + 1 end for return dseq end function function sDelimited( sequence s1, sequence s2 ) -- returns: sequence containing indices of all matches -- if unsuccessful return empty sequence {} object found found =3D match( s1, s2 ) if found then found &=3D found + sDelimited( s1, s2[found+1..length(s2)] ) else return {} end if return found end function ----------- test function --------- sequence dl, test object data integer stop atom t dl=3Drepeat(127,1) t =3D time() for i =3D 1 to 10000 do test =3D "Euman"&dl&"Euphoria"&dl&"Programmer"&dl&"this is a test"&dl -- comment / uncomment --data=3DsNest(sDelimited("=7F", test), test) data=3DsDelimited1("=7F", test) ---------------------------- end for t =3D time() - t puts(1, sprintf("%2.3f", t)&'\n') for i=3D1 to 4 do puts(1, data[i]&'\n') end for stop=3Dgetc(0) Euman
7. Re: Faster please....
- Posted by euphoric <euphoric at cklester.com> Jan 12, 2004
- 416 views
Euman wrote: > > >Darned Outlook, now it shouldnt have those 3D in there, >Im now sending plaintext instead of html. I dont know how >that couldve changed on its own.. > >Heres the code again for the last time > >global function sDelimited1(sequence s1, sequence s2) >integer len, start, endx >sequence dseq,dl -- didn't define dl >dseq=3D{} -- didn't initialize this > > len =3D length(s2) > > Please strip the "3D" extraneous characters, Euman.
8. Re: Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 405 views
From: "C. K. Lester" <euphoric at cklester.com> > Euman wrote: > > > snip > Please strip the "3D" extraneous characters, Euman. > Sorry, Hope this one gets to you without the 3D's... <snip> global function sDelimited1(sequence s1, sequence s2) integer len, start, endx sequence dseq,dl -- didn't define dl dseq=3D{} -- didn't initialize this len =3D length(s2) start =3D 1 for i =3D 1 to len do if equal(s2[i..i],s1) then endx =3D i - 1 dseq &=3D {s2[start..endx]} start =3D i + 1 end if end for return dseq end function function sNest(sequence s1, sequence s2) integer start, endx sequence dseq dseq =3D {} start =3D 1 for i =3D 1 to length(s1) do endx =3D s1[i] dseq &=3D {s2[start..endx-1]} start =3D endx + 1 end for return dseq end function function sDelimited( sequence s1, sequence s2 ) -- returns: sequence containing indices of all matches -- if unsuccessful return empty sequence {} object found found =3D match( s1, s2 ) if found then found &=3D found + sDelimited( s1, s2[found+1..length(s2)] ) else return {} end if return found end function ----------- test function --------- sequence dl, test object data integer stop atom t dl=3Drepeat(127,1) t =3D time() for i =3D 1 to 10000 do test =3D "Euman"&dl&"Euphoria"&dl&"Programmer"&dl&"this is a test"&dl -- comment / uncomment --data=3DsNest(sDelimited("=7F", test), test) data=3DsDelimited1("=7F", test) end for t =3D time() - t puts(1, sprintf("%2.3f", t)&'\n') for i=3D1 to 4 do puts(1, data[i]&'\n') end for stop=3Dgetc(0) </snip> Euman
9. Re: Faster please....
- Posted by euphoric <euphoric at cklester.com> Jan 12, 2004
- 403 views
Euman wrote: > From: "C. K. Lester" <euphoric at cklester.com> > > >>Euman wrote: >> >> >>>snip >>> >>> >>Please strip the "3D" extraneous characters, Euman. >> >> >Sorry, Hope this one gets to you without the 3D's... > > Are you trying to be funny? ><snip> > >global function sDelimited1(sequence s1, sequence s2) >integer len, start, endx >sequence dseq,dl -- didn't define dl >dseq=3D{} -- didn't initialize this > > len =3D length(s2) > start =3D 1 > > I'm trying to be amicable about this, but you're pushing the limits here. If you post another message with 3D's in it, I think I'll stomp my feet and cry and might be tempted to pull my hair or something... SO WATCH IT!!! I'm kiddin', BTW. No big thang, 'cept we cain't use yer code, dewd. :)
10. Re: Faster please....
- Posted by "Euman" <euman at bellsouth.net> Jan 12, 2004
- 414 views
Screw it, I give up.... !!!!!! ----- Original Message ----- From: "Euman" <euman at bellsouth.net> To: <EUforum at topica.com> Subject: Re: Faster please.... > > > From: "C. K. Lester" <euphoric at cklester.com> > > > Euman wrote: > > > > > snip > > Please strip the "3D" extraneous characters, Euman. > > > > Sorry, Hope this one gets to you without the 3D's... > > <snip> > > global function sDelimited1(sequence s1, sequence s2) > integer len, start, endx > sequence dseq,dl -- didn't define dl > dseq=3D{} -- didn't initialize this > > len =3D length(s2) > start =3D 1 > for i =3D 1 to len do > if equal(s2[i..i],s1) then > endx =3D i - 1 > dseq &=3D {s2[start..endx]} > start =3D i + 1 > end if > end for > return dseq > end function > > > function sNest(sequence s1, sequence s2) > integer start, endx > sequence dseq > > dseq =3D {} > start =3D 1 > for i =3D 1 to length(s1) do > endx =3D s1[i] > dseq &=3D {s2[start..endx-1]} > start =3D endx + 1 > end for > return dseq > end function > > function sDelimited( sequence s1, sequence s2 ) > -- returns: sequence containing indices of all matches > -- if unsuccessful return empty sequence {} > object found > > found =3D match( s1, s2 ) > if found then > found &=3D found + sDelimited( s1, s2[found+1..length(s2)] ) > else > return {} > end if > return found > end function > > ----------- test function --------- > sequence dl, test > object data > integer stop > atom t > > dl=3Drepeat(127,1) > > t =3D time() > for i =3D 1 to 10000 do > test =3D "Euman"&dl&"Euphoria"&dl&"Programmer"&dl&"this is a test"&dl > > -- comment / uncomment > --data=3DsNest(sDelimited("=7F", test), test) > data=3DsDelimited1("=7F", test) > > end for > t =3D time() - t > puts(1, sprintf("%2.3f", t)&'\n') > > > for i=3D1 to 4 do > puts(1, data[i]&'\n') > end for > stop=3Dgetc(0) > > </snip> > > Euman > > > > TOPICA - Start your own email discussion group. FREE! > >
11. Re: Faster please....
- Posted by "Kat" <gertie at visionsix.com> Jan 12, 2004
- 413 views
On 12 Jan 2004, at 17:27, Euman wrote: > > > Screw it, I give up.... Can you dcc it to me?, and i'll post it, i don't use Outlook. Kat
12. Re: Faster please....
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 13, 2004
- 445 views
On Mon, 12 Jan 2004 16:35:43 -0600, "C. K. Lester" <euphoric at cklester.com> wrote: >>>>snip >>>> >>>> >>>Please strip the "3D" extraneous characters, Euman. LOL >>> >>> >>Sorry, Hope this one gets to you without the 3D's... I use Forte Agent (which is not free and has crashed on me plenty in the last few months so I'm not recommending it either). However it does have one very useful feature: If you get one of these mangled emails then 90% of the time it will unmangle it (and un-line-wrap URLS) when you hit the reply button. I was just wondering if Outlook and other email s/ware has this feature? There is also a little windows utility on my webpage for anyone in need, which unmangles the clipboard contents in this regard. Pete http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html
13. Re: Faster please....
- Posted by "Hayden McKay" <hmck1 at dodo.com.au> Jan 13, 2004
- 413 views
I dont know just how you can 3D everything Euman, but its definatly funny. ----- Original Message ----- From: "C. K. Lester" <euphoric at cklester.com> To: <EUforum at topica.com> Subject: Re: Faster please.... > > > Euman wrote: > > > From: "C. K. Lester" <euphoric at cklester.com> > > > > > >>Euman wrote: > >> > >> > >>>snip > >>> > >>> > >>Please strip the "3D" extraneous characters, Euman. > >> > >> > >Sorry, Hope this one gets to you without the 3D's... > > > > > Are you trying to be funny? > > ><snip> > > > >global function sDelimited1(sequence s1, sequence s2) > >integer len, start, endx > >sequence dseq,dl -- didn't define dl > >dseq=3D{} -- didn't initialize this > > > > len =3D length(s2) > > start =3D 1 > > > > > I'm trying to be amicable about this, but you're pushing the limits > here. If you post another message with 3D's in it, I think I'll stomp my > feet and cry and might be tempted to pull my hair or something... SO > WATCH IT!!! > > I'm kiddin', BTW. No big thang, 'cept we cain't use yer code, dewd. :) > > > > TOPICA - Start your own email discussion group. FREE! > > > -- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.558 / Virus Database: 350 - Release Date: 2/01/04 > --- --