1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 17:20:29 +02:00

Add more types of constants

This commit is contained in:
Ian Price 2015-06-12 18:30:39 +01:00
parent 941f8fac01
commit e9d0f97410
2 changed files with 49 additions and 0 deletions

View file

@ -111,13 +111,39 @@ scheme.Symbol = function(s) {
};
};
// Keywords
scheme.Keyword = function(s) {
this.name = s;
return this;
};
// Vectors
scheme.Vector = function () {
this.array = Array.prototype.slice.call(arguments);
return this;
};
scheme.primitives["vector-ref"] = function (vec, idx) {
return vec.array[idx];
};
scheme.primitives["vector-set!"] = function (vec, idx, obj) {
return vec.array[idx] = obj;
};
scheme.primitives["vector-length"] = function (vec) {
return vec.array.length;
};
// Bytevectors
// Booleans
// Chars
scheme.Char = function(c) {
this.c = c;
return this;
};
// Strings
scheme.String = function(s) {