This document provides an overview of Inferno, a new hybrid scripting language based on languages like OCaml and Haskell. The language is highly restricted and is designed to allow developers to write code that can be evaluated to produce expected results.
The language supports a variety of expressions that can be used to build complex programs. Here is an example of an expression:
Array.sum (Array.keepSomes [Some 3.0, None, Some 4.0])
This expression calculates the sum of an array after filtering out the None values. The expected result of this expression is 7.0, which is a double.
Here are a few examples of expressions that can be evaluated using the language:
Array.sum (Array.keepSomes [Some 3.0, None, Some 4.0])
This expression calculates the sum of an array after filtering out the None values. The expected result of this expression is 7.0, which is a double.
Array.findFirstSome [None, Some 3.0, None, Some 4.0]
This expression finds the first element in an array that is not None. The expected result of this expression is a value that represents the found element.
Array.findLastSome [None, Some 3.0, None, Some 4.0]
This expression finds the last element in an array that is not None. The expected result of this expression is a value that represents the found element.
Array.findFirstAndLastSome [None, Some 3.0, None, Some 4.0]
This expression finds both the first and last element in an array that is not None. The expected result of this expression is a tuple of two values, where each value represents the found element.
Option.map (fun x -> x + 2) (Some 4.0)
This expression maps the given function to the value of the option, if it exists. The expected result of this expression is a value that represents the result of the mapping operation.
fromOption 0 (Some 4.0)
This expression extracts the value of an option, or returns the default value if the option is None. The expected result of this expression is the value of the option or the default value, depending on the value of the option.
(Some 4.0) ? 0
This expression returns the value of the option if it exists, or the given default value if the option is None. The expected result of this expression is the value of the option or the default value, depending on the value of the option.
Option.reduce (fun d -> d + 2) 0.0 (Some 4.0)
This expression applies the given binary function to the elements of the option and returns the result. The expected result of this expression is a value that represents the result of the reduction operation.