Comments (5)
Look at the examples
subdir for some, well, examples, like Clojure-like protocols.
For a bunch of more Mal code (like a Mal tokenizer and parser) you can look at my malc repository, though I can't recommend specific reusable functions on top of my head.
@kanaka and I previously discussed adding a lib
subdir with core.mal
and a bunch of other stuff (even move tokenizer.mal
from malc). It hasn't happened (yet).
from mal.
@ktodyruik yes, please feel free to send pull requests that add useful functions to the examples/
subdir. At some point, we'll re-organize to move more lib/contrib related stuff to a separate directory. If you include a test file in the same directory for now (and using the standard format), that would be great too.
from mal.
@ktodyruik also a lot of Clojure functions and macros should port to mal fairly easily as long as they don't rely on protocols or lazy sequences. The semantics and data structures in mal are modeled after Clojure.
from mal.
@kanaka Could you elaborate on what you meant by "If you include a test file in the same directory for now (and using the standard format), that would be great too." Thanks.
from mal.
The test syntax I'm referring to is that used in tests/*
. And you can run runtest.py
directly to run mal tests. For example, consider you defined a sumdown
function in examples/sumdown.mal
:
(def! sumdown (fn* (N) (if (> N 0) (+ N (sumdown (- N 1))) 0)))
The you could define a test file test_sumdown.mal
like this:
(load-file "sumdown.mal")
(sumdown 0)
;=>0
(sumdown 1)
;=>1
(sumdown 5)
;=>15
You can now run those tests using a specific implementation like this:
mal/examples $ ../runtest.py test_sumdown.mal ../js/run
Started with:
Mal [javascript]
TEST: (load-file "sumdown.mal") -> ['',*] -> SUCCESS
TEST: (sumdown 0) -> ['',0] -> SUCCESS
TEST: (sumdown 1) -> ['',1] -> SUCCESS
TEST: (sumdown 5) -> ['',15] -> SUCCESS
TEST RESULTS (for test_sumdown.mal):
0: soft failing tests
0: failing tests
4: passing tests
4: total tests
from mal.
Related Issues (20)
- Verilog: is there a good reason mal has not been implemented? HOT 1
- VHDL: defmacro! doesn't modify existing functions HOT 1
- make "test^js^step0" fails -- Fatal error in , line 0 -- Check failed: result.second. HOT 1
- PDFs?
- Somebody should solve Rosetta Code challenges with mal
- Mal in Coq? HOT 2
- Apparently in step 3 'env' is a class or structure type, not an object
- Questions on different design from lisp: Mal symbol do not use property lists?
- Lots of unanswered merge requests HOT 1
- Why is quasiquote so complicated? HOT 3
- What with `` gensym ''
- lexicial versus dynamic
- Floats don't work in the python implementation. HOT 2
- Is #mal IRC channel still active? people seems tends to use discord now XD HOT 1
- Should `eval` use the top-level environment? HOT 1
- How is `cond` supposed to work? HOT 2
- Remaining impls to combine eval-ast/macroexpand into eval HOT 4
- common-lisp fails to build HOT 1
- Fix self-hosted test failures HOT 24
- Vala in self-hosted mode (i.e. running mal) has rare memory corruption (probably in throw/try/catch) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mal.