Core Library Essentials

YAMLScript has a very large set of useful functions that it inherits from Clojure's clojure.core library.

These functions are the bread and butter building blocks of YAMLScript programming.

The functions are very well organized in the Clojure Docs Quick Reference and you can get to the documentation for each function from there.

This document is a condensed quick reference of the functions that are most commonly used in YAMLScript programming.

YAMLScript also has the ys::std standard library that provides additional functions.

The YAMLScript standard library replaces some Clojure functions with a version more suited to YAMLScript. In those cases, the original Clojure function is still available in the ys::clj namespace.

Number

Arithmetic

Clojure Core:

YAMLScript Std:

  • %, %% infix operators
  • add, sub, mul, div named math functions
  • sum, sqr, cube, sqrt, pow, abs
  • add+, sub+, mul+, div+ polymorphic functions

See Also:

  • clojure.math functions callable as math/<func-name> in YAMLScript.

Comparison

Clojure Core:

YAMLScript Std:

  • ==, != infix operators
  • eq, ne, lt, gt, le, ge named comparison functions

Cast

Clojure Core:

YAMLScript Std:

  • to-num, to-int, to-float - polymorphic cast functions

Test

Clojure Core:

Boolean

Clojure Core:

YAMLScript Std:

  • truey?, falsey?, to-bool, to-booly

String

Clojure Core:

YAMLScript Std:

  • words, split, join, lines, text, replace, replace1
  • chomp, trim, triml, trimr, lc, uc, uc1, index, pretty

See Also:

Regular Expression

Clojure Core:

YAMLScript Std:

  • =~, !~ infix operators
  • /.../ regex literals
  • qr

Flow Control

Boolean

Clojure Core:

YAMLScript Std:

  • ||, &&, |||, &&& infix operators
  • or?, and? booly named functions

Normal

Clojure Core:

YAMLScript Std:

  • if-lets, when-lets, call, each, exit, sleep

Exception

Clojure Core:

YAMLScript Std:

  • die, warn, exit, err

Function

Clojure Core:

YAMLScript Std:

  • \(...) anonymous function syntax
  • . dot chaining infix operator
  • value, call

Collection

General

Clojure Core:

YAMLScript Std:

  • grep, has?, in?

Vector

Clojure Core:

List

Clojure Core:

Map

Clojure Core:

YAMLScript Std:

  • omap, get+

Sequence

Clojure Core:

YAMLScript Std:

  • .. infix rng operator
  • rng, reverse

Variable

Clojure Core:

YAMLScript Std:

  • =:, .=:, +=:, -=:, *=:, /=: def/let syntax
  • value

I/O

Clojure Core:

YAMLScript Std:

  • say, out, warn, pp