all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Simple elisp problem with equal
@ 2005-04-26 23:35 exits funnel
  2005-04-27  8:03 ` Ismael Valladolid Torres
  2005-04-27  8:28 ` Peter Dyballa
  0 siblings, 2 replies; 8+ messages in thread
From: exits funnel @ 2005-04-26 23:35 UTC (permalink / raw)


Hello,

I'm trying to add some code to my .emacs which will
allow me to share the file across my windows and linux
boxes.  To make a long story short, I want this:

(equal system-type "gnu/linux")

to evaluate to true but instead it evaluates to nil. 
C-h v system-type indicates its value is "gnu/linux". 
I've spent a fair amount of time reading the lisp
manual which has been very informative, but I still
can't get this simple issue sorted out :)

One other (less important) question.  Why does:

(princ system-type)

evaluate to "gnu/linuxgnu/linux" rather than just
"gnu/linux"?  

Thanks in advance for any replies.

-exits

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: Simple elisp problem with equal
       [not found] <mailman.3114.1114558674.2895.help-gnu-emacs@gnu.org>
@ 2005-04-27  0:54 ` David Hansen
  2005-04-27  1:00 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 8+ messages in thread
From: David Hansen @ 2005-04-27  0:54 UTC (permalink / raw)


On Tue, 26 Apr 2005 16:35:42 -0700 (PDT) exits funnel wrote:

> I want this:
>
> (equal system-type "gnu/linux")
>
> to evaluate to true but instead it evaluates to nil.
> C-h v system-type indicates its value is "gnu/linux".

`system-type' is a symbol not a string.

(equal system-type 'gnu/linux)

evals to t here.

David

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

* Re: Simple elisp problem with equal
       [not found] <mailman.3114.1114558674.2895.help-gnu-emacs@gnu.org>
  2005-04-27  0:54 ` David Hansen
@ 2005-04-27  1:00 ` Thien-Thi Nguyen
  1 sibling, 0 replies; 8+ messages in thread
From: Thien-Thi Nguyen @ 2005-04-27  1:00 UTC (permalink / raw)


exits funnel <exitsfunnel@yahoo.com> writes:

> (equal system-type "gnu/linux")

play w/ `type-of' to see the difference.

(type-of (+ 6 (* 6 6))) => integer

(type-of (type-of (+ 6 (* 6 6)))) => ???

> (princ system-type)
>
> evaluate to "gnu/linuxgnu/linux" rather than just
> "gnu/linux"?

there are two things to look at (for a start ;-),
namely the value of an expression and its side
effects.  one way to separate them for better
understanding is to save the value for examination
later, during the evaluation of the expression:

(setq some-var (princ system-type))

then you can do `C-h v some-var RET' after mulling
the side effects (which cannot be saved in this way).

also, try `C-h c C-j' in the *scratch* buffer.

thi

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

* Re: Simple elisp problem with equal
  2005-04-26 23:35 Simple elisp problem with equal exits funnel
@ 2005-04-27  8:03 ` Ismael Valladolid Torres
  2005-04-27  8:28 ` Peter Dyballa
  1 sibling, 0 replies; 8+ messages in thread
From: Ismael Valladolid Torres @ 2005-04-27  8:03 UTC (permalink / raw)


exits funnel escribe:
> I'm trying to add some code to my .emacs which will
> allow me to share the file across my windows and linux
> boxes.

(when (eq system-type 'windows-nt) (...))
(when (eq system-type 'gnu/linux) (...))

These snippets in my .emacs do the job lovely in both W2K and Linux.

Cordially, Ismael

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

* Re: Simple elisp problem with equal
  2005-04-26 23:35 Simple elisp problem with equal exits funnel
  2005-04-27  8:03 ` Ismael Valladolid Torres
@ 2005-04-27  8:28 ` Peter Dyballa
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2005-04-27  8:28 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 27.04.2005 um 01:35 schrieb exits funnel:

> (equal system-type "gnu/linux")
>

Since system-type is a symbol, I think its correct use is something 
like that:

	(string= (symbol-name system-type) "gnu/linux")

I don't know how commutative Elisp is (commutative means that (1+2) is 
the same as (2+1)), I've mostly seen statements like that:

	(string= "gnu/linux" (symbol-name system-type))

--
Greetings

   Pete

"There's no place like 127.0.0.1"
                      origin unknown

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

* Re: Simple elisp problem with equal
@ 2005-04-27 18:47 exits funnel
  2005-04-27 18:59 ` Peter Dyballa
  0 siblings, 1 reply; 8+ messages in thread
From: exits funnel @ 2005-04-27 18:47 UTC (permalink / raw)
  Cc: help-gnu-emacs

Many thanks to David, Peter, Ismael and Thien-Thi. 
One additional question: I'm still a little confused
about the difference between 'foo and foo.  I've read
most or all of the stuff in the lisp manual about
symbols.  If anyone could provide a pointer to the
relevent info section I'd really apprciate it.

-exits

--- Peter Dyballa <Peter_Dyballa@Web.DE> wrote:
> 
> Am 27.04.2005 um 01:35 schrieb exits funnel:
> 
> > (equal system-type "gnu/linux")
> >
> 
> Since system-type is a symbol, I think its correct
> use is something 
> like that:
> 
> 	(string= (symbol-name system-type) "gnu/linux")
> 
> I don't know how commutative Elisp is (commutative
> means that (1+2) is 
> the same as (2+1)), I've mostly seen statements like
> that:
> 
> 	(string= "gnu/linux" (symbol-name system-type))
> 
> --
> Greetings
> 
>    Pete
> 
> "There's no place like 127.0.0.1"
>                       origin unknown
> 
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: Simple elisp problem with equal
  2005-04-27 18:47 exits funnel
@ 2005-04-27 18:59 ` Peter Dyballa
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2005-04-27 18:59 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 27.04.2005 um 20:47 schrieb exits funnel:

> If anyone could provide a pointer to the
> relevent info section I'd really apprciate it.

C-h i m Elisp RET m symbols RET -- or such was the recommendation 
Pascal Bourguignon gave me.

--
Greetings

   Pete

A common mistake that people make when trying to design something 
completely foolproof is to underestimate the ingenuity of complete 
fools.

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

* Re: Simple elisp problem with equal
       [not found] <mailman.3210.1114627946.2895.help-gnu-emacs@gnu.org>
@ 2005-04-27 19:05 ` David Kastrup
  0 siblings, 0 replies; 8+ messages in thread
From: David Kastrup @ 2005-04-27 19:05 UTC (permalink / raw)


exits funnel <exitsfunnel@yahoo.com> writes:

> Many thanks to David, Peter, Ismael and Thien-Thi. 
> One additional question: I'm still a little confused
> about the difference between 'foo and foo.

'foo is the same as (quote foo), foo is a symbol.  In an evaluated
context, (quote foo) evaluates to the unevaluated expression (here a
symbol), and the unevaluated symbol evaluates to its symbol-value.
Lists evaluate to a function call.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2005-04-27 19:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-26 23:35 Simple elisp problem with equal exits funnel
2005-04-27  8:03 ` Ismael Valladolid Torres
2005-04-27  8:28 ` Peter Dyballa
     [not found] <mailman.3114.1114558674.2895.help-gnu-emacs@gnu.org>
2005-04-27  0:54 ` David Hansen
2005-04-27  1:00 ` Thien-Thi Nguyen
  -- strict thread matches above, loose matches on Subject: below --
2005-04-27 18:47 exits funnel
2005-04-27 18:59 ` Peter Dyballa
     [not found] <mailman.3210.1114627946.2895.help-gnu-emacs@gnu.org>
2005-04-27 19:05 ` David Kastrup

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.