Examples
This is a set of examples for various operators. If you want to see their documentation, checkout the Operators page.
Modules
mod
Compiles an entire program into a single executable expression. You can define other constants within it.
Chialisp
include
Includes all of the constants defined in a library file in the module.
cdv clsp retrieve sha256tree
(mod (thing-to-hash)
;; Includes the constants defined in the file.
(include sha256tree.clib)
;; Calls the utility function as the output.
(sha256tree thing-to-hash)
)
defun
Defines a function that can be called from anywhere within the module.
Chialisp
defun-inline
Defines an inline function that can be called from anywhere within the module. It simply replaces the call with the code within (like an easier to write but limited macro).
Chialisp
lambda
Compiles a block of code into a single executable expression. Useful for writing functions as arguments to other functions.
Chialisp
defmacro, qq, unquote
Defines a macro that can manually structure the source code it is replaced with. Allows for advanced compile time behavior.
Chialisp
defconstant
Defines a constant value that can be referenced by name.
Chialisp