all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* comic-book-insult
@ 2019-09-08 19:05 Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-08 20:16 ` comic-book-insult Marcin Borkowski
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-08 19:05 UTC (permalink / raw)
  To: help-gnu-emacs

(defun scramble-string (str)
  "Randomize the characters of a string."
  (interactive "sscramble me: ")
  (let*((empty-str  "")
        (chars      (delete empty-str (split-string str empty-str)))
        (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
        (rand-str   (mapconcat 'identity rand-chars ""))
        )
    rand-str) )

(defun comic-book-insult ()
  (interactive)
  (insert (concat (scramble-string "@#$%&") "!") ))

;; (comic-book-insult) ; %@&$#!
;; (comic-book-insult) ; $%#@&!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
@ 2019-09-08 20:16 ` Marcin Borkowski
  2019-09-08 22:55   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-08 22:29 ` comic-book-insult Adam Porter
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Marcin Borkowski @ 2019-09-08 20:16 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs


On 2019-09-08, at 21:05, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> (defun scramble-string (str)
>   "Randomize the characters of a string."
>   (interactive "sscramble me: ")
>   (let*((empty-str  "")
>         (chars      (delete empty-str (split-string str empty-str)))
>         (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
>         (rand-str   (mapconcat 'identity rand-chars ""))
>         )
>     rand-str) )

Nice, but a bit wrong.  If you try it as an interactive function, it
won't display the result - only return it, but this is of no use with M-x.

> (defun comic-book-insult ()
>   (interactive)
>   (insert (concat (scramble-string "@#$%&") "!") ))
>
> ;; (comic-book-insult) ; %@&$#!
> ;; (comic-book-insult) ; $%#@&!

And this is rather cute, thanks for sharing!

Best,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-08 20:16 ` comic-book-insult Marcin Borkowski
@ 2019-09-08 22:29 ` Adam Porter
  2019-09-10 23:43   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-08 23:47 ` comic-book-insult Eric Abrahamsen
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Adam Porter @ 2019-09-08 22:29 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> (defun scramble-string (str)
>   "Randomize the characters of a string."
>   (interactive "sscramble me: ")
>   (let*((empty-str  "")
>         (chars      (delete empty-str (split-string str empty-str)))
>         (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
>         (rand-str   (mapconcat 'identity rand-chars ""))
>         )
>     rand-str) )
>
> (defun comic-book-insult ()
>   (interactive)
>   (insert (concat (scramble-string "@#$%&") "!") ))
>
> ;; (comic-book-insult) ; %@&$#!
> ;; (comic-book-insult) ; $%#@&!

seq.el makes this even easier:

    (seq-sort (lambda (_ _)
                (zerop (random 2)))
              "01234")  ;;=> "01423"




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 20:16 ` comic-book-insult Marcin Borkowski
@ 2019-09-08 22:55   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-08 22:55 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski wrote:

> Nice, but a bit wrong. If you try it as an
> interactive function, it won't display the
> result - only return it, but this is of no
> use with M-x.

Right, forgot about that, OK:

(defun scramble-string (str)
  "Randomize the characters of a string."
  (interactive "sscramble me: ")
  (let*((empty-str  "")
        (chars      (delete empty-str (split-string str empty-str)))
        (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
        (rand-str   (mapconcat 'identity rand-chars ""))
        )
    (if (called-interactively-p 'any)
        (message rand-str)
      rand-str) ))

>> (defun comic-book-insult ()
>>   (interactive)
>>   (insert (concat (scramble-string "@#$%&") "!") ))
>>
>> ;; (comic-book-insult) ; %@&$#!
>> ;; (comic-book-insult) ; $%#@&!
>
> And this is rather cute, thanks for sharing!

Anytime :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-08 20:16 ` comic-book-insult Marcin Borkowski
  2019-09-08 22:29 ` comic-book-insult Adam Porter
@ 2019-09-08 23:47 ` Eric Abrahamsen
  2019-09-09  3:56   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-09  5:09 ` comic-book-insult Yuri Khan
  2019-09-09  8:00 ` comic-book-insult Jean Louis
  4 siblings, 1 reply; 19+ messages in thread
From: Eric Abrahamsen @ 2019-09-08 23:47 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> (defun scramble-string (str)
>   "Randomize the characters of a string."
>   (interactive "sscramble me: ")
>   (let*((empty-str  "")
>         (chars      (delete empty-str (split-string str empty-str)))
>         (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
>         (rand-str   (mapconcat 'identity rand-chars ""))
>         )
>     rand-str) )

You can simplify that as:

(defun scramble-string (str)
  "Randomize the characters of a string."
  (interactive "sscramble me: ")
  (concat (sort (string-to-vector str)
		(lambda (_ _) (zerop (random 2))))))




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 23:47 ` comic-book-insult Eric Abrahamsen
@ 2019-09-09  3:56   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-09  3:56 UTC (permalink / raw)
  To: help-gnu-emacs

Eric Abrahamsen wrote:

> You can simplify that as:
>
> (defun scramble-string (str)
>   "Randomize the characters of a string."
>   (interactive "sscramble me: ")
>   (concat (sort (string-to-vector str)
> 		(lambda (_ _) (zerop (random 2))))))

(defun scramble-string (str)
  "Randomize the characters of a string."
  (interactive "sscramble me: ")
  (let ((rand-str (concat
                   (sort (string-to-vector str)
                         (lambda (_ __) (zerop (random 2))) ))))
    (if (called-interactively-p 'any)
        (message rand-str)
      rand-str) ))

(defun comic-book-insult ()
  (interactive)
  (insert (concat (scramble-string "@#$%&") "!") ))

;; (comic-book-insult) ; @#$%&!
;; (comic-book-insult) ; $&#@%!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
                   ` (2 preceding siblings ...)
  2019-09-08 23:47 ` comic-book-insult Eric Abrahamsen
@ 2019-09-09  5:09 ` Yuri Khan
  2019-09-09 17:41   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-09  8:00 ` comic-book-insult Jean Louis
  4 siblings, 1 reply; 19+ messages in thread
From: Yuri Khan @ 2019-09-09  5:09 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Mon, 9 Sep 2019 at 02:05, Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:

>         (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))

If you were to pull off this kind of thing in C or C++, that would be
classified as undefined behavior and possibly cause demons to fly out
your nose. The comparison predicate used in sorting algorithms must be
a strict weak ordering, i.e.:

* irreflexive — (not (p x x)) for each x;
* antisymmetric — if (p x y), then (not (p y x));
* transitive — if (p x y) and (p y z), then (p x z);
* the equivalence induced by it must also be transitive — if (not (or
(p x y) (p y x))) and (not (or (p y z) (p z y))), then (not (or (p x
z) (p z x))).

A predicate that returns a random boolean on each invocation will
easily violate any or all of the above.


The canonical lazy coder way to random-shuffle a collection is to
first associate a random value with each element, then sort by that:

(concat
 (seq-map #'car
          (seq-sort-by #'cdr #'<
                       (seq-map (lambda (x) (cons x (random)))
                                (string-to-vector "@#$%&")))))

(This whole sorting approach is criticized because it is O(n log n) in
the number of elements while there exist random shuffle algorithms
that are linear, i.e. O(n). See [1].)

[1]: https://stackoverflow.com/a/1287572/1326190



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
                   ` (3 preceding siblings ...)
  2019-09-09  5:09 ` comic-book-insult Yuri Khan
@ 2019-09-09  8:00 ` Jean Louis
  2019-09-09 17:32   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  4 siblings, 1 reply; 19+ messages in thread
From: Jean Louis @ 2019-09-09  8:00 UTC (permalink / raw)
  To: help-gnu-emacs

* Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2019-09-08 21:06]:
> (defun scramble-string (str)
>   "Randomize the characters of a string."
>   (interactive "sscramble me: ")
>   (let*((empty-str  "")
>         (chars      (delete empty-str (split-string str empty-str)))
>         (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
>         (rand-str   (mapconcat 'identity rand-chars ""))
>         )
>     rand-str) )
> 
> (defun comic-book-insult ()
>   (interactive)
>   (insert (concat (scramble-string "@#$%&") "!") ))
> 
> ;; (comic-book-insult) ; %@&$#!
> ;; (comic-book-insult) ; $%#@&!

Thanks, now I learned how to scramble words like this below in
Emacs. But I have no idea what means (lambda (_ __)

(defun scramble-word (word)
  "Randomize the characters of a string but not first and last"
  (let* ((first (substring word 0 1))
	 (length (length word))
	 (last (substring word (1- length) length))
	 (middle (substring word 1 (1- length)))
	 (rnd (length middle))
	 (empty-str  "")
         (chars (delete empty-str (split-string middle empty-str)))
         (rand-chars (sort chars (lambda (_ __) (zerop (random rnd)))))
         (rand-str (mapconcat 'identity rand-chars ""))
	 (word (concat first rand-str last)))
    word))

(defun scramble-string (string)
  (let* ((split (split-string string))
	 (out (with-output-to-string
		(dolist (word split)
		  (princ (scramble-word word))
		  (princ " ")))))
    out))

(defun scramble-region (start end)
  "Scramble region"
  (interactive "r")
  (let* ((s (buffer-substring-no-properties start end))
         (replacement (scramble-string s)))
    (delete-region start end)
    (insert replacement)))


(scramble-string "Hello there, Emacs is very cool piece of software")

=> "Hlelo theer, Eamcs is vrey cool peice of sfotware "

Reference:

Why your brain can read jumbled letters:
https://www.mnn.com/lifestyle/arts-culture/stories/why-your-brain-can-read-jumbled-letters

Emcas is the extenisble, customblezia, slef doucmenintg rael time dipsaly eidtor. Tihs manaul desrcibes how to eidt wtih Emacs and smoe of the wyas to cuostmize it; it crpeoorsnds to GNU Eacms versoin 235.. 


Jean



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09  8:00 ` comic-book-insult Jean Louis
@ 2019-09-09 17:32   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-09 18:05     ` comic-book-insult Jean Louis
  0 siblings, 1 reply; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-09 17:32 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> Thanks, now I learned how to scramble words
> like this below in Emacs. But I have no idea
> what means (lambda (_ __)

It is an anonymous function (lambda) with two
anonymous arguments (_ and __), they are
denoted with underscores so one can see they
are not used - if they were called element-1
and element-2, the byte-compiler will warn
about unused lexical arguments.

Why not just lambda ()? The truth is out there
in the docstring of `sort'.

> (scramble-string "Hello there, Emacs is very
> cool piece of software")
>
> => "Hlelo theer, Eamcs is vrey cool peice of
> sfotware "

It's time to take scrambling to the next level:

(scramble-string "Hello there, Emacs is very
cool piece of software")

"aye eposrr lvre olsec,ewfico ceti ftomH hseoa
l E"

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09  5:09 ` comic-book-insult Yuri Khan
@ 2019-09-09 17:41   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-09 18:26     ` comic-book-insult Yuri Khan
  0 siblings, 1 reply; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-09 17:41 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan wrote:

>> (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
>
> If you were to pull off this kind of thing in
> C or C++, that would be classified as
> undefined behavior and possibly cause demons
> to fly out your nose. The comparison
> predicate used in sorting algorithms must be
> a strict weak ordering, i.e.
>
> * irreflexive — (not (p x x)) for each x;
> * antisymmetric — if (p x y), then (not (p y x));
> * transitive — if (p x y) and (p y z), then
>   (p x z);
> * the equivalence induced by it must also
>   be transitive — if (not (or (p x y) (p y x)))
>   and (not (or (p y z) (p z y))), then (not (or
>   (p x z) (p z x))).
>
> A predicate that returns a random boolean on
> each invocation will easily violate any or all
> of the above. [...]

Interesting, however does Computer Science
theory of sorting apply even when the intention
is to randomize the elements?

> The canonical lazy coder way to random-shuffle
> a collection is to first associate a random
> value with each element, then sort by that:
>
> (concat (seq-map #'car (seq-sort-by #'cdr #'<
> (seq-map (lambda (x) (cons x (random)))
> (string-to-vector "@#$%&")))))

The coder can't be that lazy:

    seq-map: Symbol’s function definition is
    void: seq-sort-by
    
-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09 17:32   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
@ 2019-09-09 18:05     ` Jean Louis
  2019-09-09 18:10       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-09 18:13       ` comic-book-insult Eli Zaretskii
  0 siblings, 2 replies; 19+ messages in thread
From: Jean Louis @ 2019-09-09 18:05 UTC (permalink / raw)
  To: help-gnu-emacs

* Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-> (scramble-string "Hello there, Emacs is very
> cool piece of software")
> 
> "aye eposrr lvre olsec,ewfico ceti ftomH hseoa
> l E"

oh, but that one is not readable.

Thanks for explanation of anonymous arguments. Anonymous function is
clear, but I did not know of _ and __ arguments.

I cannot find it in the Emacs Lisp manual, is it there?

Jean



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09 18:05     ` comic-book-insult Jean Louis
@ 2019-09-09 18:10       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-09 18:13       ` comic-book-insult Eli Zaretskii
  1 sibling, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-09 18:10 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

>> cool piece of software")
>> 
>> "aye eposrr lvre olsec,ewfico ceti ftomH
>> hseoa l E"
>
> oh, but that one is not readable.

Hm, perhaps I better change the name from
scramble to randomize?

> Thanks for explanation of anonymous
> arguments. Anonymous function is clear, but
> I did not know of _ and __ arguments.
>
> I cannot find it in the Emacs Lisp manual, is
> it there?

They should be :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09 18:05     ` comic-book-insult Jean Louis
  2019-09-09 18:10       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
@ 2019-09-09 18:13       ` Eli Zaretskii
  2019-09-11 12:56         ` Anonymous arguments - comic-book-insult Jean Louis
  1 sibling, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-09 18:13 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 9 Sep 2019 20:05:53 +0200
> From: Jean Louis <bugs@gnu.support>
> 
> Thanks for explanation of anonymous arguments. Anonymous function is
> clear, but I did not know of _ and __ arguments.
> 
> I cannot find it in the Emacs Lisp manual, is it there?

It's right there at the end of "Using Lexical Binding".



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09 17:41   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
@ 2019-09-09 18:26     ` Yuri Khan
  2019-09-09 18:33       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Yuri Khan @ 2019-09-09 18:26 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Tue, 10 Sep 2019 at 00:41, Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> > A predicate that returns a random boolean on
> > each invocation will easily violate any or all
> > of the above. [...]
>
> Interesting, however does Computer Science
> theory of sorting apply even when the intention
> is to randomize the elements?

Yes. If you use a predicate that does not satisfy the strict weak
ordering contract, the implementation of the sorting algorithm gives
you no warranties. For example, some implementations may fail to
terminate (i.e. enter an infinite loop), raise an error condition,
crash, spew warnings, or otherwise cause an effect other than a random
shuffling.

If you know the internals of a particular sort implementation, you
might conclude it does not suffer from any problems given an improper
comparison predicate; but it is bad form to depend on such
implementation details.

> > (concat (seq-map #'car (seq-sort-by #'cdr #'<
> > (seq-map (lambda (x) (cons x (random)))
> > (string-to-vector "@#$%&")))))
>
> The coder can't be that lazy:
>
>     seq-map: Symbol’s function definition is
>     void: seq-sort-by

Works for me, on 26.2.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-09 18:26     ` comic-book-insult Yuri Khan
@ 2019-09-09 18:33       ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-09 18:33 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan wrote:

>> The coder can't be that lazy:
>> seq-map: Symbol’s function definition is void: seq-sort-by
>
> Works for me, on 26.2.

Not here on:

    GNU Emacs 25.1.1 (arm-unknown-linux-gnueabihf,
    GTK+ Version 3.22.11) of 2017-09-16, modified
    by Debian

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: comic-book-insult
  2019-09-08 22:29 ` comic-book-insult Adam Porter
@ 2019-09-10 23:43   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-10 23:43 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Porter wrote:

> seq.el makes this even easier:
>
>     (seq-sort (lambda (_ _) (zerop (random 2)))
> "01234") ;;=> "01423"

Note: One has to use _ and __, otherwise the
      byte-compiler warns "Warning: repeated
      variable _ in lambda-list".

Other than that, OK:

(require 'seq)
(defun scramble-string (str)
  "Randomize the characters of a string."
  (interactive "sscramble me: ")
  (let ((rand-str (seq-sort (lambda (_ __) (zerop (random 2))) str )))
    (if (called-interactively-p 'any)
        (message rand-str)
      rand-str) ))

(defun comic-book-insult ()
  (interactive)
  (insert (concat (scramble-string "@#$%&") "!") ))

;; (comic-book-insult) ; @#$%&!
;; (comic-book-insult) ; $&#@%!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Anonymous arguments - Re: comic-book-insult
  2019-09-09 18:13       ` comic-book-insult Eli Zaretskii
@ 2019-09-11 12:56         ` Jean Louis
  2019-09-11 15:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Jean Louis @ 2019-09-11 12:56 UTC (permalink / raw)
  To: GNU Emacs Help

* Eli Zaretskii <eliz@gnu.org> [2019-09-09 20:14]:
> > Date: Mon, 9 Sep 2019 20:05:53 +0200
> > From: Jean Louis <bugs@gnu.support>
> > 
> > Thanks for explanation of anonymous arguments. Anonymous function is
> > clear, but I did not know of _ and __ arguments.
> > 
> > I cannot find it in the Emacs Lisp manual, is it there?
> 
> It's right there at the end of "Using Lexical Binding".

Cannot find it, help me. I wish to understand it.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Anonymous arguments - Re: comic-book-insult
  2019-09-11 12:56         ` Anonymous arguments - comic-book-insult Jean Louis
@ 2019-09-11 15:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
  2019-09-17  6:19             ` Jean Louis
  0 siblings, 1 reply; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2019-09-11 15:12 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> Cannot find it, help me. I wish to
> understand it.

Assimilate this:

    (info "(elisp) Using Lexical Binding")

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Anonymous arguments - Re: comic-book-insult
  2019-09-11 15:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2019-09-17  6:19             ` Jean Louis
  0 siblings, 0 replies; 19+ messages in thread
From: Jean Louis @ 2019-09-17  6:19 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: GNU Emacs Help

* Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2019-09-11 17:36]:
> Jean Louis wrote:
> 
> > Cannot find it, help me. I wish to
> > understand it.
> 
> Assimilate this:
> 
>     (info "(elisp) Using Lexical Binding")

Now I found it, I was looking for "_" instead of "underscore" word,
now I got it. Thanks.

   A simple way to find out which variables need a variable definition
is to byte-compile the source file.  *Note Byte Compilation::.  If a
non-special variable is used outside of a ‘let’ form, the byte-compiler
will warn about reference or assignment to a free variable.  If a
non-special variable is bound but not used within a ‘let’ form, the
byte-compiler will warn about an unused lexical variable.  The
byte-compiler will also issue a warning if you use a special variable as
a function argument.

   (To silence byte-compiler warnings about unused variables, just use a
variable name that start with an underscore.  The byte-compiler
interprets this as an indication that this is a variable known not to be
used.)




^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-09-17  6:19 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-08 20:16 ` comic-book-insult Marcin Borkowski
2019-09-08 22:55   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-08 22:29 ` comic-book-insult Adam Porter
2019-09-10 23:43   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-08 23:47 ` comic-book-insult Eric Abrahamsen
2019-09-09  3:56   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09  5:09 ` comic-book-insult Yuri Khan
2019-09-09 17:41   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09 18:26     ` comic-book-insult Yuri Khan
2019-09-09 18:33       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09  8:00 ` comic-book-insult Jean Louis
2019-09-09 17:32   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09 18:05     ` comic-book-insult Jean Louis
2019-09-09 18:10       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09 18:13       ` comic-book-insult Eli Zaretskii
2019-09-11 12:56         ` Anonymous arguments - comic-book-insult Jean Louis
2019-09-11 15:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-17  6:19             ` Jean Louis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.