unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: help-gnu-emacs@gnu.org
Subject: Re: Lookarounds and recursion in Emacs regexes
Date: Sat, 4 Feb 2023 18:46:52 +0300	[thread overview]
Message-ID: <Y9597G+3NRhRt+fR@protected.localdomain> (raw)
In-Reply-To: <878rhelfks.fsf@dataswamp.org>

* Emanuel Berg <incal@dataswamp.org> [2023-02-04 17:54]:
> > Although somewhat proficient, I never learnt to love Python.
> 
> People don't love Python like they do Lisp, but no doubt it
> has it's good sides - development speed not the least.

Do you want to say that development speed in Lisp is slower than in
Python?

I think that development speed does not depend too much on the
language. 

One important issue for speed is functional programming, making one
function after the other. Python has it, Lisp has it.

But different paradigms are possible.

So when I program with small functions each doing something, then you
start doing higher level functions, and after some work done, it
becomes really speedy to make what you want.

Download the book of Paul Graham - On Lisp:
http://www.paulgraham.com/onlisptext.html

Ordering things in libraries, preparing functions in such way to be
useful to programmer, and having one's own utilities library, all that
contributes to really speedy programming.

69727 entries I have recently imported from Gutenberg free library,
the index of all the books. Now I can speedily search on my computer
for any works.

Let us say something about "Sweden", I get 119 results. Or something
like:

The Wanderings of Persiles and Sigismunda: A Northern Story
https://gutenberg.org/ebooks/61561

And I can quickly, within a second produce such hyperlinks, or just
press a key and come to the web page of that book to download it, or
to read it straight.

Few functions below are re-using previously made functions, and
multiple Emacs libraries.

Application usage can be seen here:
https://gnu.support/images/2023/02/2023-02-04/2023-02-04-16:41:08.ogv

And it is made on top of previous functions, by using these here below:

(defun rcd-db-gutenberg-search (&optional prefix query)
  (interactive "p")
  (let* ((query (or query (rcd-region-string) (rcd-ask-get "Query by name: ")))
	 (logic (cond (current-prefix-arg "OR") 
		      (t "AND")))
	 (title (rcd-sql-search-snippet-for-and-column 
		 "gutenberg_title" query nil logic))
	 (authors (rcd-sql-search-snippet-for-and-column 
		   "gutenberg_authors" query nil logic))
	 (subjects (rcd-sql-search-snippet-for-and-column 
		    "gutenberg_subjects" query nil logic))
	 (sql (format "SELECT gutenberg_id, gutenberg_title
                        FROM gutenberg
                       WHERE %s OR %s OR %s"
		      title authors subjects))
	 (title (format "Gutenberg entries for `%s'" (string-join (split-string query (concat " " logic " "))))))
    (rcd-db-sql-report title sql [("ID" 6 t) ("Name" 50 t)] "gutenberg" nil 
		       (lambda () 
			 (interactive)
			 (rcd-db-gutenberg-search prefix query)))))
	
(defun rcd-db-gutenberg-browse-url-1 (id)
  (format "https://gutenberg.org/ebooks/%d" id))

(defun rcd-db-gutenberg-read-html-images-1 (id)
  (format "https://gutenberg.org/ebooks/%d.html.images" id))

(defun rcd-db-gutenberg-browse-url (&optional id)
  "Browse URL for Gutenberg entry."
  (interactive nil rcd-db-list-mode)
  (when-tabulated-id "gutenberg"
      (let ((url (rcd-db-gutenberg-browse-url-1 id)))
	(browse-url url))))

(defun rcd-db-gutenberg-read-html-images (&optional id)
  "Read HTML with images for Gutenberg entry."
  (interactive nil rcd-db-list-mode)
  (when-tabulated-id "gutenberg"
      (let ((url (rcd-db-gutenberg-read-html-images-1 id)))
	(browse-url url))))

I have no idea of Python, but I am sure that same can be done with
Python in speedy time provided programmer re-uses existing libraries. 

Familiarity is what makes "speed" as well, user familiar with
programming language will be speedy as compared to one not as
familiar. 

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2023-02-04 15:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 14:11 Lookarounds and recursion in Emacs regexes Evan Aad
2023-01-27 18:12 ` Marcin Borkowski
2023-01-27 19:30   ` Emanuel Berg
2023-01-28  6:46     ` tomas
2023-02-03 19:22       ` Emanuel Berg
2023-02-04 15:46         ` Jean Louis [this message]
2023-02-04 21:48           ` Emanuel Berg
2023-02-07  9:46             ` Jean Louis
2023-02-07 10:25               ` Emanuel Berg
2023-02-07 22:45                 ` Jean Louis
2023-02-26 11:40       ` the GLIMPs [GIMP Lisps] (was: Re: Lookarounds and recursion in Emacs regexes) Emanuel Berg
2023-02-27  8:31         ` tomas
2023-02-04 22:28     ` Lookarounds and recursion in Emacs regexes Stefan Monnier via Users list for the GNU Emacs text editor
2023-02-04 22:44       ` Emanuel Berg
2023-02-05  5:51       ` Eli Zaretskii
2023-02-06 12:53         ` Emanuel Berg
2023-02-06 13:09           ` Emanuel Berg
2023-02-06 13:23           ` Eli Zaretskii
2023-02-06 13:44             ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y9597G+3NRhRt+fR@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).