[boulder.pm] emacs, vim, gardening and stuff

Keanan Smith KSmith at netLibrary.com
Mon Jun 24 10:44:12 CDT 2002


Hrm, VIm over Emacs, (Actually at work I use a silly win* program called
UltraEdit, it seems to work well enough) Of course I grew up using VI
(Literally, I started using it when I was 7 when I dialed-in to my dad's
main frame to play 'adventure', 'nethack' and 'rogue' *grin*)

And XML is, I agree, *not* usefull for simple 'state-maintaining' and
transmission of data structures to other perl programs.  Where XML is
usefull is where it needs to communicate to something that *isn't* a perl
program, anyone feel like writing Data::Dumper::XML? *grin* Oh wait, we just
call that SOAP eh?


In all seriouslessness though, What I've been wracking my brain on,
currently, is the best way to be able to take an array of input lines,
search among the input lines for a regular expression which matches *across
adjacent array elements* I know this is weird, and not heavily usefull,
since it's just preferable to have the whole array in a big scalar and do
your regexps against that.

The problem is that the implementation I'm dealing with *requires* an array
(Well, or a hash), and in fact, the more elements of the array I need to
update, the slower the whole process goes, so I'm trying to find the "least
work for the buck"

Problem number two is that the input files are well, huge for text files
(4-8 Megs, 50-70 thousand lines)

Problem number three the regular expression isn't known until run-time (So I
can't simply change it to a set of conditionals and single-array-element
matches before hand)




Among the Ideas I've been toying with are:

join into a scalar,
do the regular expression work,
split back into an array.
update the whole bloody thing (This is the current implementation, and I
don't like it :)

tie the scalar to a yet-uncreated tie package that implements the scalar as
an array, unfortunately changes made to such a scalar would, of neccessity,
be global in nature, as scalars are treated as a single "unit" and can't
really be updated "partially" (Unlike composite objects like arrays and
hashes) and as a result I just end up with the same thing as above, only
hidden inside a 'tie' package.

I could create alternate methods for updating the scalar only at a certain
offset (Which I would have to previously translated internally to a set of
alternate indexes by which I could access the internal array-type thingie)
However, all this workaround still generates a huge overhead in the
'translate x to scalar and back' as well as the generation of the initial
indexes (Although I only have to really pay that once)

Disect the 'searching' expression into bits which can be parsed on a single
'element' this requires some rather tricky workaround, and I don't think I
could possibly manage to get every possible case covered
(For instance /([ab]\n)*(?<=a\n)b/ would be a disturbingly complicated thing
to get working.)

Hrm, I've passed through two or three other ideas I can't think of at the
moment (It is, after all, monday morning) anyone else have anything that
sounds passable for a possible easier work-around for this type
of nonsense?



  -K 



-----Original Message-----
From: Rob Nagler [mailto:nagler at bivio.biz]
Sent: Friday, June 21, 2002 10:52 AM
To: boulder-pm-list at happyfunball.pm.org
Subject: Re: [boulder.pm] emacs, vim, gardening and stuff


Lewis, Donald G writes:
> I prefer emacs too. It can do some amazing stuff, don't know about vim.
But
> my problem too is that I do not understand all of the code behind emacs so
I
> tend to leave it the way I find it. Sometimes it will not do what I want
> even though I know it is possible for it to do. For instance the version
> here at work is sort of plain vanilla, best I can tell, and I cannot
figure
> out how to get the syntax to display in color and for it to check the
parens
> and other constructs.

You need to install cperl.  You can do it locally in your ~/emacs
directory.   Here's a page I found which discusses it:

http://www.khngai.com/emacs/perl.php

Here'e the general pages on programming modes:

http://www.tldp.org/HOWTO/Emacs-Beginner-HOWTO-3.html

Cheers,
Rob




More information about the Boulder-pm mailing list