[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lookarounds and recursion in Emacs regexes
From: |
Jean Louis |
Subject: |
Re: Lookarounds and recursion in Emacs regexes |
Date: |
Sat, 4 Feb 2023 18:46:52 +0300 |
User-agent: |
Mutt/2.2.9+54 (af2080d) (2022-11-21) |
* 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/