fez-lisp 1.4.14 → 1.4.15

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/parser.js +2 -14
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.14",
5
+ "version": "1.4.15",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/parser.js CHANGED
@@ -47,13 +47,7 @@ export const LISP = {
47
47
  source: (ast) => {
48
48
  const dfs = (exp) => {
49
49
  let out = ''
50
- let head, tail
51
- if (isLeaf(exp)) head = exp
52
- else {
53
- head = exp[0]
54
- if (head == undefined) return []
55
- tail = exp.slice(1)
56
- }
50
+ const [head, ...tail] = isLeaf(exp) ? [exp] : exp
57
51
  if (head == undefined) return (out += '()')
58
52
  switch (head[TYPE]) {
59
53
  case WORD:
@@ -115,13 +109,7 @@ export const AST = {
115
109
  struct: (ast) => {
116
110
  const dfs = (exp) => {
117
111
  let out = ''
118
- let head, tail
119
- if (isLeaf(exp)) head = exp
120
- else {
121
- head = exp[0]
122
- if (head == undefined) return []
123
- tail = exp.slice(1)
124
- }
112
+ const [head, ...tail] = isLeaf(exp) ? [exp] : exp
125
113
  if (head == undefined)
126
114
  return (out +=
127
115
  '(Expression::Apply(vec![Expression::Word("array".to_string())]))')