[Date Index] [Thread Index] [Author Index]
Re: How to declare Integers?
Le Van Tri wrote: > > Dear Joe Oswald and Sean Ross, > > About your idea of having variable typing instead of pattern matching in > Mathematica > I think that idea is nice but some what "obsolete" - by which I mean > variable typing > is obsolete by the coming out of pattern matching. Why ? In traditional > languages > like Fortran, C++, Lisp, Scheme, ML, ... variable typing was done statically > at compile > time. By using pattern matching, that could be done dynamically at run time. > Which > way is better ? Perhaps the term variable "typing" is ill-advised since it sounds the same as what is done in C++ or Fortran. No, what we are after is something like this: Declare[symbol,Integer]; Sin[symbol Pi x] and have it return zero for all x even with no explicit value assigned to symbol. I want to be able to tell mathematica that a certain symbol is Real, Complex, Imaginary, greater than 2, Integer etc. and have every single function in the language react appropriately taking that declaration as an assumption. I want Integrals to be appropriate to Real only or Integer only arguments etc. In essence I want global assumptions or conditions on symbols with every built-in function looking at those restrictions or assumptions and responding appropriately. You can't do that yet with pattern matching.