@@ -81,12 +81,17 @@ OVSM LISP is the ONLY acceptable format. That's it. Only LISP.
8181
8282## Built-in Language Functions (NO NETWORK CALLS)
8383These are ** part of the OVSM language** and execute locally:
84- - ** Data** : ` count ` , ` length ` , ` append ` , ` slice ` , ` first ` , ` rest ` , ` nth `
85- - ** Aliases** : ` head ` (=first), ` tail ` (=rest) - Haskell-style
86- - ** Object Introspection** : ` keys ` , ` get ` , ` merge ` ← ** USE THESE FOR MCP RESPONSES!**
84+ - ** Data** : ` count ` , ` length ` , ` len ` , ` append ` , ` slice ` , ` first ` , ` rest ` , ` nth ` , ` indexOf ` , ` lastIndexOf `
85+ - ** Aliases** : ` head ` (=first), ` tail ` (=rest), ` cdr ` (=rest) - Haskell/LISP-style
86+ - ** Aliases** : ` len ` (=length) - Python-style
87+ - ** JavaScript** : ` includes ` (=contains), ` indexOf ` , ` lastIndexOf `
88+ - ** Object Introspection** : ` keys ` , ` object-values ` , ` object-entries ` , ` entries ` , ` items ` , ` get ` , ` merge ` ← ** USE THESE FOR MCP RESPONSES!**
89+ - ** Python-style** : ` items ` (=entries) - Python dict.items()
90+ - ** JavaScript-style** : ` object-entries ` - JavaScript Object.entries()
8791- ** JSON** : ` parse-json ` , ` json-stringify ` (BUILT-IN, NOT MCP TOOLS!)
88- - ** Aggregation** : ` group-by ` , ` aggregate ` , ` filter ` , ` map ` , ` reduce `
89- - ** Collection operations** : ` distinct ` , ` unique ` , ` take ` , ` drop ` , ` zip ` , ` partition ` , ` flatten `
92+ - ** Aggregation** : ` group-by ` , ` aggregate ` , ` filter ` , ` map ` , ` reduce ` , ` fold ` , ` foldl ` , ` foldr `
93+ - ** Haskell-style** : ` foldl ` (=reduce), ` foldr ` (=reduce) - Haskell fold left/right
94+ - ** Collection operations** : ` distinct ` , ` unique ` , ` take ` , ` drop ` , ` zip ` , ` partition ` , ` flatten ` , ` find-index ` , ` remove ` , ` insert-at `
9095 - ** Aliases** : ` unique ` (=distinct) - SQL-style
9196- ** Predicates** : ` some ` , ` every ` , ` any ` , ` all `
9297 - ** Aliases** : ` any ` (=some), ` all ` (=every) - JavaScript-style
@@ -95,13 +100,28 @@ These are **part of the OVSM language** and execute locally:
95100- ** Logic** : ` and ` , ` or ` , ` not ` , ` if ` , ` when ` , ` while ` , ` for `
96101- ** Null checking** : ` null? ` ← ** USE THIS WITH ` get ` !**
97102- ** Object** : ` . ` (property access - ONLY if you're sure field exists), ` [] ` (array index)
98- - ** Type Conversions** : ` int ` , ` integer ` , ` float ` , ` bool ` - Convert between types
99- - ` (int "42") ` → ` 42 ` - String to integer (Python/JS style)
100- - ` (float "3.14") ` → ` 3.14 ` - String to float
103+ - ** Type Conversions** : ` int ` , ` integer ` , ` parse-int ` , ` parseint ` , ` float ` , ` parse-float ` , ` parsefloat ` , ` bool ` - Convert between types
104+ - ` (int "42") ` → ` 42 ` - String to integer (Python: int(), JavaScript: parseInt())
105+ - ` (parseint "42") ` → ` 42 ` - JavaScript parseInt() alias
106+ - ` (float "3.14") ` → ` 3.14 ` - String to float (Python: float(), JavaScript: parseFloat())
107+ - ` (parsefloat "3.14") ` → ` 3.14 ` - JavaScript parseFloat() alias
101108 - ` (bool "true") ` → ` true ` - String to boolean (accepts: true/false, yes/no, 1/0, t/f, y/n)
102109 - ` (int 3.14) ` → ` 3 ` - Float to int (truncates)
103110 - ` (float 42) ` → ` 42.0 ` - Int to float
104111 - ` (bool 0) ` → ` false ` , ` (bool 1) ` → ` true ` - Number to boolean (0 is false, non-zero is true)
112+ - ** Number Predicates** : ` even? ` , ` evenp ` , ` odd? ` , ` oddp ` , ` positive? ` , ` negative? ` , ` zero? ` , ` zerop ` - Test number properties
113+ - ` (even? 4) ` → ` true ` - Check if even (LISP-style with Common LISP ` evenp ` alias)
114+ - ` (odd? 3) ` → ` true ` - Check if odd (LISP-style with Common LISP ` oddp ` alias)
115+ - ` (positive? 5) ` → ` true ` - Check if positive
116+ - ` (negative? -5) ` → ` true ` - Check if negative
117+ - ` (zero? 0) ` → ` true ` - Check if zero (LISP-style with Common LISP ` zerop ` alias)
118+ - ** Statistical Functions** : ` mean ` , ` average ` , ` avg ` , ` median ` , ` mode ` , ` product ` , ` variance ` , ` stddev ` , ` std ` - NumPy/Pandas-style statistics
119+ - ` (mean [1 2 3 4 5]) ` → ` 3.0 ` - Calculate average (NumPy-style, with ` average ` and ` avg ` aliases)
120+ - ` (median [1 2 3 4 5]) ` → ` 3.0 ` - Find median value
121+ - ` (mode [1 2 2 3]) ` → ` 2 ` - Find most common value
122+ - ` (product [2 3 4]) ` → ` 24 ` - Calculate product of all numbers
123+ - ` (variance [1 2 3 4 5]) ` → ` 2.0 ` - Calculate variance
124+ - ` (stddev [1 2 3 4 5]) ` → ` 1.414... ` - Standard deviation (with ` std ` alias)
105125
106126### ✅ STRING FUNCTIONS (AVAILABLE - Use These!)
107127OVSM has comprehensive string manipulation:
@@ -117,16 +137,31 @@ OVSM has comprehensive string manipulation:
117137 - ` (sprintf "{} has {} messages" "Alice" 5) ` → ` "Alice has 5 messages" `
118138- ** String testing** : ` string-contains ` , ` includes ` , ` starts-with ` , ` ends-with `
119139 - ` (string-contains "hello world" "world") ` → ` true `
140+ - ` (includes "hello" "ell") ` → ` true ` - JavaScript includes() alias
120141 - ` (starts-with "hello" "hel") ` → ` true `
121142 - ` (ends-with "world" "ld") ` → ` true `
122- - ** Substring** : ` substring ` , ` subseq ` - Extract part of string
123- - ` (substring "hello" 1 4) ` → ` "ell" `
124- - ** Case conversion** : ` string-upcase ` , ` string-downcase ` , ` string-capitalize `
143+ - ** Substring** : ` substring ` , ` subseq ` - Extract part of string (JavaScript-style)
144+ - ` (substring "hello world" 0 5) ` → ` "hello" ` - JavaScript String.substring()
145+ - ` (substring "hello" 1 4) ` → ` "ell" ` - Start/end indices (swaps if start > end)
146+ - ** Case conversion** : ` toLowerCase ` , ` toUpperCase ` , ` string-upcase ` , ` string-downcase ` , ` string-capitalize `
147+ - ` (toLowerCase "HELLO") ` → ` "hello" ` - JavaScript String.toLowerCase()
148+ - ` (toUpperCase "hello") ` → ` "HELLO" ` - JavaScript String.toUpperCase()
149+ - ` (string-upcase "hello") ` → ` "HELLO" ` - LISP-style
150+ - ` (string-downcase "HELLO") ` → ` "hello" ` - LISP-style
151+ - ** Character conversion** : ` chr ` , ` ord ` - Python-style character/code conversion
152+ - ` (chr 65) ` → ` "A" ` - Python chr() - code to character (Unicode support)
153+ - ` (ord "A") ` → ` 65 ` - Python ord() - character to code
154+ - ` (chr 128512) ` → ` "😀" ` - Full Unicode support
125155- ** Trimming** : ` string-trim ` , ` string-left-trim ` , ` string-right-trim `
126- - ** Search** : ` search ` , ` position ` - Find substring/character position
156+ - ** Search** : ` search ` , ` position ` , ` indexOf ` , ` lastIndexOf ` - Find substring/character position
157+ - ` (indexOf "hello" "l") ` → ` 2 ` - JavaScript indexOf()
158+ - ` (lastIndexOf "hello" "l") ` → ` 3 ` - JavaScript lastIndexOf()
127159- ** Replace** : ` replace ` , ` replace-all ` - Replace substring occurrences
128- - ** Length** : ` string-length ` , ` length ` , ` count ` - Get string length
129- - ** Character access** : ` char-at ` , ` char-at-index ` - Get character at index
160+ - ** Length** : ` string-length ` , ` length ` , ` len ` , ` count ` - Get string length
161+ - ` (len "hello") ` → ` 5 ` - Python len() alias
162+ - ` (length "hello") ` → ` 5 ` - Standard LISP
163+ - ** Character access** : ` charAt ` , ` char-at ` , ` char-at-index ` - Get character at index
164+ - ` (charAt "hello" 1) ` → ` "e" ` - JavaScript String.charAt() (UTF-8 safe)
130165- ** Conversion** : ` str ` , ` to-string ` - Convert value to string
131166- ** Type checking** : ` stringp ` , ` typeof ` , ` type-of ` - Check value type
132167
0 commit comments