[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How users start programming in Emacs Lisp...
From: |
Jean Louis |
Subject: |
Re: How users start programming in Emacs Lisp... |
Date: |
Sun, 30 May 2021 21:57:13 +0300 |
User-agent: |
Mutt/2.0.7+183 (3d24855) (2021-05-28) |
* Christopher Dimech <dimech@gmx.com> [2021-05-30 20:22]:
> I am having some problem figuring out what the following does, having format
> repeated twice.
>
> (format format ": " name)
In Lisp at first place comes usually the function, but other list
elements are arguments to the function.
You could inspect `format' function with {C-h f format RET} as it
tells you that you apply it as:
format is a built-in function in ‘C source code’.
(format STRING &rest OBJECTS)
Format a string out of a format-string and arguments.
The first argument is a format control string.
The other arguments are substituted into it to make the result, a string.
The STRING is format-string, for example "%s" which means that %s will
be replaced with the argument or one of OBJECTS.
(format "%s" "Hello") ⇒ "Hello"
(format "Hello %s" "John") ⇒ "Hello John"
And the format-string which comes at second place is in my case named
also `format' why not.
(let ((format-string "Hello %s"))
(format format-string "John")) ⇒ "Hello John"
or like this:
(let ((format "Hello %s"))
(format format "John")) ⇒ "Hello John"
It will stop being confusing when you fully understand what is
list in Lisp and that functions come first and everything else
are arguments. This may not be best technical explanation, it is
just practical.
--
Jean
Take action in Free Software Foundation campaigns:
http://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
http://stallmansupport.org/
- Re: How users start programming in Emacs Lisp..., (continued)
- Re: How users start programming in Emacs Lisp..., Jean Louis, 2021/05/30
- How users start programming in Emacs Lisp..., Christopher Dimech, 2021/05/30
- Re: How users start programming in Emacs Lisp..., Jean Louis, 2021/05/30
- How users start programming in Emacs Lisp..., Christopher Dimech, 2021/05/30
- Re: How users start programming in Emacs Lisp..., Jean Louis, 2021/05/30
- How users start programming in Emacs Lisp..., Christopher Dimech, 2021/05/30
- Re: How users start programming in Emacs Lisp..., Jean Louis, 2021/05/30
- How users start programming in Emacs Lisp..., Christopher Dimech, 2021/05/30
- Re: How users start programming in Emacs Lisp...,
Jean Louis <=
- Re: How users start programming in Emacs Lisp..., Jean Louis, 2021/05/30
- How users start programming in Emacs Lisp..., Christopher Dimech, 2021/05/31
- Re: How users start programming in Emacs Lisp..., Jean Louis, 2021/05/31
Re: Fortran Topics (outline-minor-mode, require, fixed format), Jean Louis, 2021/05/29
- Re: Fortran Topics (outline-minor-mode, require, fixed format), Emanuel Berg, 2021/05/29
- Re: Fortran Topics (outline-minor-mode, require, fixed format), Jean Louis, 2021/05/29
- Re: Fortran Topics (outline-minor-mode, require, fixed format), Emanuel Berg, 2021/05/29
- Re: Fortran Topics (outline-minor-mode, require, fixed format), Jean Louis, 2021/05/29
Re: Fortran Topics (outline-minor-mode, require, fixed format), Stefan Monnier, 2021/05/29