Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/architecture/tickq.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Actions performed:
* increment current date ([`.u.d`](#variables)) to next day
* roll log if using tickerplant log, i.e.
* close current tickerplant log ([`.u.l`](#variables))
* create a new tickerplant log file i.e set [`.u.l`](#variables), call [`.u.ld`](#uld) with new date
* create a new tickerplant log file i.e. set [`.u.l`](#variables), call [`.u.ld`](#uld) with new date

### .u.tick

Expand Down Expand Up @@ -165,7 +165,7 @@ Where `x` is current date. Returns handle of log file for that date.

Actions performed:

* using [`.u.L`](#variables), change last 10 chars to provided date and create log file if it doesnt yet exist
* using [`.u.L`](#variables), change last 10 chars to provided date and create log file if it does not yet exist
* set [`.u.i`](#variables) and [`.u.j`](#variables) to count of valid messages currently in log file
* if log file is found to be corrupt (size bigger than size of number of valid messages) an error is returned
* open new/existing log file
Expand Down
16 changes: 11 additions & 5 deletions docs/basics/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The terminology generalizes to values.

- The left domain of a matrix `m` is `til count m`.
- The right domain of a matrix is `til count first m`.
- The right domains of a list `m` of depth `n` are `1_n{til count first x}\m`. <!-- FIXME Check -->
- The right domains of a list `m` of depth `n` are `1_til each count each (n-1)first\m`.

The single argument of a unary function is sometimes referred to as its _right argument_.

Expand Down Expand Up @@ -431,7 +431,9 @@ Q knows the identity elements of some functions, e.g. `+` (zero), but not others
## Infix

Applying an operator by writing it between its arguments, e.g.
`2+3` applies `+` to 2 and 3
`2+3` applies `+` to 2 and 3.

The alternative in most cases is to apply an operator prefix, e.g. `+[2;3]`.


## Item, list item
Expand Down Expand Up @@ -592,12 +594,16 @@ Files representing a [splayed table](#splayed-table) may also be partitioned.

## Postfix

Applying an iterator to its argument by writing it to the right, e.g. `+/` applies iterator `/` to `+`. (Not to be confused with projecting an operator on its left argument.)
Postfix notation is when a function is written to the right of its arguments. Only iterators can be written postfix,
e.g. `+/` applies iterator `/` to `+`. (Not to be confused with projecting an operator on its left argument,
e.g. `+[1 2 3]` is a projection of the `+` operator, while `+/[1 2 3]` is a reduction of `+` over the list `1 2 3`.)

:fontawesome-solid-book:
[Iterators](../ref/iterators.md)

## Prefix

Prefix notation applies a unary value `v` to its argument or indices `x`; i.e. `vx` is equivalent to `v[x]`.
Prefix notation applies a unary value `v` to its argument or indices `x`; i.e. `v x` is equivalent to `v[x]`.

:fontawesome-regular-hand-point-right:
[Application](application.md)
Expand Down Expand Up @@ -820,7 +826,7 @@ A value of rank 1, i.e. a function with 1 argument, or a list of depth ≥1.

## Unary operator

See **Iterator**.
An operator with only 1 argument. Iterators are unary operators.

:fontawesome-solid-book:
[Iterators](../ref/iterators.md)
Expand Down
5 changes: 5 additions & 0 deletions docs/ref/accumulators.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ Matching is governed by [comparison tolerance](../basics/precision.md#comparison

### Do

In its binary form, with an integer `n≥0` as the left argument, the derived function is applied `n` times.

```q
q)dbl:2*
q)3 dbl\2 7 / Do
Expand Down Expand Up @@ -188,6 +190,9 @@ q)("j"$a=b) foo/bar / ?[a=b;foo bar;bar]

### While

In its binary form, if the left argument `t` of the derived function is an applicable unary value,
it is applied **while** `t` applied on the result returns true or something other than `0`.

```q
q)(10>)dbl\2 / While
2 4 8 16
Expand Down
18 changes: 17 additions & 1 deletion docs/ref/and.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@ author: Stephen Taylor

# `and`


_Lesser of two values, logical AND_

```syntax
x and y and[x;y]
x & y &[x;y]
```

Returns the [lesser](../basics/comparison.md) of the underlying values of `x` and `y`.
In the case of boolean values, it is equivalent to the AND operator.

```q
q)2 and 3
2
q)1010b and 1100b /logical AND with booleans
1000b
q)"sat" and "cow"
"cat"
```

`and` is a [multithreaded primitive](../kb/mt-primitives.md).

:fontawesome-solid-book:
Expand Down
11 changes: 9 additions & 2 deletions docs/ref/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,17 @@ q)s:get`:SNewTrade/ / s has columns mapped on demand
5
q)get "2+3"
5
q)a:1 2 3
q)get `a
1 2 3
q)get `q`w`e!(1 2;3 4;5 6)
1 2
3 4
5 6
q)get (+;1;2)
3
```

<!-- FIXME: describe other uses. -->

[`eval`](eval.md),
[`value`](value.md)

Expand Down
19 changes: 17 additions & 2 deletions docs/ref/or.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ keywords: and, greater, kdb+, logic, or, q

_Greater of two values, logical OR_

`or` is a [multithreaded primitive](../kb/mt-primitives.md).
```syntax
x or y or[x;y]
x | y |[x;y]
```

Returns the [greater](../basics/comparison.md) of the underlying values of `x` and `y`.
In the case of boolean values, it is equivalent to the OR operator.

```q
q)2 or 3
3
q)1010b or 1100b /logical OR with booleans
1110b
q)"sat" or "cow"
"sow"
```

`or` is a [multithreaded primitive](../kb/mt-primitives.md).

:fontawesome-solid-book:
[Greater](greater.md)


4 changes: 2 additions & 2 deletions docs/wp/disaster-floods/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1257,9 +1257,9 @@ I gratefully acknowledge the Disaster Prevention team at FDL: Piotr Bilinski, Ch

### 1. Kd-tree

A kd-tree is used in k-dimensional space to create a tree structure. In the tree each node represents a hyperplane which divides the space into two seperate parts (the left and the right branch) based on a given direction. This direction is associated with a certain axis dimension, with the hyperplane perpendicular to the axis dimension. What is to the left or right of the hyperplane is determined by whether each data point being added to the tree is greater or less than the node value at the splitting dimension. For example, if the splitting dimension of the node is `x`, all data points with a smaller `x` value than the value at the splitting dimension node will be to the left of the hyperplane, while all points equal to or greater than will be in the right subplane.
A kd-tree is used in k-dimensional space to create a tree structure. In the tree each node represents a hyperplane which divides the space into two separate parts (the left and the right branch) based on a given direction. This direction is associated with a certain axis dimension, with the hyperplane perpendicular to the axis dimension. What is to the left or right of the hyperplane is determined by whether each data point being added to the tree is greater or less than the node value at the splitting dimension. For example, if the splitting dimension of the node is `x`, all data points with a smaller `x` value than the value at the splitting dimension node will be to the left of the hyperplane, while all points equal to or greater than will be in the right subplane.

The tree is used to efficiently find a datapoint’s nearest neighbor, by potentially eleminating a large portion of the dataset using the kd-tree’s properties. This is done by starting at the root and moving down the tree recursively, calculating the distance between each node and the datapoint in question, allowing branches of the dataset to be eliminated based on whether this node-point distance is less than or greater than the curent nearest neighbor distance. This enables rapid lookups for each point in a dataset.
The tree is used to efficiently find a datapoint’s nearest neighbor, by potentially eliminating a large portion of the dataset using the kd-tree’s properties. This is done by starting at the root and moving down the tree recursively, calculating the distance between each node and the datapoint in question, allowing branches of the dataset to be eliminated based on whether this node-point distance is less than or greater than the current nearest neighbor distance. This enables rapid lookups for each point in a dataset.


![Figure_10](imgs/KDtree.png)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/wp/disaster-recovery/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ This is usually due to a column vector being a different
length from the rest of the table. The only method to fix it is to
count each column file and compare, then manually saving the
erroneous one to the correct length. This can occur when not using
the standard save commands (.e.g [`.Q.dpft`](../../ref/dotq.md#dpft-save-table)), but rather setting each
the standard save commands (e.g. [`.Q.dpft`](../../ref/dotq.md#dpft-save-table)), but rather setting each
column individually, and some logic has caused the column lengths to
vary.

Expand Down
2 changes: 1 addition & 1 deletion docs/wp/hdb-analysis/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -825,4 +825,4 @@ Analysis levels 7 and 8 are the most time consuming, for this reason, the defaul
Some ideas for improvements:

* run `paths`,`dotd` etc once on startup and store the results for lookup rather than regenerating at each step.
* recovery mode if loading the hdb fails; if there is an issue with the latest partition, the hdb can fail to load. Most of the hdb variables in the `.Q` namespace (.e.g. `.Q.pv`) could be constructed on load error. However, as so much is dependent on the structure of the latest partition, it may be better to leave this to be manually investigated and fixed first.
* recovery mode if loading the hdb fails; if there is an issue with the latest partition, the hdb can fail to load. Most of the hdb variables in the `.Q` namespace (e.g. `.Q.pv`) could be constructed on load error. However, as so much is dependent on the structure of the latest partition, it may be better to leave this to be manually investigated and fixed first.