🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.lisp
10 messages
10 total messages Started by steve g Sat, 10 Oct 2026 23:14
Re: GNU Emacs native compiled functions
#18
Author: steve g
Date: Sat, 10 Oct 2026 23:14
14 lines
2534 bytes
Lawrence D’Oliveiro <ldo@nz.invalid> writes:


> On Tue, 06 Oct 2026 08:34:15 -0400, Stefan Monnier wrote:

> I can’t imagine how you could have functions as first-class objects
> without closures. At the very least, you would end up writing a lot
> more repetitive code, which I hate.

> For example, how would you deal with this, for counting words in an
> HTML page after stripping all the markup (from
> <https://gitlab.com/ldo/emacs-prefs>):

M-x count-words
Re: GNU Emacs native compiled functions
#20
Author: Lawrence D’Oliveiro
Date: Sun, 11 Oct 2026 00:39
16 lines
2381 bytes
On Sat, 10 Oct 2026 19:14:48 -0400, steve g wrote:

> Lawrence D’Oliveiro <ldo@nz.invalid> writes:
>
>> For example, how would you deal with this, for counting words in an
>> HTML page after stripping all the markup (from
>> <https://gitlab.com/ldo/emacs-prefs>):
>
> M-x count-words

Tried it on a test HTML file I had handy.

M-x count words reports a count of 10370.
My code reports a count of 9564.

Solving the wrong problem, much?
Re: GNU Emacs native compiled functions
#21
Author: steve g
Date: Mon, 12 Oct 2026 02:20
32 lines
2893 bytes
Lawrence D’Oliveiro <ldo@nz.invalid> writes:

> On Sat, 10 Oct 2026 19:14:48 -0400, steve g wrote:
>
>> Lawrence D’Oliveiro <ldo@nz.invalid> writes:
>>
>>> For example, how would you deal with this, for counting words in an
>>> HTML page after stripping all the markup (from
>>> <https://gitlab.com/ldo/emacs-prefs>):
>>
>> M-x count-words
>
> Tried it on a test HTML file I had handy.
>
> M-x count words reports a count of 10370.
> My code reports a count of 9564.

Not to be an asshole, but I can be; what do you mean by words? Usually
counting spaces does not qualify.

> Solving the wrong problem, much?

always!

have you tried wc -w ? I get the same result from wc -l and count-lines.
and the same result from wc -w from count-words. Most people do not
consider a words less than 3 letters or sum such.




Re: GNU Emacs native compiled functions
#22
Author: tfb
Date: Mon, 12 Oct 2026 05:37
12 lines
2374 bytes
steve g <Sgonedes1977@gmail.com> wrote:
> 
> 
> have you tried wc -w ? I get the same result from wc -l and count-lines.
> and the same result from wc -w from count-words. Most people do not
> consider a words less than 3 letters or sum such.

It helps to read the problem specification: 'for counting words in an HTML
page after stripping all the markup'.

-- 
tfeb.org/computer/
Re: GNU Emacs native compiled functions
#23
Author: Lawrence D’Oliveiro
Date: Mon, 12 Oct 2026 05:55
33 lines
2825 bytes
On Sun, 11 Oct 2026 22:20:04 -0400, steve g wrote:

> Lawrence D’Oliveiro <ldo@nz.invalid> writes:
>
>> On Sat, 10 Oct 2026 19:14:48 -0400, steve g wrote:
>>
>>> Lawrence D’Oliveiro <ldo@nz.invalid> writes:
>>>
>>>> For example, how would you deal with this, for counting words in
>>>> an HTML page after stripping all the markup (from
>>>> <https://gitlab.com/ldo/emacs-prefs>):
>>>
>>> M-x count-words
>>
>> Tried it on a test HTML file I had handy.
>>
>> M-x count words reports a count of 10370.
>> My code reports a count of 9564.
>
> Not to be an asshole, but I can be; what do you mean by words?
> Usually counting spaces does not qualify.

Why, did you think I was?

Clue: I mentioned “stripping all the markup”.

>> Solving the wrong problem, much?
>
> always!
>
> have you tried wc -w ?

Yes, that is even worse than your idea. Which is saying something.
Re: GNU Emacs native compiled functions
#24
Author: steve g
Date: Mon, 12 Oct 2026 21:06
34 lines
3022 bytes
Lawrence D’Oliveiro <ldo@nz.invalid> writes:

> On Sun, 11 Oct 2026 22:20:04 -0400, steve g wrote:


> Clue: I mentioned “stripping all the markup”.


Yes, I read that. So you have a document with no tags; have you tried wc ?

>>
>> have you tried wc -w ?
>
> Yes, that is even worse than your idea. Which is saying something.

Dunno. wc (1)

DESCRIPTION
       Print  newline, word, and byte counts for each FILE, and a total line if
       more than one FILE is specified.  A word is a nonempty sequence  of  non
       white  space  delimited  by white space characters or by start or end of
       input.

       With no FILE, or when FILE is -, read standard input.

       The options below may be used to select which counts are printed, always
       in the following order: newline, word,  character,  byte,  maximum  line
       length.



wc (1) seems to do the job very well. I just tried wc and count-words
again on a text file and got the same exact results.
Re: GNU Emacs native compiled functions
#27
Author: tfb
Date: Tue, 13 Oct 2026 08:14
15 lines
2384 bytes
steve g <Sgonedes1977@gmail.com> wrote:

> 
> Yes, I read that. So you have a document with no tags; have you tried wc ?
> 

Seriously, msn, stop making a fool of yourself.  The original function
*stripped the markup and counted the words remaining*.  Your idiot
non-answer does the second part of that.  Can you see why that is entirely
failing to solve the problem?



-- 
tfeb.org/computer/
Re: GNU Emacs native compiled functions
#30
Author: steve g
Date: Thu, 15 Oct 2026 19:27
14 lines
2419 bytes
tfb <tfb@work.it.out> writes:

> steve g <Sgonedes1977@gmail.com> wrote:
>
>> 
>> Yes, I read that. So you have a document with no tags; have you tried wc ?
>> 
>
> Seriously, msn, stop making a fool of yourself.  The original function
> *stripped the markup and counted the words remaining*.  Your idiot
> non-answer does the second part of that.  Can you see why that is entirely
> failing to solve the problem?

perl -pe 's/<[^>]*>//g' cltl2.html  | wc -l
Re: GNU Emacs native compiled functions
#29
Author: tfb
Date: Thu, 15 Oct 2026 19:58
10 lines
2147 bytes
steve g <Sgonedes1977@gmail.com> wrote:

> 
> perl -pe 's/<[^>]*>//g' cltl2.html  | wc -l
> 

And finally you've read the problem statement.

-- 
tfeb.org/computer/
Re: GNU Emacs native compiled functions
#31
Author: Lawrence D’Oliveiro
Date: Thu, 15 Oct 2026 21:19
12 lines
2335 bytes
On Mon, 12 Oct 2026 17:06:29 -0400, steve g wrote:

> Lawrence D’Oliveiro <ldo@nz.invalid> writes:
>
>> On Sun, 11 Oct 2026 22:20:04 -0400, steve g wrote:
>
>> Clue: I mentioned “stripping all the markup”.
>
> Yes, I read that. So you have a document with no tags ...

No, I create a *temporary* buffer containing the text with no tags,
and delete it afterwards. This is all done in the Emacs command.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads