((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/simple-cells" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "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") (toc)) (section 2 "The cell datatype" (p "In their paper \"The First Report on Scheme Revisited\", the authors Sussman and Steele remarked") (p "\"We also now believe that Carl Hewitt was right: we would have been better off to have introduced cells as a separate, primitive kind of object, rather than allowing assignment to any and every lambda-bound variable.\"") (p "This module implements the cell datatype as a procedure of zero or one argument. Using it instead of set!  set-car! and set-cdr! you have what Hewitt proposed ...") (section 3 "The API" (section 4 "simple-cells" (def (sig (procedure "(simple-cells sym ..)" (id simple-cells))) (p "Documentation procedure. Without argument, returns the list of exported symbols, with argument the documentation of that symbol."))) (section 4 "cell" (def (sig (procedure "(cell var . tests)" (id cell))) (p "Constructor. Creates a cell as a procedure of zero or one argument, initialising its content to var provided all tests succedd. Without argument returns two values, the content of the cell and the list of test predicates. With argument, replaces the cell's content with that very argument, provided all tests succead."))) (section 4 "cell?" (def (sig (procedure "(cell? xpr)" (id cell?))) (p "Type predicate."))) (section 4 "cell-of?" (def (sig (procedure "((cell-of? ok?) xpr)" (id cell-of?))) (p "is xpr a cell which passes the ok? test?")))) (section 3 "Requires" (p "simple-exceptions 0.5")) (section 3 "Examples" (highlight scheme "\n(use simple-cells simple-exceptions)\n\n(define o% (cell 5 integer? odd?))\n(cell? o%) ; -> #t\n((cell-of? number?) o%) ; -> #t\n((cell-of? even?) o%) ; -> #f\n(o%) ; -> 5\n(condition-case (o% 4) ((exn arguments) #f)) ; -> #f\n(o%) ; -> 5\n(define n% (cell 4 (named-lambda 3<=? (x) (<= 3 x))))\n(n%) ; -> 4\n(receive (val checks) (n%) checks) ; -> (<procedure (3<=? x)>)\n(n% 20)\n(n%) ; -> 20\n(o%) ; -> 5\n(receive (val checks) (o%) checks)\n  ; -> (<procedure (number? x)> <procedure (odd? x)>)\n"))) (section 2 "Last update" (p "Mar 17, 2018")) (section 2 "Author" (p (int-link "/users/juergen-lorenz" "Juergen Lorenz"))) (section 2 "License" (pre "Copyright (c) 2017-2018, Juergen Lorenz\nAll rights reserved.") (pre "Redistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\nRedistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\nNeither the name of the author nor the names of its contributors may be\nused to endorse or promote products derived from this software without\nspecific prior written permission. \n  \nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")) (section 2 "Version History" (dl (dt "1.3") (dd "cell-of? added") (dt "1.2.1") (dd "dependency on simple-exceptions updated") (dt "1.2") (dd "now working with simple-exceptions 0.5") (dt "1.1") (dd "cells now return old content on change") (dt "1.0") (dd "initial import"))))