# wark

> Simple and tiny FRP library of the classic-ish event/behavior variety, named after a chocobo sound.

Latest version **0.0.0-alpha.5** (published 2020-03-25) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install wark
pnpm add wark
yarn add wark
bun add wark
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0-alpha.5 |
| Published | 2020-03-25 |
| First published | 2018-01-04 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 107.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Johnny Hauser |
| Maintainers | m59 |
| Keywords | frp, functional, reactive, event, behavior, dynamic, emitter, observable, stream, computed, state |

## Links

- npm: https://www.npmjs.com/package/wark
- Repository: https://github.com/m59peacemaker/js-wark
- Homepage: https://github.com/m59peacemaker/js-wark#readme
- Issues: https://github.com/m59peacemaker/js-wark/issues
- npm.io page: https://npm.io/package/wark

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.0-alpha.5 (latest) — 2020-03-25
- 0.0.0-alpha.4 — 2020-03-24
- 0.0.0-alpha.3 — 2020-03-24
- 0.0.0-alpha.2 — 2020-03-17
- 0.0.0-alpha.1 — 2020-03-17
- 0.0.0-alpha.0 — 2020-03-16
- 0.0.0 — 2018-01-04

## README

# wark

> avoid pain and suffering and fly around on a chocobo or something

![Wark!](https://user-images.githubusercontent.com/4369247/33407500-42f7d608-d537-11e7-9754-1ef262f9d6ad.png)

## Status

**0.0.0-pre-alpha-insanity-wolf**

### Computation Avoidance

aka Demand-Driven Computation

### Simultaneity

### Temporal Determinism

Temporal determinism means that all actions within a system are explicitly associated with and performed within logical instants of time, providing consistent and predictable behavior of operations in relation to time.

#### How complicated, inefficient, and error-prone is temporally non-deterministic code?

- How many possible behaviors are indicated by the following five lines of code?
- How easy is it to think through the possibilities and their potential impact on an application at scale?
- How much time does it cost you to think through this?

```js
console.log(Date.now())
console.log(Date.now())
console.log(new Date().toISOString())
console.log(Date.now())
console.log(new Date().toISOString())
```

I humbly admit - I am not positive how many possibe behaviors are expressed by this code, and find it quite hard to consider and calculate. My best guess at a correct answer is "4 infinities". Here are some strategies of counting the possible behaviors. Take my work with a grain of salt!

- Do all the logged values refer to the same millisecond in time? There are 2 possibilities.
- Does each logged value refer to the same millisecond as the former? There are 16 possibilities.
- Is each logged value the same, successive (1ms apart) or any amount further apart? There are 243 possibilities.
- What is the distance between each logged value? There are 4 infinities of possibilities.

The same logic, expressed with semantics of temporal determinism results in a program with only one behavior: it will log 5 values, in two different formats, in the order they are composed, with each value referring to the same millisecond of time. Moreover, this can be performed with at most two-fifths the effort, because there is only need for the implementation to check the current millisecond of time once, and to format it to ISO string once.

```js
// TODO: this can be nicer
;[
	unix_timstamp_ms,
	unix_timestamp_ms,
	is8601_datetime,
	unix_timestamp_ms,
	is8601_datetime
]
	.reduce(
		(acc, x) => Event.chain (log) (Effect.tag (x) (acc)),
		Effect.of(0)
	)
```

## Action

`Action` is an operation performed in an instant of time, that interacts with the real world.

## Effect

`Effect` is an `Action` that impacts the real world, also known as a 'side effect'.

## Sample

`Sample` is an `Action` that examines a property of the real world. A `Sample` does not impact the real world.

## Occurrence

`Occurrence` is a pair of `Instant` and `Value`; a value at an instant in time.

## Timeline

`Timeline` is a sequence of `Occurrence`.

## Event

`Event` is a `Timeline` with a `Dynamic`, `completed`, that indicates the potential for future occurrences of the `Event`.

## Dynamic

`Dynamic` is a `Sample` with an `Event` of its updates. In the instants of its `updates`, its value is updating, and is updated thereafter.

---
_Source: https://npm.io/package/wark · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
