Most Musi code is made from expressions. An expression gives back a value. A number gives back a number. A function call gives back the function result. A match gives back the branch result.
This part teaches the forms you will read every day: literals, tuples, operators, ranges, functions, lambdas, calls, and Dot-calls.
Think of expressions like small machines on a workbench. Each machine takes some parts and gives one part back. You can connect the machines because each one gives a value.
Read this part slowly. These forms appear in almost every later page.
Chapters
Core expressions
Chapter»LiteralsLiterals create values directly. They do not call another name.Chapter»Tuples and unitA tuple groups values by position. Unit means no useful value.Chapter»Operators
:= writes, = compares, arrows describe callables, and pipelines pass values forward.Chapter»Assignment and equality:= stores a value. = checks equal values. /= checks different values.Chapter»Math and comparison+, -, *, /, and % compute numbers. <, <=, >, and >= compare them.Chapter»Logic and bitsand, or, xor, and not combine checks. shl and shr shift integer bits.Chapter»Pipelines and access|> passes a value forward. . reads fields. .[index] reads an ordered item.Chapter»Type operators: annotates, :? tests a runtime type, and :?> casts.Chapter»Callable arrows-> describes a callable type. ~> describes an effectful callable. => starts a lambda body.Chapter»RangesA range stores start and end information. Inclusivity belongs to the range value.Chapter»FunctionsFunctions are named values. Parameters and result types stay near the name.Chapter»LambdasA lambda starts with \\. This keeps it separate from tuples and grouped expressions.Chapter»CallsA call evaluates a callable value and passes arguments to it.Chapter»Dot-callsA receiver call keeps the value being acted on at the front.