Lambda calculus-like library written in TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
jlc/src/char.ts

12 lines
372 B

import { Term, g, n } from './core';
import { toNumber as $n, fromNumber as _n, x00 } from './byte';
n('char');
export const Null = g('Null', x00);
export { inc, dec, ifz as ifn, cmp, lt, le, eq, ge, gt } from './byte';
export const fromChar: (c: string) => Term = c => _n(c.charCodeAt(0));
export const toChar: (c: Term) => string = c => String.fromCharCode($n(c));