Commit Graph

2258 Commits

Author SHA1 Message Date
Timothy Sample d19c1c1bea mes: guile: Add placeholder.
* mes/module/mes/guile.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample 4aad78dd95 mes: nyacc compat18: Add placeholder.
* mes/module/nyacc/compat18.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample bfaa404395 mescc: preprocess: Remove cond-expand.
* module/mescc/preprocess.scm: Remove the special case for Mes when
calling 'insert-progress-monitors'.
2022-04-26 16:46:08 -06:00
Timothy Sample 6e21132275 mes: ice-9 getopt-long: Add as an alias.
This just re-exports symbols from '(mes getopt-long)'.

* mes/module/ice-9/getopt-long.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample f06d1176db mes: pretty-print: Move to 'ice-9'.
* mes/module/mes/pretty-print.scm: Rename this...
* mes/module/ice-9/pretty-print.scm: ...to this.
* mes/module/mes/pretty-print.mes: Adjust accordingly.
* AUTHORS: Likewise.
2022-04-26 16:46:08 -06:00
Timothy Sample 227f3aaf95 mes: reader: Support "#\nl" and "#\np".
* src/reader.c (reader_read_character): Handle the "nl" and "np"
character names.
2022-04-26 16:46:08 -06:00
Jan (janneke) Nieuwenhuizen 46d4ab25a6 mes: sxml fold: Add placeholder.
* mes/module/sxml/fold.scm: New file.
2022-04-26 16:46:08 -06:00
Jan (janneke) Nieuwenhuizen 7939d4cae9 mes: srfi-2: Add placeholder.
* mes/module/srfi/srfi-2.scm: New file.
2022-04-26 16:46:08 -06:00
Jan (janneke) Nieuwenhuizen 84ff54aa5c mes: ice-9 popen: Add placeholder.
* mes/module/ice-9/popen.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample d47735122a tests: Adjust to work with Guile modules.
* tests/base.test: Do not override 'MES_BOOT' if already set.
[mes]: Only load "test.scm" if the module system is not booted.
(lookup-toplevel): Use 'module-variable' if the module system is
booted.
* tests/match.test: Import '(ice-9 match)' directly.
* tests/boot.test: Do not override 'MES_BOOT' if already set.
* tests/guile-module.test: Likewise.
* tests/macro.test: Likewise.
* tests/perform.test: Likewise.
* tests/quasiquote.test: Likewise.
* tests/read.test: Likewise.
* tests/scm.test: Likewise.
* tests/srfi-0.test: Likewise.
* tests/srfi-9.test: Likewise.
2022-04-26 16:46:08 -06:00
Timothy Sample 1d8b876565 mes: srfi-9 gnu: Make a proper module.
* mes/module/srfi/srfi-9/gnu.scm: New file.
2022-04-26 16:46:08 -06:00
Jan (janneke) Nieuwenhuizen dc8a63e4e4 mes: srfi-43: Make a proper module.
* mes/module/srfi/srfi-43.scm: New file.
2022-04-26 16:46:08 -06:00
Jan (janneke) Nieuwenhuizen dc70e86cd9 mes: srfi-14: Make a proper module.
* mes/module/srfi/srfi-14.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample 5767ce8875 mes: match: Make a proper module.
* mes/module/ice-9/match.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample b36da36004 mes: Remove SRFI 1 from boot-4.
* mes/module/mes/boot-0.scm: Do not import 'srfi-1'.
* mes/module/mes/boot-5.scm: Likewise.
* mes/module/srfi/srfi-1.scm: Adjust exports accordingly.
* mes/module/mes/scm.mes (hash-fold): Rewrite avoiding 'fold'.
* mes/module/mes/guile-module.mes (reverse): New procedure.
(reverse!): New procedure.
2022-04-26 16:46:08 -06:00
Timothy Sample c65cd724ba mes: main: Make a proper module.
* mes/module/mes/main.scm: New file.
* mes/module/mes/boot-5.scm: Use it as a module.
2022-04-26 16:46:08 -06:00
Timothy Sample 1036d38d33 mes: repl: Make a proper module.
* mes/module/mes/repl.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample 953197594a mes: optargs: Adjust for new module system.
* module/mes/optargs.scm: Move this...
* mes/module/ice-9/optargs.scm: ...here with minor adjustments.
* mes/module/mes/optargs.mes: Adjust accordingly.
* tests/optargs.test: Adjust accordingly.
* mes/module/mes/boot-5.scm: Add '(mes syntax)' to the root module.
* mes/modules/system/base/pmatch.scm: Export 'pmatch' using
'#:replace'.
2022-04-26 16:46:08 -06:00
Timothy Sample 86432b8005 mes: srfi-9: Make a proper module.
* mes/module/srfi/srfi-9.scm: New file.
2022-04-26 16:46:08 -06:00
Timothy Sample ac68527ffe mes: srfi-1: Make a proper module.
* mes/module/srfi/srfi-1.scm: Move this...
* mes/module/srfi/srfi-1-guile.scm: ...here.
* mes/module/srfi/srfi-1.mes: Update accordingly.
* AUTHORS: Likewise.
* mes/module/srfi/srfi-1.scm: New file.

Co-authored-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2022-04-26 16:46:08 -06:00
Timothy Sample aecc79eb66 mes: Add a Mes-specific 'mes-0' module.
* mes/module/mes/mes-0.scm: New file.

Co-authored-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2022-04-26 16:46:08 -06:00
Timothy Sample b86d19c1a5 mes: boot-03: Define '@' and '@@'.
* mes/module/mes/boot-03.scm (@, @@): New macros.
* mes/module/mes/boot-0.scm (@, @@): New macros.
* mes/module/mes/boot-5.scm (@, @@): New macros.
2022-04-26 16:46:08 -06:00
Jan (janneke) Nieuwenhuizen 6c64b5e1ba build: check-boot.sh: Allow overriding of TESTS.
* build-aux/check-boot.sh (TESTS): Rename to...
(boot_tests): ...this.
(TESTS): Use boot_tests as fall-back.
(XFAIL_TESTS): Use empty as fall-back.
2022-04-26 16:46:08 -06:00
Timothy Sample 16c48267e4 mes: Add Guile-style module support.
This change adds support for Guile-style modules, but does not
enable it by default.  It can be enabled by using the 'boot-5' boot
script.

* mes/module/mes/guile-module.mes: New file.
* mes/module/mes/boot-5.mes: New file.
* mes/module/mes/boot-0.mes (effective-version, include-from-path)
(define-module, use-modules, effective-version): Move these...
* mes/module/mes/guile.scm: ...here.
* mes/module/mes/boot-0.mes: Move '%main' and the command-line
interface code...
* mes/module/mes/main.mes: ...to this new file.
* mes/module/mes/boot-0.mes: Import '(mes guile)' and '(mes main)'.
* mes/module/ice-9/rdelim.scm: New file.
* tests/data/bar.scm: New file.
* tests/data/foo.scm: New file.
* tests/guile-module.test: New file.
* build-aux/check-mes.sh (TESTS): Add it.
2022-04-26 16:46:08 -06:00
Timothy Sample b0123a9c38 core: Add the 'make-binding' builtin.
* src/eval-apply.c (make_binding): New function.
* include/mes/builtins.h (make_binding): Declare it.
* src/builtins.c (mes_builtins): Register it.
2022-04-26 16:46:08 -06:00
Timothy Sample 9ed7460eba mes: Use a hash table for fluids.
If 'make-fluid' is a macro that calls 'gensym' directly, any attempt
to wrap 'make-fluid' will result in only one symbol being produced
at expansion time.

* mes/module/mes/fluids.mes (make-fluid): Rewrite to generate a
symbol at evaluation time, and use that symbol as a key for a hash
table.
(fluid?, fluid-ref, fluid-set!): Adjust accordingly.
(with-fluid*, with-fluids): Use 'fluid-ref' instead of applying a
fluid directly.
* tests/fluids.test: Add test.
2022-04-26 16:46:08 -06:00
Timothy Sample 0f167b03f3 core: Bind all free variables during expansion.
* src/eval-apply.c (expand_variable_): Process internal definitions
as local variables; ensure all free variables are bound (creating
bindings if necessary).
(eval_apply): When evaluating a pair with a binding in its car,
evaluate the binding before dispatching; when evaluating a binding,
raise an error if the location does not have a value.
* src/mes.c (mes_environment): Bind special symbols to themselves.
* mes/module/mes/boot-0.scm (defined?): Make sure the variable
actually has a value.
* mes/module/mes/boot-00.scm (defined?): Likewise.
* mes/module/mes/boot-01.scm (defined?): Likewise.
* mes/module/mes/boot-02.scm (defined?): Likewise.
* mes/module/mes/boot-03.scm (defined?): Likewise.
* scaffold/boot/60-let-syntax-expanded.scm (defined?): Likewise.
2022-04-26 16:46:08 -06:00
Timothy Sample 543e4300c0 core: Fix continuations.
* src/eval-apply.c: Do not add a frame to the GC stack while making
a continuation.
* mes/module/mes/catch.mes (catch): Remove workaround.
* tests/boot.test: Add test.
2022-04-26 16:46:08 -06:00
Timothy Sample 5167f70038 core: set!: Check for undefined variables.
* src/eval-apply.c (set_x): Add the 'define_p' argument and if it is
not set, signal an error on an undefined variable.
(eval_apply): When evaluating 'set-x!' forms, leave 'define_p'
unset; when evaluating 'define' forms, set 'define_p'.
* include/mes/mes.h (set_x): Adjust declaration accordingly.
2022-04-26 16:46:08 -06:00
Timothy Sample 01d658a356 core: Make symbol lookup extensible.
* src/module.c (set_current_module): New function.
(module_variable): Remove function.
(module_define_x): Remove function.
(current_module_variable): New function.
* src/eval-apply.c (lookup_binding): Replace 'module_variable' with
'current_module_variable'; add the 'define_p' argument.
(set_x): Adjust for 'define_p'.
(lookup_value): Likewise.
(expand_variable_): Likewise.
(eval_apply): When evaluating defines, replace 'module_define_x' with
'lookup_binding' with 'define_p' set.
* src/gc.c (gc_init)[!__M2_PLANET__]: Double ARENA_SIZE.
* include/mes/constants.h (MODULE_EVAL_CLOSURE): New constant.
* include/mes/mes.h (current_module_variable): New declaration.
(current_module_define_x): New declaration.
* include/mes/builtins.h (set_current_module): New declaration.
(lookup_binding): Declare the 'define_p' argument.
(module_variable): Remove declaration.
(module_define_x): Remove declaration.
* src/builtins.c (mes_builtins): Register 'set-current-module';
remove 'module-variable' and 'module-define!'.
* mes/module/boot-0.scm (defined?): Do not use 'module-variable'.
* mes/module/boot-00.scm (defined?): Likewise.
* mes/module/boot-01.scm (defined?): Likewise.
* mes/module/boot-02.scm (defined?): Likewise.
* mes/module/boot-03.scm (defined?): Likewise.
* scaffold/boot/60-let-syntax-expanded.scm (defined?): Likewise.
* mes/module/mes/fluids.mes (make-fluid): Do not use
'module-define!', and wrap fluids in a variable record.
* tests/macro.test (make-fluid): Likewise.

Co-authored-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2022-04-26 16:46:05 -06:00
Timothy Sample 31b74c24bf core: Do not hold pointers during variable lookup.
If we want to make variable lookup extensible, we need to call into
Scheme code during lookup.  This might cause the garbage collector
to run, invalidating any pointer held by C code.  This change
updates call sites for variable lookup to avoid holding pointers
into Scheme data.

* src/eval-apply.c (expand_variable_): Store expressions and formals
in GC-managed registers.
(expand_variable): Initialize registers for 'expand_variable_'.
(eval_apply): When evaluating 'define' and 'define-macro' forms, do
not rely on local C variables after calls to 'lookup_binding' or
'expand_variable'.
2022-04-26 11:22:57 -06:00
Timothy Sample 22d89dfa97 core: Make 'primitive-load' a builtin.
In addition to simplifying the interpreter, this change ensures that
'primitive-load' evaluates the loaded file in the top level
environment.

* include/mes/symbols.h (cell_symbol_primitive_load): Remove
variable.
(cell_vm_begin_primitive_load): Remove variable.
(cell_vm_begin_expand_primitive_load): Remove variable.
(SYMBOL_MAX, CELL_SYMBOL_RECORD_TYPE): Adjust accordingly.
* src/symbol.c (init_symbols): Do not initialize removed variables.
* src/eval-apply.c (eval_apply): Remove primitive load code.
(primitive_load): New function.
* include/mes/builtins.h (primitive_load): Declare it.
* src/builtins.c (mes_builtins): Initialize it.
* mes/module/mes/boot-03.scm: Remove duplicate call to
'primitive-load'.
* mes/module/mes/boot-0.scm: Remove extra call to 'primitive-load';
adjust how the "--main" option is handled.
* tests/base/test.test: Add a test.
* tests/data/load.scm: Set the 'toplevel?' variable to support the
new test.
2022-04-26 11:22:57 -06:00
Timothy Sample 1360189685 core: Fix internal define bug.
* src/eval-apply.c (eval_apply): When evaluating 'define', recompute
the 'global_p' and 'local_p' flags; when evaluating a local
definition, set the closure directly instead of using 'set_x'.
* tests/base.test: Add a test.
2022-04-26 11:22:57 -06:00
Timothy Sample 06cff14bfa srfi-9: Fix record printing.
* mes/module/srfi/srfi-9-struct.mes (print-record-type): New
procedure.
(make-record-type): Add 'printer' as new record type field and use
'print-record-type' as the struct printer.
(record-type-printer): New procedure.
(record-type-fields): Bump index for the 'printer' field.
(record-constructor): Use the record type printer as the struct
printer if it is defined.
(record-printer): Print the record type name instead of the raw
record type.
2022-04-26 11:22:57 -06:00
Timothy Sample f1447abeb3 tests: Fix tests to run on Guile.
* scaffold/boot/17-open-input-string.scm: Test 'current-module' to
see if we can lookup 'read-string' in a module.
* scaffold/boot/gc.scm: Skip all tests on Guile.
* tests/gc.test: Rename 'mes?' to 'mes-core?'; use 'current-module'
to check if we need to use core Mes procedures; and adjust all tests
accordingly.
* tests/scm.test (iota -1): Skip on Guile.
* tests/vector.test (make-vector): Adjust for Guile.
2022-04-26 11:22:57 -06:00
Timothy Sample 57610dc246 core: Add an 'M1' register for the current module.
* include/mes/mes.h (M1): New variable.
* src/mes.c (main): Initialize it.
* src/gc.c (gc_flip): Account for it.
(gc_): Copy it.
(gc_dump_state): Dump it.
* src/test/gc.c (test_setup, main): Initialize it.
* src/module.c (current_module): New function.
* src/builtiins.c (mes_builtins): Register it as 'current-module'.
* include/mes/builtins.h (current_module): Declare it.
2022-04-26 11:22:57 -06:00
Timothy Sample a8ce580123 core: Rename the 'current-module' symbol.
This change renames 'current-module' to 'current-environment'.  This
will make way for 'current-module' to actually be a module.

* include/mes/symbols.h (cell_symbol_current_module): Rename this...
(cell_symbol_current_environment): ...to this.
* src/eval-apply.c: Adjust accordingly.
* src/symbol.c: Adjust accordingly, and update the Scheme name to
'current-environment'.
* mes/module/mes/base.mes: Adjust accordingly.
* mes/module/mes/boot-0.scm: Adjust accordingly.
* mes/module/mes/boot-00.scm: Adjust accordingly.
* mes/module/mes/boot-01.scm: Adjust accordingly.
* mes/module/mes/boot-02.scm: Adjust accordingly.
* mes/module/mes/boot-03.scm: Adjust accordingly.
* mes/module/mes/display.mes: Adjust accordingly.
* mes/module/mes/module.mes: Adjust accordingly.
* mes/module/mes/psyntax-0.mes: Adjust accordingly.
* mes/module/mes/repl.mes: Adjust accordingly.
* mes/module/mes/scm.mes: Adjust accordingly.
* mes/module/srfi/srfi-16.scm: Adjust accordingly.
* mes/module/srfi/srfi-26.scm: Adjust accordingly.
* module/mescc/compile.scm: Adjust accordingly.
* scaffold/boot/17-open-input-string.scm: Adjust accordingly.
* scaffold/boot/4c-quasiquote.scm: Adjust accordingly.
* scaffold/boot/4f-string-split.scm: Adjust accordingly.
* scaffold/boot/50-make-string.scm: Adjust accordingly.
* scaffold/boot/50-string-join.scm: Adjust accordingly.
* scaffold/boot/51-module.scm: Adjust accordingly.
* scaffold/boot/52-define-module.scm: Adjust accordingly.
* scaffold/boot/60-let-syntax-expanded.scm: Adjust accordingly.
* scaffold/boot/60-let-syntax.scm: Adjust accordingly.
* scaffold/gc.scm: Adjust accordingly.
* tests/gc.test: Adjust accordingly.
* tests/psyntax.test: Adjust accordingly.
2022-04-26 11:22:57 -06:00
Timothy Sample e743c1386c core: Remove '<module>' type.
This change removes the internal '<module>' record type, and changes
the initial module to be a plain hash table.

* src/symbol.c (init_symbols_): Remove 'cell_symbol_module'.
* include/mes/symbols.h (cell_symbol_module): Remove declaration.
(CELL_SYMBOL_MAX, CELL_SYMBOL_RECORD_TYPE): Adjust accordingly.
* src/module.c (make_initial_module): Use a raw hash table instead
of a struct.
(module_variable, module_define_x): Adjust accordingly.
(make_module_type, module_printer): Remove functions.
* src/builtins.c (mes_builtins): Do not register them.
* include/mes/builtins.h (make_module_type, module_printer): Remove
declarations.
* src/eval-apply.c (eval_apply): Replace 'module_printer' with
'hash_table_printer'.
* src/mes.c (main): Likewise, and initialize 'R0' after calling
'make_initial_module'.

Co-authored-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2022-04-26 11:22:57 -06:00
Timothy Sample c18b95620a core: Use variables for modules.
This change introduces a 'lexical?' field for bindings (called
'lexical_p' and stored in the cdr of the binding cell).  Non-lexical
bindings handle variables transparently, while lexical bindings do
not.

* src/module.c (module_define_x): Wrap value in a variable.
* include/mes/mes.h (scm): Add 'lexical_p' to the cdr union.
(set_x): New declaration.
* src/eval-apply.c (make_binding_): Add a 'lexical_p' argument.
(lookup_handle): Remove function.
(lookup_binding): Add function.
(lookup_value): Use 'lookup_binding' and return the contents of
variables that are not bound lexically.
(set_env_x): Remove function.
(set_x): New function.
(expand_variable_): Use 'lookup_binding' in place of
'lookup_handle'.
(eval_apply): Likewise; use 'set_x' in place of 'set_env_x'; and
when evaluating a binding, return the contents of variables that are
not bound lexically.
* include/mes/builtins.h (set_env_x): Remove declaration.
* src/builtins.c (mes_builtins): Do not register 'set-env!'.
* scaffold/boot/53-closure-display.scm (closure)[mes]: Rewrite to
avoid 'module-variable'.
2022-04-26 11:22:06 -06:00
Timothy Sample 5edef591b7 core: Implement Guile-style variables.
* src/variable.c: New file.
* simple.make (LIBMES_SOURCES): Add it.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* build-aux/snarf.sh: Snarf it.
* kaem.run: Compile it.
* include/mes/builtins.h (make_variable): New function.
(variable_p): New function.
(variable_ref): New function.
(variable_set_x): New function.
(variable_printer): New function.
* src/builtins.c (mes_builtins): Register them.
* include/mes/mes.h (make_variable_type): New function.
(scm_variable_type): New variable.
* src/module.c (make_initial_module): Initialize it.
* src/gc.c (gc_flip, gc_): Keep track of it.
* include/mes/symbols.h (cell_symbol_variable): New variable.
(SYMBOL_MAX): Adjust accordingly.
* src/symbol.c (init_symbols): Initialize 'cell_symbol_variable'.
* mes/module/mes/scm.mes (make-undefined-variable): New procedure.
(variable-bound?): New procedure.
* tests/variable.test: New file.
* build-aux/check-mes.sh (TESTS): Add it.
2022-04-25 14:19:03 -06:00
Jan (janneke) Nieuwenhuizen c317e939b9 core: Replace special cell_boot_module with initial-module builtin.
* src/module.c (initial_module): New builtin.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
* include/mes/symbols.h (cell_boot_module): Remove.
* src/symbol.c (init_symbols_): Update.
(init_symbols): Likewise.
* src/eval-apply.c (eval_apply): Likewise.
(expand_variable_): Likewise.
* tests/macro.test (make-fluid): Likewise.
* mes/module/mes/fluids.mes (make-fluid):  Likewise.
2022-04-25 14:19:03 -06:00
Timothy Sample 870256ed3e core: Refactor name resolution.
* src/module.c (module_variable): Do not search local bindings.
(module_ref): Remove function.
* src/eval-apply.c (lookup_handle): New function.
(lookup_value): New function.
(set_env_x, expand_variable_, eval_apply): Use 'lookup-handle' and
'lookup-value' in place of 'module_variable' and 'module_ref'
respectively.
* src/core.c (error): Likewise.
* include/mes/mes.h (lookup_handle, lookup_value): Add declarations.
* include/mes/builtins.h (module_ref): Remove declaration.
* src/builtins.c (mes_builtins): Remove "module-ref".

Co-authored-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2022-04-25 14:19:03 -06:00
Timothy Sample 895eaa4c5e core: Fix printing bindings.
* src/lib.c (car_): Support taking the car of a binding.
* mes/module/mes/display.mes (display): Do not use 'list->string'
when displaying a binding.
2022-04-25 14:17:57 -06:00
Timothy Sample 91b1c6e233 core: Rename variable type to binding.
This change allows us to use "variable" in the Guile sense, which is
an anonymous box for storing a value.

* include/mes/constants.h (TVARIABLE): Rename this...
(TBINDING): ...to this.
* include/mes/mes.h (scm): Rename the 'variable' field to 'binding'.
* include/mes/symbols.h (cell_type_variable): Rename this...
(cell_type_binding): ...to this.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Adjust accordingly.
* src/eval-apply.c (make_variable_): Rename this...
(make_binding_): ...to this.
(set_env_x, expand_variable_, eval_apply): Adjust accordingly.
* src/symbol.c (init_symbol): Adjust accordingly and rename the
'<cell:variable>' symbol to '<cell:binding>'.
* mes/module/mes/type-0.mes (cell:type-alist): Adjust accordingly.
(variable?): Rename this...
(binding?): ...to this.
* src/display.c (display_helper): Adjust accordingly and print
"binding" instead of "variable".
* mes/module/mes/display.mes (display): Likewise.
2022-04-25 09:22:13 -06:00
Jan (janneke) Nieuwenhuizen 07c90bdebd core: Add hashq_create_handle_x.
* src/hash.c (hash_create_handle_x): New function.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
* tests/hash.test: Add a test.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2022-04-25 09:22:13 -06:00
Jan (janneke) Nieuwenhuizen 2296972201 mes: Add hash-for-each.
* mes/module/mes/scm.mes (hash-for-each): New function.
2022-04-25 09:22:13 -06:00
Jan (janneke) Nieuwenhuizen 64d6dff810 core: Add hash_clear!.
* src/hash.c (hash_clear_x): New builtin.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
* tests/hash.test: Add a test.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2022-04-25 09:22:13 -06:00
Jan (janneke) Nieuwenhuizen 858daa625d core: Add hash-table?.
* include/mes/mes.h (scm_hash_table_type): New type.
* src/hash.c (make_hash_table_type): Rename from make_hash_type, and
initialize it.
* src/symbol.c (init_symbols): Add it to environment.
* tests/hash.test: Add a test.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2022-04-25 09:22:13 -06:00
Jan (janneke) Nieuwenhuizen 9a5de02f42 core: Allow non-string hash keys.
This merely allows adding non-string keys to a hash table and puts them
non-string keys in bucket 0.  Efficiency is lost.  TODO: calculate a
proper hash.

* src/hash.c (hash_): Allow non-string keys in bucket 0.
* tests/hash.test: Add a test.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2022-04-25 09:22:13 -06:00
Jan (janneke) Nieuwenhuizen 0a905d54d7 mes: Resurrect cell:type-name.
* mes/module/mes/type-0.mes (cell:type-name): Resurrect.
2022-04-25 09:22:13 -06:00