Mew is a library targetting R5RS/R7RS scheme, which provides some conveniences inspired from Goo, Clojure and Arc to allow writing more compact code. == Re-Exports Mew re-exports SRFI-69 (Basic hash tables), SRFI-158 (Generators and Accumulators), and {{matchable}}. == Definitions, bindings and assignments (def ) (def ( ) ) Alias for {{define}}. (fun ) Alias for {{lambda}}. (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}}. (rec ) (rec ( ) ) See Module%20(chicken%20base)#rec or SRFI-31. Often, using {{def}} in an inner scope is preferable to using {{rec}}. (set ) Alias for {{set!}}. == 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. (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 {{}} with {{_}} bound to its only argument. If {{>} is empty, behaves as {{(op _)}}, i.e. the identity function. {{(op 5)}} is the function that always returns 5. {{(op + 2 _)}} is the function that adds 2 to its argument. (str . ) Returns a new string composed by concatenating the strings given by applying {{display}} to all {{}}. == I/O helpers (prn . ) {{write}} all {{args}} separated by spaces and terminated by a newline to the current output stream. (puts . ) {{display}} all {{args}} terminated by a newline to the current output stream. (eof) Return an object for which {{eof-object?}} is true. == Data types (get ) (at ) (set (at ) ) Generalized accessor, supports indexing into lists, vectors, hash-tables, strings. (tbl ... ) Construct a hash-table; using {{equal?}}. (keys ) Alias for {{hash-table-keys}}. (vals ) Alias for {{hash-table-values}}. (keyvals ) Return a list of alternating keys and values of the hash table. (empty? ) Test if {{}} is an empty list/string/vector/hash-table. (len ) Return the length of the list/vector/string/hash-table/generator {{}}. (for ( ) ...) (for (( ) ) ...) If {{}} is a list or a vector, iterate over its elements. If {{}} is a procedure, consider it a SRFI-158 generator and iterate over its values. If {{}} is a hash-table, iterate over its keys and values. == Generators (cycle ...) Alias for {{circular-generator}}. (range ...) Alias for {{make-range-generator}}. (giterate ) Generator returning {{}}, {{( )}}, {{( ()))}}... (gfix ) Returns a generator that runs the generator {{}} until it yields a value {{equal?}} to the preceding one, then stops. (last ) Run the generator {{}} until it stops and return the last value.