Skip to content

Clojure Core Essentials

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

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

The functions are very well organized in the Clojure Docs Quick Reference  External link 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 YS programming.

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

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

Number🔗

Arithmetic🔗

Clojure Core:

YS Std:

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

See Also:

Comparison🔗

Clojure Core:

YS Std:

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

Cast🔗

Clojure Core:

YS Std:

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

Test🔗

Clojure Core:

Boolean🔗

Clojure Core:

YS Std:

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

String🔗

Clojure Core:

YS Std:

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

See Also:

Regular Expression🔗

Clojure Core:

YS Std:

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

Flow Control🔗

Boolean🔗

Clojure Core:

YS Std:

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

Normal🔗

Clojure Core:

YS Std:

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

Exception🔗

Clojure Core:

YS Std:

  • die, warn, exit, err

Function🔗

Clojure Core:

YS Std:

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

Collection🔗

General🔗

Clojure Core:

YS Std:

  • grep, has?, in?

Vector🔗

Clojure Core:

List🔗

Clojure Core:

Map🔗

Clojure Core:

YS Std:

  • omap, get+

Sequence🔗

Clojure Core:

YS Std:

  • .. infix rng operator
  • rng, reverse

Variable🔗

Clojure Core:

YS Std:

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

I/O🔗

Clojure Core:

YS Std:

  • say, out, warn, pp