Liking cljdoc? Tell your friends :D

emmy.abstract.number

Symbolic expressions in Emmy are created through the literal-number constructor, or implicitly by performing arithmetic between symbols and numbers.

This namespace implements the literal-number constructor and installs the underlying type into the generic arithmetic system.

Symbolic expressions in Emmy are created through the [[literal-number]]
constructor, or implicitly by performing arithmetic between symbols and
numbers.

This namespace implements the [[literal-number]] constructor and installs the
underlying type into the generic arithmetic system.
raw docstring

abstract-number?clj/s

(abstract-number? x)

Returns true if x is:

See literal-number? for a similar function that won't respond true to symbols, only to explicit symbolic expressions or wrapped literal numbers.

Returns true if `x` is:

- a symbolic expression
- some object wrapped by a call to [[literal-number]]
- a symbol (which implicitly acts as a [[literal-number]])

See [[literal-number?]] for a similar function that won't respond true to
symbols, only to explicit symbolic expressions or wrapped literal numbers.
sourceraw docstring

literal-numberclj/s

(literal-number x)

Returns its argument, wrapped in a marker type that responds to the generic operations registered in emmy.numsymb.

Symbols are automatically treated as literal-number instances, so

(* 10 (literal-number 'x))

is equivalent to

(* 10 'x)

If you pass an actual number, emmy will attempt to preserve exact values through various operations:

(g/+ 1 (g/cos (g/* 2 (literal-number 4))))
;;=> (+ 1 (cos 8))

Notice that the (g/* 2 ...) is evaluated, but cos evaluation is deferred, since the result is inexact. On the other hand, if the number is inexact to begin with:

(g/+ 1 (g/cos (g/* 2 (literal-number 2.2))))
;;=> 0.6926671300215806

the system will go ahead and evaluate it.

Returns its argument, wrapped in a marker type that responds to the generic
operations registered in [[emmy.numsymb]].

Symbols are automatically treated as [[literal-number]] instances, so

```clojure
(* 10 (literal-number 'x))
```

is equivalent to

```clojure
(* 10 'x)
```

If you pass an actual number, emmy will attempt to preserve exact values
through various operations:

```clojure
(g/+ 1 (g/cos (g/* 2 (literal-number 4))))
;;=> (+ 1 (cos 8))
```

Notice that the `(g/* 2 ...)` is evaluated, but `cos` evaluation is deferred,
since the result is inexact. On the other hand, if the number is inexact to
begin with:

```clojure
(g/+ 1 (g/cos (g/* 2 (literal-number 2.2))))
;;=> 0.6926671300215806
```

the system will go ahead and evaluate it.
sourceraw docstring

literal-number?clj/s

(literal-number? x)

Returns true if x is an explicit symbolic expression or something passed to literal-number, false otherwise.

See abstract-number? for a similar function that also responds true to symbols.

Returns true if `x` is an explicit symbolic expression or something passed to
`literal-number`, false otherwise.

See [[abstract-number?]] for a similar function that also responds true to
symbols.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close