Live data from Hacker News

Practical Emacs Lisp

ergoemacs.org

41–50 of 60 posts

Re: Practical Emacs Lisp

#41
post #27
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.

I have no desire to get into a personal argument, but I would like to point out that one contribution he has made for me that have not seen elsewhere is that he has chosen to use Emacs as a text-processing scripting environment in preference to Perl or Python or some other scripting languages. Without commenting on issues of style or idiom I found his write-ups of this experience using the text-editing primitives of…

I would avoid this stuff. His language advocacy is not very convincing and he also fails to understand what grep does.

Re: Practical Emacs Lisp

#42
post #32

Earlier quoted context omitted.

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…

> The only Lisp he learned was some imperative crappy style

Not to be trolling myself, but I believe that's part of the "practical" aspect.

You'll find much of the same in "Practical common lisp".

Re: Practical Emacs Lisp

#43
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 '…

Some Schemes - most notably Racket, which I use the most - allow for nested defines. Your code actually is a valid Racket code after polishing the differences in naming and syntax a bit:

    #lang racket

    (define-syntax-rule (defun name (arg ...) . body)
      (define (name arg ...) . body))
    (define nil null)
    (define t #t)

    (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))
...and you don't need to worry about recursion limits thanks to mandatory TCO.

Re: Practical Emacs Lisp

#44
post #41
post #27

Earlier quoted context omitted.

I have no desire to get into a personal argument, but I would like to point out that one contribution he has made for me that have not seen elsewhere is that he has chosen to use Emacs as a text-processing scripting environment in preference to Perl or Python or some other scripting languages. Without commenting on issues of style or idiom I found his write-ups of this experience using the text-editing primitives of…

I would avoid this stuff. His language advocacy is not very convincing and he also fails to understand what grep does.

OMG, he actually loads all the files to temporary buffers and calls it `grep`?

And the other text is misguided for the most part and reveals a misunderstanding of some basic concepts. tumba, please don't use these texts. I second lispm here. Only read these once you have a solid understanding of described concepts yourself.

Re: Practical Emacs Lisp

#45
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…

> If you can find technical faults in this resource, you should provide them so the author can correct

That's the problem, actually - I never saw Xah correct anything he thought "right", no matter how many people presented rational arguments. Granted, I don't follow his writings that much, so maybe it happens; however my general impression is that it's utterly impossible to convince Xah of anything.

On the other hand, his site does provide a certain amount of information. It just mixes good information with bad in a way which makes it very hard for beginners to tell one from the other.

Re: Practical Emacs Lisp

#46

Earlier quoted context omitted.

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 '…

Some Schemes - most notably Racket, which I use the most - allow for nested defines. Your code actually is a valid Racket code after polishing the differences in naming and syntax a bit: #lang racket (define-syntax-rule (defun name (arg ...) . body) (define (name arg ...) . body)) (define nil null) (define t #t) (defun ab (l) ;; "I'm too lazy to reverse the result back." (defun _ (l a b f) (if (null? l) (if f (list a…

Yeah, I spent too much time on scheme classes about recursive logic while using emacs lisp at the same time, hence the code above.

Re: Practical Emacs Lisp

#47
post #38

Earlier quoted context omitted.

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))))

Oops, I forgot defun affected the global namespace.

Your last example is nice. I had to read the CLHS loop to have a clue about linearity of multiple termination clauses though :)

ps: funny, while googling I even found some lisp checker with a rule about nested defuns (## define-lisp-pattern nested-defuns)

http://www.cs.northwestern.edu/academics/courses/325/program...

Re: Practical Emacs Lisp

#48
post #32

Earlier quoted context omitted.

> 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…

> The only Lisp he learned was some imperative crappy style Not to be trolling myself, but I believe that's part of the "practical" aspect. You'll find much of the same in "Practical common lisp".

What I think of is Lisp code from the 60s, before structured programming, functional programming, etc.

when he writes:

    (let (a b c)
      (setq a ...)
      ...
      (setq b ...)
      ....)
That's basically the style of the past:

     (prog (a b c)

       (setq a ...)

       ...)
With one difference: then it was usual to program control flows in Lisp with labels and gotos...

Re: Practical Emacs Lisp

#49
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.

> It's well known that much of his 'advice' is useless. The number of bullshit posts by him is a bignum.

I wanted to check this. How easy would it be to find something trolling-like, written by Xah? Turns out it took only 3 tries when searching for "Xah Lee" on googlegroups comp.lang.lisp. The third post I clicked revealed this gem:

    there's a good solution to lisp's non-functional ways. 

    BAN lispers from using list or cons. Everything should be vector/array 
    instead. 

    everytime a cons is involved, lispers should get a electric shock. 

    that will immediately fix majority of lisp's non-functional programing 
    in practice. 

    though, i'll have to say, the more i read about Clojure, the better it 
    seems. It is very functional, the savior of the lisp name. 
...I wasted a bit of time on this and I'm not sure it was worth it, but I'm pasting this here to strengthen lispm argument by replacing "it's well known" with a concrete example.

Re: Practical Emacs Lisp

#50
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.

> It's well known that much of his 'advice' is useless. The number of bullshit posts by him is a bignum. I wanted to check this. How easy would it be to find something trolling-like, written by Xah? Turns out it took only 3 tries when searching for "Xah Lee" on googlegroups comp.lang.lisp. The third post I clicked revealed this gem: there's a good solution to lisp's non-functional ways. BAN lispers from using list or…

Bullies always rationalize their bullying by arguing their victim deserved it. Their flunkies are recognized by their chorus of "Yeah he deserved it" noises.
Post reply on HN