Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Discussion of interval literal syntax



On 2013-07-20 21:28:15 +0100, John Pryce wrote:
> It just strikes me that an important language of that kind is Matlab
> (and its clones). Unfortunately there is an unavoidable clash:
> Matlab uses brackets to construct arrays so they are unavailable for
> intervals. Here is the "input" function being used with in effect
> dynamic-typing (is that the same as implicit-typing?):
> 
> > >> while true, x=input('Give x: '), end
> > Give x: 1.23                %scalar
> > x =  1.2300
> > Give x: [1.2,3.4;5.6,7.8]   %2 by 2 array
> > x =
> > 
> >    1.2000   3.4000
> >    5.6000   7.8000
> > 
> > Give x: {1,2,3,4}           %cell vector
> > x =
> > 
> > {
> >   [1,1] =  1
> >   [1,2] =  2
> >   [1,3] =  3
> >   [1,4] =  4
> > }
> etc.
> 
> When a 1788 implementation is built in Matlab, it would be nice to
> overload "input" so that it can read intervals using
> text2interval(), but that would need a syntax change! Any ideas?

Languages would typically need some transformations. Perhaps some
prefix like "I" could work in Matlab:

  I[12,34]

(unless [] is used for array subscripts or something like that).
However the uncertain form e.g. I12?1 might not work because languages
often regards letter alphanumeric* as identifiers. Having some regular
format for interval literals, e.g. they always start with "[" and
always end with "]", may ease language integration.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)