fez-lisp 1.5.79 → 1.5.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.5.79",
5
+ "version": "1.5.81",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -83,25 +83,30 @@ const fillUknownArgs = (n) =>
83
83
  }))
84
84
  export const formatType = (name, env) => {
85
85
  const stats = env[name][STATS]
86
+ const isAnonymous = typeof name === 'number'
86
87
  return stats
87
88
  ? stats[TYPE_PROP][0] === APPLY
88
- ? `${name} (${
89
+ ? `${isAnonymous ? '' : `(let ${name} `}(lambda ${
89
90
  stats[ARG_COUNT] === VARIADIC
90
91
  ? '... ' + STATIC_TYPES.UNKNOWN
91
92
  : (stats[ARGUMENTS] ?? [])
92
93
  .map(
93
- (x) =>
94
- `${x[STATS][SIGNATURE]} ${x[STATS][TYPE_PROP].map((x) =>
95
- toTypeNames(x)
96
- ).join(' ')}${
97
- getSuffix(x[STATS][SIGNATURE]) === PREDICATE_SUFFIX
98
- ? ' ' + toTypeNames(PREDICATE)
99
- : ''
94
+ (x, i) =>
95
+ `${
96
+ x[STATS][TYPE_PROP][0] === APPLY
97
+ ? `${formatType(i, stats[ARGUMENTS])}`
98
+ : `${toTypeNames(
99
+ x[STATS][TYPE_PROP][1] ?? x[STATS][TYPE_PROP][0]
100
+ )}`
100
101
  }`
101
102
  )
102
103
  .join(' ')
103
- }) -> ${toTypeNames(stats[RETURNS][1] ?? stats[RETURNS][0])}`
104
- : `${name} ${stats[TYPE_PROP].map(toTypeNames).join(' ')}`.trim()
104
+ } (${KEYWORDS.BLOCK} ${toTypeNames(
105
+ stats[RETURNS][1] ?? stats[RETURNS][0]
106
+ )})${isAnonymous ? '' : ')'})`
107
+ : `(let ${name} ${toTypeNames(
108
+ stats[TYPE_PROP][1] ?? stats[TYPE_PROP][0]
109
+ )})`
105
110
  : name
106
111
  }
107
112
  const formatTypes = (env) => {
@@ -124,7 +129,7 @@ const getScopeNames = (scope) => {
124
129
  }
125
130
  const withScope = (name, scope) => {
126
131
  const chain = getScopeNames(scope)
127
- return `${chain.length === 1 ? '· ' : ''}${chain
132
+ return `${chain.length === 1 ? '; ' : ''}${chain
128
133
  .map((x) => (Number.isInteger(+x) ? '::' : x))
129
134
  .join(' ')} ${name}`
130
135
  }
@@ -407,6 +412,7 @@ export const typeCheck = (ast) => {
407
412
  env[name] = {
408
413
  [STATS]: {
409
414
  [TYPE_PROP]: [APPLY],
415
+ [SIGNATURE]: name,
410
416
  retried: 0,
411
417
  counter: 0,
412
418
  [VARIABLE_ORDER_INDEX]: env[ORDER],
@@ -471,6 +477,7 @@ export const typeCheck = (ast) => {
471
477
  // DECLARATION of ATOM
472
478
  env[name] = {
473
479
  [STATS]: {
480
+ [SIGNATURE]: name,
474
481
  retried: 0,
475
482
  counter: 0,
476
483
  [VARIABLE_ORDER_INDEX]: env[ORDER],
@@ -508,6 +515,7 @@ export const typeCheck = (ast) => {
508
515
  [STATS]: {
509
516
  retried: 0,
510
517
  counter: 0,
518
+ [SIGNATURE]: name,
511
519
  [VARIABLE_ORDER_INDEX]: env[ORDER],
512
520
  [TYPE_PROP]: [
513
521
  isL
package/src/types.js CHANGED
@@ -31,7 +31,7 @@ export const toTypeNames = (type) => {
31
31
  }
32
32
  }
33
33
  export const SPECIAL_FORM_TYPES = {
34
- [SCOPE_NAME]: '·',
34
+ [SCOPE_NAME]: ';',
35
35
  [ORDER]: 0,
36
36
  [toTypeNames(APPLY)]: {
37
37
  [STATS]: {