xs: Concatenative array language inspired by kdb+/q in OCaml

tosh3 pts0 comments

Welcome to xs’s documentation! — xs 0.1 documentation

Docs "

Welcome to xs’s documentation!

View page source

Welcome to xs’s documentation!¶

xs is a dynamically typed, dynamically scoped, concatenative array<br>language inspired by kdb+/q and released into the public domain. The<br>interpreter and builtin functions are written in OCaml.

The name “xs” either stands for:

eXtra Small

The plural of “x”

Check out the project page on github if you wish to browse the<br>source, open an issue or pull request. xs aims to be a small<br>language with a focus on compactness and expressiveness. Or email me<br>at sturm@cryptm.org

Installation

Examples

Tutorial<br>Introduction

Comments

Function and Variables

Operators

Lists

Scoping

Data Types

Day 1 Advent of Code 2019 Solution

Language Reference<br>Command-Line Parameters

Syntax

Data Types

Parsing

Scoping

Math<br>neg unary negative

+ addition

- substraction

* multiplication

% division

mod modulus

** power

ln natural logarithm

sin sine

cos cosine

tan tangent

sum sum of list

sums partial sums of list

prod product of list

prods partial products of list

abs absolute value

ceil ceiling

floor floor

Boolean and Conditionals<br>== equals

less than

> greater than

gq greater or equal

lq less or equal

&& And

|| Or

if if expression

cond multiple conditional

every tests all true

any any true

cmp comparison

Stack Manipulation<br>dup duplicate element

swap swap elements

drop drop value

Function Application<br>. apply

$ swap and apply

Assignment<br>: set/print

~ peek set/print

:: reassign

Iterators and Accumulators<br>' map

'' map2

/ fold

\ scan

fix fixpoint

fixes partial fixpoints

do iteration

List and String<br>[] make list

enlist make list

^ delist

til construct numbered list

len length of list

flip flip list

rev reverse

, concatenate

,, cons

lower lowercase string

upper uppercase string

Indexing, Reshaping, Changing<br>@ get

? find

where

# take

_ drop

cut reshape

cat concatenate all

cats partial concatenate all

Set Operations<br>in contains

inter intersection

union

uniq unique elements

Sorting<br>asc sort ascending

dsc sort descending

sort custom sort

Types<br>of type conversion

type

sv scalar from vector

vs vector from scalar

I/O<br>open open file

read read data

write write data

seek change file position

close close file handle

readl read lines

writel write lines

Misc<br>rand random value

include evaluate file

measure elapsed time

eval evaluate

list language documentation data partial sort

Related Articles