unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Splitting  a list with spaces and comments
@ 2023-08-16 12:17 Heime
  2023-08-16 19:07 ` Philip Kaludercic
  2023-08-16 21:20 ` Pierre Rouleau
  0 siblings, 2 replies; 5+ messages in thread
From: Heime @ 2023-08-16 12:17 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor


Can one split a list with spaces and comments, like so

(let ( (csel '("Symbol" "Command"))
       (cseq '("alpha α"     "Beta B"     "beta β"
               "Gamma Γ"     "gamma γ"

               ;; Additional Graphemes
               "Delta Δ"     "delta δ"
               "Epsilon E"   "epsilon ε"  "varepsilon ε"
               "Zeta Z"      "zeta ζ")) ))



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

* Re: Splitting  a list with spaces and comments
  2023-08-16 12:17 Splitting a list with spaces and comments Heime
@ 2023-08-16 19:07 ` Philip Kaludercic
  2023-08-16 21:20 ` Pierre Rouleau
  1 sibling, 0 replies; 5+ messages in thread
From: Philip Kaludercic @ 2023-08-16 19:07 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

Heime <heimeborgia@protonmail.com> writes:

> Can one split a list with spaces and comments, like so
>
> (let ( (csel '("Symbol" "Command"))
>        (cseq '("alpha α"     "Beta B"     "beta β"
>                "Gamma Γ"     "gamma γ"
>
>                ;; Additional Graphemes
>                "Delta Δ"     "delta δ"
>                "Epsilon E"   "epsilon ε"  "varepsilon ε"
>                "Zeta Z"      "zeta ζ")) ))

Comments are forgotten after parsing the code, functions that take
s-expressions as arguments have no knowledge of these, and cannot take
them into account in any computation.



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

* Re: Splitting a list with spaces and comments
  2023-08-16 12:17 Splitting a list with spaces and comments Heime
  2023-08-16 19:07 ` Philip Kaludercic
@ 2023-08-16 21:20 ` Pierre Rouleau
  2023-08-17  0:26   ` Heime
  1 sibling, 1 reply; 5+ messages in thread
From: Pierre Rouleau @ 2023-08-16 21:20 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

Heime,

Why not just try what you want to learn directly inside Emacs?
You can use the Emacs Lisp REPLl (read-eval-print-loop) for that and
there's one built-in Emacs: ielm.
Type 'M-x ielm' and you will get a buffer with a Emacs Lisp interpreter
running.
Then inside that you can try to set variables with the values you want.
At the ELISP> prompt type any valid Emacs Lisp expression.  If there is an
error it will tell you.

Here's a session creating the csel and cset variables:


*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (setq csel '("Symbol" "Command"))
("Symbol" "Command")

ELISP> csel
("Symbol" "Command")

ELISP> (setq cseq '("alpha α"     "Beta B"     "beta β"


                    "Gamma Γ"     "gamma γ"


                    ;; some comments


                    "Delta Δ"     "delta δ"


                    "Epsilon E"   "epsilon ε"  "varepsilon ε"


                    "Zeta Z"      "zeta ζ"))
("alpha α" "Beta B" "beta β" "Gamma Γ" "gamma γ" "Delta Δ" "delta δ"
"Epsilon E" "epsilon ε" "varepsilon ε" "Zeta Z" "zeta ζ")

ELISP> cseq
("alpha α" "Beta B" "beta β" "Gamma Γ" "gamma γ" "Delta Δ" "delta δ"
"Epsilon E" "epsilon ε" "varepsilon ε" "Zeta Z" "zeta ζ")

ELISP>


On Wed, Aug 16, 2023 at 8:19 AM Heime <heimeborgia@protonmail.com> wrote:

>
> Can one split a list with spaces and comments, like so
>
> (let ( (csel '("Symbol" "Command"))
>        (cseq '("alpha α"     "Beta B"     "beta β"
>                "Gamma Γ"     "gamma γ"
>
>                ;; Additional Graphemes
>                "Delta Δ"     "delta δ"
>                "Epsilon E"   "epsilon ε"  "varepsilon ε"
>                "Zeta Z"      "zeta ζ")) ))
>
>

-- 
/Pierre


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

* Re: Splitting a list with spaces and comments
  2023-08-16 21:20 ` Pierre Rouleau
@ 2023-08-17  0:26   ` Heime
  2023-08-17  1:01     ` Pierre Rouleau
  0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2023-08-17  0:26 UTC (permalink / raw)
  To: Pierre Rouleau; +Cc: Heime via Users list for the GNU Emacs text editor



------- Original Message -------
On Thursday, August 17th, 2023 at 9:20 AM, Pierre Rouleau <prouleau001@gmail.com> wrote:


> Heime,
> 
> Why not just try what you want to learn directly inside Emacs?
> You can use the Emacs Lisp REPLl (read-eval-print-loop) for that and there's one built-in Emacs: ielm.
> Type 'M-x ielm' and you will get a buffer with a Emacs Lisp interpreter running.
> Then inside that you can try to set variables with the values you want.
> At the ELISP> prompt type any valid Emacs Lisp expression. If there is an error it will tell you.
> 
> Here's a session creating the csel and cset variables:
> 
> 
> *** Welcome to IELM *** Type (describe-mode) for help.
> ELISP> (setq csel '("Symbol" "Command"))
> ("Symbol" "Command")
> 
> ELISP> csel
> ("Symbol" "Command")
> 
> ELISP> (setq cseq '("alpha α" "Beta B" "beta β"
> "Gamma Γ" "gamma γ"
> ;; some comments
> "Delta Δ" "delta δ"
> "Epsilon E" "epsilon ε" "varepsilon ε"
> "Zeta Z" "zeta ζ"))
> ("alpha α" "Beta B" "beta β" "Gamma Γ" "gamma γ" "Delta Δ" "delta δ" "Epsilon E" "epsilon ε" "varepsilon ε" "Zeta Z" "zeta ζ")
> 
> ELISP> cseq
> ("alpha α" "Beta B" "beta β" "Gamma Γ" "gamma γ" "Delta Δ" "delta δ" "Epsilon E" "epsilon ε" "varepsilon ε" "Zeta Z" "zeta ζ")
> 
> ELISP>

Much appreciate showing me how to use ielm for this.
 
 
> On Wed, Aug 16, 2023 at 8:19 AM Heime <heimeborgia@protonmail.com> wrote:
> 
> > 
> > Can one split a list with spaces and comments, like so
> > 
> > (let ( (csel '("Symbol" "Command"))
> > (cseq '("alpha α" "Beta B" "beta β"
> > "Gamma Γ" "gamma γ"
> > 
> > ;; Additional Graphemes
> > "Delta Δ" "delta δ"
> > "Epsilon E" "epsilon ε" "varepsilon ε"
> > "Zeta Z" "zeta ζ")) ))
> 
> 
> 
> --
> /Pierre



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

* Re: Splitting a list with spaces and comments
  2023-08-17  0:26   ` Heime
@ 2023-08-17  1:01     ` Pierre Rouleau
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Rouleau @ 2023-08-17  1:01 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

On Wed, Aug 16, 2023 at 8:26 PM Heime <heimeborgia@protonmail.com> wrote:

>
> Much appreciate showing me how to use ielm for this.
>

You're welcome.  ielm, along with the help that comes with each EMacs Lisp
function will help you a lot.

You can request help for any function by typing 'C-h f'
 For example, if you want to see more information about the setq special
form, you:
-  type: 'C-h f'
- Emacs will prompt at the bottom of the screen: type 'setq' then hit return
- Emacs will then open a window with a help buffer showing this:

setq is a special form in ‘C source code’.

(setq [SYM VAL]...)

Set each SYM to the value of its VAL.
The symbols SYM are variables; they are literal (not evaluated).
The values VAL are expressions; they are evaluated.
Thus, (setq x (1+ y)) sets ‘x’ to the value of ‘(1+ y)’.
The second VAL is not computed until after the first SYM is set, and so on;
each VAL can use the new value of variables set earlier in the ‘setq’.
The return value of the ‘setq’ form is the value of the last VAL.

You will also see some highlighted words.  They are links that will show
other info.
If you have installed Emacs C source code, there will also be a link that
will lead you to the C source code for this special form.
If you request help for something implemented in Emacs Lisp the link will
lead to the source code of that function.

You can also request help for other things, like keys (C-h k), any symbol
(C-h o) , the coding system (C-h C), etc...

All of this information is in Emacs manual (internally to Emacs, or outside
in the Web-based manual (ie:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Help.html#Help
).

I also have built a set of PDF files with lots of links when I first
learned Emacs (I find it helped me to remember things).  The page
describing help is here:
https://raw.githubusercontent.com/pierre-rouleau/pel/master/doc/pdf/help.pdf
(access it with a browser that can render PDF if you want to use the links
easily.  I think it can be done within Emacs running in graphics mode, but
I mostly use terminal-based Emacs for various reasons).

It will help you a lot to go through the help.  It will influence your
design ideas for the better.

-- 
/Pierre


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

end of thread, other threads:[~2023-08-17  1:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 12:17 Splitting a list with spaces and comments Heime
2023-08-16 19:07 ` Philip Kaludercic
2023-08-16 21:20 ` Pierre Rouleau
2023-08-17  0:26   ` Heime
2023-08-17  1:01     ` Pierre Rouleau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).