[mLite]

Changes

A rather fine-grained change log.

20141229 Fixed a bug that could cause ~= to crash when autoscaling failed.
20141217 Fixed to_radix (radix.m) for 0 input.
20141203 Fixed ntos for reals ending in ".0".
20141203 Fixed ~= and ~<> operators (auto-scaling before comparison now).
20141202 Fixed comparison (=,<>) of strings of unequal length.
20141202 Fixed precision of pi in trig.m. Thanks, Bruce!
20141201 Tentatively increased mantissa size to 36 digits.
20141201 Added n'th root function (nthroot) to core library.
20141127 Changed realnum semantics of ~<> and ~= ((not) approx. equal).
20141127 Fixed x^y with fractional y. Thanks, Bruce "Bugmagnet" Axtens!
20141124 Grouping does not work in implicit guards. No fix for now.
20141121 Made ^ reject fractional exponents with no useful approximation.
20141120 Made << and >> operators associate to the right.
20141119 Started test suite.
20141118 Added negative exponents in real number literals, e.g. 1e~5.
20141118 Added more multi-character char literals, like #"\"", etc.
20141116 Made the ^ operator accept a non-integer exponent.
20141112 Fixed broken real number parser. Thanks again, Bruce Axtens!
20141107 Fix: compiler missed some errors (currying in alternative patterns).
20141031 Closed a massive GC leak in the div and rem functions.
20141030 Protected redirected I/O streams from GC.
20141030 Made #! a comment to end of line.
20141027 Documented the foreach function. Thanks, Bruce Axtens!
20141027 Added the ntos and ston functions (num/str conversion). Thanks, Bruce!
20141018 Renamed library path environment variable (MLITE_LIBRARY_PATH).
20141018 Made :: a valid type name in constructors, e.g. type :x = :y (::)
20141014 Fixed a bug that could crash the compiler. Thanks, James Turner!
20141014 Removed POSIX prelude (not required).

Addenda and Errata


        ADDENDA AND ERRATA TO "THE MLITE PROGRAMMING LANGUAGE"

        The following language constructs are not covered by the manual
        or have been modified since the last release of the manual.


	UNDOCUMENTED FUNCTIONS

	error (s1, x) -- print error message "s1: x" and abort program
	execution.

	real_mant r -- return mantissa of real (r for integers)
	real_exp r -- return exponent of real (0 for integers).

	argv n -- return n'th command line argument or false.

	environ s -- return value of environment variable s or false.

	system s -- run shell command s and return exit code.


        NTH-ROOT FUNCTION

        The library function nthroot (n,x) computes the n'th root of x.


        APPROXIMATELY EQUAL OPERATOR

        Unlike stated in the manual, the ~= operator compares real
        numbers with one digit of slack, so

        1.4142  = 1.4143  -->  false
        1.4142 ~= 1.4143  -->  true

        ~= is useful for comparison in real number functions that
        converge against a fixed point, but may oscillate at the
        fixed point.

	One digit of slack also means that 1.0 ~= 9.0
	(or even 1e6 ~= 2e6!), so be careful!

        x ~<> y means (not (x ~= y)).


        GROUPING IN IMPLICIT GUARDS

        No grouping is currently allowed in implicit guards. E.g.
        fun f (a < 0) = ...  will work, but  fun f (a < (0)) = ...
        will not. This is a bug, but unfortunately the fix is
        nontrivial.


        REFERENCES TO LOCAL SYMBOLS IN IMPLICIT GUARDS

        Even if this is not explicitly described in the manual,
        implicit guard expressions can reference all variables
        bound in the pattern containing the guard. E.g.:

        fun mem (x, []) = false
              | (x = a, a :: as) = true
              | (x, _ :: as) = mem (x, as)

        works fine, because  (x = a, a :: as)
        is equivalent to     (x, a :: as) where (x = a) .

        (Note, though, that (a = x, a :: as) would NOT work, because
         it would be short for (a, a :: as) where (a = x), so a would
         appear two times and the pattern and x would be unbound!)

        This has been pointed out by Bruce Axtens. Thanks!


        MULTI-CHARACTER LITERALS

        The following multi-character char literals exist in addition
        to #"space" and #"newline":

        #"\""           (")
        #"\\"           (\)
        #"baskslash"    (\)
        #"quote"        (")
        #"tab"          (ASCII 9, HT)


        NEGATIVE EXPONENTS IN NUMBER LITERALS

        Real number literal may have negative exponents, e.g.:

        1.23e~5


        STREAM OPERATORS

        The stream operators associate to the right, so

        instream "foo" >> outstream "bar" << function ()

        is a valid program that applies function with input taken from
        "foo" and output written to "bar".


contact