branching and very basic merging of slots

This commit is contained in:
Joeri Exelmans 2025-04-17 09:19:41 +02:00
parent 614e6c0fdb
commit 3978f7f835
32 changed files with 684 additions and 420 deletions

View file

@ -1,10 +1,11 @@
import { Type } from "../primitives/types.js";
import { typedFnType } from "../structures/types.js"
import { Double } from "../primitives/types.js";
import { makeTypeConstructor } from "../type_constructor.js";
// Create nominal types
export const PointCartesian2D = { symbol: Symbol('PointCartesian2D'), params: [] };
export const PointPolar2D = { symbol: Symbol('PointPolar2D') , params: [] };
export const PointCartesian2D = makeTypeConstructor(Symbol('PointCartesian2D'))(0);
export const PointPolar2D = makeTypeConstructor(Symbol('PointPolar2D'))(0);
export const cart2polar = ({x, y}) => {
const r = Math.sqrt(x*x + y*y);