1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00
Commit Graph

16 Commits

Author SHA1 Message Date
Joel Martin
8a19f60386 Move implementations into impls/ dir
- Reorder README to have implementation list after "learning tool"
  bullet.

- This also moves tests/ and libs/ into impls. It would be preferrable
  to have these directories at the top level.  However, this causes
  difficulties with the wasm implementations which need pre-open
  directories and have trouble with paths starting with "../../". So
  in lieu of that, symlink those directories to the top-level.

- Move the run_argv_test.sh script into the tests directory for
  general hygiene.
2020-02-10 23:50:16 -06:00
Nicolas Boulenguez
e6d41de4d5 load-file: accept empty file or final comment, return nil
Let `load-file` append a new line in case last line contains a
comment.

Also append `nil` so that the return value is predictible. Remove the
existing explicit `nil` from existing sources.

Adapt documentation and tests.
2019-07-28 13:08:05 +02:00
Joel Martin
03a2a69679
Merge pull request #423 from asarhaddon/trivial-from-401
Trivial commits from 401
2019-07-17 18:05:54 -05:00
Joel Martin
12c29f0c51
Merge pull request #361 from asarhaddon/exercise-native-implementations
Draft exercise, native implementations of some built-in functions.
2019-07-17 18:03:10 -05:00
Nicolas Boulenguez
b3f9b5a0a3 lib/perf.mal (trivial): println instead of prn and str 2019-07-18 00:00:03 +02:00
Nicolas Boulenguez
13e679cdde lib/load-file-once: basic support for multiple imports 2019-07-16 00:16:44 +02:00
Nicolas Boulenguez
e748a37d49 mal: modify lib/ in order to hide bugs in make/ and guile/
Make: avoid # character.
Guile: avoid `unquote` inside a vector inside a list inside `quasiquote`.
The bug in scheme/ is most probably the same.
2019-07-09 14:05:29 +02:00
Nicolas Boulenguez
b1a8dbd55f mal: rename macro? to _macro?. Also rename bool-and in lib/equality.mal. 2019-07-09 14:05:29 +02:00
Nicolas Boulenguez
26ced15b31 Remove gensym, inc and or from step files.
* Move `gensym` and `inc` from step files to `lib/trivial.mal`.
* Move `or` from step files to `lib/test_cascade.mal`.
  Shorten it because `(first ())` returns `nil`
* Update process and tests accordingly (not the figures yet).
2019-07-09 14:05:29 +02:00
Chris McCormick
d0efab8745 Added alias hacks from frock to lib. See #321.
Thanks @asarhaddon for your guidance.
2019-07-01 16:06:20 +08:00
Nicolas Boulenguez
9c20ca3f39 exercises: rebase, improve quasiquote and let*, avoid circular dependencies.
* Avoid including `lib/*.mal` to prevent unexpected circular
  dependencies (bitten by `foldr` using `nth`).
* Ask `quote` before `let*`, the latter requires the former.
  Answer previous questions without `let*`.
* Tell the reader that `let*` has various levels of difficulty.
* Drop implicit dependency on `or`, soon out of step files.
* Allow simple recursion in `let*` via a combinator.
2019-05-30 19:00:45 +02:00
Nicolas Boulenguez
9bdff6ea55 lib/ README.md should not repeat the process unless needed 2019-05-19 19:17:55 +02:00
Nicolas Boulenguez
83665b4fda lib/: add tests, fix detected problems, improve implementations
equality.mal:
- fix typos
- let and2 and or2 always return booleans
- when looping in sequences, compare lengths only once
- empty? instead of an equality test
- when looping on a keys, do not check if a contains the current key
- change the `cond` logic: when a is a sequence and b a map, return
  false instead of delegating to scalar-equal?.
- add tests

memoize.mal:
- make explicit that the function name must be kept
- fix typo in tests

protocols.mal:
- document
- add a function mapping an object to its type
- add default types for remaining built-in MAL values
- let defprotocol return the new protocol instead of last method
- set the right profile for abstract methods, improving error messages
- replace incomplete example with lots of tests

pprint:
- escape parenthesis in expected test results

[kanaka]
- explain in lib/README.md how to run tests/lib/*.
- rename folds to reducers and composition to threading
- move fib and sumdown from lib/ to tests/
2019-05-18 01:52:13 +02:00
Nicolas Boulenguez
bf6647fbb3 Fix style issues in lib/.
This diff is best viewed without space differences.
2019-05-18 01:52:13 +02:00
Nicolas Boulenguez
dcdb6c029e lib/: perform file splits, without change in contents 2019-05-18 01:52:13 +02:00
Nicolas Boulenguez
3e9b89d4b5 Prepare move of reusable code to lib/.
Changes creating huge diffs, like file splits, have been delayed for
readability .
Also fix description of `and`.
2019-05-18 01:52:13 +02:00