Re: Rewrap "> " lines from file ?

This is a discussion on Re: Rewrap "> " lines from file ? within the Scheme forums in Programming Languages category; In article <87myjbkoeo.fsf @ plap.localdomain>, Paul Donnelly <paul-donnelly @ sbcglobal.net> wrote: > problems @ gmail writes: > > > I want to promote the idea that 'we should use a higher level langauge, > > like lisp or scheme'. But I don't yet have enough fluency to give a good > > example. A suitable and not too big a task, to serve as a comparison > > against the currently used languages would be: > > > > rearrange a small text file, so that: > > * all lines of length > 78 are wrapped to len < ...

Go Back   Application Development Forum > Programming Languages > Scheme

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-18-2008, 08:30 AM
problems@gmail
Guest
 
Default Re: Rewrap "> " lines from file ?

In article <87myjbkoeo.fsf@plap.localdomain>, Paul Donnelly <paul-donnelly@sbcglobal.net> wrote:

> problems@gmail writes:
>
> > I want to promote the idea that 'we should use a higher level langauge,
> > like lisp or scheme'. But I don't yet have enough fluency to give a good
> > example. A suitable and not too big a task, to serve as a comparison
> > against the currently used languages would be:
> >
> > rearrange a small text file, so that:
> > * all lines of length > 78 are wrapped to len < 75, with breaks at
> > word-boundries;
> > * the "> " strings which start each line are replaced to the beginning
> > of the new shorter lines;
> >
> > I guess something like this might do it:
> >
> > * delete all line-breaks and "> ";
> > * Initialise counter/s;
> > * While Not eof do
> > write("> ");
> > While lineNotFull do
> > write(NextWord);
> > Inc(lineLen by wordLen)
> > EndWhile lineNotFull;
> > EndWhile Not eof.
> >
> > I've got elisp ver xxx to start with - and an undocumented Scheme,
> > which runs a graphics application, which I've tested on simple functions,
> > but I don't know the syntax to: ' read/write in/out text from/to a file'.
> >
> > Please provide some source for the folowing skeleton, which could get
> > me started:
> >
> > 1. Init files if needed;
> > 2. For lines = 1st till last or eol do
> > ReadLine from InFile & count chars;
> > To OutFile write "line n =", lines
> > 3. To OutFile write "Done".
> >
> > == TIA.

>
> If you've got elisp, you've probably got the rest of Emacs too, right?


No ! I was able to 'chroot <otherPartitionInstallation> info emacs'
and info elisp. And the [other partition/installation] info elisp
apparently uses emacs documentation ?

I don't want to re-boot to the other partition now.
Doing is not as easy as talking.
Can't someone just write my 3 step algorithm in lisp/scheme ?!

> Why not take a look at the source for FILL-REGION-AS-PARAGRAPH? It
> includes a lot of code for handling things you don't plan to handle,
> but what you'll see is that the business end of the function is mostly
> made up of editor commands. In a high-level language, you can create
> abstractions that let you work at the level you wish to, in this case,
> text editing commands. If you can easily make the abstractions you
> want, then the language you are using is high-level enough. Which is
> my roundabout way of saying that I don't think Lisp has any particular
> advantage in this task, except for intangibles like comfort and
> familiarity for and to Lispers. I mean, look at your pseudocode.
> Despite being slightly wrong, what would be easier about
> writing it in Lisp than in some other language?
>
> If you want to promote this idea, it would be better to routinely
> dazzle your peers by writing better programs more quickly in
> Lisp. That's much more persuasive than picking some arbitrary
> benchmark program because, for most tasks, it's the little things that
> count, like being able to put an IF form anywhere a value is expected.
> For some tasks, there might be a trick you can do in Lisp that makes
> it worlds easier, but, even so, that trick will probably be a small
> part of the program and not a big deal to a person who isn't looking
> to be convinced to learn a new language. These are little things that
> are hard to see from a single code comparison, but whose cumulative
> impact over several programs is impossible to ignore.
>



Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:50 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.