* numeri
@ 2008-11-29 14:36 Eli Zaretskii
2008-11-29 16:04 ` numeri Andreas Schwab
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2008-11-29 14:36 UTC (permalink / raw)
To: handa; +Cc: emacs-devel
Observe:
M-: (get-char-code-property ?4 'numeric-value) RET
=> \4
What does the backslash signify in this case?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 14:36 numeri Eli Zaretskii
@ 2008-11-29 16:04 ` Andreas Schwab
2008-11-29 17:22 ` numeri Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2008-11-29 16:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel, handa
Eli Zaretskii <eliz@gnu.org> writes:
> Observe:
>
> M-: (get-char-code-property ?4 'numeric-value) RET
> => \4
>
> What does the backslash signify in this case?
That it's a symbol, not a number.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 16:04 ` numeri Andreas Schwab
@ 2008-11-29 17:22 ` Eli Zaretskii
2008-11-29 17:39 ` numeri Andreas Schwab
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2008-11-29 17:22 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel, handa
> From: Andreas Schwab <schwab@suse.de>
> Cc: handa@m17n.org, emacs-devel@gnu.org
> Date: Sat, 29 Nov 2008 17:04:27 +0100
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Observe:
> >
> > M-: (get-char-code-property ?4 'numeric-value) RET
> > => \4
> >
> > What does the backslash signify in this case?
>
> That it's a symbol, not a number.
Right, but why backslash? Why not something like `digit-four'?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 17:22 ` numeri Eli Zaretskii
@ 2008-11-29 17:39 ` Andreas Schwab
2008-11-29 18:05 ` numeri Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2008-11-29 17:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel, handa
Eli Zaretskii <eliz@gnu.org> writes:
> Right, but why backslash? Why not something like `digit-four'?
I don't understand the question. What is digit-four in this context?
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 17:39 ` numeri Andreas Schwab
@ 2008-11-29 18:05 ` Eli Zaretskii
2008-11-29 18:38 ` numeri Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2008-11-29 18:05 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel, handa
> From: Andreas Schwab <schwab@suse.de>
> Cc: handa@m17n.org, emacs-devel@gnu.org
> Date: Sat, 29 Nov 2008 18:39:51 +0100
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Right, but why backslash? Why not something like `digit-four'?
>
> I don't understand the question. What is digit-four in this context?
I meant to ask why would it be worse idea to have
(get-char-code-property ?4 'numeric-value)
return a symbol `digit-four' or `digit-4'.
But maybe the answer is because `\4' is ready for the Lisp reader,
while the alternatives are not.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 18:05 ` numeri Eli Zaretskii
@ 2008-11-29 18:38 ` Eli Zaretskii
2008-11-29 19:01 ` numeri David De La Harpe Golden
2008-11-29 22:50 ` numeri Stefan Monnier
0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2008-11-29 18:38 UTC (permalink / raw)
To: emacs-devel, handa
> Date: Sat, 29 Nov 2008 20:05:18 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org, handa@m17n.org
>
> > From: Andreas Schwab <schwab@suse.de>
> > Cc: handa@m17n.org, emacs-devel@gnu.org
> > Date: Sat, 29 Nov 2008 18:39:51 +0100
> >
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> > > Right, but why backslash? Why not something like `digit-four'?
> >
> > I don't understand the question. What is digit-four in this context?
>
> I meant to ask why would it be worse idea to have
>
> (get-char-code-property ?4 'numeric-value)
>
> return a symbol `digit-four' or `digit-4'.
>
> But maybe the answer is because `\4' is ready for the Lisp reader,
> while the alternatives are not.
Actually, why not make the above return the number 4? The Unicode
Data File Format says that this property's value is ``an integer or
rational number''. We could even use 0.2 for characters such as
"VULGAR FRACTION ONE FIFTH". Isn't that better than `1/5'?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 18:38 ` numeri Eli Zaretskii
@ 2008-11-29 19:01 ` David De La Harpe Golden
2008-11-29 21:26 ` numeri Eli Zaretskii
2008-11-29 22:50 ` numeri Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: David De La Harpe Golden @ 2008-11-29 19:01 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: handa, emacs-devel
Eli Zaretskii wrote:
>
> Actually, why not make the above return the number 4? The Unicode
> Data File Format says that this property's value is ``an integer or
> rational number''. We could even use 0.2 for characters such as
> "VULGAR FRACTION ONE FIFTH". Isn't that better than `1/5'?
>
>
Bear in mind that 1/5 (0.2) isn't actually exactly representable by
binary floating point, bit like the way 1/3 (0.333(3 recurring)) can't
be written properly in decimal, so try in emacs lisp:
(format "%.20f" 0.2)
I'd tend to hold off on allowing the vulgar fractions to map to numbers
without the programmer to do a conversion step and "own" the associated
potential information loss - at least until there is no loss: Emacs
Lisp could one day get CL-like exact rational numbers I guess (though
bignums would probably be a higher priority...)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 19:01 ` numeri David De La Harpe Golden
@ 2008-11-29 21:26 ` Eli Zaretskii
0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2008-11-29 21:26 UTC (permalink / raw)
To: David De La Harpe Golden; +Cc: handa, emacs-devel
> Date: Sat, 29 Nov 2008 19:01:22 +0000
> From: David De La Harpe Golden <david@harpegolden.net>
> Cc: handa@m17n.org, emacs-devel@gnu.org
>
> > Actually, why not make the above return the number 4? The Unicode
> > Data File Format says that this property's value is ``an integer or
> > rational number''. We could even use 0.2 for characters such as
> > "VULGAR FRACTION ONE FIFTH". Isn't that better than `1/5'?
>
> Bear in mind that 1/5 (0.2) isn't actually exactly representable by
> binary floating point, bit like the way 1/3 (0.333(3 recurring)) can't
> be written properly in decimal
The important issue, IMO, is whether the value of that property should
be a number whenever possible. The rest are details that can be
figured out once we make that decision.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 18:38 ` numeri Eli Zaretskii
2008-11-29 19:01 ` numeri David De La Harpe Golden
@ 2008-11-29 22:50 ` Stefan Monnier
2008-12-01 12:09 ` numeri Kenichi Handa
1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2008-11-29 22:50 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: handa, emacs-devel
>> (get-char-code-property ?4 'numeric-value)
> Actually, why not make the above return the number 4? The Unicode
Agreed. It says `numeric-value' so it should return a number.
I understand that 1/5 cannot be represented exactly as a number in Elisp
right now, but the floating point approximation should be sufficient: we
can recover the /15 fraction from it, if really needed, by considering
additional assumptions such as "this is the numeric value of a unicode
char".
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: numeri
2008-11-29 22:50 ` numeri Stefan Monnier
@ 2008-12-01 12:09 ` Kenichi Handa
0 siblings, 0 replies; 10+ messages in thread
From: Kenichi Handa @ 2008-12-01 12:09 UTC (permalink / raw)
To: Stefan Monnier; +Cc: eliz, emacs-devel
In article <jwvy6z2xi4x.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> (get-char-code-property ?4 'numeric-value)
> > Actually, why not make the above return the number 4? The Unicode
> Agreed. It says `numeric-value' so it should return a number.
> I understand that 1/5 cannot be represented exactly as a number in Elisp
> right now, but the floating point approximation should be sufficient: we
> can recover the /15 fraction from it, if really needed, by considering
> additional assumptions such as "this is the numeric value of a unicode
> char".
Ok, I've just committed changes to make the above return an
integer or a floating point (if non-nil).
---
Kenichi Handa
handa@ni.aist.go.jp
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-12-01 12:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-29 14:36 numeri Eli Zaretskii
2008-11-29 16:04 ` numeri Andreas Schwab
2008-11-29 17:22 ` numeri Eli Zaretskii
2008-11-29 17:39 ` numeri Andreas Schwab
2008-11-29 18:05 ` numeri Eli Zaretskii
2008-11-29 18:38 ` numeri Eli Zaretskii
2008-11-29 19:01 ` numeri David De La Harpe Golden
2008-11-29 21:26 ` numeri Eli Zaretskii
2008-11-29 22:50 ` numeri Stefan Monnier
2008-12-01 12:09 ` numeri Kenichi Handa
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).