1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 10:07:45 +03:00
Commit Graph

3863 Commits

Author SHA1 Message Date
Denis Fuenzalida
a1f1a72d2b Generalize note for with-meta (guide, Step A)
The bullet point for `with-meta` describes how to implement it for Mal functions, but it's applicable to all Mal types, while the last sentence can be reordered to emphasize the details specific to metadata on functions.
2024-08-09 17:49:26 -05:00
Jordi Iñigo
47395d754d pprint properly prints hash-maps 2024-08-09 17:40:29 -05:00
Joel Martin
ba0159031f GHA: add self-hosted workflow input. 2024-08-08 15:51:13 -05:00
Joel Martin
f5d6d0e1e2 get-ci-matrix.py: ignore IMPLS.yml and Makefile.impls
This isn't a perfect solution because if somebody pushes a new
implementation and then later pushes the updates to these files, it
probably won't trigger any implementations. However, the workflow can
always be manually triggered for a specific implementation and branch so
that's probably okay. At least this way, the addition of a new
implementation won't always trigger every other implementation to be
tested.
2024-08-08 15:42:21 -05:00
Nicolas Boulenguez
205cf51a7d latex3: require ubuntu:24.04 in the Dockerfile 2024-08-08 15:40:26 -05:00
Nicolas Boulenguez
6b8424bf92 latex3: add non-interactive apt-get option to Dockerfile 2024-08-08 15:40:26 -05:00
Nicolas Boulenguez
e28b72752e latex3: fix time-ms from seconds to milliseconds, register in IMPLS.yml 2024-08-08 15:40:26 -05:00
Nicolas Boulenguez
00d168fdca latex3: new implementation
Self hosting fails at step4 because of exceeded TeX capacity.
2024-08-08 15:40:26 -05:00
Nicolas Boulenguez
5808977f9f tests: improve consistency with the key not found error message
Never require quotes around the symbol.
2024-08-08 15:40:26 -05:00
Nicolas Boulenguez
24d82e4fcf wasm: prevent macros from mutating functions 2024-08-08 14:05:01 -05:00
Nicolas Boulenguez
91f9877935 wasm: backport recent changes to steps0-9 2024-08-08 14:05:01 -05:00
Nicolas Boulenguez
0125507b0f wasm: merge EVAL_AST into EVAL
EVAL_AST is kept but only applies to sequences
2024-08-08 14:05:01 -05:00
Nicolas Boulenguez
d27d374834 wasm: implement DEBUG-EVAL 2024-08-08 14:05:01 -05:00
Nicolas Boulenguez
fd686fc9f2 wasm: simplify EVAL_AST without br_table 2024-08-08 14:05:01 -05:00
Nicolas Boulenguez
1c4a08efbd wasm: simplify some conditionals, remove duplicate assignments 2024-08-08 14:05:01 -05:00
Nicolas Boulenguez
c9970d7077 wasm: style changes in Makefile and Dockerfile 2024-08-08 14:05:01 -05:00
Joel Martin
9773dba75f wasm: downgrade node from 18 to 16 since ffi builds there
With node 18, building ffi module fails.
2024-08-08 11:26:53 -05:00
Joel Martin
f1d24730eb wasm: update image to Ubuntu 20.04. Update runtimes
- node 10 -> node 18
- wasmtime v0.8.0-ish -> wasmtime v3.0.0
- wasmer 0.12.0-ish -> wasmer 2.0.0

Also, update ffi-napi to 4.0.3.

Comment out wac/wax/wace build since these don't currently work.
2024-08-08 10:52:27 -05:00
Joel Martin
dff0977d3d wasm: lucet no longer exists (merged into wasmtime). 2024-08-08 10:52:27 -05:00
Nicolas Boulenguez
37f62250a4 python: various simplifications
Use raw or multiline string litterals to make some hard-coded strings
more readable.

Replace some lambda constructs with more idiomatic generator
expressions, removing several temporary sequences (conversions,
contatenations, slices, arguments).

Replace definitions with assignments when possible.

Replace most python2/3 wrappers with code compatible with both
versions.  Use a non-printable ASCII characters instead of Unicode
characters (in order to avoid unicode in python2).

core:
Close file open by 'slurp' after reading.
coll_Q: remove as obsolete.
conj: do not preserve metadata.

env:
Replace find with an optional argument to get.
Search in outer environments with a loop instead of a recursion.
(python is not intended for large recursions).

readline:
Copy the example from the docs.
Write the history once.

mal_types:
clone: copy.copy() everything except callables.
functions: construct fn* functions in steps, where they are used
  (there was no encapsulation anyway)
Derive List and Vector from tuple, which is more efficient than list
for immutable structures.  Remove the need for __getitem__ stuff.
maps: provide an asPairs iterator.

printer:
Introduce a pr_list helper like many other implementations.

steps:
Remove obviously backported stuff from first steps.
Port forward the limitation of the exception backtrace size from step5
to later steps, so that REGRESS=1 does not crash stepA tests.
Fix the detection of special forms (strings were accepted as well as
symbols).
Let try* benefit from TCO.
2024-08-08 10:10:13 -05:00
Nicolas Boulenguez
c64f6f2357 make: trivial 2024-08-08 09:15:01 -05:00
Nicolas Boulenguez
446964e734 make: improve efficiency and encapsulation
Readability
* Use implicit parameter transmission ($(_list?) instead of $(call
  _list?,$1),
  first/lastword instead of word 1/words,
  $1 instead of $(1).
* Use an undefined $(rem) macro and some automatic stripping (if,
  foreach) to indent code with less calls to `strip` functions.
* Name the Make macro implementing a MAL core function exactly like the
  function (modulo the encoding above) and simplify core_ns accordingly.
* Replace empty results representing `nil` with explicit MAL values.
* Implement large conditionals with a computed variable name, as already
  done in printer.mk.  For QUASIQUOTE and EVAL, this reduces a lot the
  diff between steps.
* Represent the reader state as an explicit global variable instead of
  passing the same name as argument again and again.
* Merge read-atom into read-form so that the switch on first character
  is more visible.

Encapsulation
* Hide most representations into types.mk.
* Implement the type as a suffix in order to avoid a conditional in
  _obj_type.
* Implement _error with throw.
* Create distinct types for keywords and macros.
* Move most metadata and atom stuff from core.mk to types.mk.
* Move parameter association from env to types because it hides more
  about the representation of functions.

Representation
* Encode Make special characters in all strings/keywords/symbols, so
  they can be used directly as spaced words and/or variable names for
  map keys. (The encoding adding separating characters is kept for
  read-string and seq).
* Change representation of numbers/strings/keywords/symbols, reducing
  the number of Make variables.

Various
* Allow keyword argument for keyword core function.
* Shorten time-mes,slurp,readline...
* Remove obsolete stuff:
  * `get` and `contains?` for vectors
  * `count` for hash-maps
  * `_join` from util.mk.
  * `type` from core.mk.
* Add a function listing env_keys for DEBUG-EVAL.
* Fix some includes.
2024-08-08 09:15:01 -05:00
Nicolas Boulenguez
3f6a40f708 mal impl: report more errors in step files 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
2304fea342 mal impl: stop returning a value from env-set
This improves readability because the return value was only a trick to
shorten `def!` and `defmacro!` and was ignored everywhere else.

As a side effect, this probably improves efficiency, as `let*` is the
most frequent caller.
2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
af2279d18d mal impl: use native macro? core function
This change requires that the apply core function accepts macros and
functions indifferently, update guide and tests accordingly.
2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
79458ba641 vimscript: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
9307c5a8ce sml: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
c324a4ea52 prolog: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
9a5a94cf27 nasm: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
4aa2c7edf7 haskell: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
e942621048 fsharp: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
140dcb0987 erlang: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
a734ce082b ada.2: allow macro argument for apply core function 2024-08-07 13:25:02 -05:00
Nicolas Boulenguez
253cdf1ae5 rust: update and merge eval-ast
Remove unneeded intermediate executable files.
Remove Cargo.lock from version control system.
Update dependency versions.
Update Dockerfile (converge to update-some-dockerfiles branch).
Apply changes suggested by rustfmt and clippy, or enforced by rustc.
Remove several unneeded clone().
Merge eval and eval-ast, remove quasiquoteexpand and macroexpand.
Report more errors during startup.
2024-08-07 12:55:39 -05:00
Søren Sjørup
ec15d215c1 Javascript: parseFloat does not take a base parameter 2024-08-06 15:46:24 -05:00
Christoffer Ekeroth
b50380f040 Remove package-lock.json from .gitignore files
The package-lock.json file is intended to be checked in to source
control in order to make builds reproducible; without
a package-lock.json file `npm install` becomes non-deterministic.

See e.g.
https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json:

> package-lock.json is automatically generated for any operations where
> npm modifies either the node_modules tree, or package.json. It describes
> the exact tree that was generated, such that subsequent installs are
> able to generate identical trees, regardless of intermediate dependency
> updates.
>
> This file is intended to be committed into source repositories, and
> serves various purposes:
2024-08-06 15:28:00 -05:00
YAMAMOTO Yuji
0040170d3f Fix link to every step in README 2024-08-06 15:23:10 -05:00
seedpower
6ab763daa1 Update guide.md
change binds to `binds`
2024-08-06 14:58:36 -05:00
François Lamboley
69db481767 Update README.md
Fix Xcode capitalization
2024-08-06 14:57:50 -05:00
jero98772
e2d25044d5 solve issue Floats don't work in the python implementation. #646 2024-08-06 12:49:06 -05:00
Joel Martin
062fb6f66e common-lisp: fix build with sbcl 2.0.1.debian
The update from ubuntu:vivid to ubuntu:20.04 update the version of sbcl
from 1.2.4.debian to 2.0.1.debian. This resulted in the cl-launch based
build process no longer working: dependencies were not resolved (but
running it several times would eventually resolve them. So use an sbcl
build command directly when building for sbcl.

Note: updating the image to ubuntu:24.04 upgrades the version of sbcl to
2.2.9.debian. Something about that version breaks how we do hash-maps.
They become temperamental: hash-map creation often results in a nil
object returned and doing (get hm key) usually results in nil returned
even if the key shows as being present.
2024-08-06 12:08:31 -05:00
Nicolas Boulenguez
448d26aab6 ruby.2: fix (rest (list 6)) 2024-08-06 10:50:31 -05:00
Joel Martin
2253ce6b57 ruby: update Dockerfile to 24.04 2024-08-06 09:51:31 -05:00
Nicolas Boulenguez
bebd906a3e ruby: use pattern matching, remove double negations, simplify try* 2024-08-06 09:50:13 -05:00
Nicolas Boulenguez
9e1d457dc4 ruby: let varargs functions pass a mal list instead of a ruby array
Fixes some tests like
((fn* (& more) (list? more)) 1 2 3)
2024-08-06 09:50:06 -05:00
Joel Martin
8ac470f1bf ci.sh: for push, check repo and correct branch
Also, remove extra '}' character in built step summary.
2024-08-06 09:20:41 -05:00
Joel Martin
b423d350b7 elm: fix Makefile SOURCES list. 2024-08-06 09:05:52 -05:00
Joel Martin
f172407be6 elm: update Dockerfile to ubuntu:24.04.
Add DEBIAN_FRONTEND=noninteractive to bypass tzdata interactive query.
2024-08-06 08:40:59 -05:00
Nicolas Boulenguez
e984ed8801 elm: merge more ideas from #450
Various trivial changes reducing the diff to #450.

Dockerfile: npm already depends on nodejs

Core.elm: change profile of deepEquals instead of uncurrying before
each call.
2024-08-06 08:24:09 -05:00
Nicolas Boulenguez
0068653bf9 elm: merge ideas from #450
It was necessary to rename some ambiguous variables. Some more names
could probably be changed in order to reduce the diff with #450 (my
names were choosen in order to reduce the diff with master...)

Peek ideas from #450:
- sort imports
- skip a line between '->' or before 'else'
- no indentation after 'in'
- fix indentation when it was only intended to reduce diff
- remove some unneeded parenthesis
and
- if .. return True else False -> ...
2024-08-06 08:24:09 -05:00