Mew is a library targetting R5RS/R7RS scheme, which provides some
conveniences inspired from Goo, Clojure and Arc to allow writing more
compact code.
== Design goals
Mew, in its current iteration, is designed as a Scheme library. Even
though a program written in Mew will look quite different to a plain
Scheme program, code is compatible, and Scheme code can generally live
inside a Mew program, and Mew can load Scheme libraries. Extra care
has been taken to not reuse identifiers found in important SRFIs.
Mew code is tight code, commonly used Mew identifiers are short.
Mew uses a few features of R7RS internally, but does not require using
R7RS.
Mew targets Chicken Scheme currently but should be easy to port to
other Scheme implementations.
Mew is multi-paradigm: it simplifies both writing imperative and
functional code.
Mew uses SRFI-158 (Generators and Accumulators) for generic functions
on enumerable structures.
Mew generally uses {{equal?}} as equality predicate.
Mew never mutates lists.
== Re-Exports
Mew re-exports
SRFI-1 (List library),
SRFI-69 (Basic hash tables),
SRFI-158 (Generators and Accumulators),
{{(chicken io)}},
{{(chicken irregex)}},
{{(chicken pretty-print)}}},
{{(chicken sort)}}},
and {{matchable}}.
== Definitions, bindings and assignments
(def )
(def ( ) )
Alias for {{define}}.
(fun ...)
Alias for {{lambda}}.
(fun* ...)
Lambda which pattern matches all its arguments (ala the {{match}} macro).
(loc ( ... ) )
Binds local variables in pattern (ala the {{match}} macro)
{{pat1}} to the result of evaluating {{val1}},
then {{pat2}} to {{val2}}, etc., then evaluates {{body}}.
Assignments can refer to previously assigned values of the {{loc}}.
(andloc ( ... ) )
Like {{loc}} (without pattern matching), but return false when one of
the {{>}} evaluates to false. If a {{}} is {{_}},
only performs the check without binding a value.
(rec )
(rec ( ) )
See Module%20(chicken%20base)#rec or SRFI-31.
Often, using {{def}} in an inner scope is preferable to using {{rec}}.
(set )
Like {{set!}}, but also return the value of {{}}.
== Control flow
(esc )
Bind {{}} to the current continuation, then run {{}}.
Code should not pass {{}} outside the lexical scope
and only call it once---use {{call/cc}} else.
(fin . )
Evaluate {{}}, then evaluate {{}}, even if {{}}
used a non-local exit (as from {{esc}}).
Returns value of {{}}, so can also be used as a replacment
for Common Lisp PROG1.
(rep ( ... ) ...)
Explicit form of named {{let}}, using {{loc}} binding syntax.
Assignments cannot refer to previously assigned values of the {{rep}}.
(seq . )
Alias for {{begin}}.
(unless ...)
(when ...)
As in R7RS-small.
(while ...)
(until ...)
Evaluate {{}} while {{}} is true/false.
== Numeric helpers
(inc )
(dec )
Increment or decrement the argument by 1.
(div . )
Alias for {{floor-quotient}}.
(mod . )
Alias for {{floor-remainder}}.
== General helpers
(app . )
Alias for {{apply}}.
(op
Returns a procedure that evaluates {{