Miscellaneous

Buffered channels.

usage

(import :std/misc/channel)

make-channel

usage

(make-channel ...)

Please document me!

channel?

usage

(channel? ...)

Please document me!

channel-put

usage

(channel-put ...)

Please document me!

channel-try-put

usage

(channel-try-put ...)

Please document me!

channel-sync

usage

(channel-sync ...)

Please document me!

channel-get

usage

(channel-get ...)

Please document me!

channel-try-get

usage

(channel-try-get ...)

Please document me!

channel-close

usage

(channel-close ...)

Please document me!

channel-closed?

usage

(channel-closed? ...)

Please document me!

Asynchronous Completions

usage

(import :std/misc/completion)

make-completion

usage

(make-completion ...)

Please document me!

completion?

usage

(completion? ...)

Please document me!

completion-ready?

usage

(completion-ready? ...)

Please document me!

completion-wait!

usage

(completion-wait! ...)

Please document me!

completion-post!

usage

(completion-post! ...)

Please document me!

completion-error!

usage

(completion-error! ...)

Please document me!

with-completion-error

usage

(with-completion-error ...)

Please document me!

List utilities

usage

(import :std/misc/list)

alist?

usage

(alist? ...)

Please document me!

plist?

usage

(plist? ...)

Please document me!

plist->alist

usage

(plist->alist ...)

Please document me!

alist->plist

usage

(alist->plist ...)

Please document me!

length=?

usage

(length=? ...)

Please document me!

length=n?

usage

(length=n? ...)

Please document me!

length<?

usage

(length<? ...)

Please document me!

length<n?

usage

(length<n? ...)

Please document me!

length<=?

usage

(length<=? ...)

Please document me!

length<=n?

usage

(length<=n? ...)

Please document me!

length>?

usage

(length>? ...)

Please document me!

length>n?

usage

(length>n? ...)

Please document me!

length>=?

usage

(length>=? ...)

Please document me!

length>=n?

usage

(length>=n? ...)

Please document me!

call-with-list-builder

usage

(call-with-list-builder ...)

Please document me!

with-list-builder

usage

(with-list-builder ...)

Please document me!

snoc

usage

(snoc ...)

Please document me!

append1

usage

(append1 ...)

Please document me!

for-each!

usage

(for-each! ...)

Please document me!

push!

usage

(push! ...)

Please document me!

flatten1

usage

> (flatten1 [1 [2]])
=> (1 2)

> (flatten1 [1 [2] [[3]]])
=> (1 2 (3))

Removes one layer of a nested proper list.

flatten

usage

> (flatten [1 [2]])
=> (1 2)

> (flatten [1 [2] [[3]]])
=> (1 2 3)

Removes all nested layers of a proper list.

LRU caches

usage

(import :std/misc/lru)

make-lru-cache

usage

(make-lru-cache ...)

Please document me!

lru-cache?

usage

(lru-cache? ...)

Please document me!

lru-cache-ref

usage

(lru-cache-ref ...)

Please document me!

lru-cache-get

usage

(lru-cache-get ...)

Please document me!

lru-cache-put!

usage

(lru-cache-put! ...)

Please document me!

lru-cache-remove!

usage

(lru-cache-remove! ...)

Please document me!

lru-cache-size

usage

(lru-cache-size ...)

Please document me!

lru-cache-capacity

usage

(lru-cache-capacity ...)

Please document me!

lru-cache-flush!

usage

(lru-cache-flush! ...)

Please document me!

lru-cache-walk

usage

(lru-cache-walk ...)

Please document me!

lru-cache-fold

usage

(lru-cache-fold ...)

Please document me!

lru-cache-foldr

usage

(lru-cache-foldr ...)

Please document me!

lru-cache->list

usage

(lru-cache->list ...)

Please document me!

Port utilities

usage

(import :std/misc/ports)

copy-port

usage

(copy-port ...)

Please document me!

read-all-as-string

usage

(read-all-as-string ...)

Please document me!

read-file-string

usage

(read-file-string ...)

Please document me!

read-all-as-lines

usage

(read-all-as-lines ...)

Please document me!

read-file-lines

usage

(read-file-lines ...)

Please document me!

Port Destructor

(defmethod {destroy <port>} close-port)

The module also defines a destroy method for ports, so that they can be used in with-destroy forms and other primitives that use the destroy idiom.

Priority Queues

usage

(import :std/misc/pqueue)

make-pqueue

usage

(make-pqueue ...)

Please document me!

pqueue?

usage

(pqueue? ...)

Please document me!

pqueue-empty?

usage

(pqueue-empty? ...)

Please document me!

pqueue-size

usage

(pqueue-size ...)

Please document me!

pqueue-peek

usage

(pqueue-peek ...)

Please document me!

pqueue-pop!

usage

(pqueue-pop! ...)

Please document me!

pqueue-push!

usage

(pqueue-push! ...)

Please document me!

Proces Utilities

usage

(import :std/misc/process)

Overview

These utilities synchronously spawn a subprocess, spawn a coprocess function in a thread to interact with the process (default: std/misc/ports#read-all-as-string), check the status of the process upon termination, and return the result of that coprocess if successful.

run-process

usage

(run-process ...)

Please document me!

run-process/batch

usage

(run-process/batch ...)

Please document me!

Deques

usage

(import :std/misc/queue)

make-queue

usage

(make-queue ...)

Please document me!

queue?

usage

(queue? ...)

Please document me!

queue-length

usage

(queue-length ...)

Please document me!

queue-empty?

usage

(queue-empty? ...)

Please document me!

non-empty-queue?

usage

(non-empty-queue? ...)

Please document me!

enqueue!

usage

(enqueue! ...)

Please document me!

enqueue-front!

usage

(enqueue-front! ...)

Please document me!

dequeue!

usage

(dequeue! ...)

Please document me!

queue->list

usage

(queue->list ...)

Please document me!

Sourceable Representation

usage

(import :std/misc/repr)

usage

(print-representation obj [port = (current-output-port)] [options = (current-representation-options)])

print-representation is a function (also available with the short-hand name pr) that takes an object, optionally a port and a table of options, and displays on that port source-code representation of the object that can be evaluated back into an equivalent object.

Behavior of print-representation can be specialized for new classes of objects by defining new methods on :pr, as in:

(defmethod {:pr my-class}
  (lambda (self port options)
    ...))

pr

usage

(defalias pr print-representation)

Same as print-representation.

prn

usage

(prn ...)

prn does the same as pr then follows with a newline.

repr

usage

(repr obj [options = (current-representation-options)])

repr does not take a port as argument and instead returns the representation as a string.

representable

(defclass representable ())

representable is an abstract mixin class that defines a method for :pr. By default, if a class does not provide its own implementation, that method will call print-unrepresentable-object.

usage

(print-unrepresentable-object obj [port = (current-output-port)] [options = (current-representation-options)])

print-unrepresentable-object is a helper function to use as fallback for objects that can't otherwise be displayed.

default-representation-options

(def default-representation-options)

default-representation-options is the default table of options. No options are currently defined, and the default table is currently empty. In the future, options may be defined for pretty-printing, etc.

current-representation-options

usage

(current-representation-options [options])

current-representation-options is a parameter returning the current options, and initially returns the default-representation-options.

display-separated

usage

(display-separated lst [port = (current-output-port)]
                   [prefix: prefix = ""]
                   [separator: separator = " "]
                   [suffix: suffix = ""]
                   [display-element: disp = display])

display-separated is a helper function that takes a list of objects, an optional port, and as keywords a prefix: string (empty by default), a suffix: string (empty by default), a separator string (defaulting to a single space " "), and a display-element: function (the function display by default), and displays each element of the list with the given prefix, suffix, separator and display function.

Type Descriptor Utilities.

usage

(import :std/misc/rtd)

object-type

usage

(object-type ...)

Please document me!

type?

usage

(type? ...)

Please document me!

type-id

usage

(type-id ...)

Please document me!

type-name

usage

(type-name ...)

Please document me!

type-super

usage

(type-super ...)

Please document me!

type-descriptor?

usage

(type-descriptor? ...)

Please document me!

type-descriptor-mixin

usage

(type-descriptor-mixin ...)

Please document me!

type-descriptor-fields

usage

(type-descriptor-fields ...)

Please document me!

type-descriptor-plist

usage

(type-descriptor-plist ...)

Please document me!

type-descriptor-ctor

usage

(type-descriptor-ctor ...)

Please document me!

type-descriptor-slots

usage

(type-descriptor-slots ...)

Please document me!

type-descriptor-methods

usage

(type-descriptor-methods ...)

Please document me!

Shared-structure Equality.

usage

(import :std/misc/shared)

equal-shared?

usage

(equal-shared? ...)

Please document me!

Shuffling

usage

(import :std/misc/shuffle)

shuffle

usage

(shuffle ...)

Please document me!

vector-shuffle

usage

(vector-shuffle ...)

Please document me!

vector-shuffle!

usage

(vector-shuffle! ...)

Please document me!

String utilities

usage

(import :std/misc/string)

string-split-prefix

usage

(string-split-prefix ...)

Please document me!

string-trim-prefix

usage

(string-trim-prefix ...)

Please document me!

string-split-suffix

usage

(string-split-suffix ...)

Please document me!

string-trim-suffix

usage

(string-trim-suffix ...)

Please document me!

string-split-eol

usage

(string-split-eol ...)

Please document me!

string-trim-eol

usage

(string-trim-eol ...)

Please document me!

+cr+

(def +cr+)

Please document me!

+lf+

(def +lf+)

Please document me!

+crlf+

(def +crlf+)

Please document me!

Synchronized Data Structures.

usage

(import :std/misc/sync)

make-sync-hash

usage

(make-sync-hash ...)

Please document me!

sync-hash?

usage

(sync-hash? ...)

Please document me!

sync-hash-get

usage

(sync-hash-get ...)

Please document me!

sync-hash-ref

usage

(sync-hash-ref ...)

Please document me!

sync-hash-key?

usage

(sync-hash-key? ...)

Please document me!

sync-hash-put!

usage

(sync-hash-put! ...)

Please document me!

sync-hash-remove!

usage

(sync-hash-remove! ...)

Please document me!

sync-hash-do

usage

(sync-hash-do ...)

Please document me!

Text Utilities

usage

(import :std/misc/text)

include-text

usage

(include-text ...)

Please document me!

Thread utilities

usage

(import :std/misc/threads)

primordial-thread-group

usage

(primordial-thread-group ...)

Please document me!

thread-group->thread-list*

usage

(thread-group->thread-list* ...)

Please document me!

all-threads

usage

(all-threads ...)

Please document me!

thread-dead?

usage

(thread-dead? ...)

Please document me!

thread-group-kill!

usage

(thread-group-kill! ...)

Please document me!

thread-raise!

usage

(thread-raise! ...)

Please document me!

thread-abort!

usage

(thread-abort! ...)

Please document me!

thread-abort?

usage

(thread-abort? ...)

Please document me!

thread-async!

usage

(thread-async! ...)

Please document me!

on-all-processors

usage

(on-all-processors ...)

Please document me!

Timeouts

usage

(import :std/misc/timeout)

make-timeout

usage

(make-timeout ...)

Please document me!

UUIDs

usage

(import :std/misc/uuid)

UUID

usage

(UUID ...)

Please document me!

uuid-length

usage

(uuid-length ...)

Please document me!

uuid::t

usage

(uuid::t ...)

Please document me!

make-uuid

usage

(make-uuid ...)

Please document me!

uuid?

usage

(uuid? ...)

Please document me!

uuid=?

usage

(uuid=? ...)

Please document me!

uuid-hash

usage

(uuid-hash ...)

Please document me!

uuid->u8vector

usage

(uuid->u8vector ...)

Please document me!

u8vector->uuid

usage

(u8vector->uuid ...)

Please document me!

uuid->string

usage

(uuid->string ...)

Please document me!

string->uuid

usage

(string->uuid ...)

Please document me!

random-uuid

usage

(random-uuid ...)

Please document me!

Functional utilities

usage

(import :std/misc/func)

Collection of mixed purpose higher-order functions.

always

usage

> (def fn (always 5))
> (list (fn) (fn))
=> (5 5)

> (def fn (always (lambda () "hi")))
> (fn)
=> "hi"

> (def fn (always random-integer 10)
> (list (fn) (fn))
=> (4 3)

Creates a lambda which returns the same value or calls always the same function with the same arguments.

repeat

usage

> (repeat 2 5)
=> (2 2 2 2 2)

> (repeat (lambda () 10) 2)
=> (10 10)

> (repeat random-integer 3 10)
=> (8 3 5)

Repeat value or call function N times and return the result as list.