1
1
mirror of https://github.com/kanaka/mal.git synced 2024-07-14 17:10:30 +03:00
Commit Graph

23 Commits

Author SHA1 Message Date
Nicolas Boulenguez
fbfe6784d2 Change quasiquote algorithm
- Add a `vec` built-in function in step7 so that `quasiquote` does not
  require `apply` from step9.
- Introduce quasiquoteexpand special in order to help debugging step7.
  This may also prepare newcomers to understand step8.
- Add soft tests.
- Do not quote numbers, strings and so on.

Should ideally have been in separate commits:
- elisp: simplify and fix (keyword :k)
- factor: fix copy/paste error in let*/step7, simplify eval-ast.
- guile: improve list/vector types
- haskell: revert evaluation during quasiquote
- logo, make: cosmetic issues
2020-08-11 01:01:56 +02:00
Nicolas Boulenguez
dcaf3f213c Improve answer to exercises
The identity function is not used in the answers.
Sort list, prn, hash-map by increasing difficulty.
Fix indentation consistency in concat.
Avoid using the same identifier twice.
In do3, make explicit that acc is not used.
In _quasiquote_iter, call the tested quasiquote2 instead of the original quasiquote.
In the quoting section, add foldr_pairs to hide recursions.
The compose function is not used in the answers.
2020-07-21 17:48:45 +02: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
Nicolas Boulenguez
0f37b1af06 exercises: progressive solution for let* 2019-07-17 11:01:02 +02: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
7977c2cb5e exercises: quote with macros 2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
4f72e010a6 Update paths to prepare merge of extend-core.mal branch 2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
42d31a20ba exercises: recommend not to override nth permanently 2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
9678065e17 Exercises: improve, add questions about folds.
Rename the question file for consistency with answer file.
Give an explicit command to copy/paste for tests.
Warn about defining `nth` with `cond`.
Fix typo in let2.
Use tools from core.mal in answers.
2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
1ca3ee3dcd exercices: fix apply again. It must be a function, not a macro.
It is more interesting to ask an implementation of count from empty?
than the reverse.

Ask for nth, map, concat and conj.

Allow core.mal in answers. Currently, requires the branch with foldr.
2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
304930e749 exercises: fix apply reimplementation, add Joel's hints for maps 2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
0544b52f1a Draft exercise suggesting native implementations of some built-in functions. 2019-05-30 16:46:04 +02:00
Nicolas Boulenguez
a1805b96af Move tests of lib/ and new tests of core.mal to tests/lib/.
Partial translation of examples from lib/ to new tests.

Correct test of memoize.

`reduce`, `foldr`, `every?`, `some` and `and` were previously not
tested in tests/step*.mal. Tests them in `tests/lib/` instead.
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
Sebastian Rasmussen
0198b7a230 Fix a number of typos in documentation/comments. 2017-09-15 20:00:15 +02:00
Joel Martin
e17aef048e Misc fixes and TODO updates.
- Truncate ruby and python stacktraces since they can get very long
  in certain cases causing problems.
- Fix Clojure West example with proper escaping.
2017-09-15 00:00:23 -05:00
Joel Martin
044eb1c758 examples/pprint.mal: comment out inline tests. 2016-02-10 16:21:33 -06:00
Joel Martin
531d0798ce Simple pprint example.
Answering #165.
2016-02-10 16:19:32 -06:00
Dov Murik
a624ba4b67 examples: add memoize.mal as a usage example for atoms 2015-12-10 12:51:39 -05:00
Dov Murik
513810af6b add examples/eqaulity.mal
Implementations that don't have proper native comparison of hash-maps
and sequences can load examples/equality.mal for a pure-mal
implementation.
2015-11-17 14:41:06 -05:00
Joel Martin
a076db29a0 examples/: add chouser's protocols.mal file.
Originally from: https://gist.github.com/Chouser/6081ea66d144d13e56fc
2015-11-12 17:03:17 -06:00
Joel Martin
cb0533b0e8 Move mal code examples from mal/ to examples/ 2015-11-12 17:00:55 -06:00