Live data from Hacker News

Practical Emacs Lisp

ergoemacs.org

31–40 of 60 posts

Re: Practical Emacs Lisp

#31
post #25

Earlier quoted context omitted.

The way to handle an unhelpful resource is to flag it. Even better would be to submit superior resources. The ad homenim is unproductive because it just makes people dumber and makes mean behavior look normal.

Xah Lee has trolled Lisp groups for years. It's well known that much of his 'advice' is useless. The number of bullshit posts by him is a bignum. His comp.lang.lisp trolling is legendary. Nothing 'ad homenim' or mean - just saying how it is.

As an emacs beginner, I've landed on his site numerous times, often finding it helpful. The fact that he might or might not have trolled some mailing list is of no concern to me.

If you have a better alternative resource, please present it. If you can find technical faults in this resource, you should provide them so the author can correct it and other might learn of them as well.

Otherwise, stop trying to justify ad hominem with meaningless retorts.

Re: Practical Emacs Lisp

#32
post #25

Earlier quoted context omitted.

Xah Lee has trolled Lisp groups for years. It's well known that much of his 'advice' is useless. The number of bullshit posts by him is a bignum. His comp.lang.lisp trolling is legendary. Nothing 'ad homenim' or mean - just saying how it is.

As an emacs beginner, I've landed on his site numerous times, often finding it helpful. The fact that he might or might not have trolled some mailing list is of no concern to me. If you have a better alternative resource, please present it. If you can find technical faults in this resource, you should provide them so the author can correct it and other might learn of them as well. Otherwise, stop trying to justify ad…

> The fact that he might or might not have trolled some mailing list is of no concern to me.

It's not meaningless to me.

> If you can find technical faults in this resource, you should provide them so the author can correct it and other might learn of them as well.

We had extensive discussions with him for years. Literally thousands of posts can be found on comp.lang.lisp.

The only Lisp he learned was some imperative crappy style, while lecturing everyone how dumb they are.

Re: Practical Emacs Lisp

#33
post #25

Earlier quoted context omitted.

The way to handle an unhelpful resource is to flag it. Even better would be to submit superior resources. The ad homenim is unproductive because it just makes people dumber and makes mean behavior look normal.

Xah Lee has trolled Lisp groups for years. It's well known that much of his 'advice' is useless. The number of bullshit posts by him is a bignum. His comp.lang.lisp trolling is legendary. Nothing 'ad homenim' or mean - just saying how it is.

His behavior on Usenet doesn't excuse anyone's behavior on HN.

Re: Practical Emacs Lisp

#34
post #26
post #15

Xah Lee can't program a line of Lisp on his own. Most of that code is collected from elsewhere. There are much better resources to learn Emacs Lisp from.

what a malicious lie. I have written some 10 packages, at least hundred thousand lines of emacs lisp since 2005, all public in github or on my website. http://ergoemacs.org/emacs/xah_emacs_modes.html the only borrowed code i can think of now, now named xah-extend-selection in xah-fly-keys, by Nikolaj Schumacher, fully credited in the inline doc still. (and that function is also in ergoemacs-mode, fully credited still…

I am truly glad to hear that things have improved in the past year. Your site clearly demonstrates your integrity and good will. My deep thanks for your many contributions that make the internet better.

Re: Practical Emacs Lisp

#35
post #29

Earlier quoted context omitted.

IIUC rx.el is a sexp dsl/interface to build vanilla regex down the line right ? from what I remember about scheme SRFI is not the 'syntax' but the return values, you get streams of match, then you can leverage, folds and maps. lispm point is nice (and no one can argue about evaluation order and count), but beside the battle-tested aspect, `loop` scares the crap out of me. That's even more a reason to prefer things th…

See this Xah Lee Elisp code: (defvar xah-left-brackets '("(" "{" "[" " " "〕" "】" "〗" "〉" "》" "」" "』" "”" "’" "›" "»") "list of right bracket chars.") (progn (setq xah-right-brackets '()) (dotimes (x (- (length xah-brackets) 1)) (when (= (% x 2) 1) (push (char-to-string (elt xah-brackets x)) xah-right-brackets))) (setq xah-right-brackets (reverse xah-right-brackets))) In CL this is just: (defun every-nth (seq start n…

Oh I wasn't arguing that CL loop was a far better solution than while loops (unless you process too long lists). I just became very very+ fond of academic recursive style. Here's a singly-linear variant for fixed steps.

    (defun ab (l)
      "I'm too lazy to reverse the result back."
      (defun _ (l a b f)
	(if (null l)
	    (if f (list a b) (list b a))
	  (_ (cdr l) b (cons (car l) a) (not f))))
      (_ l nil nil t))

    (ab '())
    (ab '(1))
    (ab '(1 2))
    (ab '(1 2 3 4 5 6 7 8 9 10))
    ;; ((9 7 5 3 1) (10 8 6 4 2))
    (ab '(1 2 3 4 5 6 7 8 9 10 11))
    ;; ((11 9 7 5 3 1) (10 8 6 4 2))

I don't know how cute or ugly a solution for variable step could be though. `ab` is a nice partitioning building block, less general than every-nth surely.

ps: Straight from the land of wishful lisping

    (defun abn (l n)
      (defun ono (n)
	"builds a cons oo cycle of size n"
	'unicorn)
      (defun noo (c)
	"rotates a cons cycle by one"
	'unicorn)
      (defun cooons (c v)
	"cons v to the head of c"
	'unicorn)
      (defun _ (l c)
	(if (null l)
	    c
	  (_ (cdr l) (noo (cooons c (car l))))))
      (_ l (ono n)))

Re: Practical Emacs Lisp

#36
post #28

Earlier quoted context omitted.

I perused a couple of links. This code [0] is pretty much unidiomatic. Closing parens one per line and using setq all over the place. [0]: http://ergoemacs.org/emacs/elisp_grep_string_inside_tag.html

hi PuercoPop, that code is meant to be run as a script (emacs --script filename), so i used setq is possibly more proper. But, this is just post-fact defense, as lots my pages began as quick blogs. As you know, CL has controversial status in gnu emacs dev community. e.g. http://ergoemacs.org/emacs/elisp_common_lisp_in_emacs.html I myself avoid it, because i don't like CL. I'm going to tuck in the hanging parens in a…

But stuff like

   (let (var1 (var2 0))
     (when condition
       (setq var1 (var1-initializer-form))
        ...)))
is just silly. Only the inner scope of the when uses var1, or any of the vars; it could just be:

   (when condition
     (let ((var1 (var1-initializer-form))
           (var2 0))
        ...))
Never do two-step initialization of a variable without an excellent reason; it's just sloppy otherwise.

Re: Practical Emacs Lisp

#37
post #29

Earlier quoted context omitted.

IIUC rx.el is a sexp dsl/interface to build vanilla regex down the line right ? from what I remember about scheme SRFI is not the 'syntax' but the return values, you get streams of match, then you can leverage, folds and maps. lispm point is nice (and no one can argue about evaluation order and count), but beside the battle-tested aspect, `loop` scares the crap out of me. That's even more a reason to prefer things th…

See this Xah Lee Elisp code: (defvar xah-left-brackets '("(" "{" "[" " " "〕" "】" "〗" "〉" "》" "」" "』" "”" "’" "›" "»") "list of right bracket chars.") (progn (setq xah-right-brackets '()) (dotimes (x (- (length xah-brackets) 1)) (when (= (% x 2) 1) (push (char-to-string (elt xah-brackets x)) xah-right-brackets))) (setq xah-right-brackets (reverse xah-right-brackets))) In CL this is just: (defun every-nth (seq start n…

In TXR Lisp:

  $ txr -i
  1> (defvarl brackets '("(" ")" "[" "]" "")))
  brackets
  2> [brackets (range 0 : 2)]
  ("(" "[" " [brackets (range 1 : 2)]
  (")" "]" ">")
range generates lazy list of integers with a step size (the colon symbol defaults the second upper bound argument so the list is infinite). A list of integers can be used in the brackets notation to select elements. Put the two together and you have spaced selection.

Regarding defvarl, there is defvar too; defvarl means that the symbol is not marked special and so rebindings are lexical. Often, it is overkill for a global variable to support rebinding. We just pollute the symbol with the special marker and then have to namespace it or put earmuffs on it just in case, even though it is ever used that way.

Re: Practical Emacs Lisp

#38
post #29

Earlier quoted context omitted.

See this Xah Lee Elisp code: (defvar xah-left-brackets '("(" "{" "[" " " "〕" "】" "〗" "〉" "》" "」" "』" "”" "’" "›" "»") "list of right bracket chars.") (progn (setq xah-right-brackets '()) (dotimes (x (- (length xah-brackets) 1)) (when (= (% x 2) 1) (push (char-to-string (elt xah-brackets x)) xah-right-brackets))) (setq xah-right-brackets (reverse xah-right-brackets))) In CL this is just: (defun every-nth (seq start n…

Oh I wasn't arguing that CL loop was a far better solution than while loops (unless you process too long lists). I just became very very+ fond of academic recursive style. Here's a singly-linear variant for fixed steps. (defun ab (l) "I'm too lazy to reverse the result back." (defun _ (l a b f) (if (null l) (if f (list a b) (list b a)) (_ (cdr l) b (cons (car l) a) (not f)))) (_ l nil nil t)) (ab '()) (ab '(1)) (ab '…

Nested DEFUNs? Not in Lisp. In Common Lisp use LABELS for recursive local functions.

I'd avoid recursive code like that as much as possible.

I'd write:

    (defun ab (l)
      (loop while l collect (pop l) into a
            while l collect (pop l) into b
            finally (return (list a b))))

Re: Practical Emacs Lisp

#39
post #19

Earlier quoted context omitted.

seems like an unnecessary personal attack

It's just the truth. I've seen him posting code for a long time. He has posted lots of bad advice, because he does not understand much Lisp programming and makes claims about all kinds of random stuff.

As someone who comes across his writings once in a while I wish you would counter his bad advice with your good advice, rather than simply write that its bad.

Re: Practical Emacs Lisp

#40
post #39
post #19

Earlier quoted context omitted.

It's just the truth. I've seen him posting code for a long time. He has posted lots of bad advice, because he does not understand much Lisp programming and makes claims about all kinds of random stuff.

As someone who comes across his writings once in a while I wish you would counter his bad advice with your good advice, rather than simply write that its bad.

That's a fulltime job. comp.lang.lisp did that several years.

Just take from this discussion that his Lisp style is non-idiomatic and he writes in some primitive crappy imperative style. See my other example in this discussion.

Post reply on HN