Re: [fpc-pascal] Example: regular expressions and "hash-tables"

2013-03-29 Thread S. Fisher
--- On Wed, 3/20/13, S. Fisher wrote: > The program reads a text file and counts the number of > unique words, > and also displays the number of times the most common word > was found. > For comparison, here's a C++ program. Unlike the Pascal version, it shows the 20 most

[fpc-pascal] Easy string-splitting

2013-03-24 Thread S. Fisher
uses regexpr, classes; var pieces : tstringlist; s : string; begin pieces := TStringList.create; SplitRegExpr( '--+| *, *', 'thus--and even , hurly-burly,willy-nilly', pieces ); for s in pieces do writeln( s, '<'); pieces.destroy; end. Output: thus< a

[fpc-pascal] Re: Example: regular expressions and "hash-tables"

2013-03-22 Thread S. Fisher
--- On Fri, 3/22/13, Mattias Gaertner wrote: > From: Mattias Gaertner > Subject: Re: [fpc-pascal] Re: Example: regular expressions and "hash-tables" > To: fpc-pascal@lists.freepascal.org > Date: Friday, March 22, 2013, 4:11 AM > On Fri, 22 Mar 2013 01:19:17 -0700 >

Re: [fpc-pascal] Example: regular expressions and "hash-tables"

2013-03-22 Thread S. Fisher
--- On Wed, 3/20/13, S. Fisher wrote: > The program reads a text file and counts the number of > unique words, > and also displays the number of times the most common word > was found. > Added an iterator of sorts for regular expressions. This allows if re.exec( lin

Re: [fpc-pascal] Re: Example: regular expressions and "hash-tables"

2013-03-22 Thread S. Fisher
--- On Thu, 3/21/13, Reinier Olislagers wrote: > From: Reinier Olislagers > Subject: [fpc-pascal] Re: Example: regular expressions and "hash-tables" > To: "FPC Mailing list" > Date: Thursday, March 21, 2013, 5:35 AM > On 21-3-2013 2:14, S. Fisher wrote: &g

Re: [fpc-pascal] How To write an enumerator for trees

2013-03-21 Thread S. Fisher
--- On Thu, 3/21/13, kyan wrote: > > HTH > > Constantine Are you the man who created Kyan Pascal? I used that many years ago. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] TFPDataHashTable: how to iterate?

2013-03-21 Thread S. Fisher
Is there any way to iterate over a TFPDataHashTable ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Example: regular expressions and "hash-tables"

2013-03-21 Thread S. Fisher
Not actually a hash-table, but an AvgLvlTree, which can be used the same way. The AvgLvlTree unit comes with Lazarus; if you don't have that, you can download avglvltree.pas here: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/lazutils/avglvltree.pas?root=lazarus&view=log There do

Re: [fpc-pascal] My favourite missing feature

2008-12-24 Thread S. Fisher
Anyone who pretends to know how to use computers effectively must know how to use grep. (grep is available for Windoze.) Let's say that you want to search all of the files in the current directory for lines that contain "foobar" or "foo bar" or "foo-bar", followed later in the line by "practise"

Re: [fpc-pascal] My favourite missing feature

2008-12-24 Thread S. Fisher
--- On Mon, 12/22/08, Mark Morgan Lloyd wrote: > > There's been a recent thread in fpc-other on second > languages, but it appeared to focus more on what was a > useful part of a developer's skillset rather than what > people miss from Pascal. > > What /I/ miss is Perl's pattern matching, and

Re: [fpc-pascal] copy(), length(), and setlength() is not mentioned in fpc docs?

2007-12-06 Thread S. Fisher
--- Daniël Mantione <[EMAIL PROTECTED]> wrote: > > > Op Wed, 5 Dec 2007, schreef Bee: > > > Hi all, > > > > Is it just me or above methods are indeed not mentioned within fpc's doc > > 2.2.0? Any texts that are supposed to be a link to above methods is not > formed > > as a link. > > > > Jus

Re: [fpc-pascal] Faster fannkuch?

2007-11-11 Thread S. Fisher
--- Florian Klaempfl <[EMAIL PROTECTED]> wrote: > S. Fisher schrieb: > > It seems strange that this is slower on the shootout's computer > > when it's faster both on my slow laptop and the 3GHz computer > > at work. > > The shootout uses a P

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread S. Fisher
--- Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > The code shown in the url below works just fine. Also the usage sample > is all you need to use the tokenizer. Just replace the FieldSpecLine > variable with the content from a CSV file and you are good to go. I > use it as-is in my production c

[fpc-pascal] regex-dna: finally fast enough?

2007-11-10 Thread S. Fisher
I don't think so, although it's over twice as fast as the last incarnation. One speedup I stole from the Perl program: instead of counting matches for /foo|bar/, count matches for /foo/ and for /bar/. The other speedup is lowercasing the string that is searched instead of requiring the regex engi

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread S. Fisher
--- Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > OK, while we are busy with show-and-tell... Then have a look at my > token library implementation. > > http://tinyurl.com/395vgp > > Sample Usage: > > tokenizer := TTokens.Create(FieldSpecLine, ', ', '"', '"', '\', > tsMul

[fpc-pascal] CSV via PCRE

2007-11-09 Thread S. Fisher
Fields are separated by commas, but if a field is surrounded by double quotes it can contain commas---in fact, can contain any byte whatsoever; double quotes (") within the field must be doubled, just as single quotes within a Pascal string are doubled. All we need in order to parse a csv record

Re: [fpc-pascal] PCRE

2007-11-07 Thread S. Fisher
ow, which is the unit that I > supplied a > uRL to in my first email. Which I cannot download, and am waiting for Jeff > to > reply. In the mean time, S. Fisher has already got a unit working while we > were > yapping. > > L505 For everbody who wants pcre, here's h

Re: [fpc-pascal] Faster fannkuch?

2007-11-07 Thread S. Fisher
--- Florian Klaempfl <[EMAIL PROTECTED]> wrote: > S. Fisher schrieb: > > This is faster than the one at the shootout > > > (shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&lang=fpascal&id=3) > > on my computer. See if it's faster on you

[fpc-pascal] Faster fannkuch?

2007-11-07 Thread S. Fisher
This is faster than the one at the shootout (shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&lang=fpascal&id=3) on my computer. See if it's faster on yours. { The Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Florian Klaempfl modified by Micha Neli

[fpc-pascal] regex-dna using PCRE

2007-11-07 Thread S. Fisher
Unfortunately, it's slightly slower than my fastest program that uses the library that comes with FPC. I wonder if the dll was compiled with all of the C compiler's optimiaztions turned on. {$mode objfpc} uses pcre; // from www.renatomancuso.com/software/dpcre/dpcre.htm const patterns : array

[fpc-pascal] Faster regex-dna

2007-11-07 Thread S. Fisher
Instead of looking for 'B' and replacing with '(c|g|t)'), then looking for 'D' and replacing with '(a|g|t)', etc., the program now looks for '[BDH...Y]' and replaces with the corresponding string. { The Computer Language Benchmarks Game http://shootout.alioth.debian.org contributed by Steve F

Re: [fpc-pascal] PCRE

2007-11-07 Thread S. Fisher
--- Marco van de Voort <[EMAIL PROTECTED]> wrote: > > > Doing a dumb header port is not that hard. If you can't do it, start > making > > > tests, and I'll do it. > > (skip nonsense stuff) > > > So why use the JCL? Just do all the translations yourself.. forget JCL. > > - JCL's license is MPL

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-06 Thread S. Fisher
--- L <[EMAIL PROTECTED]> wrote: > > >> Ok, now somebody has to fix the regexpr unit and accelerate it *g* > > > > > > The C program in the shootout uses pcre (Perl-compatible > > > regular expressions). It would be very nice if FPC came > > > with pcre. > > > > Well, that way we can never win

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-06 Thread S. Fisher
--- Florian Klaempfl <[EMAIL PROTECTED]> wrote: > S. Fisher schrieb: > > --- Florian Klaempfl <[EMAIL PROTECTED]> wrote: > > > > > >> Ok, now somebody has to fix the regexpr unit and accelerate it *g* > > > > The C program in the shoot

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-06 Thread S. Fisher
--- Florian Klaempfl <[EMAIL PROTECTED]> wrote: > > Ok, now somebody has to fix the regexpr unit and accelerate it *g* The C program in the shootout uses pcre (Perl-compatible regular expressions). It would be very nice if FPC came with pcre. _

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Dani�l Mantione <[EMAIL PROTECTED]> wrote: > > Is it true that a slow program has a worse effect on the shootout > > results than a missing program? That seems wrong to me. > > There has been a long discussion on the Shootout forums about it. Isaac > believes that it is more fair this wa

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Peter Vreman <[EMAIL PROTECTED]> wrote: > reasonable time. The updated source can be found in: > > http://svn.freepascal.org/svn/fpc/trunk/tests/bench/shootout/src/regexdna.pp > > But the code is a lot slower than gcc so there is still a lot of > performance tuning to do: > >

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Marc Weustink <[EMAIL PROTECTED]> wrote: > > if not GenerateRegExprEngine( target, [ref_caseinsensitive], engine) > then > > begin > > writeln( 'Failed to generate regex. engine for "',target,'".' ); > > halt(1) > > end; > > For this benchmark you don't need extra unneeded cod

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Vincent Snijders <[EMAIL PROTECTED]> wrote: > S. Fisher schreef: > > > > Is it true that a slow program has a worse effect on the shootout > > results than a missing program? That seems wrong to me. > > To me is seems wrong too, but is nevertheless the

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Peter Vreman <[EMAIL PROTECTED]> wrote: > around. I have update the program to use a pchar instead of an ansistring > so it finishes within > reasonable time. The updated source can be found in: > > http://svn.freepascal.org/svn/fpc/trunk/tests/bench/shootout/src/regexdna.pp > > But the co

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Peter Vreman <[EMAIL PROTECTED]> wrote: > >> > >> --- Marco van de Voort <[EMAIL PROTECTED]> wrote: > >> > >>> > http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all > >>> > > >>> > The reason is that D's mean degraded from 1.40 to 1.43. I wonder how > >>> > that could happe

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Florian Klaempfl <[EMAIL PROTECTED]> wrote: > S. Fisher schrieb: > > --- Marco van de Voort <[EMAIL PROTECTED]> wrote: > > > >>> http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all > >>> > >>> The reason is

Re: [fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
--- Marco van de Voort <[EMAIL PROTECTED]> wrote: > > http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all > > > > The reason is that D's mean degraded from 1.40 to 1.43. I wonder how > > that could happen. > > They change often. Clean is also quite variable. I assume the diff

[fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all The reason is that D's mean degraded from 1.40 to 1.43. I wonder how that could happen. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://

[fpc-pascal] Re: fast text processing

2007-11-01 Thread S. Fisher
--- L <[EMAIL PROTECTED]> wrote: > > > No more strlen: > > > http://www.hu.freepascal.org/fpcircbot/cgipastebin?msgid=1432 > > > > This doesn't work if you have spaces in front of the < tags > > > > > > I'm not sure if the Perl one fails too though. > I don't have perl installed and