+++ title = "API" weight = 110 template = "page-api.html" aliases = [ "/api" ] +++
{{ api_listing_entry(fn_name="decode", namespace="base64", doc="```phel (decode s & [strict?])
Decodes the Base64 encoded string `s`. If `strict?` is true invalid characters trigger an error.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/base64.phel#L9", ) }}
{{ api_listing_entry(fn_name="decode-url", namespace="base64", doc="```phel
(decode-url s & [strict?])
Decodes a Base64 URL encoded string s. If strict? is true invalid characters trigger an error.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/base64.phel#L22", ) }}
{{ api_listing_entry(fn_name="encode", namespace="base64", doc="```phel
(encode s)
Returns the Base64 representation of `s`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/base64.phel#L4", ) }}
{{ api_listing_entry(fn_name="encode-url", namespace="base64", doc="```phel
(encode-url s)
Returns the URL safe Base64 representation of s. Padding is removed.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/base64.phel#L14", ) }}
{{ api_listing_entry(fn_name="%", namespace="core", doc="```phel
(% dividend divisor)
Return the remainder of `dividend` / `divisor`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1830", ) }}
{{ api_listing_entry(fn_name="*", namespace="core", doc="```phel
(* & xs)
Returns the product of all elements in xs. All elements in xs must be
numbers. If xs is empty, return 1.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1804", ) }}
{{ api_listing_entry(fn_name="", namespace="core", doc="```phel
( a x)
Return `a` to the power of `x`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1837", ) }}
{{ api_listing_entry(fn_name="*build-mode*", namespace="core", doc="Set to true when a file is being built/transpiled, false otherwise.", , ) }}
{{ api_listing_entry(fn_name="*compile-mode*", namespace="core", doc="Deprecated! Use *build-mode* instead. Set to true when a file is compiled, false otherwise.", , ) }}
{{ api_listing_entry(fn_name="*ns*", namespace="core", doc="```phel
*ns*
Returns the namespace in the current scope.", , ) }} {{ api_listing_entry(fn_name="+", namespace="core", doc="```phel (+ & xs)
Returns the sum of all elements in `xs`. All elements `xs` must be numbers.
If `xs` is empty, return 0.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1780", ) }}
{{ api_listing_entry(fn_name="-", namespace="core", doc="```phel
(- & xs)
Returns the difference of all elements in xs. If xs is empty, return 0. If xs
has one element, return the negative value of that element.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1791", ) }}
{{ api_listing_entry(fn_name="->", namespace="core", doc="```phel
(-> x & forms)
Threads the expr through the forms. Inserts `x` as the second item
in the first form, making a list of it if it is not a list already.
If there are more forms, insert the first form as the second item in
the second form, etc.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2047", ) }}
{{ api_listing_entry(fn_name="->>", namespace="core", doc="```phel
(->> x & forms)
Threads the expr through the forms. Inserts x as the
last item in the first form, making a list of it if it is not a
list already. If there are more forms, insert the first form as the
last item in the second form, etc.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2063", ) }}
{{ api_listing_entry(fn_name="/", namespace="core", doc="```phel
(/ & xs)
Returns the nominator divided by all the denominators. If `xs` is empty,
returns 1. If `xs` has one value, returns the reciprocal of x.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1817", ) }}
{{ api_listing_entry(fn_name="<", namespace="core", doc="```phel
(< a & more)
Checks if each argument is strictly less than the following argument. Returns a boolean.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L463", ) }} {{ api_listing_entry(fn_name="<=", namespace="core", doc="```phel (<= a & more)
Checks if each argument is less than or equal to the following argument. Returns a boolean.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L475", ) }}
{{ api_listing_entry(fn_name="<=>", namespace="core", doc="```phel
(<=> a b)
Alias for the spaceship PHP operator in ascending order. Returns an int.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L511", ) }} {{ api_listing_entry(fn_name="=", namespace="core", doc="```phel (= a & more)
Checks if all values are equal. Same as `a == b` in PHP.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L440", ) }}
{{ api_listing_entry(fn_name=">", namespace="core", doc="```phel
(> a & more)
Checks if each argument is strictly greater than the following argument. Returns a boolean.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L487", ) }} {{ api_listing_entry(fn_name=">=", namespace="core", doc="```phel (>= a & more)
Checks if each argument is greater than or equal to the following argument. Returns a boolean.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L499", ) }}
{{ api_listing_entry(fn_name=">=<", namespace="core", doc="```phel
(>=< a b)
Alias for the spaceship PHP operator in descending order. Returns an int.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L517", ) }} {{ api_listing_entry(fn_name="NAN", namespace="core", doc="Constant for Not a Number (NAN) values.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1776", ) }} {{ api_listing_entry(fn_name="all?", namespace="core", doc="```phel (all? pred xs)
Returns true if `(pred x)` is logical true for every `x` in collection `xs`
or if `xs` is empty. Otherwise returns false.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L523", ) }}
{{ api_listing_entry(fn_name="and", namespace="core", doc="```phel
(and & args)
Evaluates each expression one at a time, from left to right. If a form
returns logical false, and returns that value and doesn't evaluate any of the
other expressions, otherwise, it returns the value of the last expression.
Calling the and function without arguments returns true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L412", ) }}
{{ api_listing_entry(fn_name="apply", namespace="core", doc="```phel
(apply f expr*)
Calls the function with the given arguments. The last argument must be a list of values, which are passed as separate arguments, rather than a single list. Apply returns the result of the calling function.", , , doc_url="/documentation/functions-and-recursion/#apply-functions") }}
{{ api_listing_entry(fn_name="argv", namespace="core", doc="Array of arguments passed to script.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L43", ) }}
{{ api_listing_entry(fn_name="as->", namespace="core", doc="```phel
(as-> expr name & forms)
Binds name to expr, evaluates the first form in the lexical context
of that binding, then binds name to that result, repeating for each
successive form, returning the result of the last form.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2113", ) }}
{{ api_listing_entry(fn_name="assert-non-nil", namespace="core", doc="```phel
(assert-non-nil & xs)
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1697", ) }}
{{ api_listing_entry(fn_name="assoc", namespace="core", doc="```phel
(assoc ds key value)
Alias for put.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L844", ) }}
{{ api_listing_entry(fn_name="assoc-in", namespace="core", doc="```phel
(assoc-in ds ks v)
Alias for `put-in`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1091", ) }}
{{ api_listing_entry(fn_name="associative?", namespace="core", doc="```phel
(associative? x)
Returns true if x is an associative data structure, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L766", ) }}
{{ api_listing_entry(fn_name="binding", namespace="core", doc="```phel
(binding bindings & body)
Temporary redefines definitions while executing the body.
The value will be reset after the body was executed.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2154", ) }}
{{ api_listing_entry(fn_name="bit-and", namespace="core", doc="```phel
(bit-and x y & args)
Bitwise and.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1707", ) }} {{ api_listing_entry(fn_name="bit-clear", namespace="core", doc="```phel (bit-clear x n)
Clear bit an index `n`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1757", ) }}
{{ api_listing_entry(fn_name="bit-flip", namespace="core", doc="```phel
(bit-flip x n)
Flip bit at index n.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1762", ) }}
{{ api_listing_entry(fn_name="bit-not", namespace="core", doc="```phel
(bit-not x)
Bitwise complement.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1731", ) }}
{{ api_listing_entry(fn_name="bit-or", namespace="core", doc="```phel
(bit-or x y & args)
Bitwise or.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1715", ) }} {{ api_listing_entry(fn_name="bit-set", namespace="core", doc="```phel (bit-set x n)
Set bit an index `n`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1752", ) }}
{{ api_listing_entry(fn_name="bit-shift-left", namespace="core", doc="```phel
(bit-shift-left x n)
Bitwise shift left.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1738", ) }} {{ api_listing_entry(fn_name="bit-shift-right", namespace="core", doc="```phel (bit-shift-right x n)
Bitwise shift right.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1745", ) }}
{{ api_listing_entry(fn_name="bit-test", namespace="core", doc="```phel
(bit-test x n)
Test bit at index n.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1767", ) }}
{{ api_listing_entry(fn_name="bit-xor", namespace="core", doc="```phel
(bit-xor x y & args)
Bitwise xor.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1723", ) }}
{{ api_listing_entry(fn_name="boolean?", namespace="core", doc="```phel
(boolean? x)
Returns true if x is a boolean, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L713", ) }}
{{ api_listing_entry(fn_name="butlast", namespace="core", doc="```phel
(butlast xs)
Returns all but the last item in `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1143", ) }}
{{ api_listing_entry(fn_name="case", namespace="core", doc="```phel
(case e & pairs)
Takes an expression e and a set of test-content/expression pairs. First
evaluates e and then finds the first pair where the test-constant matches
the result of e. The associated expression is then evaluated and returned.
If no matches can be found a final last expression can be provided that is
then evaluated and returned. Otherwise, nil is returned.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L380", ) }}
{{ api_listing_entry(fn_name="coerce-in", namespace="core", doc="```phel
(coerce-in v min max)
Returns `v` if it is in the range, or `min` if `v` is less than `min`, or `max` if `v` is greater than `max`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1923", ) }}
{{ api_listing_entry(fn_name="comment", namespace="core", doc="```phel
(comment &)
Ignores the body of the comment.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L208", ) }} {{ api_listing_entry(fn_name="comp", namespace="core", doc="```phel (comp & fs)
Takes a list of functions and returns a function that is the composition of those functions.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1583", ) }}
{{ api_listing_entry(fn_name="compare", namespace="core", doc="```phel
(compare x y)
An integer less than, equal to, or greater than zero when x is less than, equal to, or greater than y, respectively.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L606", ) }}
{{ api_listing_entry(fn_name="compile", namespace="core", doc="```phel
(compile form)
Returns the compiled PHP code string for the given form.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2273", ) }}
{{ api_listing_entry(fn_name="complement", namespace="core", doc="```phel
(complement f)
Returns a function that takes the same arguments as f and returns the opposite truth value.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1592", ) }}
{{ api_listing_entry(fn_name="concat", namespace="core", doc="```phel
(concat arr & xs)
Concatenates multiple sequential data structures.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L98", ) }}
{{ api_listing_entry(fn_name="cond", namespace="core", doc="```phel
(cond & pairs)
Takes a set of test/expression pairs. Evaluates each test one at a time. If a test returns logically true, the expression is evaluated and returned. If no test matches a final last expression can be provided that is then evaluated and returned. Otherwise, nil is returned.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L364", ) }} {{ api_listing_entry(fn_name="cons", namespace="core", doc="```phel (cons x xs)
Prepends `x` to the beginning of `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L289", ) }}
{{ api_listing_entry(fn_name="constantly", namespace="core", doc="```phel
(constantly x)
Returns a function that always returns x and ignores any passed arguments.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1578", ) }}
{{ api_listing_entry(fn_name="contains-value?", namespace="core", doc="```phel
(contains-value? coll val)
Returns true if the value is present in the given collection, otherwise returns false.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1368", ) }}
{{ api_listing_entry(fn_name="contains?", namespace="core", doc="```phel
(contains? coll key)
Returns true if key is present in the given collection, otherwise returns false.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L598", ) }} {{ api_listing_entry(fn_name="count", namespace="core", doc="```phel (count xs)
Counts the number of elements in a sequence. Can be used on everything that implements the PHP Countable interface.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L332", ) }}
{{ api_listing_entry(fn_name="dec", namespace="core", doc="```phel
(dec x)
Decrements x by one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1851", ) }}
{{ api_listing_entry(fn_name="declare", namespace="core", doc="```phel
(declare name)
Declare a global symbol before it is defined.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L179", ) }}
{{ api_listing_entry(fn_name="dedupe", namespace="core", doc="```phel
(dedupe xs)
Returns a vector with consecutive duplicate values removed in xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1495", ) }}
{{ api_listing_entry(fn_name="deep-merge", namespace="core", doc="```phel
(deep-merge & args)
Recursively merges data structures.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1684", ) }}
{{ api_listing_entry(fn_name="def", namespace="core", doc="```phel
(def name meta? value)
This special form binds a value to a global symbol.", , , doc_url="/documentation/global-and-local-bindings/#definition-def") }} {{ api_listing_entry(fn_name="def-", namespace="core", doc="```phel (def- name value)
Define a private value that will not be exported.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L159", ) }}
{{ api_listing_entry(fn_name="defexception", namespace="core", doc="```phel
(defexception name)
Define a new exception.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L196", ) }} {{ api_listing_entry(fn_name="defexception*", namespace="core", doc="```phel (defexception my-ex)
{{ api_listing_entry(fn_name="definterface", namespace="core", doc="```phel
(definterface name & fns)
Defines an interface.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2177", ) }} {{ api_listing_entry(fn_name="definterface*", namespace="core", doc="```phel (definterface name & fns)
An interface in Phel defines an abstract set of functions. It is directly mapped to a PHP interface. An interface can be defined by using the definterface macro.", , , doc_url="/documentation/interfaces/#defining-interfaces") }}
{{ api_listing_entry(fn_name="defmacro", namespace="core", doc="```phel
(defmacro name & fdecl)
Define a macro.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L164", ) }} {{ api_listing_entry(fn_name="defmacro-", namespace="core", doc="```phel (defmacro- name & fdecl)
Define a private macro that will not be exported.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L174", ) }}
{{ api_listing_entry(fn_name="defn", namespace="core", doc="```phel
(defn name & fdecl)
Define a new global function.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L154", ) }} {{ api_listing_entry(fn_name="defn-", namespace="core", doc="```phel (defn- name & fdecl)
Define a private function that will not be exported.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L169", ) }}
{{ api_listing_entry(fn_name="defstruct", namespace="core", doc="```phel
(defstruct name keys & implementations)
Define a new struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L184", ) }} {{ api_listing_entry(fn_name="defstruct*", namespace="core", doc="```phel (defstruct my-struct [a b c])
A Struct is a special kind of Map. It only supports a predefined number of keys and is associated to a global name. The Struct not only defines itself but also a predicate function.", , , doc_url="/documentation/data-structures/#structs") }}
{{ api_listing_entry(fn_name="deref", namespace="core", doc="```phel
(deref variable)
Return the value inside the variable.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L891", ) }} {{ api_listing_entry(fn_name="difference", namespace="core", doc="```phel (difference set & sets)
Difference between multiple sets into a new one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1559", ) }}
{{ api_listing_entry(fn_name="difference-pair", namespace="core", doc="```phel
(difference-pair s1 s2)
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1545", ) }} {{ api_listing_entry(fn_name="dissoc", namespace="core", doc="```phel (dissoc ds key)
Alias for `unset`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L867", ) }}
{{ api_listing_entry(fn_name="dissoc-in", namespace="core", doc="```phel
(dissoc-in ds ks)
Alias for unset-in.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1119", ) }}
{{ api_listing_entry(fn_name="distinct", namespace="core", doc="```phel
(distinct xs)
Returns a vector with duplicated values removed in `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1234", ) }}
{{ api_listing_entry(fn_name="do", namespace="core", doc="```phel
(do expr*)
Evaluates the expressions in order and returns the value of the last expression. If no expression is given, nil is returned.", , , doc_url="/documentation/control-flow/#statements-do") }} {{ api_listing_entry(fn_name="dofor", namespace="core", doc="```phel (dofor head & body)
Repeatedly executes body for side effects with bindings and modifiers as
provided by for. Returns nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1017", ) }}
{{ api_listing_entry(fn_name="doto", namespace="core", doc="```phel
(doto x & forms)
Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2123", ) }} {{ api_listing_entry(fn_name="drop", namespace="core", doc="```phel (drop n xs)
Drops the first `n` elements of `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1124", ) }}
{{ api_listing_entry(fn_name="drop-last", namespace="core", doc="```phel
(drop-last n xs)
Drops the last n elements of xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1129", ) }}
{{ api_listing_entry(fn_name="drop-while", namespace="core", doc="```phel
(drop-while pred xs)
Drops all elements at the front `xs` where `(pred x)` is true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1148", ) }}
{{ api_listing_entry(fn_name="empty?", namespace="core", doc="```phel
(empty? x)
Returns true if x would be 0, "" or empty collection, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L733", ) }} {{ api_listing_entry(fn_name="eval", namespace="core", doc="```phel (eval form)
Evaluates a form and return the evaluated results.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2267", ) }}
{{ api_listing_entry(fn_name="even?", namespace="core", doc="```phel
(even? x)
Checks if x is even.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1858", ) }}
{{ api_listing_entry(fn_name="every?", namespace="core", doc="```phel
(every? pred xs)
Alias for `all?`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L532", ) }}
{{ api_listing_entry(fn_name="extreme", namespace="core", doc="```phel
(extreme order args)
Returns the most extreme value in args based on the binary order function.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1908", ) }}
{{ api_listing_entry(fn_name="false?", namespace="core", doc="```phel
(false? x)
Checks if `x` is false. Same as `x === false` in PHP.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L582", ) }}
{{ api_listing_entry(fn_name="ffirst", namespace="core", doc="```phel
(ffirst xs)
Same as (first (first xs)).", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L303", ) }}
{{ api_listing_entry(fn_name="filter", namespace="core", doc="```phel
(filter pred xs)
Returns all elements of `xs` where `(pred x)` is true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1192", ) }}
{{ api_listing_entry(fn_name="find", namespace="core", doc="```phel
(find pred xs)
Returns the first item in xs where (pred item) evaluates to true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1213", ) }}
{{ api_listing_entry(fn_name="find-index", namespace="core", doc="```phel
(find-index pred xs)
Returns the index of the first item in `xs` where `(pred index item)` evaluates to true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1223", ) }}
{{ api_listing_entry(fn_name="first", namespace="core", doc="```phel
(first xs)
Returns the first element of an indexed sequence or nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L78", ) }} {{ api_listing_entry(fn_name="flatten", namespace="core", doc="```phel (flatten xs)
Takes a nested sequential data structure `(tree)`, and returns their contents
as a single, flat vector.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1648", ) }}
{{ api_listing_entry(fn_name="float?", namespace="core", doc="```phel
(float? x)
Returns true if x is float point number, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L658", ) }}
{{ api_listing_entry(fn_name="fn", namespace="core", doc="```phel
(fn [params*] expr*)
Defines a function. A function consists of a list of parameters and a list of expression. The value of the last expression is returned as the result of the function. All other expression are only evaluated for side effects. If no expression is given, the function returns nil.", , , doc_url="/documentation/functions-and-recursion/#anonymous-function-fn") }}
{{ api_listing_entry(fn_name="for", namespace="core", doc="```phel
(for head & body)
List comprehension. The head of the loop is a vector that contains a
sequence of bindings modifiers and options. A binding is a sequence of three
values binding :verb expr. Where binding is a binding as
in let and :verb is one of the following keywords:
:rangeloop over a range by using the range function.:inloops over all values of a collection.:keysloops over all keys/indexes of a collection.:pairsloops over all key-value pairs of a collection.
After each loop binding, additional modifiers can be applied. Modifiers
have the form :modifier argument. The following modifiers are supported:
:whilebreaks the loop if the expression is falsy.:letdefines additional bindings.:whenonly evaluates the loop body if the condition is true.
Finally, additional options can be set:
:reduce [accumulator initial-value]Instead of returning a list, it reduces the values intoaccumulator. Initiallyaccumulatoris bound toinitial-value.", , , doc_url="/documentation/control-flow/#for") }} {{ api_listing_entry(fn_name="foreach", namespace="core", doc="```phel (foreach [value valueExpr] expr*) (foreach [key value valueExpr] expr*)
The foreach special form can be used to iterate over all kind of PHP datastructures. The return value of foreach is always nil. The loop special form should be preferred of the foreach special form whenever possible.", , , doc_url="/documentation/control-flow/#foreach") }}
{{ api_listing_entry(fn_name="format", namespace="core", doc="```phel
(format fmt & xs)
Returns a formatted string. See PHP's sprintf for more information.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1997", ) }} {{ api_listing_entry(fn_name="frequencies", namespace="core", doc="```phel (frequencies xs)
Returns a map from distinct items in `xs` to the number of times they appear.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1274", ) }}
{{ api_listing_entry(fn_name="full-name", namespace="core", doc="```phel
(full-name x)
Return the namespace and name string of a string, keyword or symbol.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2253", ) }} {{ api_listing_entry(fn_name="function?", namespace="core", doc="```phel (function? x)
Returns true if `x` is a function, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L688", ) }}
{{ api_listing_entry(fn_name="gensym", namespace="core", doc="```phel
(gensym )
Generates a new unique symbol.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L220", ) }} {{ api_listing_entry(fn_name="get", namespace="core", doc="```phel (get ds k & [opt])
Get the value mapped to `key` from the datastructure `ds`.
Returns `opt` or nil if the value cannot be found.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L817", ) }}
{{ api_listing_entry(fn_name="get-in", namespace="core", doc="```phel
(get-in ds ks & [opt])
Access a value in a nested data structure. Looks into the data structure via a sequence of keys.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1078", ) }} {{ api_listing_entry(fn_name="group-by", namespace="core", doc="```phel (group-by f xs)
Returns a map of the elements of xs keyed by the result of
f on each element.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1421", ) }}
{{ api_listing_entry(fn_name="hash-map", namespace="core", doc="```phel
(hash-map & xs) # {& xs}
Creates a new hash map. If no argument is provided, an empty hash map is created. The number of parameters must be even.", , , doc_url="/documentation/data-structures/#maps") }} {{ api_listing_entry(fn_name="hash-map?", namespace="core", doc="```phel (hash-map? x)
Returns true if `x` is a hash map, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L698", ) }}
{{ api_listing_entry(fn_name="id", namespace="core", doc="```phel
(id a & more)
Checks if all values are identical. Same as a === b in PHP.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L430", ) }}
{{ api_listing_entry(fn_name="identity", namespace="core", doc="```phel
(identity x)
Returns its argument.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1573", ) }}
{{ api_listing_entry(fn_name="if", namespace="core", doc="```phel
(if test then else?)
A control flow structure. First evaluates test. If test evaluates to true, only the then form is evaluated and the result is returned. If test evaluates to false only the else form is evaluated and the result is returned. If no else form is given, nil will be returned.
The test evaluates to false if its value is false or equal to nil. Every other value evaluates to true. In sense of PHP this means (test != null && test !== false).", , , doc_url="/documentation/control-flow/#if") }} {{ api_listing_entry(fn_name="if-let", namespace="core", doc="```phel (if-let bindings then & [else])
If test is true, evaluates then with binding-form bound to the value of test,
if not, yields else", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2195", ) }}
{{ api_listing_entry(fn_name="if-not", namespace="core", doc="```phel
(if-not test then & [else])
Shorthand for (if (not condition) else then).", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L349", ) }}
{{ api_listing_entry(fn_name="inc", namespace="core", doc="```phel
(inc x)
Increments `x` by one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1844", ) }}
{{ api_listing_entry(fn_name="indexed?", namespace="core", doc="```phel
(indexed? x)
Returns true if x is indexed sequence, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L757", ) }}
{{ api_listing_entry(fn_name="int?", namespace="core", doc="```phel
(int? x)
Returns true if `x` is an integer number, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L663", ) }}
{{ api_listing_entry(fn_name="interleave", namespace="core", doc="```phel
(interleave & xs)
Returns a vector with the first items of each col, then the second items, etc.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1253", ) }} {{ api_listing_entry(fn_name="interpose", namespace="core", doc="```phel (interpose sep xs)
Returns a vector of elements separated by `sep`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1264", ) }}
{{ api_listing_entry(fn_name="intersection", namespace="core", doc="```phel
(intersection set & sets)
Intersect multiple sets into a new one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1540", ) }} {{ api_listing_entry(fn_name="invert", namespace="core", doc="```phel (invert map)
Returns a new map where the keys and values are swapped. If map has
duplicated values, some keys will be ignored.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1465", ) }}
{{ api_listing_entry(fn_name="iterate", namespace="core", doc="```phel
(iterate f x)
Returns an infinite sequence of x, (f x), (f (f x)), and so on.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1416", ) }} {{ api_listing_entry(fn_name="juxt", namespace="core", doc="```phel (juxt & fs)
Takes a list of functions and returns a new function that is the juxtaposition of those functions.
`((juxt a b c) x) => [(a x) (b x) (c x)]`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1597", ) }}
{{ api_listing_entry(fn_name="keep", namespace="core", doc="```phel
(keep pred xs)
Returns a list of non-nil results of (pred x).", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1197", ) }}
{{ api_listing_entry(fn_name="keep-indexed", namespace="core", doc="```phel
(keep-indexed pred xs)
Returns a list of non-nil results of `(pred i x)`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1205", ) }}
{{ api_listing_entry(fn_name="keys", namespace="core", doc="```phel
(keys xs)
Gets the keys of an associative data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1282", ) }} {{ api_listing_entry(fn_name="keyword", namespace="core", doc="```phel (keyword x)
Creates a new Keyword from a given string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L256", ) }}
{{ api_listing_entry(fn_name="keyword?", namespace="core", doc="```phel
(keyword? x)
Returns true if x is a keyword, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L678", ) }}
{{ api_listing_entry(fn_name="kvs", namespace="core", doc="```phel
(kvs xs)
Returns a vector of key-value pairs like `[k1 v1 k2 v2 k3 v3 ...]`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1297", ) }}
{{ api_listing_entry(fn_name="last", namespace="core", doc="```phel
(last xs)
Returns the last element of xs or nil if xs is empty or nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1136", ) }}
{{ api_listing_entry(fn_name="let", namespace="core", doc="```phel
(let [bindings*] expr*)
Creates a new lexical context with assignments defined in bindings. Afterwards the list of expressions is evaluated and the value of the last expression is returned. If no expression is given nil is returned.", , , doc_url="/documentation/global-and-local-bindings/#local-bindings-let") }}
{{ api_listing_entry(fn_name="list", namespace="core", doc="```phel
(list & xs) # '(& xs)
Creates a new list. If no argument is provided, an empty list is created.", , , doc_url="/documentation/data-structures/#lists") }} {{ api_listing_entry(fn_name="list?", namespace="core", doc="```phel (list? x)
Returns true if `x` is a list, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L708", ) }}
{{ api_listing_entry(fn_name="loop", namespace="core", doc="```phel
(loop [bindings*] expr*)
Creates a new lexical context with variables defined in bindings and defines a recursion point at the top of the loop.", , ) }} {{ api_listing_entry(fn_name="macroexpand", namespace="core", doc="```phel (macroexpand form)
Recursively expands the given form until it is no longer a macro call.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2316", ) }}
{{ api_listing_entry(fn_name="macroexpand-1", namespace="core", doc="```phel
(macroexpand-1 form)
Expands the given form once if it is a macro call.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2292", ) }} {{ api_listing_entry(fn_name="map", namespace="core", doc="```phel (map f & xs)
Returns an array consisting of the result of applying `f` to all of the first items in each `xs`,
followed by applying `f` to all the second items in each `xs` until anyone of the `xs` is exhausted.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1027", ) }}
{{ api_listing_entry(fn_name="map-indexed", namespace="core", doc="```phel
(map-indexed f xs)
Applies f to each element in xs. f is a two-argument function. The first argument
is an index of the element in the sequence and the second element is the element itself.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1042", ) }}
{{ api_listing_entry(fn_name="mapcat", namespace="core", doc="```phel
(mapcat f & xs)
Applies `f` on all `xs` and concatenate the result.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1048", ) }}
{{ api_listing_entry(fn_name="max", namespace="core", doc="```phel
(max & numbers)
Returns the numeric maximum of all numbers.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1918", ) }} {{ api_listing_entry(fn_name="mean", namespace="core", doc="```phel (mean xs)
Returns the mean of `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1935", ) }}
{{ api_listing_entry(fn_name="median", namespace="core", doc="```phel
(median xs)
Returns the median of xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1940", ) }}
{{ api_listing_entry(fn_name="memoize", namespace="core", doc="```phel
(memoize f)
Returns a memoized version of the function `f`. The memoized function
caches the return value for each set of arguments.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1614", ) }}
{{ api_listing_entry(fn_name="merge", namespace="core", doc="```phel
(merge & maps)
Merges multiple maps into one new map. If a key appears in more than one collection, then later values replace any previous ones.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1448", ) }} {{ api_listing_entry(fn_name="merge-with", namespace="core", doc="```phel (merge-with f & hash-maps)
Merges multiple maps into one new map. If a key appears in more than one
collection, the result of `(f current-val next-val)` is used.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1663", ) }}
{{ api_listing_entry(fn_name="meta", namespace="core", doc="```phel
(meta obj)
Gets the metadata of the given object.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L116", ) }} {{ api_listing_entry(fn_name="min", namespace="core", doc="```phel (min & numbers)
Returns the numeric minimum of all numbers.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1913", ) }}
{{ api_listing_entry(fn_name="name", namespace="core", doc="```phel
(name x)
Returns the name string of a string, keyword or symbol.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2243", ) }} {{ api_listing_entry(fn_name="namespace", namespace="core", doc="```phel (namespace x)
Return the namespace string of a symbol or keyword. Nil if not present.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2248", ) }}
{{ api_listing_entry(fn_name="nan?", namespace="core", doc="```phel
(nan? x)
Checks if x is not a number.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1888", ) }}
{{ api_listing_entry(fn_name="neg?", namespace="core", doc="```phel
(neg? x)
Checks if `x` is smaller than zero.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1883", ) }}
{{ api_listing_entry(fn_name="next", namespace="core", doc="```phel
(next xs)
Returns the sequence of elements after the first element. If there are no elements, returns nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L63", ) }} {{ api_listing_entry(fn_name="nfirst", namespace="core", doc="```phel (nfirst xs)
Same as `(next (first xs))`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L322", ) }}
{{ api_listing_entry(fn_name="nil?", namespace="core", doc="```phel
(nil? x)
Returns true if x is nil, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L587", ) }}
{{ api_listing_entry(fn_name="nnext", namespace="core", doc="```phel
(nnext xs)
Same as `(next (next xs))`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L327", ) }}
{{ api_listing_entry(fn_name="not", namespace="core", doc="```phel
(not x)
The not function returns true if the given value is logical false and false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L450", ) }}
{{ api_listing_entry(fn_name="not-any?", namespace="core", doc="```phel
(not-any? pred xs)
Returns true if `(pred x)` is logical false for every `x` in `xs`
or if `xs` is empty. Otherwise returns false.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L556", ) }}
{{ api_listing_entry(fn_name="not-empty", namespace="core", doc="```phel
(not-empty coll)
Returns coll if it contains elements, otherwise nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L742", ) }}
{{ api_listing_entry(fn_name="not-every?", namespace="core", doc="```phel
(not-every? pred xs)
Returns false if `(pred x)` is logical true for every `x` in collection `xs`
or if `xs` is empty. Otherwise returns true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L537", ) }}
{{ api_listing_entry(fn_name="not=", namespace="core", doc="```phel
(not= a & more)
Checks if all values are unequal. Same as a != b in PHP.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L455", ) }}
{{ api_listing_entry(fn_name="ns", namespace="core", doc="```phel
(ns name imports*)
Defines the namespace for the current file and adds imports to the environment. Imports can either be uses or requires. The keyword `:use` is used to import PHP classes, the keyword `:require` is used to import Phel modules and the keyword `:require-file` is used to load php files.", , , doc_url="/documentation/namespaces/#namespace-ns") }}
{{ api_listing_entry(fn_name="number?", namespace="core", doc="```phel
(number? x)
Returns true if x is a number, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L668", ) }}
{{ api_listing_entry(fn_name="odd?", namespace="core", doc="```phel
(odd? x)
Checks if `x` is odd.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1863", ) }}
{{ api_listing_entry(fn_name="one?", namespace="core", doc="```phel
(one? x)
Checks if x is one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1873", ) }}
{{ api_listing_entry(fn_name="or", namespace="core", doc="```phel
(or & args)
Evaluates each expression one at a time, from left to right. If a form
returns a logical true value, or returns that value and doesn't evaluate any of
the other expressions, otherwise, it returns the value of the last expression.
Calling or without arguments, returns nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L399", ) }}
{{ api_listing_entry(fn_name="pairs", namespace="core", doc="```phel
(pairs xs)
Gets the pairs of an associative data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1292", ) }} {{ api_listing_entry(fn_name="partial", namespace="core", doc="```phel (partial f & args)
Takes a function `f` and fewer than normal arguments of `f` and returns a function
that a variable number of additional arguments. When call `f` will be called
with `args` and the additional arguments.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1607", ) }}
{{ api_listing_entry(fn_name="partition", namespace="core", doc="```phel
(partition n xs)
Partition an indexed data structure into vectors of maximum size n. Returns a new vector.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1500", ) }} {{ api_listing_entry(fn_name="partition-by", namespace="core", doc="```phel (partition-by f xs)
Applies `f` to each value in `xs`, splitting them each time the return value changes.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1483", ) }}
{{ api_listing_entry(fn_name="peek", namespace="core", doc="```phel
(peek xs)
Returns the last element of a sequence.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L784", ) }} {{ api_listing_entry(fn_name="persistent", namespace="core", doc="```phel (persistent coll)
Converts a transient collection to a persistent collection.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L242", ) }}
{{ api_listing_entry(fn_name="phel->php", namespace="core", doc="```phel
(phel->php x)
Recursively converts a Phel data structure to a PHP array.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1320", ) }} {{ api_listing_entry(fn_name="php->phel", namespace="core", doc="```phel (php->phel x)
Recursively converts a PHP array to Phel data structures.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1350", ) }}
{{ api_listing_entry(fn_name="php-array-to-map", namespace="core", doc="```phel
(php-array-to-map arr)
Converts a PHP Array to a map.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1311", ) }} {{ api_listing_entry(fn_name="php-array?", namespace="core", doc="```phel (php-array? x)
Returns true if `x` is a PHP Array, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L718", ) }}
{{ api_listing_entry(fn_name="php-associative-array", namespace="core", doc="```phel
(php-associative-array & xs)
Creates a PHP associative array. An even number of parameters must be provided.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L266", ) }} {{ api_listing_entry(fn_name="php-indexed-array", namespace="core", doc="```phel (php-indexed-array & xs)
Creates a PHP indexed array from the given values.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L261", ) }}
{{ api_listing_entry(fn_name="php-object?", namespace="core", doc="```phel
(php-object? x)
Returns true if x is a PHP object, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L728", ) }}
{{ api_listing_entry(fn_name="php-resource?", namespace="core", doc="```phel
(php-resource? x)
Returns true if `x` is a PHP resource, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L723", ) }}
{{ api_listing_entry(fn_name="pop", namespace="core", doc="```phel
(pop xs)
Removes the last element of the array xs. If the array is empty returns nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L801", ) }}
{{ api_listing_entry(fn_name="pos?", namespace="core", doc="```phel
(pos? x)
Checks if `x` is greater than zero.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1878", ) }}
{{ api_listing_entry(fn_name="print", namespace="core", doc="```phel
(print & xs)
Prints the given values to the default output stream. Returns nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1984", ) }} {{ api_listing_entry(fn_name="print-str", namespace="core", doc="```phel (print-str & xs)
Same as print. But instead of writing it to an output stream, the resulting string is returned.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1969", ) }}
{{ api_listing_entry(fn_name="printf", namespace="core", doc="```phel
(printf fmt & xs)
Output a formatted string. See PHP's printf for more information.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2002", ) }} {{ api_listing_entry(fn_name="println", namespace="core", doc="```phel (println & xs)
Same as print followed by a newline.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1990", ) }}
{{ api_listing_entry(fn_name="push", namespace="core", doc="```phel
(push xs x)
Inserts x at the end of the sequence xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L790", ) }}
{{ api_listing_entry(fn_name="put", namespace="core", doc="```phel
(put ds key value)
Puts `value` mapped to `key` on the datastructure `ds`. Returns `ds`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L826", ) }}
{{ api_listing_entry(fn_name="put-in", namespace="core", doc="```phel
(put-in ds [k & ks] v)
Puts a value into a nested data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1084", ) }} {{ api_listing_entry(fn_name="quote", namespace="core", doc="```phel (NAME_QUOTE)
{{ api_listing_entry(fn_name="rand", namespace="core", doc="```phel
(rand )
Returns a random number between 0 and 1.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1893", ) }} {{ api_listing_entry(fn_name="rand-int", namespace="core", doc="```phel (rand-int n)
Returns a random number between 0 and `n`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1898", ) }}
{{ api_listing_entry(fn_name="rand-nth", namespace="core", doc="```phel
(rand-nth xs)
Returns a random item from xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1903", ) }} {{ api_listing_entry(fn_name="range", namespace="core", doc="```phel (range a & rest)
Create an array of values `[start, end)`. If the function has one argument then
the range `[0, end)` is returned. With two arguments, returns `[start, end)`.
The third argument is an optional step width (default 1).", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L908", ) }}
{{ api_listing_entry(fn_name="re-seq", namespace="core", doc="```phel
(re-seq re s)
Returns a sequence of successive matches of pattern in string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2142", ) }} {{ api_listing_entry(fn_name="read-string", namespace="core", doc="```phel (read-string s)
Reads the first phel expression from the string s.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2258", ) }}
{{ api_listing_entry(fn_name="recur", namespace="core", doc="```phel
(recur expr*)
Internally recur is implemented as a PHP while loop and therefore prevents the Maximum function nesting level errors..
```", , , doc_url="/documentation/global-and-local-bindings/#local-bindings-let") }}
{{ api_listing_entry(fn_name="reduce", namespace="core", doc="```phel
(reduce f & xs)
(reduce f coll) (reduce f val coll) f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the result of applying f to val and the first item in coll, then applying f to that result and the 2nd item, etc. If coll contains no items, returns val and f is not called.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1053", ) }} {{ api_listing_entry(fn_name="remove", namespace="core", doc="```phel (remove xs offset & [n])
Removes up to `n` element from array `xs` starting at index `offset`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L809", ) }}
{{ api_listing_entry(fn_name="repeat", namespace="core", doc="```phel
(repeat a & rest)
Returns a vector of length n where every element is x. With one argument returns an infinite sequence of x.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1396", ) }} {{ api_listing_entry(fn_name="repeatedly", namespace="core", doc="```phel (repeatedly a & rest)
Returns a vector of length n with values produced by repeatedly calling f.
With one argument returns an infinite sequence of calls to f.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1405", ) }}
{{ api_listing_entry(fn_name="rest", namespace="core", doc="```phel
(rest xs)
Returns the sequence of elements after the first element. If there are no elements, returns an empty sequence.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L313", ) }} {{ api_listing_entry(fn_name="reverse", namespace="core", doc="```phel (reverse xs)
Reverses the order of the elements in the given sequence.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1246", ) }}
{{ api_listing_entry(fn_name="second", namespace="core", doc="```phel
(second xs)
Returns the second element of an indexed sequence or nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L308", ) }} {{ api_listing_entry(fn_name="select-keys", namespace="core", doc="```phel (select-keys m ks)
Returns a new map including key value pairs from `m` selected with of keys `ks`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1457", ) }}
{{ api_listing_entry(fn_name="set", namespace="core", doc="```phel
(set & xs)
Creates a new Set. If no argument is provided, an empty Set is created.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L251", ) }} {{ api_listing_entry(fn_name="set!", namespace="core", doc="```phel (set! variable value)
Sets a new value to the given variable.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L886", ) }}
{{ api_listing_entry(fn_name="set-meta!", namespace="core", doc="```phel
(set-meta! obj)
Sets the metadata to a given object.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L121", ) }} {{ api_listing_entry(fn_name="set-var", namespace="core", doc="```phel (var value)
Variables provide a way to manage mutable state. Each variable contains a single value. To create a variable use the var function.", , , doc_url="/documentation/global-and-local-bindings/#variables") }}
{{ api_listing_entry(fn_name="set?", namespace="core", doc="```phel
(set? x)
Returns true if x is a set, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L775", ) }}
{{ api_listing_entry(fn_name="shuffle", namespace="core", doc="```phel
(shuffle xs)
Returns a random permutation of xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1389", ) }}
{{ api_listing_entry(fn_name="slice", namespace="core", doc="```phel
(slice xs & [offset & [length]])
Extract a slice of xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1070", ) }}
{{ api_listing_entry(fn_name="slurp", namespace="core", doc="```phel
(slurp filename & [opts])
Reads entire file into a string. Accepts `opts` map for overriding default
PHP file_get_contents arguments.
See PHP's [file_get_contents](https://www.php.net/manual/en/function.file-get-contents.php) for more information.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2012", ) }}
{{ api_listing_entry(fn_name="some", namespace="core", doc="```phel
(some pred xs)
Returns the first logical true value of (pred x) for any x in xs, else nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L562", ) }}
{{ api_listing_entry(fn_name="some->", namespace="core", doc="```phel
(some-> x & forms)
Threads `x` through the forms like `->` but stops when a form returns `nil`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2079", ) }}
{{ api_listing_entry(fn_name="some->>", namespace="core", doc="```phel
(some->> x & forms)
Threads x through the forms like ->> but stops when a form returns nil.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2096", ) }}
{{ api_listing_entry(fn_name="some?", namespace="core", doc="```phel
(some? pred xs)
Returns true if `(pred x)` is logical true for at least one `x` in `xs`, else false.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L547", ) }}
{{ api_listing_entry(fn_name="sort", namespace="core", doc="```phel
(sort xs & [comp])
Returns a sorted vector. If no comparator is supplied compare is used.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1373", ) }} {{ api_listing_entry(fn_name="sort-by", namespace="core", doc="```phel (sort-by keyfn xs & [comp])
Returns a sorted vector where the sort order is determined by comparing
`(keyfn item)`. If no comparator is supplied compare is used.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1380", ) }}
{{ api_listing_entry(fn_name="spit", namespace="core", doc="```phel
(spit filename data & [opts])
Writes data to file, returning number of bytest that were written or nil
on failure. Accepts opts map for overriding default PHP file_put_contents
arguments, as example to append to file use {:flags php/FILE_APPEND}.
See PHP's file_put_contents for more information.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2028", ) }}
{{ api_listing_entry(fn_name="split-at", namespace="core", doc="```phel
(split-at n xs)
Returns a vector of `[(take n coll) (drop n coll)]`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1473", ) }}
{{ api_listing_entry(fn_name="split-with", namespace="core", doc="```phel
(split-with f xs)
Returns a vector of [(take-while pred coll) (drop-while pred coll)].", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1478", ) }}
{{ api_listing_entry(fn_name="str", namespace="core", doc="```phel
(str & args)
Creates a string by concatenating values together. If no arguments are
provided an empty string is returned. Nil and false are represented as an empty
string. True is represented as 1. Otherwise, it tries to call `__toString`.
This is PHP equivalent to `$args[0] . $args[1] . $args[2] ...`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L225", ) }}
{{ api_listing_entry(fn_name="str-contains?", namespace="core", doc="```phel
(str-contains? str s)
Returns true if str contains s.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L592", ) }} {{ api_listing_entry(fn_name="string?", namespace="core", doc="```phel (string? x)
Returns true if `x` is a string, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L673", ) }}
{{ api_listing_entry(fn_name="struct?", namespace="core", doc="```phel
(struct? x)
Returns true if x is a struct, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L693", ) }}
{{ api_listing_entry(fn_name="sum", namespace="core", doc="```phel
(sum xs)
Returns the sum of all elements is `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1930", ) }}
{{ api_listing_entry(fn_name="swap!", namespace="core", doc="```phel
(swap! variable f & args)
Swaps the value of the variable to (apply f current-value args). Returns the values that are swapped in.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L896", ) }}
{{ api_listing_entry(fn_name="symbol", namespace="core", doc="```phel
(symbol name-or-ns & [name])
Returns a new symbol for given string with optional namespace.
Arity-1 returns a symbol without namespace. Arity-2 returns a symbol in given namespace.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L212", ) }}
{{ api_listing_entry(fn_name="symbol?", namespace="core", doc="```phel
(symbol? x)
Returns true if x is a symbol, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L683", ) }}
{{ api_listing_entry(fn_name="symmetric-difference", namespace="core", doc="```phel
(symmetric-difference set & sets)
Symmetric difference between multiple sets into a new one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1564", ) }}
{{ api_listing_entry(fn_name="take", namespace="core", doc="```phel
(take n xs)
Takes the first n elements of xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1158", ) }}
{{ api_listing_entry(fn_name="take-last", namespace="core", doc="```phel
(take-last n xs)
Takes the last `n` elements of `xs`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1173", ) }}
{{ api_listing_entry(fn_name="take-nth", namespace="core", doc="```phel
(take-nth n xs)
Returns every nth item in xs.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1183", ) }}
{{ api_listing_entry(fn_name="take-while", namespace="core", doc="```phel
(take-while pred xs)
Takes all elements at the front of `xs` where `(pred x)` is true.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1178", ) }}
{{ api_listing_entry(fn_name="throw", namespace="core", doc="```phel
(throw exception)
Throw an exception. See try-catch.", , ) }} {{ api_listing_entry(fn_name="time", namespace="core", doc="```phel (time expr)
Evaluates expr and prints the time it took. Returns the value of expr.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2235", ) }}
{{ api_listing_entry(fn_name="to-php-array", namespace="core", doc="```phel
(to-php-array xs)
Create a PHP Array from a sequential data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1306", ) }} {{ api_listing_entry(fn_name="transient", namespace="core", doc="```phel (transient coll)
Converts a persistent collection to a transient collection.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L237", ) }}
{{ api_listing_entry(fn_name="tree-seq", namespace="core", doc="```phel
(tree-seq branch? children root)
Returns a vector of the nodes in the tree, via a depth-first walk. branch? is a function with one argument that returns true if the given node has children. children must be a function with one argument that returns the children of the node. root the root node of the tree.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1631", ) }} {{ api_listing_entry(fn_name="true?", namespace="core", doc="```phel (true? x)
Checks if `x` is true. Same as `x === true` in PHP.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L572", ) }}
{{ api_listing_entry(fn_name="truthy?", namespace="core", doc="```phel
(truthy? x)
Checks if x is truthy. Same as x == true in PHP.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L577", ) }}
{{ api_listing_entry(fn_name="try", namespace="core", doc="```phel
(try expr* catch-clause* finally-clause?)
All expressions are evaluated and if no exception is thrown the value of the last expression is returned. If an exception occurs and a matching catch-clause is provided, its expression is evaluated and the value is returned. If no matching catch-clause can be found the exception is propagated out of the function. Before returning normally or abnormally the optionally finally-clause is evaluated.", , , doc_url="/documentation/control-flow/#try-catch-and-finally") }}
{{ api_listing_entry(fn_name="type", namespace="core", doc="```phel
(type x)
Returns the type of x. The following types can be returned:
:vector:list:struct:hash-map:set:keyword:symbol:var:int:float:string:nil:boolean:function:php/array:php/resource:php/object:unknown", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L616", ) }} {{ api_listing_entry(fn_name="union", namespace="core", doc="```phel (union & sets)
Union multiple sets into a new one.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1521", ) }}
{{ api_listing_entry(fn_name="unquote", namespace="core", doc="```phel
(unquote my-sym) # Evaluates to my-sym
,my-sym # Shorthand for (same as above)
Values that should be evaluated in a macro are marked with the unquote function (shorthand ,).", , , doc_url="/documentation/macros/#quasiquote") }}
{{ api_listing_entry(fn_name="unquote-splicing", namespace="core", doc="```phel
(unquote-splicing my-sym) # Evaluates to my-sym
,@my-sym # Shorthand for (same as above)
Values that should be evaluated in a macro are marked with the unquote function (shorthand `,@`).", , , doc_url="/documentation/macros/#quasiquote") }}
{{ api_listing_entry(fn_name="unset", namespace="core", doc="```phel
(unset ds key)
Returns ds without key.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L849", ) }}
{{ api_listing_entry(fn_name="unset-in", namespace="core", doc="```phel
(unset-in ds [k & ks])
Removes a value from a nested data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1109", ) }}
{{ api_listing_entry(fn_name="update", namespace="core", doc="```phel
(update ds k f & args)
Updates a value in a datastructure by applying f to the current element and replacing it with the result of f.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1096", ) }}
{{ api_listing_entry(fn_name="update-in", namespace="core", doc="```phel
(update-in ds [k & ks] f & args)
Updates a value into a nested data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1101", ) }}
{{ api_listing_entry(fn_name="values", namespace="core", doc="```phel
(values xs)
Gets the values of an associative data structure.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1287", ) }} {{ api_listing_entry(fn_name="var", namespace="core", doc="```phel (var value)
Creates a new variable with the given value.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L876", ) }}
{{ api_listing_entry(fn_name="var?", namespace="core", doc="```phel
(var? x)
Checks if the given value is a variable.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L881", ) }} {{ api_listing_entry(fn_name="vector", namespace="core", doc="```phel (vector & xs) # [& xs]
Creates a new vector. If no argument is provided, an empty vector is created.", , , doc_url="/documentation/data-structures/#vectors") }}
{{ api_listing_entry(fn_name="vector?", namespace="core", doc="```phel
(vector? x)
Returns true if x is a vector, false otherwise.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L703", ) }}
{{ api_listing_entry(fn_name="when", namespace="core", doc="```phel
(when test & body)
Evaluates `test` and if that is logical true, evaluates `body`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L354", ) }}
{{ api_listing_entry(fn_name="when-let", namespace="core", doc="```phel
(when-let bindings & body)
When test is true, evaluates body with binding-form bound to the value of test", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L2216", ) }} {{ api_listing_entry(fn_name="when-not", namespace="core", doc="```phel (when-not test & body)
Evaluates `test` and if that is logical false, evaluates `body`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L359", ) }}
{{ api_listing_entry(fn_name="with-output-buffer", namespace="core", doc="```phel
(with-output-buffer & body)
Everything that is printed inside the body will be stored in a buffer. The result of the buffer is returned.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1957", ) }} {{ api_listing_entry(fn_name="zero?", namespace="core", doc="```phel (zero? x)
Checks if `x` is zero.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1868", ) }}
{{ api_listing_entry(fn_name="zipcoll", namespace="core", doc="```phel
(zipcoll a b)
Creates a map from two sequential data structures. Return a new map.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1433", ) }} {{ api_listing_entry(fn_name="zipmap", namespace="core", doc="```phel (zipmap keys vals)
Returns a new map with the keys mapped to the corresponding values. Stops when the shorter of `keys` or `vals` is exhausted.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/core.phel#L1438", ) }}
{{ api_listing_entry(fn_name="doctype", namespace="html", doc="```phel
(doctype type)
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/html.phel#L166", ) }} {{ api_listing_entry(fn_name="escape-html", namespace="html", doc="```phel (escape-html s)
Escapes the string that may contain HTML.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/html.phel#L6", ) }}
{{ api_listing_entry(fn_name="html", namespace="html", doc="```phel
(html & content)
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/html.phel#L154", ) }} {{ api_listing_entry(fn_name="raw-string", namespace="html", doc="```phel (raw-string s)
Creates a new raw-string struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/html.phel#L4", ) }}
{{ api_listing_entry(fn_name="raw-string?", namespace="html", doc="```phel
(raw-string? x)
Checks if x is an instance of the raw-string struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/html.phel#L4", ) }}
{{ api_listing_entry(fn_name="create-response-from-map", namespace="http", doc="", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L341", ) }}
{{ api_listing_entry(fn_name="create-response-from-string", namespace="http", doc="", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L348", ) }}
{{ api_listing_entry(fn_name="emit-response", namespace="http", doc="```phel
(emit-response response)
Emits the response.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L389", ) }}
{{ api_listing_entry(fn_name="files-from-globals", namespace="http", doc="```phel
(files-from-globals & [files])
Extracts the files from $_FILES and normalizes them to a map of "uploaded-file".", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L143", ) }}
{{ api_listing_entry(fn_name="headers-from-server", namespace="http", doc="```phel
(headers-from-server & [server])
Extracts all headers from the `$_SERVER` variable.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L152", ) }}
{{ api_listing_entry(fn_name="request", namespace="http", doc="```phel
(request method uri headers parsed-body query-params cookie-params server-params uploaded-files version attributes)
Creates a new request struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L176", ) }} {{ api_listing_entry(fn_name="request-from-globals", namespace="http", doc="```phel (request-from-globals )
Extracts a request from `$_SERVER`, `$_GET`, `$_POST`, `$_COOKIE` and `$_FILES`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L225", ) }}
{{ api_listing_entry(fn_name="request-from-globals-args", namespace="http", doc="```phel
(request-from-globals-args server get-parameter post-parameter cookies files)
Extracts a request from args.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L203", ) }} {{ api_listing_entry(fn_name="request-from-map", namespace="http", doc="```phel (request-from-map {:method method :version version :uri uri :headers headers :parsed-body parsed-body :query-params query-params :cookie-params cookie-params :server-params server-params :uploaded-files uploaded-files :attributes attributes})
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L230", ) }}
{{ api_listing_entry(fn_name="request?", namespace="http", doc="```phel
(request? x)
Checks if x is an instance of the request struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L176", ) }}
{{ api_listing_entry(fn_name="response", namespace="http", doc="```phel
(response status headers body version reason)
Creates a new response struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L261", ) }}
{{ api_listing_entry(fn_name="response-from-map", namespace="http", doc="```phel
(response-from-map {:status status :headers headers :body body :version version :reason reason})
Creates a response struct from a map. The map can have the following keys:
:statusThe HTTP Status (default 200):headersA map of HTTP Headers (default: empty map):bodyThe body of the response (default: empty string):versionThe HTTP Version (default: 1.1):reasonThe HTTP status reason. If not provided a common status reason is taken", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L326", ) }} {{ api_listing_entry(fn_name="response-from-string", namespace="http", doc="```phel (response-from-string s)
Create a response from a string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L343", ) }}
{{ api_listing_entry(fn_name="response?", namespace="http", doc="```phel
(response? x)
Checks if x is an instance of the response struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L261", ) }}
{{ api_listing_entry(fn_name="uploaded-file", namespace="http", doc="```phel
(uploaded-file tmp-file size error-status client-filename client-media-type)
Creates a new uploaded-file struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L103", ) }}
{{ api_listing_entry(fn_name="uploaded-file?", namespace="http", doc="```phel
(uploaded-file? x)
Checks if x is an instance of the uploaded-file struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L103", ) }}
{{ api_listing_entry(fn_name="uri", namespace="http", doc="```phel
(uri scheme userinfo host port path query fragment)
Creates a new uri struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L9", ) }}
{{ api_listing_entry(fn_name="uri-from-globals", namespace="http", doc="```phel
(uri-from-globals & [server])
Extracts the URI from the $_SERVER variable.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L53", ) }}
{{ api_listing_entry(fn_name="uri-from-string", namespace="http", doc="```phel
(uri-from-string url)
Create a uri struct from a string", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L76", ) }}
{{ api_listing_entry(fn_name="uri?", namespace="http", doc="```phel
(uri? x)
Checks if x is an instance of the uri struct.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/http.phel#L9", ) }}
{{ api_listing_entry(fn_name="decode", namespace="json", doc="```phel
(decode json & [{:flags flags :depth depth}])
Decodes a JSON string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/json.phel#L51", ) }}
{{ api_listing_entry(fn_name="decode-value", namespace="json", doc="```phel
(decode-value x)
Convert a json data structure to a 'phel compatible' value.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/json.phel#L40", ) }} {{ api_listing_entry(fn_name="encode", namespace="json", doc="```phel (encode value & [{:flags flags :depth depth}])
Returns the JSON representation of a value.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/json.phel#L29", ) }}
{{ api_listing_entry(fn_name="encode-value", namespace="json", doc="```phel
(encode-value x)
Convert a Phel data type to a 'json compatible' value.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/json.phel#L19", ) }} {{ api_listing_entry(fn_name="valid-key?", namespace="json", doc="```phel (valid-key? v)
Checks if `v` is a valid JSON key or can be converted to a JSON key.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/json.phel#L4", ) }}
{{ api_listing_entry(fn_name="php/->", namespace="php", doc="```phel
(php/-> object call*)
(php/:: class call*)
Access to an object property or result of chained calls.", , , doc_url="/documentation/php-interop/#php-set-object-properties") }} {{ api_listing_entry(fn_name="php/::", namespace="php", doc="```phel (php/:: class (methodname expr*)) (php/:: class call*)
Calls a static method or property from a PHP class. Both methodname and property must be symbols and cannot be an evaluated value.", , , doc_url="/documentation/php-interop/#php-static-method-and-property-call") }}
{{ api_listing_entry(fn_name="php/aget", namespace="php", doc="```phel
(php/aget arr index)
Equivalent to PHP's arr[index] ?? null.", , , doc_url="/documentation/php-interop/#get-php-array-value") }}
{{ api_listing_entry(fn_name="php/apush", namespace="php", doc="```phel
(php/apush arr value)
Equivalent to PHP's `arr[] = value`.", , , doc_url="/documentation/php-interop/#append-php-array-value") }}
{{ api_listing_entry(fn_name="php/aset", namespace="php", doc="```phel
(php/aset arr index value)
Equivalent to PHP's arr[index] = value.", , , doc_url="/documentation/php-interop/#set-php-array-value") }}
{{ api_listing_entry(fn_name="php/aunset", namespace="php", doc="```phel
(php/aunset arr index)
Equivalent to PHP's `unset(arr[index])`.", , , doc_url="/documentation/php-interop/#unset-php-array-value") }}
{{ api_listing_entry(fn_name="php/new", namespace="php", doc="```phel
(php/new expr args*)
Evaluates expr and creates a new PHP class using the arguments. The instance of the class is returned.", , , doc_url="/documentation/php-interop/#php-class-instantiation") }} {{ api_listing_entry(fn_name="php/oset", namespace="php", doc="```phel (php/oset (php/-> object property) value) (php/oset (php/:: class property) value)
Use `php/oset` to set a value to a class/object property.", , , doc_url="/documentation/php-interop/#php-set-object-properties") }}
{{ api_listing_entry(fn_name="build-facade", namespace="repl", doc="", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L11", ) }}
{{ api_listing_entry(fn_name="compile-str", namespace="repl", doc="```phel
(compile-str s)
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L129", ) }} {{ api_listing_entry(fn_name="doc", namespace="repl", doc="```phel (doc sym)
Prints the documentation for the given symbol.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L52", ) }}
{{ api_listing_entry(fn_name="loaded-namespaces", namespace="repl", doc="```phel
(loaded-namespaces )
Return all namespaces currently loaded in the REPL.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L18", ) }} {{ api_listing_entry(fn_name="print-colorful", namespace="repl", doc="```phel (print-colorful & xs)
Colored print.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L116", ) }}
{{ api_listing_entry(fn_name="println-colorful", namespace="repl", doc="```phel
(println-colorful & xs)
Colored println.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L122", ) }} {{ api_listing_entry(fn_name="require", namespace="repl", doc="```phel (require sym & args)
Requires a Phel module into the environment.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L81", ) }}
{{ api_listing_entry(fn_name="resolve", namespace="repl", doc="```phel
(resolve sym)
Resolves the given symbol in the current environment and returns a resolved Symbol with the absolute namespace or nil if it cannot be resolved.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L32", ) }} {{ api_listing_entry(fn_name="use", namespace="repl", doc="```phel (use sym & args)
Adds a use statement to the environment.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/repl.phel#L94", ) }}
{{ api_listing_entry(fn_name="blank?", namespace="str", doc="```phel
(blank? s)
True if s is nil, empty, or contains only whitespace.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L156", ) }} {{ api_listing_entry(fn_name="capitalize", namespace="str", doc="```phel (capitalize s)
Converts first character of the string to upper-case, all other
characters to lower-case. Handles multibyte characters.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L122", ) }}
{{ api_listing_entry(fn_name="contains?", namespace="str", doc="```phel
(contains? s substr)
True if s contains substr.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L178", ) }} {{ api_listing_entry(fn_name="ends-with?", namespace="str", doc="```phel (ends-with? s substr)
True if s ends with substr.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L173", ) }}
{{ api_listing_entry(fn_name="escape", namespace="str", doc="```phel
(escape s cmap)
Return a new string, using cmap to escape each character ch from s as follows:
If (cmap ch) is nil, append ch to the new string. If (cmap ch) is non-nil, append (str (cmap ch)) instead.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L195", ) }} {{ api_listing_entry(fn_name="includes?", namespace="str", doc="```phel (includes? s substr)
True if s includes substr.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L183", ) }}
{{ api_listing_entry(fn_name="index-of", namespace="str", doc="```phel
(index-of s value & [from-index])
Return index of value (string or char) in s, optionally searching forward from from-index. Return nil if value not found.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L210", ) }} {{ api_listing_entry(fn_name="join", namespace="str", doc="```phel (join separator & [coll])
Returns a string of all elements in coll, as returned by (seq coll),
separated by an optional separator.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L12", ) }}
{{ api_listing_entry(fn_name="last-index-of", namespace="str", doc="```phel
(last-index-of s value & [from-index])
Return last index of value (string or char) in s, optionally searching backward from from-index. Return nil if value not found.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L225", ) }} {{ api_listing_entry(fn_name="lower-case", namespace="str", doc="```phel (lower-case s)
Converts string to all lower-case. Handles multibyte characters.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L131", ) }}
{{ api_listing_entry(fn_name="pad-both", namespace="str", doc="```phel
(pad-both s len & [pad-str])
Returns a string padded on both sides to length len.
If pad-str is omitted it defaults to a single space.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L263", ) }}
{{ api_listing_entry(fn_name="pad-left", namespace="str", doc="```phel
(pad-left s len & [pad-str])
Returns a string padded on the left side to length `len`.
If `pad-str` is omitted it defaults to a single space.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L251", ) }}
{{ api_listing_entry(fn_name="pad-right", namespace="str", doc="```phel
(pad-right s len & [pad-str])
Returns a string padded on the right side to length len.
If pad-str is omitted it defaults to a single space.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L257", ) }}
{{ api_listing_entry(fn_name="re-quote-replacement", namespace="str", doc="```phel
(re-quote-replacement replacement)
Given a replacement string that you wish to be a literal
replacement for a pattern match in replace or replace-first, do the
necessary escaping of special characters in the replacement.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L188", ) }}
{{ api_listing_entry(fn_name="repeat", namespace="str", doc="```phel
(repeat s n)
Returns a string containing n copies of s.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L35", ) }} {{ api_listing_entry(fn_name="replace", namespace="str", doc="```phel (replace s match replacement)
Replaces all instance of match with replacement in s.
match/replacement can be:
string / string
pattern / (string or function of match).
See also replace-first.
The replacement is literal (i.e. none of its characters are treated
specially) for all cases above except pattern / string.
For pattern / string, $1, $2, etc. in the replacement string are
substituted with the string that matched the corresponding
parenthesized group in the pattern. If you wish your replacement
string r to be used literally, use (re-quote-replacement r) as the
replacement argument.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L40", ) }}
{{ api_listing_entry(fn_name="replace-first", namespace="str", doc="```phel
(replace-first s match replacement)
Replaces the first instance of match with replacement in s.
match/replacement can be:
char / char string / string pattern / (string or function of match).
See also replace.
The replacement is literal (i.e. none of its characters are treated specially) for all cases above except pattern / string.
For pattern / string, $1, $2, etc. in the replacement string are substituted with the string that matched the corresponding parenthesized group in the pattern. If you wish your replacement string r to be used literally, use (re-quote-replacement r) as the replacement argument.
Example: (str/replace-first "swap first two words" #"(\w+)(\s+)(\w+)" "$3$2$1") -> "first swap two words"", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L72", ) }} {{ api_listing_entry(fn_name="reverse", namespace="str", doc="```phel (reverse s)
Returns s with its characters reversed.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L29", ) }}
{{ api_listing_entry(fn_name="split", namespace="str", doc="```phel
(split s re & [limit])
Splits string on a regular expression. Optional argument limit is the maximum number of parts. Not lazy. Returns vector of the parts. Trailing empty strings are not returned - pass limit of -1 to return all.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L5", ) }} {{ api_listing_entry(fn_name="split-lines", namespace="str", doc="```phel (split-lines s)
Splits s on \n or \r\n. Trailing empty lines are not returned.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L246", ) }}
{{ api_listing_entry(fn_name="starts-with?", namespace="str", doc="```phel
(starts-with? s substr)
True if s starts with substr.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L168", ) }} {{ api_listing_entry(fn_name="subs", namespace="str", doc="```phel (subs s start & [end])
Returns the substring of `s` from `start` (inclusive) to `end` (exclusive).
If `end` is omitted, the substring extends to the end of `s`.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L19", ) }}
{{ api_listing_entry(fn_name="trim", namespace="str", doc="```phel
(trim s)
Removes whitespace from both ends of string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L141", ) }} {{ api_listing_entry(fn_name="trim-newline", namespace="str", doc="```phel (trim-newline s)
Removes all trailing newline \n or return \r characters from
string. Similar to Perl's chomp.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L110", ) }}
{{ api_listing_entry(fn_name="triml", namespace="str", doc="```phel
(triml s)
Removes whitespace from the left side of string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L146", ) }} {{ api_listing_entry(fn_name="trimr", namespace="str", doc="```phel (trimr s)
Removes whitespace from the right side of string.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L151", ) }}
{{ api_listing_entry(fn_name="upper-case", namespace="str", doc="```phel
(upper-case s)
Converts string to all upper-case. Handles multibyte characters.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/str.phel#L136", ) }} {{ api_listing_entry(fn_name="deftest", namespace="test", doc="```phel (deftest test-name & body)
Defines a test function with no arguments.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/test.phel#L199", ) }}
{{ api_listing_entry(fn_name="is", namespace="test", doc="```phel
(is form & [message])
Generic assertion macro.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/test.phel#L183", ) }} {{ api_listing_entry(fn_name="print-summary", namespace="test", doc="```phel (print-summary )
Prints the summary of the test suite.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/test.phel#L289", ) }}
{{ api_listing_entry(fn_name="report", namespace="test", doc="```phel
(report data)
", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/test.phel#L33", ) }} {{ api_listing_entry(fn_name="run-tests", namespace="test", doc="```phel (run-tests options & namespaces)
Runs all test functions in the given namespaces.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/test.phel#L325", ) }}
{{ api_listing_entry(fn_name="successful?", namespace="test", doc="```phel
(successful? )
Checks if all tests have passed.", , github_url="https://github.com/phel-lang/phel-lang/blob/main/src/phel/test.phel#L334", ) }}