Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for [[/eggref/4/strictly-pretty|the CHICKEN 4 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-4.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == Introduction The {{strictly-pretty}} library is an implementation of the algebraic pretty printer described by Christian Lindig in his paper [[http://citeseer.ist.psu.edu/lindig00strictly.html|Strictly Pretty]]. == Requires ; [[datatype]] == Library procedures === {{doc?:: OBJECT -> BOOL}} A predicate that returns true if the given argument is a pretty-printer object constructed with the procedures in this library. === {{doc:empty?:: DOC -> BOOL}} Returns true if the given document object is empty, false otherwise. === {{doc:empty:: () -> DOC}} Returns an empty document object. === {{doc:cons:: DOC * DOC -> DOC}} Returns a document object that contains the concatenated pair of documents. === {{doc:text:: STRING -> DOC}} Returns a document object that contains the given string. === {{doc:nest:: INDENT * DOC -> DOC}} Returns an inner document group that contains the given document, which will be broken up at the given indentation. === {{doc:break:: () -> DOC}} Returns an optional line break object. === {{doc:break-with:: STRING -> DOC}} Returns an optional line break object that uses the given string to delimit the break. === {{doc:group:: DOC -> DOC}} Returns a document group that contains the given document. === {{doc:concat:: LST -> DOC}} Concatenates the documents in the given list. === {{doc:binop:: INDENT -> LEFT * OPER * RIGHT -> DOC}} A parameterizable formatter for infix binary operation expressions. Given an indentation level {{INDENT}}, returns a procedure that takes a left operand (document object), operator (string), and a right operand (document object) and returns a document object that contains the formatted expression. === {{doc:ifthen:: INDENT * IF * THEN * ELSE -> COND * IFTRUE * IFFALSE -> DOC}} A parameterizable formatter for if-then-else expressions. Given an indentation level {{INDENT}}, and document objects that represent {{if,then,else}} keywords, respectively, returns a procedure that takes a condition (document object), true branch (string), and false branch (document object) and returns a document object that contains the formatted expression. === {{doc:list:: INDENT * ELEM->DOC * SEP -> LST -> DOC}} A parameterizable formatter for list expressions. Given an indentation level {{INDENT}}, a procedure that creates document object representations of the elements of the list, and a document object that represents the list element separator, returns a procedure that takes a list of elements and returns a document object that contains the formatted expression. === {{doc:block:: INDENT * OPEN * CLOSE -> BODY -> DOC}} A parameterizable formatter for block expressions. Given an indentation level {{INDENT}}, and document objects that represent block open and close markers, returns a procedure that takes a document object and returns a new document object that encloses the given object in a block. === {{doc:letblk:: INDENT * LET * IN * END -> E1 * E2 -> DOC}} A parameterizable formatter for let expressions (local binding). Given an indentation level {{INDENT}}, and document objects that represent {{let,in,end}} keywords, respectively, returns a procedure that takes bindings block (document object) and body block (document object) and returns a document object that contains the formatted expression. === {{doc:display:: WIDTH * DOC -> UNDEFINED}} Formatted display procedure. === {{doc:format:: WIDTH * DOC -> SDOC}} A procedure that generates simple document representation of the given document object. === {{sdoc?:: OBJECT -> BOOL}} A predicate that returns true if the given argument is a simple document object. === {{sdoc->string:: SDOC -> STRING}} Generates string representation of the given simple document object. == Example <enscript highlight="scheme"> (define cond1 ((doc:binop 2) (doc:text "a") (doc:text "==") (doc:text "b"))) (define e1 ((doc:binop 2) (doc:text "a") (doc:text "<<") (doc:text "2"))) (define e2 ((doc:binop 2) (doc:text "c") (doc:text "+") (doc:text "d"))) (define doc1 ((doc:ifthen 2 (doc:text "if") (doc:text "then") (doc:text "else")) cond1 e1 e2)) (define doc2 ((doc:block 2 (doc:text "(") (doc:text ")")) doc1)) (define doc3 ((doc:list 2 (lambda (x) x) doc:break) (list e1 e2))) (define doc4 ((doc:letblk 2 (doc:text "program") (doc:text "in") (doc:text "end")) doc3 doc1)) (print (sdoc->string (doc:format 32 doc4))) (print (sdoc->string (doc:format 10 doc4))) </enscript> == Authors Ivan Raikov == Version ; 1.3 : Added doc:empty? procedure ; 1.2 : Now using matchable extension ; 1.1 : Added doc:connect to list of exports ; 1.0 : Initial version == License Copyright 2008 Ivan Raikov and the Okinawa Institute of Science and Technology. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 17 to 8?