Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core blocks #22

Closed
mikedewar opened this issue Dec 2, 2014 · 23 comments
Closed

core blocks #22

mikedewar opened this issue Dec 2, 2014 · 23 comments
Labels

Comments

@mikedewar
Copy link
Collaborator

This issue is to describes those blocks we currently feel should be included in st-core. Each comment should describe a block or a group of related blocks.

@mikedewar mikedewar added the spec label Dec 2, 2014
@mikedewar
Copy link
Collaborator Author

Pusher, Sink

The pusher block emits a constant stream of messages. The message can be set by setting the value input to something. Sink discards any message it receives immediately upon receipt.

-- update
don't need a pusher, because every inbound route can essentially act as a pushed. Do need a sink, though, as messages won't be automatically discarded on unconnected routes.

@mikedewar
Copy link
Collaborator Author

Delay

Upon receiving a message Delay blocks for a specified duration before emitting the message.

@mikedewar
Copy link
Collaborator Author

Log

Log writes inbound messages to stdout (or somewhere).

@mikedewar
Copy link
Collaborator Author

+ - × ÷ ^ %

These basic operators operate on two inputs, returning the output of the operation or an error on type failure.

@mikedewar
Copy link
Collaborator Author

> < == !=

These comparisons operate on two inputs, returning a boolean or an error on type failure.

@mikedewar
Copy link
Collaborator Author

inArray, inObject, inString, hasPrefix, hasSuffix

These membership operators operate on a value and an array/object/string returning a boolean or an error on type failure. Note that inObject is a bit vague and maybe "hasField" or something like that might be better...?

@mikedewar
Copy link
Collaborator Author

Latch

A latch has a value input and a control input, and left and right outputs. If the control input is true, then the value will be emitted on the left output. If the control input is false the value will be emitted from the right output.

@mikedewar
Copy link
Collaborator Author

kvGet, kvSet, kvDump, kvClear

These blocks perform get, set and dump operations against a key-value store. Get accepts a key and emits a value, Set accepts a key and a value, Dump responds to a bang with the whole key-value store as an object.

@mikedewar
Copy link
Collaborator Author

pqPush, pqPop, pqPeek, pqLen, pqClear, pqDump

These blocks perform push, pop, and peek operations against a key-value store. Push accepts a value and a priority, pop responds to a bang and removes the last value from the queue before emitting, and peek responds to a bang, returning an object containing the last value and its priority.

@mikedewar
Copy link
Collaborator Author

Uniform, Zipf, Poisson, Categorical, Gaussian, Bernoulli

These blocks emit a random number in response to a bang

@mikedewar
Copy link
Collaborator Author

exp, log10, ln, sqrt, sin, cos, tan

These blocks perform a single operation on an inbound number emitting the result or error on a type problem.

@mikedewar
Copy link
Collaborator Author

toLower, toUpper, toTitle

These blocks perform a single operation on an inbound string, emitting the result or error on type failure.

@mikedewar
Copy link
Collaborator Author

fields

Outputs the fields of an inbound object as an array. Emits a type error if the inbound message is not an object. Could be called "keys" instead depending where we end up with the vocabulary. I think I prefer fields but I've not had any coffee yet.

@mikedewar
Copy link
Collaborator Author

set

Set has two inputs, a key and a value, and it outputs the object key:value.

@mikedewar
Copy link
Collaborator Author

merge

Merge has two inputs, both expecting objects. The Merge block creates a new object by combining the two inbound objects at the root of the block, favouring the left input for any conflicts.

@mikedewar
Copy link
Collaborator Author

gate

Gate has two inputs, value and trigger. When messages exist at value and trigger, the value is emitted.

@mikedewar
Copy link
Collaborator Author

append

Append has two inputs, array and value. When messages exist at both inputs, the value is appended to the array.

@mikedewar
Copy link
Collaborator Author

first

First emits the first N values it sees.

@mikedewar
Copy link
Collaborator Author

qPush, qPop, qPeek, qLen, qClear, qDump

These blocks perform operations on a queue, analogous the priority queue.

@mikedewar
Copy link
Collaborator Author

identity

This block has a single input and a single output and does nothing.

@mikedewar
Copy link
Collaborator Author

head, tail

head accepts an array and has two outputs. One output emits the first element in the array and the other output emits the remainder of the array. The empty array will cause nothing to be emitted on either outbound channel.

Tail does the opposite.

@mikedewar
Copy link
Collaborator Author

JSONUmarshal, XMLUnmarshal

These accept strings and try to turn them into map[string]interface{}s, accordingly. Failure to unmarshal results in emitting an error.

@nikhan
Copy link
Contributor

nikhan commented Nov 10, 2015

💃

@nikhan nikhan closed this as completed Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants