Просмотр исходного кода

Add negation function and clean up string library a little.

Matt Coles лет назад: 9
Родитель
Сommit
01851a6f73
2 измененных файлов с 3 добавлено и 7 удалено
  1. 3 0
      lib/stdlib.js
  2. 0 7
      lib/str.js

+ 3 - 0
lib/stdlib.js

65
   or: function (pred1, pred2) { 
65
   or: function (pred1, pred2) { 
66
     return pred1 || pred2
66
     return pred1 || pred2
67
   },
67
   },
68
+  neg: function (pred) {
69
+    return !pred
70
+  },
68
   modulo: function (arg1, arg2) {
71
   modulo: function (arg1, arg2) {
69
     return {
72
     return {
70
       value: (arg1.value % arg2.value)
73
       value: (arg1.value % arg2.value)

+ 0 - 7
lib/str.js

1
-const global_obj = {}
2
-const function_defs = {}
3
-const warnings = {}
4
 const builtins = {
1
 const builtins = {
5
   concat: function () {
2
   concat: function () {
6
     let str = ""
3
     let str = ""
22
       console.error("Undefined function call! No such function: ", prop)
19
       console.error("Undefined function call! No such function: ", prop)
23
     }
20
     }
24
   }, 
21
   }, 
25
-  set: function (target, prop, data) {
26
-    if (prop === 'w') data.map((w) => warnings.w = true)
27
-    else console.error("Attempting to set unknown property on interpreter! How did you do that?")
28
-  }
29
 }
22
 }
30
 
23
 
31
 const proxy_obj = new Proxy({}, my_handler)
24
 const proxy_obj = new Proxy({}, my_handler)