Did you know ... Search Documentation:
Pack cosmos -- docs/index - Copy.md

Introduction

Cosmos is an in-development logic-functional, statically typed prototypal language.

rel main()
    x = io.read()
    io.writeln("hello, "+x+'!')

The above might look like imperative code. In fact, it's made to resemble a modern scripting language- or perhaps even allow for an imperative-style of code.

However, it's a fully functional (or actually, logic) programming language.

The first hint of this is the usage of rel in the above example (standing for relation) rather than, say, fun (function).

In fact, we borrow from many schools-of-thought. Cosmos has a...

  • Fully procedural, whitespace-sensitive syntax...
  • Functional features... (immutability, closures, type inference)
  • All while being a logic programming language... (relations, non-determinism)
  • ...~~with objects~~! (not included yet) See also a few points of comparison- or go right to the Quickstart section.

    Cosmos is in-development. Documentation is provided for development. Please understand that the language is in-development.

Documentation

Installation

As an Executable

Cosmos can be installed by, (1). Installing Swi-Prolog (preferably 8.4+), (2) downloading the latest release, and (3) simply typing,

make

in the project directory.

This should work on any system that can run Swi-Prolog.

You can test that the installation has succeeded.

$ cosmos -v
"Cosmos 0.13 beta - (Pl)"

Pack

Cosmos can be installed as a Swi-Prolog pack. This is recommended if you are already a Prolog user or plan to use the languages together.

:- pack_install(cosmos).

You can then load the language.

:- use_module(library(cosmos)).
:- cquery('x=2').

If you want to open the interpreter:

:- cstart.

As said, this is recommended if you're already a Prolog user. You're opening the Cosmos interpreter inside the Prolog interpreter, and so on. This is somewhat redundant.

Naturally, you may install it both normally and as a pack.