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

2013-03-29 Thread S. Fisher
--- On Wed, 3/20/13, S. Fisher expandaf...@yahoo.com 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

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

2013-03-22 Thread S. Fisher
On 21-3-2013 2:14, S. Fisher wrote: 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

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

2013-03-22 Thread S. Fisher
--- On Wed, 3/20/13, S. Fisher expandaf...@yahoo.com 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( line

[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=lazarusview=log There

[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

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

2013-03-21 Thread S. Fisher
--- On Thu, 3/21/13, kyan alfasud...@gmail.com 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

Re: [fpc-pascal] My favourite missing feature

2008-12-24 Thread S. Fisher
--- On Mon, 12/22/08, Mark Morgan Lloyd markmll.fpc-pas...@telemetry.co.uk 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

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 or

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. Just to make sure,

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 P4 which behaves sometimes strange regarding optimization. Well

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, ', ', '', '', '\',

[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

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 code.

[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

[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=fannkuchlang=fpascalid=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

[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

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 and thus not

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=fannkuchlang=fpascalid=3) on my computer. See if it's faster on yours. Indeed, just submit it. There's a slight problem. I

Re: [fpc-pascal] PCRE

2007-11-07 Thread S. Fisher
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 how I got it working. From http://www.renatomancuso.com/software/dpcre/dpcre.htm, download PCRE 6.7

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-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 shootout uses pcre (Perl-compatible regular expressions). It would be very

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 :) Anyways, I think

[fpc-pascal] FPC now 3rd in shootout

2007-11-05 Thread S. Fisher
http://shootout.alioth.debian.org/gp4/benchmark.php?test=alllang=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

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=alllang=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 differences are

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 case. Right. A missing program should

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 code for checking

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: 10

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 way for

[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 sometag sometag I'm not sure if the Perl one fails too though. I don't have perl installed and can't