Mew is a library targetting R5RS/R7RS scheme, which provides some
conveniences inspired from Goo, Clojure, T 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 provided by 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.
Except for few shortcut macros ({{op}} and {{op*}),
Mew endorses macro hygiene.
== Re-Exports
Mew re-exports
SRFI-1 (List library),
SRFI-13 (String Libraries) (from {{utf8-srfi-13}}),
SRFI-69 (Basic hash tables),
SRFI-158 (Generators and Accumulators),
{{(chicken io)}},
{{(chicken irregex)}},
{{(chicken pretty-print)}}},
{{(chicken sort)}}},
{{matchable}},
and {{err}} (see {{err.svnwiki}}).
== 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 . )
Like {{begin}}, but allows {{}} to be empty and returns a value
which is {{void?}} then.
(unless ...)
(when ...)
As in R7RS-small.
(while ...)
(until ...)
Evaluate {{}} while {{}} is true/false.
(xcond ...)
Like {{cond}}, but raise error if no case matched.
(fail ? ...)
Create and signal a condition of {{}} (default: {{(exn)}})
with a {{'message}} of {{}} passed through {{format}} with
{{}}.
== Numeric helpers
(inc )
(dec )
Increment or decrement the argument by 1.
(inc! [])
(dec! [])
Increment or decrement the location {{}} by {{}} (default: 1).
(div )
Alias for {{floor-quotient}}.
(mod )
Alias for {{floor-remainder}}.
(sgn )
Returns -1, 0, 1 depending on whether {{}} is negative, zero, or positve.
== General helpers
(app . )
Like {{apply}}, but supports empty {{}}.
(op
Returns a procedure that evaluates {{