fez-lisp 1.4.19 → 1.5.0

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.4.19",
5
+ "version": "1.5.0",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/compiler.js CHANGED
@@ -115,7 +115,7 @@ const Helpers = {
115
115
  atom_predicate: `atom_predicate=(number)=>+(typeof number==='number')`,
116
116
  lambda_predicate: `lambda_predicate=(fn)=>+(typeof fn==='function')`,
117
117
  __error: `__error=(error)=>{throw new Error(error.map((x)=>String.fromCharCode(x)).join(''))}`,
118
- set_effect: `set_effect=function(array,index,value){if(arguments.length===1){array.pop()}else{array[index] = value};return array}`
118
+ alter_effect: `alter_effect=function(array,index,value){if(arguments.length===1){array.pop()}else{array[index] = value};return array}`
119
119
  }
120
120
  const semiColumnEdgeCases = new Set([
121
121
  ';)',
@@ -528,7 +528,7 @@ export const keywords = {
528
528
  KEYWORDS.NOT
529
529
  } ${stringifyArgs(args)})`
530
530
  )
531
- return +!evaluate(args[0], env)
531
+ return +!operand
532
532
  },
533
533
  [KEYWORDS.EQUAL]: (args, env) => {
534
534
  if (args.length !== 2)
package/src/keywords.js CHANGED
@@ -40,7 +40,7 @@ export const KEYWORDS = {
40
40
  CALL_FUNCTION: 'apply',
41
41
  DEFINE_VARIABLE: 'let',
42
42
 
43
- SET_ARRAY: 'set!',
43
+ SET_ARRAY: 'alter!',
44
44
  ERROR: 'throw'
45
45
  }
46
46
 
package/src/utils.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import std from '../lib/baked/std.js'
2
+ import debugStd from '../lib/debug/std.js'
2
3
  import { compile } from './compiler.js'
3
4
  import {
4
5
  APPLY,
@@ -291,21 +292,19 @@ export const debug = (ast, onSuccess = compile) => {
291
292
  ...keywords,
292
293
  [DEBUG.CALLSTACK]: [KEYWORDS.BLOCK],
293
294
  [DEBUG.SIGNATURE]: (args, env) => {
294
- if (args.length !== 1)
295
- throw new RangeError(
296
- `Invalid number of arguments to (${DEBUG.SIGNATURE}) (= 1) (${
297
- DEBUG.SIGNATURE
298
- } ${stringifyArgs(args)})`
299
- )
300
- const name = args[0][VALUE]
301
- const signatures = std[0][1][1].filter(
302
- (x) =>
303
- x[0][TYPE] === APPLY &&
304
- x[0][VALUE] === KEYWORDS.DEFINE_VARIABLE &&
305
- x[1][TYPE] === WORD &&
306
- x[1][VALUE].toString().includes(name)
307
- )
308
- return signatures.map(LISP.source).join('\n\n')
295
+ const signatures =
296
+ args.length === 0
297
+ ? debugStd[0][1][1].slice(1)
298
+ : debugStd[0][1][1].filter(
299
+ (x) =>
300
+ x[0][TYPE] === APPLY &&
301
+ x[0][VALUE] === KEYWORDS.DEFINE_VARIABLE &&
302
+ x[1][TYPE] === WORD &&
303
+ x[1][VALUE].toString().includes(args[0][VALUE])
304
+ )
305
+ return signatures.length === 0
306
+ ? 'Not defined in library'
307
+ : signatures.map(LISP.source).join('\n\n')
309
308
  },
310
309
  [DEBUG.LOG]: (args, env) => {
311
310
  if (args.length !== 1 && args.length !== 2)