path.q

Path structure as text, pathlib's names: .path.name, .path.stem, .path.suffix, .path.parent, .path.join and .path.string. Nothing here touches the disk.
  • implNote - THE .path surface: path structure as text, and never storage. Nothing here opens, stats, expands `~`, resolves a symlink or makes a path absolute. Portable q - it must run on kx q as well as peachq, so it calls nothing from the peachq C surface. Names, and the stem/suffix rule, are pathlib's. Three families live in `: symbols and only the FIRST is path-shaped: paths, IPC handles (`:host:port, `:tcps://...) and provider handles (`:pq:...). The last two are 'domain, because lexical rules corrupt them silently - .path.parent would strip the trailing slash that makes `:pq:ds:al:cfg:t/ a TABLE handle rather than a connection. host:port is deliberately NOT detected and must never be: `:localhost:5000 is indistinguishable from a folder named "localhost:5000", and a Windows drive puts a colon at position 1, so any host:port heuristic would break every `:c:/temp/x.csv. ANY-ORDER LAW: definitions only at top level.

Entity Summary

EntitiesShort Description
.path.join[parts]the components joined into ONE path, the first supplying any leading "/" or drive.
.path.name[p]the final component.
.path.parent[p]the lexical parent.
.path.path[p]the canonical path value.
.path.stem[p]the final component without its last suffix.
.path.string[p]the path as a string, WITHOUT the leading ":".
.path.suffix[p]the final suffix, leading "." included as pathlib spells it, or ` where there is none.

Entity Details

.path.join[parts]

the components joined into ONE path, the first supplying any leading "/" or drive. The one function here that is NOT elementwise: join is variadic, so its list argument IS the component sequence, never paths to map over.

Parameters:
  • parts - (list) the components, each a string, a symbol or a path

.path.name[p]

the final component.

Parameters:
  • p - (any) a string, a symbol or a path - or a list of them

.path.parent[p]

the lexical parent. A bare name parents to `:. and the root to itself, as pathlib does. The empty path is RELATIVE, so it parents to `:. too - only a leading "/" in the text tells it apart from the root here.

Parameters:
  • p - (any) a string, a symbol or a path - or a list of them

.path.path[p]

the canonical path value. A `:pq:... provider handle or a scheme:// URL is 'domain - see the header.

Parameters:
  • p - (any) a string, a symbol or a path - or a list of them

.path.stem[p]

the final component without its last suffix.

Parameters:
  • p - (any) a string, a symbol or a path - or a list of them

.path.string[p]

the path as a string, WITHOUT the leading ":".

Parameters:
  • p - (any) a string, a symbol or a path - or a list of them

.path.suffix[p]

the final suffix, leading "." included as pathlib spells it, or ` where there is none.

Parameters:
  • p - (any) a string, a symbol or a path - or a list of them