~/bend-docscommunity

src/series.bend checks

raw source on the hub · import bend-visgraph@1.0.0.0/src/series.bend as Series

A time series from text with one value per line, as ts2vg's command line reads it. Blank lines are skipped. Each value is rounded once, from its decimal text to F32. Its x is its index, or the number in the same place in a file of x coordinates, which xs checks.

1 import
import Base

Types

type Parsed source · line 7 · raw

Data

type XsCheck source · line 85 · raw

Data

The x coordinates of a file, last first, if they suit a series; or why they do not.

Definitions

def add source · line 11 · raw

@blank:Bool -> @m:Maybe<&2, F32> -> @+line:U32 -> @rev:List<&2, F32> -> @+n:U32 -> Parsed

def step source · line 20 · raw

@s:String -> @+line:U32 -> @st:Parsed -> Parsed

def scan source · line 32 · raw

@s:String -> @nl:Bool -> @+h:Char -> @cur:String -> @+line:U32 -> @st:Parsed -> Parsed

Base's String.lines recurses once per character, too deep for the JS lane's stack, so this walks the text with tail calls. h is the character before s, nl whether it is a newline, and cur the line before h, last character first.

def parse source · line 45 · raw

@text:String -> Parsed

The values of text, last first, and how many there are; or the first line, counted from 1, that holds no number.

def column source · line 52 · raw

@rev:List<&2, F32> -> @+i:U32 -> @ys:Array<F32> -> Array<F32>

def ys source · line 60 · raw

@rev:List<&2, F32> -> @+n:U32 -> Array<F32>

The n values rev, last first, as an array indexed from 0.

def read_text.done source · line 63 · raw

@m:Pair(File, Result<&1, &1, Pair(U32, String), String>) -> IO(String)

def read_text.sized source · line 70 · raw

@m:Pair(File, Result<&1, &1, Pair(U32, String), U32>) -> IO(String)

def read_text source · line 77 · raw

@path:String -> IO(String)

def increasing source · line 91 · raw

@rest:List<&2, F32> -> @+a:F32 -> @ok:Bool -> Bool

Whether each value of rest, last first, is below a, as ts2vg checks that x increases.

def increases source · line 98 · raw

@xrev:List<&2, F32> -> Bool

def xs_check source · line 105 · raw

@same:Bool -> @up:Bool -> @rev:List<&2, F32> -> @+n:U32 -> @+m:U32 -> XsCheck

def xs source · line 116 · raw

@p:Parsed -> @+n:U32 -> XsCheck

The x coordinates p of a series of n values: ts2vg takes one x per value, each above the one before.