1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 02:59:54 +00:00

More work on cleaing up code.

This commit is contained in:
Calvin Rose 2017-03-26 11:47:58 -04:00
parent 6365a007b6
commit ac50f6232e
5 changed files with 14 additions and 17 deletions

View File

@ -105,7 +105,7 @@ void debug_repl(FILE *in, FILE *out) {
}
int main() {
printf("Super cool interpreter v0.0\n");
printf("GST v0.0 repl\nCopyright 2017 Calvin Rose\n");
debug_repl(stdin, stdout);
return 0;
}

View File

@ -248,8 +248,7 @@ GstValue gst_object_remove(Gst * vm, GstObject *o, GstValue key) {
}
}
/* Put a value into the dictionary. Returns 1 if successful, 0 if out of memory.
* The VM pointer is needed for memory allocation. */
/* Put a value into the dictionary. */
void gst_object_put(Gst *vm, GstObject *o, GstValue key, GstValue value) {
GstBucket *bucket, *previous;
uint32_t index = gst_hash(key) % o->capacity;

11
gsttests/basic.gst Normal file
View File

@ -0,0 +1,11 @@
# Define assert
(: assert (fn [x e] (if x x (do (print e) (exit 1)))))
# Basic Math
(assert (= 10 (+ 1 2 3 4), "addition")
(assert (= -8 (- 1 2 3 4), "subtraction")
(assert (= 24 (* 1 2 3 4), "multiplication")
(assert (= 0.1 (/ 1 10), "division")
# All good
(exit 0)

View File

@ -1,2 +1 @@
# The standard library
(fn + [...args]

View File

@ -1,12 +0,0 @@
(do
(:= a (set-class {} {"call" (fn [self a] (set self "last" a) (print self) self)}))
(a 1)
(a 2)
(a 3)
)
# Run call-for-each test
(call-for-each print 1 2 3 4)
(call-for-each (fn [a] (print a "hi")) 1 2 3 45)