* lisp question
@ 2007-04-29 17:14 Hadron
2007-04-29 17:32 ` Barry Margolin
0 siblings, 1 reply; 16+ messages in thread
From: Hadron @ 2007-04-29 17:14 UTC (permalink / raw)
To: help-gnu-emacs
from the lisp tutorial which comes with emacs 22:
,----
| 1.8.3 Variable Number of Arguments
| ----------------------------------
|
| Some functions, such as `concat', `+' or `*', take any number of
| arguments. (The `*' is the symbol for multiplication.) This can be
| seen by evaluating each of the following expressions in the usual way.
| What you will see in the echo area is printed in this text after `=>',
| which you may read as `evaluates to'.
|
| In the first set, the functions have no arguments:
|
| (+) => 0
|
| (*) => 1
|
| In this set, the functions have one argument each:
|
| (+ 3) => 3
|
| (* 3) => 3
|
| In this set, the functions have three arguments each:
|
| (+ 3 4 5) => 12
|
| (* 3 4 5) => 60
`----
It kind of glosses over sections (1) and (2).
Why do (*) and (* 3) evaluate to 1?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-04-29 17:14 Hadron
@ 2007-04-29 17:32 ` Barry Margolin
2007-04-29 23:06 ` Hadron
0 siblings, 1 reply; 16+ messages in thread
From: Barry Margolin @ 2007-04-29 17:32 UTC (permalink / raw)
To: help-gnu-emacs
In article <871wi385na.fsf@gmail.com>, Hadron <hadronquark@gmail.com>
wrote:
> from the lisp tutorial which comes with emacs 22:
>
> ,----
> | 1.8.3 Variable Number of Arguments
> | ----------------------------------
> |
> | Some functions, such as `concat', `+' or `*', take any number of
> | arguments. (The `*' is the symbol for multiplication.) This can be
> | seen by evaluating each of the following expressions in the usual way.
> | What you will see in the echo area is printed in this text after `=>',
> | which you may read as `evaluates to'.
> |
> | In the first set, the functions have no arguments:
> |
> | (+) => 0
> |
> | (*) => 1
> |
> | In this set, the functions have one argument each:
> |
> | (+ 3) => 3
> |
> | (* 3) => 3
> |
> | In this set, the functions have three arguments each:
> |
> | (+ 3 4 5) => 12
> |
> | (* 3 4 5) => 60
> `----
>
> It kind of glosses over sections (1) and (2).
>
> Why do (*) and (* 3) evaluate to 1?
(* 3) evaluates to 3, not 1.
With associative functions, calling them with no arguments returns the
identity value for that function. This maintains the equivalence that
(<fun> <arguments>) == (<fun> (<fun> <part1>) (<fun> <part2>))
for any partitioning of the original arguments, including part1 or part2
being empty. E.g.
(* 3 4 5) = (* (* 3) (* 4 5)) = (* (*) (* 3 4 5))
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-04-29 17:32 ` Barry Margolin
@ 2007-04-29 23:06 ` Hadron
0 siblings, 0 replies; 16+ messages in thread
From: Hadron @ 2007-04-29 23:06 UTC (permalink / raw)
To: help-gnu-emacs
Barry Margolin <barmar@alum.mit.edu> writes:
> In article <871wi385na.fsf@gmail.com>, Hadron <hadronquark@gmail.com>
> wrote:
>
>> from the lisp tutorial which comes with emacs 22:
>>
>> ,----
>> | 1.8.3 Variable Number of Arguments
>> | ----------------------------------
>> |
>> | Some functions, such as `concat', `+' or `*', take any number of
>> | arguments. (The `*' is the symbol for multiplication.) This can be
>> | seen by evaluating each of the following expressions in the usual way.
>> | What you will see in the echo area is printed in this text after `=>',
>> | which you may read as `evaluates to'.
>> |
>> | In the first set, the functions have no arguments:
>> |
>> | (+) => 0
>> |
>> | (*) => 1
>> |
>> | In this set, the functions have one argument each:
>> |
>> | (+ 3) => 3
>> |
>> | (* 3) => 3
>> |
>> | In this set, the functions have three arguments each:
>> |
>> | (+ 3 4 5) => 12
>> |
>> | (* 3 4 5) => 60
>> `----
>>
>> It kind of glosses over sections (1) and (2).
>>
>> Why do (*) and (* 3) evaluate to 1?
>
> (* 3) evaluates to 3, not 1.
Sorry, yes.
>
> With associative functions, calling them with no arguments returns the
> identity value for that function. This maintains the equivalence that
>
> (<fun> <arguments>) == (<fun> (<fun> <part1>) (<fun> <part2>))
>
> for any partitioning of the original arguments, including part1 or part2
> being empty. E.g.
>
> (* 3 4 5) = (* (* 3) (* 4 5)) = (* (*) (* 3 4 5))
All clear. Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
@ 2007-04-30 18:25 A Soare
2007-04-30 19:09 ` Peter Dyballa
0 siblings, 1 reply; 16+ messages in thread
From: A Soare @ 2007-04-30 18:25 UTC (permalink / raw)
To: Emacs Help [help-gnu-emacs]
Why e^0 evaluates to 1?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-04-30 18:25 A Soare
@ 2007-04-30 19:09 ` Peter Dyballa
0 siblings, 0 replies; 16+ messages in thread
From: Peter Dyballa @ 2007-04-30 19:09 UTC (permalink / raw)
To: alinsoar; +Cc: Emacs Help [help-gnu-emacs]
Am 30.04.2007 um 20:25 schrieb A Soare:
> Why e^0 evaluates to 1?
Because ln(e) is 1 and ln(1) is 0. The third reason I do not
remember ...
--
Greetings
Pete <\
_\ O _
|o \ _\\_/-\='
_____________(_)|-(_) (_)___________________________________
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
[not found] <mailman.5.1177957929.32220.help-gnu-emacs@gnu.org>
@ 2007-05-01 8:23 ` Brendan Halpin
2007-05-01 11:41 ` Hartmut Figge
0 siblings, 1 reply; 16+ messages in thread
From: Brendan Halpin @ 2007-05-01 8:23 UTC (permalink / raw)
To: help-gnu-emacs
A Soare <alinsoar@voila.fr> writes:
> Why e^0 evaluates to 1?
x^0 is defined as 1 for all real values of x.
Brendan
--
Brendan Halpin, Department of Sociology, University of Limerick, Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:brendan.halpin@ul.ie http://www.ul.ie/sociology/brendan.halpin.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-05-01 8:23 ` Brendan Halpin
@ 2007-05-01 11:41 ` Hartmut Figge
2007-05-01 13:24 ` Malte Spiess
0 siblings, 1 reply; 16+ messages in thread
From: Hartmut Figge @ 2007-05-01 11:41 UTC (permalink / raw)
To: help-gnu-emacs
Brendan Halpin schribselte
>A Soare <alinsoar@voila.fr> writes:
>> Why e^0 evaluates to 1?
>
>x^0 is defined as 1 for all real values of x.
Mhm, not if x is zero. In this case the result is not defined. IIRC. :)
Hartmut
--
Usenet-ABC-Wiki http://www.usenet-abc.de/wiki/
Von Usern fuer User :-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-05-01 11:41 ` Hartmut Figge
@ 2007-05-01 13:24 ` Malte Spiess
0 siblings, 0 replies; 16+ messages in thread
From: Malte Spiess @ 2007-05-01 13:24 UTC (permalink / raw)
To: help-gnu-emacs
Hartmut Figge <h.figge@gmx.de> writes:
> Brendan Halpin schribselte
>>A Soare <alinsoar@voila.fr> writes:
>
>>> Why e^0 evaluates to 1?
>>
>>x^0 is defined as 1 for all real values of x.
>
> Mhm, not if x is zero. In this case the result is not defined. IIRC. :)
That is really a matter of how you define it. Normally it's easier to
say that 0^0=1, it makes calculations easier.
> Hartmut
Greetings
Malte
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
@ 2007-05-01 18:39 A Soare
2007-05-01 19:10 ` Jesper Harder
0 siblings, 1 reply; 16+ messages in thread
From: A Soare @ 2007-05-01 18:39 UTC (permalink / raw)
To: Emacs Help [help-gnu-emacs]
What determined the mathematicians to give the definition of x^0 = 1, not defined for x=0 ?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-05-01 18:39 lisp question A Soare
@ 2007-05-01 19:10 ` Jesper Harder
2007-05-01 21:11 ` Marco Almeida
0 siblings, 1 reply; 16+ messages in thread
From: Jesper Harder @ 2007-05-01 19:10 UTC (permalink / raw)
To: help-gnu-emacs
A Soare <alinsoar@voila.fr> writes:
> What determined the mathematicians to give the definition of x^0 = 1,
> not defined for x=0 ?
Because 0/0 is undefined:
x^1 x
x^0 = ---- = ---
x^1 x
x=0 -> 0/0.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
[not found] <mailman.55.1178045196.32220.help-gnu-emacs@gnu.org>
@ 2007-05-01 19:21 ` Maarten Bergvelt
2007-05-01 20:32 ` Scott Frazer
1 sibling, 0 replies; 16+ messages in thread
From: Maarten Bergvelt @ 2007-05-01 19:21 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.55.1178045196.32220.help-gnu-emacs@gnu.org>, A Soare wrote:
> What determined the mathematicians to give the definition of x^0 = 1, not defined for x=0 ?
Discussion of this point at
http://www.faqs.org/faqs/sci-math-faq/specialnumbers/0to0/
--
Maarten Bergvelt
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
[not found] <mailman.55.1178045196.32220.help-gnu-emacs@gnu.org>
2007-05-01 19:21 ` Maarten Bergvelt
@ 2007-05-01 20:32 ` Scott Frazer
1 sibling, 0 replies; 16+ messages in thread
From: Scott Frazer @ 2007-05-01 20:32 UTC (permalink / raw)
To: help-gnu-emacs
A Soare wrote:
> What determined the mathematicians to give the definition of x^0 = 1, not defined for x=0 ?
>
y = x^0
ln(y) = ln(x^0) = ln(x) * 0 = 0
and since ln(1) = 0, y = 1 for any (non-zero) value of x
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2007-05-01 19:10 ` Jesper Harder
@ 2007-05-01 21:11 ` Marco Almeida
0 siblings, 0 replies; 16+ messages in thread
From: Marco Almeida @ 2007-05-01 21:11 UTC (permalink / raw)
To: help-gnu-emacs
At Tue, 01 May 2007 21:10:44 +0200,
Jesper Harder wrote:
>
> A Soare <alinsoar@voila.fr> writes:
>
> > What determined the mathematicians to give the definition of x^0 = 1,
> > not defined for x=0 ?
>
> Because 0/0 is undefined:
>
> x^1 x
> x^0 = ---- = ---
> x^1 x
>
> x=0 -> 0/0.
>
As far as I know, 0^0 = 0 by convention (pretty much like 0 != 1)
Also, I think that your argument is wrong.
0^y = 0 for any y
0 is the characteristic of R and you can not divid by it
This means that your first step :
x^1
x^0 = ----
x^1
is not valid, regardeless of the value you chose as exponent because you will be trying a division by zero.
Also, from Concrete Mathematics p.162 (R. Graham, D. Knuth, O. Patashnik):
Some textbooks leave the quantity 0^0 undefined, because the functions 0^x and x^0 have different limiting values when x decreases to 0. But this is a mistake. We must define x^0=1 for all x , if the binomial theorem is to be valid when x=0 , y=0 , and/or x=-y . The theorem is too important to be arbitrarily restricted! By contrast, the function 0^x is quite unimportant.
>
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* lisp question
@ 2011-08-04 2:25 suvayu ali
2011-08-04 4:52 ` Jambunathan K
0 siblings, 1 reply; 16+ messages in thread
From: suvayu ali @ 2011-08-04 2:25 UTC (permalink / raw)
To: Emacs mailing list
Hi Elisp users,
I was trying to write some simple elisp code to manipulate properties
from an org-mode entry. I can't figure out what kind of variable is
returned and how I can extract "somecategory" into a string from it.
(org-get-category (point)) ; evaluating gives me the output below
#("somecategory" 0 12 (fontified t font-lock-fontified t face
org-meta-line org-category "property-test"))
Thanks for any guidance.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2011-08-04 2:25 suvayu ali
@ 2011-08-04 4:52 ` Jambunathan K
2011-08-04 6:49 ` suvayu ali
0 siblings, 1 reply; 16+ messages in thread
From: Jambunathan K @ 2011-08-04 4:52 UTC (permalink / raw)
To: suvayu ali; +Cc: Emacs mailing list
Suvayu
> Hi Elisp users,
>
> I was trying to write some simple elisp code to manipulate properties
> from an org-mode entry. I can't figure out what kind of variable is
> returned and how I can extract "somecategory" into a string from it.
>
> (org-get-category (point)) ; evaluating gives me the output below
> #("somecategory" 0 12 (fontified t font-lock-fontified t face
> org-meta-line org-category "property-test"))
Return value is a text with properties. You can use
(substring-no-properties (org-get-category (point)))
to get just the text part.
I think you will be better off using the property APIs. You can use
(org-entry-get (point) "CATEGORY")
to extract the desired information.
See "Using the property API" section of the manual.
> Thanks for any guidance.
--
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: lisp question
2011-08-04 4:52 ` Jambunathan K
@ 2011-08-04 6:49 ` suvayu ali
0 siblings, 0 replies; 16+ messages in thread
From: suvayu ali @ 2011-08-04 6:49 UTC (permalink / raw)
To: Jambunathan K; +Cc: Emacs mailing list
Hi Jambunathan,
On Thu, Aug 4, 2011 at 6:52 AM, Jambunathan K <kjambunathan@gmail.com> wrote:
> Return value is a text with properties. You can use
>
> (substring-no-properties (org-get-category (point)))
>
> to get just the text part.
>
> I think you will be better off using the property APIs. You can use
> (org-entry-get (point) "CATEGORY")
>
> to extract the desired information.
>
> See "Using the property API" section of the manual.
Thanks a lot for both the pointers! :)
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-08-04 6:49 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-01 18:39 lisp question A Soare
2007-05-01 19:10 ` Jesper Harder
2007-05-01 21:11 ` Marco Almeida
-- strict thread matches above, loose matches on Subject: below --
2011-08-04 2:25 suvayu ali
2011-08-04 4:52 ` Jambunathan K
2011-08-04 6:49 ` suvayu ali
[not found] <mailman.55.1178045196.32220.help-gnu-emacs@gnu.org>
2007-05-01 19:21 ` Maarten Bergvelt
2007-05-01 20:32 ` Scott Frazer
[not found] <mailman.5.1177957929.32220.help-gnu-emacs@gnu.org>
2007-05-01 8:23 ` Brendan Halpin
2007-05-01 11:41 ` Hartmut Figge
2007-05-01 13:24 ` Malte Spiess
2007-04-30 18:25 A Soare
2007-04-30 19:09 ` Peter Dyballa
2007-04-29 17:14 Hadron
2007-04-29 17:32 ` Barry Margolin
2007-04-29 23:06 ` Hadron
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).