--- 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
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
--- 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
>
--- 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
--- 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
--- 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
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
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
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"
--- 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
--- 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
--- 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
--- 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
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
--- 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
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
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
--- 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
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
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
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
--- 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
--- 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
--- 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
--- 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.
_
--- 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
--- 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:
>
>
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
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://
--- 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
35 matches
Mail list logo