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

2024 02 ngi to main #24

Merged
merged 140 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
7f8cd93
2023/12/14
FadiShawki Dec 14, 2023
30de7a0
2024/02/02 - Setting up some stuff for Chyp
FadiShawki Jan 2, 2024
49b9000
2024/02/03 - Some helpers
FadiShawki Jan 3, 2024
4ecb0c7
Merge branch 'main' into chyp
FadiShawki Jan 3, 2024
947dfce
2024/02/04 - Some helpers
FadiShawki Jan 4, 2024
d4103c9
2024/02/04 - Some initial translations of Chyp
FadiShawki Jan 4, 2024
ab75a2e
2024/02/05 - Some simple translations
FadiShawki Jan 5, 2024
922614c
2024/02/06 - Some simple translations
FadiShawki Jan 6, 2024
abfe214
2024/02/06 - Some simple translations
FadiShawki Jan 6, 2024
d3e7a57
2024/02/06 - Some simple translations
FadiShawki Jan 6, 2024
91c186a
2024/02/06 - Some simple translations
FadiShawki Jan 6, 2024
f9b5f2d
2024/02/06 - Some simple translations
FadiShawki Jan 6, 2024
0b5ee47
2024/02/06 - Some translations
FadiShawki Jan 6, 2024
f007ac1
2024/02/06 - Some translations
FadiShawki Jan 6, 2024
eb25155
2024/02/07 - Some translations
FadiShawki Jan 7, 2024
fc42941
2024/02/07 - Some translations
FadiShawki Jan 7, 2024
fe03042
2024/02/07 - Some translations
FadiShawki Jan 7, 2024
a8fd7f2
test
FadiShawki Jan 7, 2024
1909bdc
Some interface playground
FadiShawki Jan 7, 2024
134dd72
2024/02/08 - Moving around some Ray definitions
FadiShawki Jan 8, 2024
77f5ba7
2024/02/08 - Moving around some Ray definitions
FadiShawki Jan 8, 2024
0eecb63
2024/02/09 - Setting up test, fixing self-referential bugs
FadiShawki Jan 9, 2024
7a5f1d7
2024/02/09 - Rename empty to None
FadiShawki Jan 9, 2024
395a621
2024/02/09 - Vertex tests
FadiShawki Jan 9, 2024
d91eaaf
2024/02/09 - continues_with is compose
FadiShawki Jan 9, 2024
680d47e
Merge remote-tracking branch 'origin/chyp-local' into chyp
FadiShawki Jan 9, 2024
f53b531
2024/02/09 - ChypCanvas merge changes
FadiShawki Jan 9, 2024
ad43623
2024/02/09 - Experimenting with some react rendering ideas, need some…
FadiShawki Jan 9, 2024
6f59ac1
2024/02/09 - Experimenting with object proxy
FadiShawki Jan 9, 2024
a762e89
2024/02/09 - Experimenting with object proxy & JS.Object
FadiShawki Jan 9, 2024
558dfff
2024/02/09 - GitHub tests
FadiShawki Jan 9, 2024
e2fc773
2024/02/09 - Move everything into a Ray
FadiShawki Jan 9, 2024
cb0e45e
2024/02/09 - Move everything into a Ray
FadiShawki Jan 9, 2024
161eba1
2024/02/09 - Trying some debug mode options
FadiShawki Jan 9, 2024
df83100
2024/02/09 - Reverse some debug options
FadiShawki Jan 9, 2024
213313f
2024/02/09 - Start in debugging
FadiShawki Jan 9, 2024
f25f77e
2024/02/09 - Start in debugging
FadiShawki Jan 9, 2024
f6b2687
2024/02/10 - Removing some redundant stuff, some naive translations
FadiShawki Jan 10, 2024
77fbfce
2024/02/10 - More naive translations
FadiShawki Jan 10, 2024
1a81cda
2024/02/10 - More naive translations
FadiShawki Jan 10, 2024
2909728
2024/02/10 - More naive translations & setting up test suite
FadiShawki Jan 10, 2024
192029b
2024/02/10 - Move to naive_pass file. - At least for the initial rewr…
FadiShawki Jan 10, 2024
28cee3d
2024/02/10 - Some project logistics for README.md
FadiShawki Jan 10, 2024
f9b48c6
2024/02/10 - Some project logistics for README.md
FadiShawki Jan 10, 2024
967da3a
2024/02/10 - Some project logistics for README.md
FadiShawki Jan 10, 2024
0e04eba
2024/02/10 - Some project logistics for README.md
FadiShawki Jan 10, 2024
7ce9785
2024/02/10 - Some project logistics for README.md
FadiShawki Jan 10, 2024
d6ee5ba
2024/02/10 - Slowly towards a more sensible implementation
FadiShawki Jan 10, 2024
2dffa4e
2024/02/10 - Slowly towards a more sensible implementation
FadiShawki Jan 10, 2024
3cb4cc3
2024/02/10 - Slowly towards a more sensible implementation
FadiShawki Jan 10, 2024
475a46c
2024/02/11 - Debug playground setup
FadiShawki Jan 11, 2024
cc5e1d5
2024/01/11 - Debug playground setup
FadiShawki Jan 11, 2024
8d79a18
2024/01/11 - List hotkey.combo
FadiShawki Jan 11, 2024
5d80b4c
2024/01/11 - Setting up debug
FadiShawki Jan 11, 2024
c33942c
2024/01/11 - Setting up debug
FadiShawki Jan 11, 2024
3e6fdba
2024/01/11 - Setting up debug - Need some better infrastructure for this
FadiShawki Jan 11, 2024
e275e25
2024/01/11 - Setting up debug - Need some better infrastructure for this
FadiShawki Jan 11, 2024
2a0fadf
2024/01/12 - Testing some debug settings
FadiShawki Jan 12, 2024
fd5b92f
2024/01/12 - Some examples
FadiShawki Jan 12, 2024
175e614
2024/01/12 - Some examples
FadiShawki Jan 12, 2024
707a054
2024/01/13 - Setup for arbitrary functions?
FadiShawki Jan 13, 2024
f523b68
2024/01/13 - Method test
FadiShawki Jan 13, 2024
e2f447e
2024/01/13 - Test for calling on a vertex
FadiShawki Jan 13, 2024
d3cf474
2024/01/13 - Naive equivalence between vertices
FadiShawki Jan 13, 2024
8d35d7e
2024/01/13 - Naive equivalence between vertices
FadiShawki Jan 13, 2024
abcbd03
2024/01/13 - First ugly implementation of continuing the ___func as _…
FadiShawki Jan 13, 2024
15ac009
2024/01/13 - First ugly implementation of previous/next of arbitrary …
FadiShawki Jan 13, 2024
e44a0b4
2024/01/13 - First ugly implementation of previous/next of arbitrary …
FadiShawki Jan 13, 2024
f49d87e
2024/01/13 - First ugly implementation of previous/next of arbitrary …
FadiShawki Jan 13, 2024
09741c6
2024/01/13 - Tests for JavaScript generators/iterators
FadiShawki Jan 13, 2024
b9d4622
2024/01/15 - More hacky equivalences, compose=merge=continues_with
FadiShawki Jan 15, 2024
ccef6d4
2024/01/15 - Iterating on some ways to do equivalences over existing …
FadiShawki Jan 15, 2024
bf07fe0
2024/01/15 - Refactoring - moving some stuff around
FadiShawki Jan 15, 2024
648555e
2024/01/16 - Iterating on some ideas to implement 'next'
FadiShawki Jan 16, 2024
e9e52ba
2024/01/16 - Iterating on some ideas to implement 'next'
FadiShawki Jan 16, 2024
6e18ea2
2024/01/16 - Iterating on some ideas to implement 'next'
FadiShawki Jan 16, 2024
0975cdb
2024/01/16 - Some bug somewhere..
FadiShawki Jan 16, 2024
11c00e8
2024/01/16 - Quick fix
FadiShawki Jan 16, 2024
3e4cad1
2024/01/16 - Tests for has_next/has_previous/first/last
FadiShawki Jan 16, 2024
ec67355
2024/01/16 - Tests fixed for traverse
FadiShawki Jan 16, 2024
017bd8c
2024/01/16 - Remove import
FadiShawki Jan 16, 2024
8cc6a67
2024/01/16 - .dereference tests
FadiShawki Jan 16, 2024
da6e033
2024/01/16 - Add older helper methods: .of_length, .at, .permutation …
FadiShawki Jan 16, 2024
f5bd312
2024/01/16 - Already had .of_length as .size
FadiShawki Jan 16, 2024
29338c3
2024/01/16 - Permutation comment
FadiShawki Jan 16, 2024
1d2fe2c
2024/01/16 - Permutation comment
FadiShawki Jan 16, 2024
e265a85
2024/01/16 - Refactoring, some tests, after this is done need a much …
FadiShawki Jan 16, 2024
9d15197
2024/01/17 - Some minor doc changes from thoughts last night
FadiShawki Jan 17, 2024
a527fee
2024/01/17 - Some minor doc changes from thoughts last night
FadiShawki Jan 17, 2024
0c4533b
2024/01/17 - .equivalent
FadiShawki Jan 17, 2024
9124c75
2024/01/17 - .as_terminal / .as_initial
FadiShawki Jan 17, 2024
52ce84e
2024/01/17 - .as_terminal / .as_initial through .equivalence + tests
FadiShawki Jan 17, 2024
c6d564e
2024/01/17 - Remove continues_with dependence
FadiShawki Jan 17, 2024
70e02f0
2024/01/17 - Helper method for stepping to direction: 'follow' ; this…
FadiShawki Jan 17, 2024
96769c0
2024/01/17 - Replace older `continues_with` with `compose`, and `equi…
FadiShawki Jan 17, 2024
06288fd
2024/01/17 - Replace older `continues_with` with `compose`, and `equi…
FadiShawki Jan 17, 2024
2a637c8
2024/01/17 - Composing lists
FadiShawki Jan 17, 2024
7cfcdf6
2024/01/17 - Finalizing '.equivalent' + tests ; just one more bug som…
FadiShawki Jan 17, 2024
0a33dea
2024/01/17 - Separate chained .equivalent of 3 separate ones. Bug com…
FadiShawki Jan 17, 2024
5a7021b
2024/01/17 - Separate chained .equivalent of 3 separate ones. Bug com…
FadiShawki Jan 17, 2024
ce2b721
2024/01/17 - Fix is probably: disallow ignorant connection of A-B, re…
FadiShawki Jan 17, 2024
f08c1cf
2024/01/18 - Needs a lot of cleanup, clearly some of this is not intu…
FadiShawki Jan 18, 2024
1b7a181
2024/01/18 - Test cleanup
FadiShawki Jan 18, 2024
6eb96c2
2024/01/18 - Some fixes, iterating on .traverse/.next for the arbitra…
FadiShawki Jan 18, 2024
0397e8a
2024/01/18 - More .any to a reference '.any.[]' pattern, introduce .a…
FadiShawki Jan 18, 2024
f4d9534
2024/01/18 - More .any to a reference '.any.[]' pattern, introduce .a…
FadiShawki Jan 18, 2024
229fd10
2024/01/19 - Going to do a large refactor - some of these aren't grea…
FadiShawki Jan 19, 2024
18d2e52
2024/01/21 - JS tests, preparing QuickVisualizationInterface.tsx for …
FadiShawki Jan 21, 2024
9322d41
2024/01/21 - Moving function implementation to JS.ts
FadiShawki Jan 21, 2024
356588d
2024/01/21 - Moving function implementation to JS.ts
FadiShawki Jan 21, 2024
8184893
2024/01/21 - WIP Refactor of all traversal/stepping funcs
FadiShawki Jan 21, 2024
66c4611
2024/01/21 - WIP Refactor of all traversal/stepping funcs
FadiShawki Jan 21, 2024
5973568
2024/01/22 - Refactoring Ray.ts & JS.ts into something acceptable
FadiShawki Jan 22, 2024
0618cd5
2024/01/22 - Refactoring Ray.ts & JS.ts into something acceptable
FadiShawki Jan 22, 2024
f7c4396
2024/01/23 - Some initial ideas of what this refactor should look like
FadiShawki Jan 23, 2024
e212a7f
2024/01/23 - Some initial ideas of what this refactor should look like
FadiShawki Jan 23, 2024
0a9bfc4
2024/01/23 - Some initial ideas of what this refactor should look like
FadiShawki Jan 23, 2024
e292379
2024/01/23 - Separate things actually necessary to get traversal working
FadiShawki Jan 23, 2024
329e980
2024/01/23 - Should probably implement this function traversal as a d…
FadiShawki Jan 23, 2024
3a4f08e
2024/01/24 - Thinking about possible debug modes, different way of im…
FadiShawki Jan 24, 2024
6ac4b7d
2024/01/25 - Moving some stuff around for a beautiful JavaScript impl…
FadiShawki Jan 24, 2024
a863495
2024/01/23 - Move everything back into Ray. Only the JS specific stuf…
FadiShawki Jan 25, 2024
39ba513
2024/01/25 - Move everything to a separate orbitmines.com folder.
FadiShawki Jan 25, 2024
4b2d7c4
2024/01/25 - Move everything to a separate orbitmines.com folder.
FadiShawki Jan 25, 2024
25a570a
2024/01/25 - Move some files around, get tests working
FadiShawki Jan 25, 2024
c477f13
2024/01/25 - Move some files around, get tests working
FadiShawki Jan 25, 2024
5dfdef7
2024/01/25 - Ops, docs
FadiShawki Jan 25, 2024
a150f67
2024/01/25 - Minor doc/impl changes
FadiShawki Jan 25, 2024
66b8249
2024/01/25 - Minor doc/impl changes
FadiShawki Jan 25, 2024
8b8769f
2024/01/25 - as_(reference, vertex, terminal, initial)
FadiShawki Jan 25, 2024
84b11c3
2024/01/25 - as_(reference, vertex, terminal, initial)
FadiShawki Jan 25, 2024
63b939b
2024/01/29 - Some thinking on runtime/compiler differences
FadiShawki Jan 29, 2024
acf70fb
2024/01/29 - Some thinking on runtime/compiler differences
FadiShawki Jan 29, 2024
451cdc9
2024/01/29 - Move some stuff around
FadiShawki Jan 29, 2024
6585bbd
2024/01/29 - Move some old Ray stuff into OnOrbits.tsx to make it ind…
FadiShawki Jan 29, 2024
775ed37
2024/01/29 - Boilerplate
FadiShawki Jan 29, 2024
24b8e9d
2024/01/31 - License changes
FadiShawki Jan 31, 2024
6430b2e
Create LICENSE
FadiShawki Jan 31, 2024
78a70da
2024/01/31 - Fixes
FadiShawki Jan 31, 2024
20d5bd2
2024/01/31 - NGI Grant Proposal: OrbitMines' (Hypergraphic) Version C…
FadiShawki Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Tests

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
- working-directory: "./orbitmines.com"
run: npm install
- working-directory: "./orbitmines.com"
run: npm run test -- --watchAll=false
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Miscellaneous
external

# orbitmines.com
orbitmines.com/node_modules

# Environment
**/.idea

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/github.com/akissinger/chyp"]
path = external/github.com/akissinger/chyp
url = git@github.com:akissinger/chyp.git
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Fadi Shawki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
95 changes: 88 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,102 @@
![orbitmines.logo.3000x1000.png](src%2Flib%2Forganizations%2Forbitmines%2Flogo%2Forbitmines.logo.3000x1000.png)
![orbitmines.logo.3000x1000.png](./orbitmines.com/src%2Flib%2Forganizations%2Forbitmines%2Flogo%2Forbitmines.logo.3000x1000.png)

# orbitmines.com
*A public repository for [orbitmines.com](https://orbitmines.com). The hub for OrbitMines' (research) projects.*

*Once a Minecraft server, now a research project dedicated to understanding arbitrarily unknown dynamical systems.*

![header](./orbitmines.com/public/papers/on-orbits-equivalence-and-inconsistencies/images/header.png)

## What is this?, What is OrbitMines?, What are Rays?

A simple way of phrasing this, is that the concept of a (hyper-/)'Vertex', (hyper-/)'Edge', (hyper-/)'Graph', (hyper-/)'Rule', (hyper-/)'Tactic', (hyper-/)..., (hyper-/)'Rewrite' are merged into one thing: a [Ray](./environments/javascript/@orbitmines/rays/src/Ray.ts). It handles surrounding context, ignorances, equivalences, ..., differentiation (And if it cannot, then it offers a way of implementing it for all of the above).

Most importantly, it is here as infrastructure. Infrastructure for the design and implementation of a different category of (programming) interfaces.

- If you prefer **text**, see [2023-12-31. On Orbits, Equivalence and Inconsistencies](https://orbitmines.com/papers/on-orbits-equivalence-and-inconsistencies), or more generally my/OrbitMines writing can be found here: [orbitmines.com/profiles/fadi-shawki](https://orbitmines.com/profiles/fadi-shawki).


- If you prefer **audio-visual mumblings**, see [2024-01-04. What is OrbitMines?, Implementing Aleks Kissinger's Chyp and maybe looking at Tinygrad](https://www.youtube.com/watch?v=O6v_gzlI1kY), or more generally my streams can be found here: [youtube.com/@FadiShawki/streams](https://www.youtube.com/@FadiShawki/streams).


- If you prefer **archaic symbolics: i.e. code**, see [Ray.ts](./environments/javascript/@orbitmines/rays/src/Ray.ts), or more generally my/OrbitMines code can be found here [github.com/orbitmines](https://github.com/orbitmines/).


- If you prefer discussions on **Discord**: [discord.orbitmines.com](https://discord.orbitmines.com).


- TODO: ~~Or if prefer smashing your keyboard till there's something interesting on the screen. See a first implementation of this *explorational interface*: [orbitmines.com/explorer/github.com/akissinger/chyp](https://orbitmines.com/explorer/github.com/akissinger/chyp).~~

---

## Where is OrbitMines going with this? - i.e. Future inquiries

Check out everything I've made public regarding this here: [GitHub Issues](https://github.com/orbitmines/orbitmines.com/issues) or equivalently, check the Discord channels grouped under the name: [Fractals of the Galaxy](https://discord.com/channels/1055502602365845534/1114584997702156388).

---

### Some general notes about this project

> [!IMPORTANT]
> Anything in this directory should be considered as deprecated. It is merely used as the initial (crude) bootstrap for OrbitMines. And will surely be replaced at some point - it is not (yet) meant as a formal spec.

> [!WARNING]
> No proper security audit has yet been done on its current iteration.

> [!WARNING]
> No proper performance optimizations have been done on its current iteration.

---

### Local setup

- Running `orbitmines.com` locally on `http://localhost:3000`:
- ```shell
git clone git@github.com:orbitmines/orbitmines.com.git
```
- ```shell
cd ./orbitmines.com/orbitmines.com
```
- ```
npm install
```
- ```
npm start
```
- Running tests.
- ```shell
npm run test -- --watchAll
```

---

## JavaScript Interface Examples

**This is just preliminary, I'll change this later**

> [!WARNING]
> Reasoning backwards, what should the JavaScript interface look like?

- [ ] Applying a function on a Ray (vertex/initial/terminal) ; then go inside, insde can again be a vertex/initial/terminal on each vertex, apply on those.

---

#### Discussion
Let's take logic gates as an example? - and maybe logic with different equiv func? - Like switching between true/false on each check?

```ts
import Ray from '@orbitmines/rays';

const initial = Ray.boolean().orbit().size(2);
const terminal = Ray.boolean().orbit().size(2);


// TODO: Compiles to a sequence of traversal checks?, and setting ops?, and arbitrary many of them make up a program.

Feel free to discuss this project on this GitHub repository or preferably the [OrbitMines Community Discord](https://discord.orbitmines.com).
```

---

#### Latest Writing - Some context on this project
## License Magic

[2023-12-31. On Orbits, Equivalence and Inconsistencies](http://orbitmines.com/papers/on-orbits-equivalence-and-inconsistencies/
)
![on-orbits-equivalence-and-inconsistencies](public/papers/on-orbits-equivalence-and-inconsistencies/images/thumbnail/3840x2160.jpeg)
I'm not convinced putting licenses on the repo's in the usual case is anything other than *Minecraft servers putting "Not affiliated with Mojang" in their stores* just because everyone else does it. But here: after doing absolutely no research into the international ramifications: [LICENSE](./LICENSE) a license for those who like to look at them. Try to reason to what that applies in this repository, obviously that doesn't cover everything not made by me or other contributions to OrbitMines or something. Just put a reference to me or this project somewhere if it's remotely interesting to you.

221 changes: 221 additions & 0 deletions _temp/JS2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
//
//
//
// /**
// * Puts the Ray this is called with on a new Ray [initial = ref, ???, ???]. Then it places any structure it's applying a method to, on the terminal of this new Ray [initial = ref, ???, terminal = any]
// */
// static Ref = (impl: Ray.FunctionImpl<Ray.Any>): Function => {
// return new Function(impl); // TODO: THIS SHOULD CHANGE, TO ON VERTEX.
// }
// static Impl = <T = Ray>(impl: (initial: T, terminal: T) => T): Function<T> => {
// return Function.Ref((ref: T) => impl(ref.initial, ref.terminal));
// }
// // static IgnorantOfInitial = <T extends AbstractDirectionality<T> = Ray>(impl: (terminal: T) => T): Function<T> => Function.Impl((_, terminal) => impl(terminal));
// // static IgnorantOfTerminal = <T extends AbstractDirectionality<T> = Ray>(impl: (initial: T) => T): Function<T> => Function.Impl((initial, _) => impl(initial));
// // static Ignorant = <T extends AbstractDirectionality<T> = Ray>(impl: ParameterlessFunction<T>): Function<T> => Function.Impl(impl);
//
// /**
// * TODO: Reversible through memory...
// */
// static WithMemory = <T = Ray>(
// apply: (previous: Ray.Any) => Ray.Any | any
// ): Function<T> => {
// // return Function.Ref((ref: T) => impl(ref.initial, ref.terminal));
//
// return {
// as_ray: (ref: Ray.Any = Ray.None()) => {
// const next = (previous: Ray.Any, first: boolean = false): Ray.Any => {
// const result = apply(previous);
// const is_terminal = result instanceof Ray ?
// result.is_none() || (result.is_terminal() && result.self.is_none())
// : false;
//
// // Clear the terminal function attached to the Iterator.
// // TODO: In case of 'is_terminal = true': Could also leave this be, in case JavaScript allows for adding stuff to the iterator even after .done === true;
// previous.self.terminal = previous.self.___empty_terminal();
//
// if (is_terminal) {
// // We're done, this is the end of the iterator
//
// return Ray.None();
// }
//
// const current = Ray
// .vertex(() => result instanceof Ray ? result.self : JS.Any(result)) // TODO test
// .o(result instanceof Ray ? {} : { js: result })
// .as_reference();
//
// // Move the iterator to the terminal.
// current.self.terminal = () => next(current);
//
// if (first) {
// // Move the iterator's terminal to current.
// previous.self.terminal = () => current.self;
//
// current.self.initial = () => previous.self;
//
// return current; // Answer to INITIAL.terminal is a VERTEX.
// }
//
// // // TODO: This is just compose, but without .type checks.. ; FIX ON COMPOSE END for is_reference etc..
// // if (previous.follow().type !== RayType.TERMINAL)
// // throw new PreventsImplementationBug();
// // if (current.follow(Ray.directions.previous).type !== RayType.INITIAL)
// // throw new PreventsImplementationBug();
// //
// // previous.follow().equivalent(current.follow(Ray.directions.previous));
// previous.compose(current);
//
// return current.self.initial; // Answer to VERTEX.terminal is an INITIAL.
// }
//
// if (ref.is_none()) {
// const ray: Ray.Any = new Ray({
// vertex: Ray.Any.None,
// terminal: () => next(ray, true),
// }).as_reference();
//
// return ray;
// } else {
// const initial_vertex = Ray.vertex(() => ref.self).as_reference();
//
// initial_vertex.self.terminal = () => next(initial_vertex);
//
// return initial_vertex;
// }
// }
// } as Function<T>;
// }
//
// /**
// * @see "Reversibility after ignoring some difference": https://orbitmines.com/papers/on-orbits-equivalence-and-inconsistencies#:~:text=Another%20example%20of%20this%20is%20reversibility
// * @see "More accurately phrased as the assumption of Reversibility: with the potential of being violated.": https://orbitmines.com/papers/on-orbits-equivalence-and-inconsistencies#:~:text=On%20Assumptions%20%26%20Assumption%20Violation
// */
// static Reversible = <T extends AbstractDirectionality<T> = Ray>(
// // @alias('backward')
// initial: (ref: Ray.Any) => Ray.Any | any,
// // @alias('forward')
// terminal: (ref: Ray.Any) => Ray.Any | any,
// ): Function<T> => {
// // return Function.Ref((ref: T) => impl(ref.initial, ref.terminal));
//
// return {
// as_ray: (ref: Ray.Any = Ray.None()): Ray.Any => {
// if (ref.is_none())
// throw new NotImplementedError();
//
// const next = (previous: Ray.Any, direction: (ref: Ray.Any) => Ray.Any | any): Ray.Any => {
// const result = direction(previous);
//
// // TODO: COuld do this in place.
// const current = Ray
// .vertex(() => result instanceof Ray ? result.self : JS.Any(result))
// .o(result instanceof Ray ? {} : { js: result })
// .as_reference();
//
// current.self.initial.self = () => next(current, initial);
// current.self.terminal.self = () => next(current, terminal);
//
// return current.self.initial;
// }
//
//
// const initial_vertex = Ray.vertex(() => ref.self).as_reference();
//
// // const initial_vertex = Ray.vertex(() => ref.self).as_reference();
// initial_vertex.self.initial.self = () => next(initial_vertex, initial);
// initial_vertex.self.terminal.self = () => next(initial_vertex, terminal);
//
// return initial_vertex;
// }
// } as Function<T>;
// }
//
// /**
// * Constructs a class method accepting arbitrary structure.
// *
// * a.compose(b).compose(c) = [a, b, c].compose = abc.compose = [[a1, a2], b, c].compose = [[a1, a2], b, [c1, c2]].compose = [[a1, [[[a2]]], [[[[]]], []]], b, [[[]], [], [c]]].compose = ...
// */
// as_method = <TResult>(ref: Ray.Any): Method<Ray, TResult> => ((...any: Recursive<Ray.Any>): TResult => {
// if (any === undefined || any.length === 0)
// return this.step(ref);
//
// // TODO: This can be much better...
// const first = (recursive?: Recursive<T>): T | undefined => {
// if (recursive === undefined) return;
// // if (_.isObject(recursive)) return recursive as unknown as Ray;
//
// for (let r of recursive) {
// if (r === undefined) continue;
// if (_.isObject(r)) return r as unknown as T;
//
// // if (r instanceof Ray)
// // throw new PreventsImplementationBug();
//
// // @ts-ignore
// const _first = first(r);
// if (_first)
// return _first;
// }
// }
//
// const _first = first(any);
//
// if (_first === undefined)
// return this.step(ref);
//
// const pointer = (new Ray({
// // @ts-ignore
// initial: () => ref,
// // @ts-ignore
// terminal: () => _first
// })) as unknown as T;
//
// return this.step(pointer);
//
// // TODO: ANY CASE
// // if (any.length === 1) {
// // }
// })
//
// as_ray = (initial: Ray.Any = Ray.None()): Ray.Any => {
// throw new NotImplementedError();
// }
//
// as_generator = (): Generator<T> => {
// throw new NotImplementedError();
// }
//
// }
//
//
//
// export const Iterator = <T = any>(iterator: Iterator<T>): Ray.Any => {
// // [ |--]
//
// return Ray.Function.WithMemory(previous => {
// const iterator_result = iterator.next();
//
// return iterator_result.done !== true ? iterator_result.value : Ray.Any.None();
// }).as_ray();
// }
//

//
// // TODO
// export const Object = (object: object): Ray.Any => Ray.Any.vertex().o(object).as_reference();
//
// export const Any = (any: any): Ray.Any => {
// if (any === null || any === undefined) return JS.Any(any);
// if (JS.is_boolean(any)) return JS.Boolean(any);
// // if (JS.is_number(any)) return JS.Number(any); TODO
// if (JS.is_iterable(any)) return JS.Iterable(any); // || is_array(any))
// if (JS.is_function(any)) return Ray.Function.Any(any).as_ray();
// if (JS.is_object(any)) return JS.Object(any);
//
// // TODO
// // return JS.Any(any);
// return Ray.vertex().o({js: any}).as_reference();
// }
//
// }
Loading
Loading