Skip to main content

module Prelude

rascal-0.34.0

All basic utility functions in one handy module to import

Usage

import Prelude;

Dependencies

extend Boolean;
extend DateTime;
extend Exception;
extend Grammar;
extend IO;
extend List;
extend ListRelation;
extend Map;
extend Node;
extend ParseTree;
extend Relation;
extend Set;
extend String;
extend Type;
extend ValueIO;

Description

Unlike the module name suggests the Prelude module is not automatically imported when Rascal is started. All it is, is a handy combination of extended modules that will provide the utility functions most Rascal programmers need.

Prelude combines the following modules:

Examples

rascal>import Prelude;
ok
rascal>println("Hello World"); // from IO
Hello World
ok
rascal>size([1,2,3]) // from List
int: 3
rascal>size({1,2,1}) // from Set
int: 2

Benefits

  • Prelude makes all the feature of the extended modules transitively available to an importing module.

Pitfalls

  • Prelude combines many many function names and so the namespace of modules that import it is a bit crowded.