home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!eco.twg.com!twg.com!news
- From: "David Herron" <david@twg.com>
- Subject: Re: Advice wanted on math functions for Tcl 7.0
- Message-ID: <1992Dec22.231908.7168@twg.com>
- Sensitivity: Personal
- Encoding: 30 TEXT , 4 TEXT
- Sender: news@twg.com (USENET News System)
- Conversion: Prohibited
- Organization: The Wollongong Group, Inc., Palo Alto, CA
- Conversion-With-Loss: Prohibited
- Date: Tue, 22 Dec 1992 23:19:43 GMT
- Lines: 35
-
- I've already voted for embedding trig functions in expr. But I just
- had two thoughts which suggest third and fourth ways of doing this.
- One is by using array's and the other by introducing a new class
- of special things.
-
- array
-
- In this method the user writes: $sin(0.2). A trap would be set up which
- interprets the index as floating point, computes the function, and returns it.
- Any programmer can write one of these arrays without having to extend expr.
- Also, expr's parsing doesn't have to be extended at all. Instead it happens
- in Tcl_Eval().
-
- Downside is you're back to converting back to strings which introduces
- needless and useless overhead. Just because TCL is not a numerical programming
- language, it doesn't mean it has to PURPOSELY make numerical things slow.
-
- function
-
- In this case you'd introduce a new special leading character. $'s introduce
- array/scalar references. This new character (`%'?) would introduce a
- numerical function. The user writes: %sin(0.2). Some API function can
- be in the library which lets C programmers create these functions. Some
- effort should be put into letting these stay in floating point if being
- interpreted by expr, and converted to strings if interpreted by Tcl_Eval().
- But my memory of the internals says this isn't likely.
-
-
- One definite need is a way for C programmers to extend the set of functions.
- Perhaps to include functions with multiple arguments?
-
- <- David Herron <david@twg.com> (work) <david@davids.mmdf.com> (home)
- <-
- <- During the '80s Usenet's mantra was: "Not all the world's a VAX".
- <- During the '90s I hope it becomes: "Not all the world's DOS (ick)".
-