Sujet : Re: Why Python When There Is Perl?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.advocacyDate : 22. Mar 2024, 04:06:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <utip2g$2i1dd$3@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On 22 Mar 2024 01:43:02 GMT, rbowman wrote:
As I worked through the exercises I was mentally
calculating how I would do it in C.
C doesn’t put call frames on the heap, or even allow nested functions
(as standard), so I don’t know how you would handle closures.
If you want to talk about lexical oddities, there's the 73 stacked up
parens.
I keep them straight by indentation, e.g.
(defun convert-to-region-codes (beg end)
"converts alphabetic characters in the selection to “region indicator symbols”."
(interactive "*r")
(unless (use-region-p)
(ding)
(keyboard-quit)
) ; unless
(let
(
deactivate-mark
(intext (delete-and-extract-region beg end))
c
)
(dotimes (i (- end beg))
(setq c (elt intext i))
(cond
((and (>= c ?A) (<= c ?Z))
(setq c (+ (- c ?A) #x1F1E6))
)
((and (>= c ?a) (<= c ?z))
(setq c (+ (- c ?a) #x1F1E6))
)
) ; cond
(insert-char c)
) ; dotimes
) ; let
) ; convert-to-region-codes
What makes this sort of idiosyncrasy worthwhile is a thing called
“homoiconicity”. It’s a pretty cool feature, though not obvious at
first sight.
I shouldn't be so snotty.
No problem. Your impressions are all too common among those new to
Lisp.
After all I used Forth back in the day and threaded interpreted
languages are a wonder to behold.
Now there is something that is nowadays only fit to be in a museum ...