Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 813 Bytes

DOCS.md

File metadata and controls

65 lines (51 loc) · 813 Bytes

Crisp documentation

Introduction

crisp is a programming language based on Lisp that takes more inspiration from Rust (keywords for instance).

Table of contents

Basics

>> "Hello, world!"
"Hello, world!"
>> (+ 1 2 3 4 5)
15
>> (* 4 5 6)
120
>> (- 5 15)
-10
>> (* 13 (+ 1 2 3) 5)
390

Variables

>> (let x 10)
nil
>> (let y 15)
nil
>> (+ x y)
25

Functions

>> (let triple (fn (x) (* x 3)))
nil
>> (triple 5)
15

Above can also be written like so:

>> (let (triple x) (* x 3))
nil
>> (triple 5)
15

Functions can also be recursive (tail-call optimization is implemented):

>> (let (sum x acc) (if (> x 0) (sum (- x 1) (+ acc x)) acc))
nil
>> (sum 10 0)
55