"Copyright (c) 2015, Mark Tarver All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of Mark Tarver may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Mark Tarver ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Mark Tarver BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." (defun load (V1498) (let Load (let Start (get-time run) (let Result (shen.load-help (value shen.*tc*) (read-file V1498)) (let Finish (get-time run) (let Time (- Finish Start) (let Message (shen.prhush (cn " run time: " (cn (str Time) " secs ")) (stoutput)) Result))))) (let Infs (if (value shen.*tc*) (shen.prhush (cn " typechecked in " (shen.app (inferences) " inferences " shen.a)) (stoutput)) shen.skip) loaded))) (defun shen.load-help (V1505 V1506) (cond ((= false V1505) (shen.for-each (lambda X (shen.prhush (shen.app (shen.eval-without-macros X) " " shen.s) (stoutput))) V1506)) (true (let RemoveSynonyms (mapcan (lambda X (shen.remove-synonyms X)) V1506) (let Table (mapcan (lambda X (shen.typetable X)) RemoveSynonyms) (let Assume (shen.for-each (lambda X (shen.assumetype X)) Table) (trap-error (shen.for-each (lambda X (shen.typecheck-and-load X)) RemoveSynonyms) (lambda E (shen.unwind-types E Table))))))))) (defun shen.remove-synonyms (V1508) (cond ((and (cons? V1508) (= shen.synonyms-help (hd V1508))) (do (eval V1508) ())) (true (cons V1508 ())))) (defun shen.typecheck-and-load (V1510) (do (nl 1) (shen.typecheck-and-evaluate V1510 (gensym A)))) (defun shen.typetable (V1516) (cond ((and (cons? V1516) (and (= define (hd V1516)) (cons? (tl V1516)))) (let Sig (compile (lambda Y (shen. Y)) (tl (tl V1516)) (lambda E (simple-error (shen.app (hd (tl V1516)) " lacks a proper signature. " shen.a)))) (cons (cons (hd (tl V1516)) Sig) ()))) (true ()))) (defun shen.assumetype (V1518) (cond ((cons? V1518) (declare (hd V1518) (tl V1518))) (true (shen.f_error shen.assumetype)))) (defun shen.unwind-types (V1525 V1526) (cond ((= () V1526) (simple-error (error-to-string V1525))) ((and (cons? V1526) (cons? (hd V1526))) (do (shen.remtype (hd (hd V1526))) (shen.unwind-types V1525 (tl V1526)))) (true (shen.f_error shen.unwind-types)))) (defun shen.remtype (V1528) (set shen.*signedfuncs* (shen.removetype V1528 (value shen.*signedfuncs*)))) (defun shen.removetype (V1536 V1537) (cond ((= () V1537) ()) ((and (cons? V1537) (and (cons? (hd V1537)) (= (hd (hd V1537)) V1536))) (shen.removetype (hd (hd V1537)) (tl V1537))) ((cons? V1537) (cons (hd V1537) (shen.removetype V1536 (tl V1537)))) (true (shen.f_error shen.removetype)))) (defun shen. (V1539) (let Parse_shen. (shen. V1539) (if (not (= (fail) Parse_shen.)) (let Parse_ ( Parse_shen.) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) (shen.hdtl Parse_shen.)) (fail))) (fail)))) (defun write-to-file (V1542 V1543) (let Stream (open V1542 out) (let String (if (string? V1543) (shen.app V1543 " " shen.a) (shen.app V1543 " " shen.s)) (let Write (pr String Stream) (let Close (close Stream) V1543)))))