Skip to content
Jonathan Potter edited this page Jun 3, 2014 · 5 revisions

The following operators are functions that can be accessed on the tlc.op object. For example: tlc.op["+"](1, 2).

  • /
  • ===
  • <
  • <=
  • =

  • &&
  • ||

For logical negation we use tlc.not instead of tlc.op["!"] because it's shorter and more readable.

Defining these operator functions is useful because JavaScript operators are not first class. For example, this allows you to do:

tlc.reduce(tlc.op["+"], 0, [1, 2, 3]); // 6

There are also flipped versions of all of these operators (except the ones that are commutative) in the corresponding tlc.fop object. tlc.fop will often be useful when you're partially applying an operator. For example:

tlc.filter(tlc.fop["<"](3), [1, 2, 3]); // [1, 2]

API

  • [Array](API Array)
  • [Function](API Function)
  • [Maybe](API Maybe)
  • [Object](API Object)
  • [Set](API Set)
  • [Typeclass](API Typeclass)

Guides

  • [Operators](Guide Operators)
  • [Typeclasses](Guide Typeclasses)
  • [Replacing OOP](Guide Replacing Object Oriented Programming)

General

Clone this wiki locally