Extending arithmetic

Steven H. Rogers, PhD. <>
Tue Feb 11 12:05:17 CET 2003


Per Bergqvist wrote:
>>Strong typing would certainly make it easier on the compiler.       
> 
> Extending                                                             
> 
>>arithmetic to tuples shouldn't place that big a burden on the       
> 
> compiler.                                                             
> 
>>  The tuples would need to have all numeric elements, and it might  
> 
> be a                                                                  
> 
>>good idea to have a flag identifing a tuple as strictly numeric.    
> 
> Internally maybe, as a performance improvement, but certainly not     
> accessible for the programmer.                                        
>                                                                       
> /Per                                                                  
> 
Concur.  As a laguage feature, they'd need to be hidden.  If one were to 
write a "Numerical Erlang" package with the esisting language, a 
reasonable representation of a vector might be a tuple with the atom 
'vector' as the first element and numbers for the remainder.  A matrix 
might be a tuple with 'matrix' as the first element and vectors of equal 
length as the remaining elements.

-- 
  _    Steven H. Rogers, PhD.
<_`   email: 
|_>   Weblog http://shrogers.com/portal/Members/steve/blog
| \   "A language that doesn't affect the way you think about
       programming is not worth knowing." - Alan Perlis




More information about the erlang-questions mailing list