Re: Lost in Ashok's teachings

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Lost in Ashok's teachings
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tcl
Date : 26. Sep 2024, 23:28:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd4n61$d3p6$1@dont-email.me>
References : 1 2 3
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Luc <luc@sep.invalid> wrote:
On Thu, 26 Sep 2024 11:21:14 +0200, Ralf Fassel wrote:
What about that plus sign? Where is it defined?

A bit of 'context' would help us in actually knowing to what you are
referring.  I'm assuming you mean this construct from your original
post:

   [+ $var $var]

That + is the "proc" version of the addition operator.  It is
accessible as either:

   $ rlwrap tclsh
   % ::tcl::mathop::+ 1 2
   3
   %

Or by setting up a namespace path within your current namespace, which
then allows you to call the proc without the absolute namespace names:

   % namespace path {::tcl::mathop}
   % + 3 4
   7

You can also access the math functions (i.e., sin(), abs() etc) in a similar
way (they exist in ::tcl::mathfunc::)

   % namespace path {::tcl::mathop ::tcl::mathfunc}
   % sin .2
   0.19866933079506122
   % abs -4
   4

Presumably, somewhere in an earlier chapter of Ashok's book, he
detailed the above little setting to be able to call the math operators
(and/or functions) as procs.  But as the full book is not on the web,
you would not have had the benefit of having read that material prior
to reading the OO chapter that is available.


Date Sujet#  Auteur
26 Sep 24 * Lost in Ashok's teachings8Luc
26 Sep 24 `* Re: Lost in Ashok's teachings7Ralf Fassel
26 Sep 24  `* Re: Lost in Ashok's teachings6Luc
26 Sep 24   +- Re: Lost in Ashok's teachings1Ashok
26 Sep 24   +- Re: Lost in Ashok's teachings1Ralf Fassel
26 Sep 24   `* Re: Lost in Ashok's teachings3Rich
27 Sep 24    `* Re: Lost in Ashok's teachings2Luc
27 Sep 24     `- Re: Lost in Ashok's teachings1Rich

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal