all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why is result of `car' ⇒ quote ?
@ 2022-06-14  8:28 Jean Louis
  2022-06-14  8:31 ` Po Lu
  2022-06-14 10:16 ` Emanuel Berg
  0 siblings, 2 replies; 5+ messages in thread
From: Jean Louis @ 2022-06-14  8:28 UTC (permalink / raw)
  To: Help GNU Emacs

Here I do not understand it quite, why do I get result of `car' below,
to be `quote'?

(nth 2 (car exporters)) ⇒ '("Block 227, Plot 20086, Kakajja Zone")
(car (nth 2 (car exporters))) ⇒ quote


Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: Why is result of `car' ⇒ quote ?
  2022-06-14  8:28 Why is result of `car' ⇒ quote ? Jean Louis
@ 2022-06-14  8:31 ` Po Lu
  2022-06-14 10:16 ` Emanuel Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Po Lu @ 2022-06-14  8:31 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help GNU Emacs

Jean Louis <bugs@gnu.support> writes:

> Here I do not understand it quite, why do I get result of `car' below,
> to be `quote'?
>
> (nth 2 (car exporters)) ⇒ '("Block 227, Plot 20086, Kakajja Zone")
> (car (nth 2 (car exporters))) ⇒ quote

'("Block 227, Plot 20086, Kakajja Zone") is simply read syntax for
(quote "Block 227, Plot 20086, Kakajja Zone").



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

* Re: Why is result of `car' ⇒ quote ?
  2022-06-14  8:28 Why is result of `car' ⇒ quote ? Jean Louis
  2022-06-14  8:31 ` Po Lu
@ 2022-06-14 10:16 ` Emanuel Berg
  2022-06-14 10:24   ` Emanuel Berg
  1 sibling, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2022-06-14 10:16 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> Here I do not understand it quite, why do I get result of
> `car' below, to be `quote'?
>
> (nth 2 (car exporters)) ⇒ '("Block 227, Plot 20086, Kakajja Zone")
> (car (nth 2 (car exporters))) ⇒ quote

And the answer is ...

You have quoted the list twice!

(setq exporters '((1 2 '("Block 227, Plot 20086, Kakajja Zone"))))

(nth 2 (car exporters)) ; '("Block 227, Plot 20086, Kakajja Zone")

(car (nth 2 (car exporters))) ; quote

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: Why is result of `car' ⇒ quote ?
  2022-06-14 10:16 ` Emanuel Berg
@ 2022-06-14 10:24   ` Emanuel Berg
  2022-06-14 21:53     ` Why is result of `car' ⇒ quote ? [SOLVED] Jean Louis
  0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2022-06-14 10:24 UTC (permalink / raw)
  To: help-gnu-emacs

>> Here I do not understand it quite, why do I get result of
>> `car' below, to be `quote'?
>>
>> (nth 2 (car exporters)) ; ("Block 227, Plot 20086, Kakajja
>> Zone") (car (nth 2 (car exporters))) ; quote
>
> And the answer is ...
>
> You have quoted the list twice!
>
> (setq exporters '((1 2 '("Block 227, Plot 20086, Kakajja Zone"))))
>
> (nth 2 (car exporters)) ; '("Block 227, Plot 20086, Kakajja Zone")
>
> (car (nth 2 (car exporters))) ; quote

Instead of quoting the list twice, use `list' three times

  (setq exporters (list (list 1 2 (list "Block 227, Plot 20086, Kakajja Zone"))))
  (nth 2 (car exporters))
  (car (nth 2 (car exporters))) ; "Block 227, Plot 20086, Kakajja Zone"

and then it works :)

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: Why is result of `car' ⇒ quote ? [SOLVED]
  2022-06-14 10:24   ` Emanuel Berg
@ 2022-06-14 21:53     ` Jean Louis
  0 siblings, 0 replies; 5+ messages in thread
From: Jean Louis @ 2022-06-14 21:53 UTC (permalink / raw)
  To: help-gnu-emacs

* Emanuel Berg <incal@dataswamp.org> [2022-06-14 13:27]:
> >> Here I do not understand it quite, why do I get result of
> >> `car' below, to be `quote'?
> >>
> >> (nth 2 (car exporters)) ; ("Block 227, Plot 20086, Kakajja
> >> Zone") (car (nth 2 (car exporters))) ; quote
> >
> > And the answer is ...
> >
> > You have quoted the list twice!
> >
> > (setq exporters '((1 2 '("Block 227, Plot 20086, Kakajja Zone"))))
> >
> > (nth 2 (car exporters)) ; '("Block 227, Plot 20086, Kakajja Zone")
> >
> > (car (nth 2 (car exporters))) ; quote
> 
> Instead of quoting the list twice, use `list' three times
> 
>   (setq exporters (list (list 1 2 (list "Block 227, Plot 20086, Kakajja Zone"))))
>   (nth 2 (car exporters))
>   (car (nth 2 (car exporters))) ; "Block 227, Plot 20086, Kakajja Zone"
> 
> and then it works :)

That is what I did now, thanks.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

end of thread, other threads:[~2022-06-14 21:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-14  8:28 Why is result of `car' ⇒ quote ? Jean Louis
2022-06-14  8:31 ` Po Lu
2022-06-14 10:16 ` Emanuel Berg
2022-06-14 10:24   ` Emanuel Berg
2022-06-14 21:53     ` Why is result of `car' ⇒ quote ? [SOLVED] 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.