references/sleep-functions/INDEX.md
GitHubSleep Programming Language Documentation Index
This directory contains split documentation for the Sleep programming language, organized for efficient LLM ingestion.
Source: https://sleep.dashnine.org/manual/
Tutorial Documentation
Core Concepts
- intro.md - Introduction to Sleep, support resources, and acknowledgements
- started.md - Getting started with stand-alone scripts and the Sleep console
- fundamentals.md - Scalars, scalar expressions, numbers, and strings
- datastruct.md - Arrays, stacks, lists, sets, and hashes
- flowcontrol.md - Comparisons, loops, exceptions, and assertions
- functions.md - Subroutines, scalar scope, closures, and continuations
- regex.md - Regular expression patterns and matching
- hoes.md - Java object integration and object expressions
- io.md - Input/Output handles, files, network, threads, and buffers
- embed.md - Sleep integration, extending Sleep, and working with scalars
Reference Documentation
Arrays (30 functions)
Operations for manipulating array data structures.
- add.md - Add elements to an array or hash
- addAll.md - Add all elements from one array to another
- cast.md - Cast an array to a specific Java array type
- clear.md - Clear all elements from an array or hash
- concat.md - Concatenate arrays
- copy.md - Create a copy of an array or hash
- filter.md - Filter array elements using a function
- flatten.md - Flatten a nested array structure
- identity.md - Test scalar identity (=~)
- in.md - Test if element is in array or hash
- map.md - Map a function over array elements
- pop.md - Remove and return last element
- push.md - Add element to end of array
- putAll.md - Put all key-value pairs into a hash
- reduce.md - Reduce array using a function
- remove.md - Remove element from array or hash
- removeAll.md - Remove multiple elements
- removeAt.md - Remove element at specific index
- retainAll.md - Retain only specified elements
- reverse.md - Reverse array order
- search.md - Search for element in array
- shift.md - Remove and return first element
- size.md - Get size of array or hash
- sort.md - Sort array with custom comparator
- sorta.md - Sort array alphabetically
- sortd.md - Sort array as doubles
- sortn.md - Sort array numerically
- splice.md - Remove/replace elements in array
- sublist.md - Get subarray slice
- sum.md - Sum numeric array elements
Date/Time (3 functions)
Functions for working with dates and times.
- formatDate.md - Format a date/time value
- parseDate.md - Parse a date/time string
- ticks.md - Get current time in milliseconds
File System (21 functions)
Operations for working with files and directories.
- chdir.md - Change current directory
- createNewFile.md - Create a new file
- cwd.md - Get current working directory
- deleteFile.md - Delete a file
- getFileName.md - Get filename from path
- getFileParent.md - Get parent directory
- getFileProper.md - Construct proper file path
- lastModified.md - Get file modification time
- listRoots.md - List filesystem roots
- lof.md - Get length of file
- ls.md - List directory contents
- mkdir.md - Create directory
- pr_canread.md - Test if file can be read (-canread)
- pr_canwrite.md - Test if file can be written (-canwrite)
- pr_exists.md - Test if file exists (-exists)
- pr_isDir.md - Test if path is directory (-isDir)
- pr_isFile.md - Test if path is file (-isFile)
- pr_isHidden.md - Test if file is hidden (-isHidden)
- rename.md - Rename a file
- setLastModified.md - Set file modification time
- setReadOnly.md - Set file as read-only
Hashes (6 functions)
Operations specific to hash/map data structures.
- keys.md - Get array of hash keys
- ohash.md - Create ordered hash (insertion order)
- ohasha.md - Create ordered hash (access order)
- setMissPolicy.md - Set policy for missing keys
- setRemovalPolicy.md - Set removal policy for hash
- values.md - Get array of hash values
Input/Output (31 functions)
Functions for reading, writing, and managing I/O streams.
- allocate.md - Allocate a memory buffer
- available.md - Get bytes available for reading
- bread.md - Binary read with pack template
- bwrite.md - Binary write with pack template
- closef.md - Close an I/O handle
- connect.md - Connect to network host
- exec.md - Execute external program
- fork.md - Create new thread
- getConsole.md - Get console I/O handle
- listen.md - Listen for network connections
- mark.md - Mark position in stream
- openf.md - Open file for reading/writing
- pr_eof.md - Test for end-of-file (-eof)
- print.md - Print to stream
- printAll.md - Print all array elements
- printEOF.md - Print EOF marker
- println.md - Print with newline
- readAll.md - Read all remaining data
- readAsObject.md - Read and deserialize object
- readb.md - Read bytes
- readc.md - Read character
- readln.md - Read line
- readObject.md - Read serialized object
- reset.md - Reset stream to marked position
- setEncoding.md - Set character encoding
- sizeof.md - Get size of object in bytes
- skip.md - Skip bytes in stream
- wait.md - Wait for thread to complete
- writeAsObject.md - Serialize and write object
- writeb.md - Write bytes
- writeObject.md - Write serialized object
Math (28 functions)
Mathematical operations and functions.
- abs.md - Absolute value
- acos.md - Arc cosine
- asin.md - Arc sine
- atan.md - Arc tangent
- atan2.md - Arc tangent of y/x
- ceil.md - Ceiling function
- checksum.md - Calculate checksum
- cos.md - Cosine
- degrees.md - Convert radians to degrees
- digest.md - Calculate cryptographic digest
- double.md - Convert to double
- exp.md - Exponential (e^x)
- floor.md - Floor function
- formatNumber.md - Format number as string
- int.md - Convert to integer
- log.md - Natural logarithm
- long.md - Convert to long
- not.md - Bitwise NOT
- parseNumber.md - Parse number from string
- radians.md - Convert degrees to radians
- rand.md - Random number
- round.md - Round to nearest integer
- sin.md - Sine
- spaceship.md - Three-way comparison (<=>)
- sqrt.md - Square root
- srand.md - Seed random number generator
- tan.md - Tangent
- uint.md - Convert to unsigned integer
Strings (29 functions)
String manipulation and pattern matching.
- asc.md - Get ASCII value of character
- byteAt.md - Get byte at position
- charAt.md - Get character at position
- chr.md - Convert ASCII value to character
- cmp.md - Compare strings
- find.md - Find string in array
- hasmatch.md - Test if string has regex match
- indexOf.md - Find substring index
- ismatch.md - Test if string matches regex
- iswm.md - Test wildcard match
- join.md - Join array elements into string
- lc.md - Convert to lowercase
- left.md - Get leftmost characters
- lindexOf.md - Find last occurrence index
- matched.md - Get regex match results
- matches.md - Extract regex matches
- mid.md - Get substring from middle
- pack.md - Pack values into binary string
- replace.md - Replace regex matches
- replaceAt.md - Replace substring at position
- right.md - Get rightmost characters
- split.md - Split string into array
- strlen.md - Get string length
- strrep.md - Repeat string
- substr.md - Get substring
- tr.md - Translate characters
- uc.md - Convert to uppercase
- unpack.md - Unpack binary string into values
Utility (39 functions)
General utility and meta-programming functions.
- acquire.md - Acquire semaphore
- casti.md - Cast scalar to specific type
- checkError.md - Check for soft error
- compile_closure.md - Compile closure from code
- debug.md - Set debug flags
- eval.md - Evaluate Sleep code
- exit.md - Exit script
- expr.md - Evaluate expression
- function.md - Get function by name
- getStackTrace.md - Get call stack trace
- global.md - Declare global variables
- iff.md - Conditional operator
- include.md - Include another script
- inline.md - Define inline subroutine
- invoke.md - Invoke function dynamically
- is.md - Test object reference equality
- isa.md - Test if object is instance of class
- lambda.md - Create anonymous function
- let.md - Assign variables
- local.md - Declare local variables
- newInstance.md - Create proxy instance
- popl.md - Pop local scope
- profile.md - Get profiling statistics
- pushl.md - Push new local scope
- release.md - Release semaphore
- scalar.md - Convert object to scalar
- semaphore.md - Create semaphore
- setf.md - Set function
- setField.md - Set object field
- sleep.md - Pause execution
- systemProperties.md - Get system properties
- taint.md - Mark data as tainted
- this.md - Access closure scope
- typeOf.md - Get type of scalar
- untaint.md - Remove taint from data
- use.md - Load Java bridge
- warn.md - Print warning message
- watch.md - Watch variable for changes
Quick Reference
By Category
- Arrays: 30 functions for array manipulation
- Date/Time: 3 functions for date/time operations
- File System: 21 functions for file operations
- Hashes: 6 functions for hash/map operations
- Input/Output: 31 functions for I/O operations
- Math: 28 mathematical functions
- Strings: 29 string manipulation functions
- Utility: 39 utility and meta-programming functions
Total Functions: 187
Usage Notes
- Each function page contains the full documentation from the Sleep manual
- Function pages include examples, parameters, return values, and related functions
- Tutorial pages provide comprehensive learning material
- All content sourced from https://sleep.dashnine.org/manual/
License
Sleep is distributed under the LGPL (GNU Lesser General Public License). Documentation © Raphael Mudge