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 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/strictly-pretty|the CHICKEN 5 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-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == strictly-pretty [[toc:]] === 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]]. === Library procedures <procedure>doc?:: OBJECT -> BOOL</procedure> A predicate that returns true if the given argument is a pretty-printer object constructed with the procedures in this library. <procedure>doc:empty?:: DOC -> BOOL</procedure> Returns true if the given document object is empty, false otherwise. <procedure>doc:empty:: () -> DOC</procedure> Returns an empty document object. <procedure>doc:cons:: DOC * DOC -> DOC</procedure> Returns a document object that contains the concatenated pair of documents. <procedure>doc:text:: STRING -> DOC</procedure> Returns a document object that contains the given string. <procedure>doc:nest:: INDENT * DOC -> DOC</procedure> Returns an inner document group that contains the given document, which will be broken up at the given indentation. <procedure>doc:break:: () -> DOC</procedure> Returns an optional line break object. <procedure>doc:break-with:: STRING -> DOC</procedure> Returns an optional line break object that uses the given string to delimit the break. <procedure>doc:group:: DOC -> DOC</procedure> Returns a document group that contains the given document. <procedure>doc:concat:: LST -> DOC</procedure> Concatenates the documents in the given list. <procedure>doc:binop:: INDENT -> LEFT * OPER * RIGHT -> DOC</procedure> 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. <procedure>doc:ifthen:: INDENT * IF * THEN * ELSE -> COND * IFTRUE * IFFALSE -> DOC</procedure> 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. <procedure>doc:list:: INDENT * ELEM->DOC * SEP -> LST -> DOC</procedure> 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. <procedure>doc:block:: INDENT * OPEN * CLOSE -> BODY -> DOC</procedure> 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. <procedure>doc:letblk:: INDENT * LET * IN * END -> E1 * E2 -> DOC</procedure> 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. <procedure>doc:display:: WIDTH * DOC -> UNDEFINED</procedure> Formatted display procedure. <procedure>doc:format:: WIDTH * DOC -> SDOC</procedure> A procedure that generates simple document representation of the given document object. <procedure>sdoc?:: OBJECT -> BOOL</procedure> A predicate that returns true if the given argument is a simple document object. <procedure>sdoc->string:: SDOC -> STRING</procedure> 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> === Author [[/users/ivan-raikov|Ivan Raikov]] === Version ; 1.4 : Ported to Chicken 4 ; 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-2010 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 4 to 12?