<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Test Suite</title> <!-- 2014-12-23 Di 22:50 --> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="generator" content="Org-mode" /> <meta name="author" content="Arne Babenhauserheide" /> <style type="text/css"> <!--/*--><![CDATA[/*><!--*/ .title { text-align: center; } .todo { font-family: monospace; color: red; } .done { color: green; } .tag { background-color: #eee; font-family: monospace; padding: 2px; font-size: 80%; font-weight: normal; } .timestamp { color: #bebebe; } .timestamp-kwd { color: #5f9ea0; } .right { margin-left: auto; margin-right: 0px; text-align: right; } .left { margin-left: 0px; margin-right: auto; text-align: left; } .center { margin-left: auto; margin-right: auto; text-align: center; } .underline { text-decoration: underline; } #postamble p, #preamble p { font-size: 90%; margin: .2em; } p.verse { margin-left: 3%; } pre { border: 1px solid #ccc; box-shadow: 3px 3px 3px #eee; padding: 8pt; font-family: monospace; overflow: auto; margin: 1.2em; } pre.src { position: relative; overflow: visible; padding-top: 1.2em; } pre.src:before { display: none; position: absolute; background-color: white; top: -10px; right: 10px; padding: 3px; border: 1px solid black; } pre.src:hover:before { display: inline;} pre.src-sh:before { content: 'sh'; } pre.src-bash:before { content: 'sh'; } pre.src-emacs-lisp:before { content: 'Emacs Lisp'; } pre.src-R:before { content: 'R'; } pre.src-perl:before { content: 'Perl'; } pre.src-java:before { content: 'Java'; } pre.src-sql:before { content: 'SQL'; } table { border-collapse:collapse; } caption.t-above { caption-side: top; } caption.t-bottom { caption-side: bottom; } td, th { vertical-align:top; } th.right { text-align: center; } th.left { text-align: center; } th.center { text-align: center; } td.right { text-align: right; } td.left { text-align: left; } td.center { text-align: center; } dt { font-weight: bold; } .footpara:nth-child(2) { display: inline; } .footpara { display: block; } .footdef { margin-bottom: 1em; } .figure { padding: 1em; } .figure p { text-align: center; } .inlinetask { padding: 10px; border: 2px solid gray; margin: 10px; background: #ffffcc; } #org-div-home-and-up { text-align: right; font-size: 70%; white-space: nowrap; } textarea { overflow-x: auto; } .linenr { font-size: smaller } .code-highlighted { background-color: #ffff00; } .org-info-js_info-navigation { border-style: none; } #org-info-js_console-label { font-size: 10px; font-weight: bold; white-space: nowrap; } .org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold; } /*]]>*/--> </style> <script type="text/javascript"> /* @licstart The following is the entire license notice for the JavaScript code in this tag. Copyright (C) 2012-2013 Free Software Foundation, Inc. The JavaScript code in this tag is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License (GNU GPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The code is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. As additional permission under GNU GPL version 3 section 7, you may distribute non-source (e.g., minimized or compacted) forms of that code without the copy of the GNU GPL normally required by section 4, provided you include this license notice and a URL through which recipients can access the Corresponding Source. @licend The above is the entire license notice for the JavaScript code in this tag. */ <!--/*--><![CDATA[/*><!--*/ function CodeHighlightOn(elem, id) { var target = document.getElementById(id); if(null != target) { elem.cacheClassElem = elem.className; elem.cacheClassTarget = target.className; target.className = "code-highlighted"; elem.className = "code-highlighted"; } } function CodeHighlightOff(elem, id) { var target = document.getElementById(id); if(elem.cacheClassElem) elem.className = elem.cacheClassElem; if(elem.cacheClassTarget) target.className = elem.cacheClassTarget; } /*]]>*///--> </script> </head> <body> <div id="content"> <h1 class="title">Test Suite</h1> <p> The wisp test-suite consists of a large number of wisp-snippets and the corresponding scheme-code. </p> <p> A wisp-implementation may call itself compliant with the wisp test-suite if the code tree parsed from the wisp file is the same as a code tree parsed from the equivalent Scheme file. </p> <p> A wisp-implementation may call itself a compliant wisp pre-processor if it successfully converts each wisp-snippet into the corresponging scheme-snippet. Blank lines at the end of the file and non-functional white-space in the produced scheme-file do not matter for this purpose. </p> <p> This test-suite is also available in the <a href="http://draketo.de/proj/wisp">wisp repository</a> along with a script-runner (runtests.sh) which tests the reference wisp-implementation with GNU Guile against this testsuite.<sup><a id="fnr.1" name="fnr.1" class="footref" href="#fn.1">1</a></sup> </p> <div id="outline-container-sec-1" class="outline-2"> <h2 id="sec-1"><span class="section-number-2">1</span> tests/syntax-underscore.w</h2> <div class="outline-text-2" id="text-1"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">a</span> b c <span style="color: #0000ff;">_ d</span> e <span style="color: #0000ff;">___ f</span> <span style="color: #0000ff;">___</span> g h <span style="color: #0000ff;">__</span><span style="color: #a020f0;"> . </span>i <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">_</span> <span style="color: #0000ff;">_ display</span> <span style="color: #8b2252;">"hello\n"</span> <span style="color: #0000ff;">\_</span> </pre> </div> </div> </div> <div id="outline-container-sec-2" class="outline-2"> <h2 id="sec-2"><span class="section-number-2">2</span> tests/syntax-underscore.scm</h2> <div class="outline-text-2" id="text-2"> <div class="org-src-container"> <pre class="src src-scheme">(<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">a</span> b c) (d e (f) (g h) i)) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">_</span>) (display <span style="color: #8b2252;">"hello\n"</span>)) (_) </pre> </div> </div> </div> <div id="outline-container-sec-3" class="outline-2"> <h2 id="sec-3"><span class="section-number-2">3</span> tests/syntax-strings-parens.w</h2> <div class="outline-text-2" id="text-3"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">; </span><span style="color: #b22222;">Test linebreaks in strings and brackets</span> <span style="color: #a020f0;">. </span><span style="color: #8b2252;">"flubbub</span> <span style="color: #8b2252;">flabbab"</span> hrug (<span style="color: #0000ff;">nadda</span> <span style="color: #0000ff;">madda</span> gadda <span style="color: #8b2252;">"shoktom</span> <span style="color: #8b2252;"> mee"</span> <span style="color: #8b2252;">" sep </span> <span style="color: #8b2252;">ka"</span> <span style="color: #0000ff;"> hadda)</span> <span style="color: #0000ff;"> gom</span> <span style="color: #0000ff;">flu</span> <span style="color: #0000ff;">sum</span> [foo <span style="color: #0000ff;">bar]</span> barz {1 + [* <span style="color: #008b8b;">2</span> <span style="color: #008b8b;">2</span>]} <span style="color: #0000ff;">mara</span> { <span style="color: #0000ff;">li</span> <span style="color: #0000ff;">+</span> <span style="color: #0000ff;">lo</span> - (<span style="color: #0000ff;">mabba</span>) <span style="color: #0000ff;">}</span> </pre> </div> </div> </div> <div id="outline-container-sec-4" class="outline-2"> <h2 id="sec-4"><span class="section-number-2">4</span> tests/syntax-strings-parens.scm</h2> <div class="outline-text-2" id="text-4"> <div class="org-src-container"> <pre class="src src-scheme"><span style="color: #b22222;">; </span><span style="color: #b22222;">Test linebreaks in strings and brackets</span> <span style="color: #8b2252;">"flubbub</span> <span style="color: #8b2252;">flabbab"</span> (hrug (nadda madda gadda <span style="color: #8b2252;">"shoktom</span> <span style="color: #8b2252;"> mee"</span> <span style="color: #8b2252;">" sep </span> <span style="color: #8b2252;">ka"</span> hadda) (gom)) (flu) (sum [foo bar] barz {1 + [* 2 2]}) (mara { li + lo - (mabba) }) </pre> </div> </div> </div> <div id="outline-container-sec-5" class="outline-2"> <h2 id="sec-5"><span class="section-number-2">5</span> tests/syntax-indent.w</h2> <div class="outline-text-2" id="text-5"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #483d8b;">define</span> <span style="color: #0000ff;"> hello</span> who <span style="color: #0000ff;"> format</span> <span style="color: #008b8b;">#t</span> <span style="color: #8b2252;">"Hello ~A\n"</span> who <span style="color: #483d8b;">define</span> <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> :</span> <span style="color: #0000ff;"> a</span> <span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> b</span> <span style="color: #008b8b;">2</span> <span style="color: #0000ff;"> c</span> <span style="color: #008b8b;">3</span> <span style="color: #0000ff;"> format</span> <span style="color: #008b8b;">#t</span> <span style="color: #8b2252;">"a: ~A, b: ~A, c: ~A"</span> <span style="color: #0000ff;"> +</span> a <span style="color: #008b8b;">2</span> <span style="color: #a020f0;"> . </span> b c </pre> </div> </div> </div> <div id="outline-container-sec-6" class="outline-2"> <h2 id="sec-6"><span class="section-number-2">6</span> tests/syntax-indent.scm</h2> <div class="outline-text-2" id="text-6"> <div class="org-src-container"> <pre class="src src-scheme">(<span style="color: #a020f0;">define</span> (hello who) (format #t <span style="color: #8b2252;">"Hello ~A\n"</span> who)) (<span style="color: #a020f0;">define</span> (<span style="color: #a020f0;">let</span> ( (a 1) (b 2) (c 3)) (format #t <span style="color: #8b2252;">"a: ~A, b: ~A, c: ~A"</span> (+ a 2) b c))) </pre> </div> </div> </div> <div id="outline-container-sec-7" class="outline-2"> <h2 id="sec-7"><span class="section-number-2">7</span> tests/syntax-empty.w</h2> <div class="outline-text-2" id="text-7"> <div class="org-src-container"> <pre class="src src-wisp"></pre> </div> </div> </div> <div id="outline-container-sec-8" class="outline-2"> <h2 id="sec-8"><span class="section-number-2">8</span> tests/syntax-empty.scm</h2> <div class="outline-text-2" id="text-8"> <div class="org-src-container"> <pre class="src src-scheme"></pre> </div> </div> </div> <div id="outline-container-sec-9" class="outline-2"> <h2 id="sec-9"><span class="section-number-2">9</span> tests/syntax-dot.w</h2> <div class="outline-text-2" id="text-9"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">foo</span> <span style="color: #a020f0;"> . </span><span style="color: #8b2252;">"bar"</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">bar</span> <span style="color: #0000ff;"> '</span> <span style="color: #008b8b;">1</span> <span style="color: #a020f0;"> . . </span><span style="color: #008b8b;">2</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">pair</span> <span style="color: #0000ff;">display</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">foo</span> <span style="color: #0000ff;">newline</span> <span style="color: #0000ff;">display</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">bar</span> <span style="color: #0000ff;">newline</span> </pre> </div> </div> </div> <div id="outline-container-sec-10" class="outline-2"> <h2 id="sec-10"><span class="section-number-2">10</span> tests/syntax-dot.scm</h2> <div class="outline-text-2" id="text-10"> <div class="org-src-container"> <pre class="src src-scheme">(<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">foo</span>) <span style="color: #8b2252;">"bar"</span>) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">bar</span>) '(1 . 2 ))<span style="color: #b22222;">; </span><span style="color: #b22222;">pair</span> (display (foo)) (newline) (display (bar)) (newline) </pre> </div> </div> </div> <div id="outline-container-sec-11" class="outline-2"> <h2 id="sec-11"><span class="section-number-2">11</span> tests/syntax-colon.w</h2> <div class="outline-text-2" id="text-11"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> :</span> <span style="color: #0000ff;"> a</span> <span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> b</span> <span style="color: #008b8b;">2</span> <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> :</span> <span style="color: #a020f0;"> :</span> <span style="color: #a020f0;"> . </span>c <span style="color: #008b8b;">3</span> <span style="color: #0000ff;"> format</span> <span style="color: #008b8b;">#t</span> <span style="color: #8b2252;">"a: ~A, b: ~A, c: ~A"</span> <span style="color: #a020f0;"> . </span> a b c <span style="color: #a020f0;">: </span>a <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">hello</span> <span style="color: #0000ff;"> display</span> <span style="color: #8b2252;">"hello\n"</span> <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> : </span><span style="color: #0000ff;">a</span> <span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> b</span> <span style="color: #008b8b;">2</span> <span style="color: #0000ff;"> format</span> <span style="color: #008b8b;">#t</span> <span style="color: #8b2252;">"a: ~A, b: ~A"</span> <span style="color: #a020f0;"> . </span> a b <span style="color: #483d8b;">let</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">:</span> a ' : <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> : </span> <span style="color: #b22222;">; </span><span style="color: #b22222;">foo</span> <span style="color: #0000ff;"> a</span> ' <span style="color: #a020f0;">:</span> a <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">\:</span> <span style="color: #0000ff;"> hello</span> <span style="color: #0000ff;">\:</span> </pre> </div> </div> </div> <div id="outline-container-sec-12" class="outline-2"> <h2 id="sec-12"><span class="section-number-2">12</span> tests/syntax-colon.scm</h2> <div class="outline-text-2" id="text-12"> <div class="org-src-container"> <pre class="src src-scheme">(<span style="color: #a020f0;">let</span> ( (a 1) (b 2)) (<span style="color: #a020f0;">let</span> ( ( c 3)) (format #t <span style="color: #8b2252;">"a: ~A, b: ~A, c: ~A"</span> a b c))) ((a)) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">hello</span>) (display <span style="color: #8b2252;">"hello\n"</span>)) (<span style="color: #a020f0;">let</span> ((a 1) (b 2)) (format #t <span style="color: #8b2252;">"a: ~A, b: ~A"</span> a b)) (<span style="color: #a020f0;">let</span> ((a '()))) (<span style="color: #a020f0;">let</span> ( <span style="color: #b22222;">; </span><span style="color: #b22222;">foo</span> (a '()))) ( (a)) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">:</span>) (hello)) (:) </pre> </div> </div> </div> <div id="outline-container-sec-13" class="outline-2"> <h2 id="sec-13"><span class="section-number-2">13</span> tests/sublist.w</h2> <div class="outline-text-2" id="text-13"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">; </span><span style="color: #b22222;">sublists allow to start single line function calls with a colon ( : ).</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">a</span> b c <span style="color: #483d8b;">let</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">:</span> e<span style="color: #a020f0;"> . </span>f <span style="color: #a020f0;"> . </span>g </pre> </div> </div> </div> <div id="outline-container-sec-14" class="outline-2"> <h2 id="sec-14"><span class="section-number-2">14</span> tests/sublist.scm</h2> <div class="outline-text-2" id="text-14"> <div class="org-src-container"> <pre class="src src-scheme"><span style="color: #b22222;">; </span><span style="color: #b22222;">sublists allow to start single line function calls with a colon ( : ).</span> (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">a</span> b c) (<span style="color: #a020f0;">let</span> ((e . f)) g)) </pre> </div> </div> </div> <div id="outline-container-sec-15" class="outline-2"> <h2 id="sec-15"><span class="section-number-2">15</span> tests/hashbang.w</h2> <div class="outline-text-2" id="text-15"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">#!/usr/bin/wisp.py # !#</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">This tests hashbang lines</span> </pre> </div> </div> </div> <div id="outline-container-sec-16" class="outline-2"> <h2 id="sec-16"><span class="section-number-2">16</span> tests/hashbang.scm</h2> <div class="outline-text-2" id="text-16"> <div class="org-src-container"> <pre class="src src-scheme">#!/usr/bin/wisp.py # !# <span style="color: #b22222;">; </span><span style="color: #b22222;">This tests hashbang lines</span> </pre> </div> </div> </div> <div id="outline-container-sec-17" class="outline-2"> <h2 id="sec-17"><span class="section-number-2">17</span> tests/readable-tests.w</h2> <div class="outline-text-2" id="text-17"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">fibfast</span> n <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;"><</span> n <span style="color: #008b8b;">2</span> <span style="color: #a020f0;"> . </span>n <span style="color: #0000ff;"> fibup</span> n <span style="color: #008b8b;">2</span> <span style="color: #008b8b;">1</span> <span style="color: #008b8b;">0</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">fibup</span> maxnum count n-1 n-2 <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">=</span> maxnum count <span style="color: #0000ff;"> +</span> n-1 n-2 <span style="color: #0000ff;"> fibup</span> maxnum <span style="color: #0000ff;"> +</span> count <span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> +</span> n-1 n-2 <span style="color: #a020f0;"> . </span>n-1 <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">factorial</span> n <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;"><=</span> n <span style="color: #008b8b;">1</span> <span style="color: #a020f0;"> . </span><span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> *</span> n <span style="color: #0000ff;"> factorial</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">-</span> n <span style="color: #008b8b;">1</span> <span style="color: #483d8b;">define</span> (<span style="color: #0000ff;">gcd</span> x y) <span style="color: #483d8b;">if</span> (<span style="color: #0000ff;">=</span> y <span style="color: #008b8b;">0</span>) <span style="color: #a020f0;"> . </span>x <span style="color: #0000ff;"> gcd</span> y <span style="color: #0000ff;"> rem</span> x y <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">add-if-all-numbers</span> lst <span style="color: #0000ff;"> call/cc</span> <span style="color: #0000ff;"> lambda</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">exit</span> <span style="color: #483d8b;">let</span> loop <span style="color: #a020f0;"> : </span> <span style="color: #0000ff;"> lst</span> lst <span style="color: #0000ff;"> sum</span> <span style="color: #008b8b;">0</span> <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">null?</span> lst <span style="color: #a020f0;"> . </span>sum <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #483d8b;">not</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">number?</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">car</span> lst <span style="color: #0000ff;"> exit</span> <span style="color: #008b8b;">#f</span> <span style="color: #0000ff;"> +</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">car</span> lst <span style="color: #0000ff;"> loop</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">cdr</span> lst </pre> </div> </div> </div> <div id="outline-container-sec-18" class="outline-2"> <h2 id="sec-18"><span class="section-number-2">18</span> tests/readable-tests.scm</h2> <div class="outline-text-2" id="text-18"> <div class="org-src-container"> <pre class="src src-scheme">(<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">fibfast</span> n) (<span style="color: #a020f0;">if</span> (< n 2)) n (fibup n 2 1 0 )) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">fibup</span> maxnum count n-1 n-2) (<span style="color: #a020f0;">if</span> (= maxnum count) (+ n-1 n-2) (fibup maxnum (+ count 1 ) (+ n-1 n-2 ) n-1))) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">factorial</span> n) (<span style="color: #a020f0;">if</span> (<= n 1) 1 (* n (factorial (- n 1))))) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">gcd</span> x y) (<span style="color: #a020f0;">if</span> (= y 0)) x (gcd y (rem x y))) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">add-if-all-numbers</span> lst) (<span style="color: #a020f0;">call/cc</span> (<span style="color: #a020f0;">lambda</span> (exit) (<span style="color: #a020f0;">let</span> <span style="color: #0000ff;">loop</span> ( (lst lst ) (sum 0)) (<span style="color: #a020f0;">if</span> (null? lst) sum (<span style="color: #a020f0;">if</span> (not (number? (car lst))) (exit #f) (+ (car lst) (loop (cdr lst))))))))) </pre> </div> </div> </div> <div id="outline-container-sec-19" class="outline-2"> <h2 id="sec-19"><span class="section-number-2">19</span> tests/quotecolon.w</h2> <div class="outline-text-2" id="text-19"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">#!/home/arne/wisp/wisp-multiline.sh </span> <span style="color: #b22222;">; </span><span style="color: #b22222;">!#</span> <span style="color: #483d8b;">define</span> a <span style="color: #008b8b;">1</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">test whether ' : correctly gets turned into '(</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">and whether brackets in commments are treated correctly.</span> <span style="color: #483d8b;">define</span> a '<span style="color: #a020f0;"> : </span><span style="color: #0000ff;">1</span> <span style="color: #008b8b;">2</span> <span style="color: #008b8b;">3</span> <span style="color: #483d8b;">define</span> <span style="color: #0000ff;"> a</span> b <span style="color: #0000ff;"> c</span> </pre> </div> </div> </div> <div id="outline-container-sec-20" class="outline-2"> <h2 id="sec-20"><span class="section-number-2">20</span> tests/quotecolon.scm</h2> <div class="outline-text-2" id="text-20"> <div class="org-src-container"> <pre class="src src-scheme">#!/home/arne/wisp/wisp-multiline.sh <span style="color: #b22222;">; </span><span style="color: #b22222;">!#</span> (<span style="color: #a020f0;">define</span> <span style="color: #0000ff;">a</span> 1 )<span style="color: #b22222;">; </span><span style="color: #b22222;">test whether ' : correctly gets turned into '(</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">and whether brackets in commments are treated correctly.</span> (<span style="color: #a020f0;">define</span> <span style="color: #0000ff;">a</span> '(1 2 3)) (<span style="color: #a020f0;">define</span> (a b) (c)) </pre> </div> </div> </div> <div id="outline-container-sec-21" class="outline-2"> <h2 id="sec-21"><span class="section-number-2">21</span> tests/namedlet.w</h2> <div class="outline-text-2" id="text-21"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">#!/home/arne/wisp/wisp-multiline.sh </span> <span style="color: #b22222;">; </span><span style="color: #b22222;">!#</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">hello</span> who <span style="color: #0000ff;"> display</span> who <span style="color: #483d8b;">let</span> hello <span style="color: #a020f0;"> : </span><span style="color: #0000ff;">who</span> <span style="color: #008b8b;">0</span> <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">=</span> who <span style="color: #008b8b;">5</span> <span style="color: #0000ff;"> display</span> who <span style="color: #0000ff;"> hello</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">+</span> <span style="color: #008b8b;">1</span> who </pre> </div> </div> </div> <div id="outline-container-sec-22" class="outline-2"> <h2 id="sec-22"><span class="section-number-2">22</span> tests/namedlet.scm</h2> <div class="outline-text-2" id="text-22"> <div class="org-src-container"> <pre class="src src-scheme">#!/home/arne/wisp/wisp-multiline.sh <span style="color: #b22222;">; </span><span style="color: #b22222;">!#</span> (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">hello</span> who) (display who)) (<span style="color: #a020f0;">let</span> <span style="color: #0000ff;">hello</span> ((who 0)) (<span style="color: #a020f0;">if</span> (= who 5) (display who) (hello (+ 1 who)))) </pre> </div> </div> </div> <div id="outline-container-sec-23" class="outline-2"> <h2 id="sec-23"><span class="section-number-2">23</span> tests/flexible-parameter-list.w</h2> <div class="outline-text-2" id="text-23"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">; </span><span style="color: #b22222;">Test using a . as first parameter on a line by prefixing it with a second .</span> <span style="color: #483d8b;">define</span> <span style="color: #0000ff;"> a</span> i <span style="color: #a020f0;"> . . </span>b <span style="color: #0000ff;"> unless</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">>=</span> i<span style="color: #a020f0;"> : </span><span style="color: #0000ff;">length</span> b <span style="color: #0000ff;"> display</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">number->string</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">length</span> b <span style="color: #0000ff;"> display</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">list-ref</span> b i <span style="color: #0000ff;"> newline</span> <span style="color: #0000ff;"> apply</span> a ( <span style="color: #0000ff;">+</span> i <span style="color: #008b8b;">1</span> ) b <span style="color: #0000ff;">a</span> <span style="color: #008b8b;">0</span> <span style="color: #8b2252;">"123"</span> <span style="color: #8b2252;">"345"</span> <span style="color: #8b2252;">"567"</span> </pre> </div> </div> </div> <div id="outline-container-sec-24" class="outline-2"> <h2 id="sec-24"><span class="section-number-2">24</span> tests/flexible-parameter-list.scm</h2> <div class="outline-text-2" id="text-24"> <div class="org-src-container"> <pre class="src src-scheme"><span style="color: #b22222;">; </span><span style="color: #b22222;">Test using a . as first parameter on a line by prefixing it with a second .</span> (<span style="color: #a020f0;">define</span> (a i . b) (unless (>= i (length b)) (display (number->string (length b ))) (display (list-ref b i)) (newline) (apply a ( + i 1 ) b))) (a 0 <span style="color: #8b2252;">"123"</span> <span style="color: #8b2252;">"345"</span> <span style="color: #8b2252;">"567"</span>) </pre> </div> </div> </div> <div id="outline-container-sec-25" class="outline-2"> <h2 id="sec-25"><span class="section-number-2">25</span> tests/factorial.w</h2> <div class="outline-text-2" id="text-25"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #b22222;">;; </span><span style="color: #b22222;">short version</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">note: once you use one inline colon, all the following forms on that</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">line will get closed at the end of the line</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">factorial</span> n <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">zero?</span> n <span style="color: #a020f0;"> . </span><span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> *</span> n<span style="color: #a020f0;"> : </span><span style="color: #0000ff;">factorial</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">-</span> n <span style="color: #008b8b;">1</span> <span style="color: #0000ff;">display</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">factorial</span> <span style="color: #008b8b;">5</span> <span style="color: #b22222;">;; </span><span style="color: #b22222;">more vertical space, less colons</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">factorial</span> n <span style="color: #483d8b;">if</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">zero?</span> n <span style="color: #a020f0;"> . </span><span style="color: #008b8b;">1</span> <span style="color: #0000ff;"> *</span> n <span style="color: #0000ff;"> factorial</span> <span style="color: #0000ff;"> -</span> n <span style="color: #008b8b;">1</span> <span style="color: #0000ff;">display</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">factorial</span> <span style="color: #008b8b;">5</span> </pre> </div> </div> </div> <div id="outline-container-sec-26" class="outline-2"> <h2 id="sec-26"><span class="section-number-2">26</span> tests/factorial.scm</h2> <div class="outline-text-2" id="text-26"> <div class="org-src-container"> <pre class="src src-scheme"><span style="color: #b22222;">;; </span><span style="color: #b22222;">short version</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">note: once you use one inline colon, all the following forms on that</span> <span style="color: #b22222;">; </span><span style="color: #b22222;">line will get closed at the end of the line</span> (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">factorial</span> n) (<span style="color: #a020f0;">if</span> (zero? n) 1 (* n (factorial (- n 1))))) (display (factorial 5 )) <span style="color: #b22222;">;; </span><span style="color: #b22222;">more vertical space, less colons</span> (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">factorial</span> n) (<span style="color: #a020f0;">if</span> (zero? n) 1 (* n (factorial (- n 1))))) (display (factorial 5 )) </pre> </div> </div> </div> <div id="outline-container-sec-27" class="outline-2"> <h2 id="sec-27"><span class="section-number-2">27</span> tests/example.w</h2> <div class="outline-text-2" id="text-27"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #483d8b;">define</span> (<span style="color: #0000ff;">a</span> b c) <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> : </span> <span style="color: #0000ff;"> d</span> <span style="color: #8b2252;">"i am a string</span> <span style="color: #8b2252;">do not break me!"</span> <span style="color: #a020f0;"> : </span> <span style="color: #b22222;">; </span><span style="color: #b22222;">comment: 0</span> f <span style="color: #b22222;">; </span><span style="color: #b22222;">comment : 1</span> <span style="color: #0000ff;"> `</span> g <span style="color: #b22222;">; </span><span style="color: #b22222;">comment " : " 2</span> <span style="color: #a020f0;"> : </span> <span style="color: #0000ff;"> h</span> (<span style="color: #0000ff;">I</span> am in brackets: <span style="color: #0000ff;"> do</span> <span style="color: #483d8b;">not</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">change</span> <span style="color: #8b2252;">"me"</span>) <span style="color: #a020f0;"> . </span>i <span style="color: #0000ff;"> ,</span><span style="color: #008b8b;"> 'j</span> k <span style="color: #a020f0;"> . </span>l <span style="color: #b22222;">; </span><span style="color: #b22222;">comment</span> <span style="color: #0000ff;"> a</span> c <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">b</span> :n o <span style="color: #a020f0;"> . </span><span style="color: #8b2252;">"second defun : with a docstring!"</span> <span style="color: #0000ff;"> message</span> <span style="color: #8b2252;">"I am here"</span> <span style="color: #a020f0;"> . </span>t <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">c</span> e f <span style="color: #a020f0;"> : </span><span style="color: #0000ff;">g</span> <span style="color: #a020f0;"> :</span> <span style="color: #0000ff;"> h</span> <span style="color: #0000ff;"> i</span> <span style="color: #0000ff;"> j</span> <span style="color: #0000ff;"> '</span> : <span style="color: #0000ff;"> k</span> <span style="color: #a020f0;"> . </span>l <span style="color: #a020f0;"> . </span>: <span style="color: #0000ff;">m</span> <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">_</span> \: <span style="color: #0000ff;">__</span> <span style="color: #0000ff;">__</span><span style="color: #a020f0;"> . </span>\: <span style="color: #0000ff;">\_</span> b <span style="color: #483d8b;">define</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">d</span> <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> : </span><span style="color: #0000ff;">a</span> b <span style="color: #0000ff;"> c</span> d <span style="color: #0000ff;">a</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">:</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">c</span> <span style="color: #483d8b;">let</span> <span style="color: #a020f0;"> : </span><span style="color: #0000ff;">a</span> b c <span style="color: #483d8b;">let</span><span style="color: #a020f0;"> : </span><span style="color: #0000ff;">:</span> a b <span style="color: #a020f0;">. </span>a </pre> </div> </div> </div> <div id="outline-container-sec-28" class="outline-2"> <h2 id="sec-28"><span class="section-number-2">28</span> tests/example.scm</h2> <div class="outline-text-2" id="text-28"> <div class="org-src-container"> <pre class="src src-scheme">(<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">a</span> b c) (<span style="color: #a020f0;">let</span> ( (d <span style="color: #8b2252;">"i am a string</span> <span style="color: #8b2252;">do not break me!"</span>) ( <span style="color: #b22222;">; </span><span style="color: #b22222;">comment: 0</span> (f) <span style="color: #b22222;">; </span><span style="color: #b22222;">comment : 1</span> `(g ))<span style="color: #b22222;">; </span><span style="color: #b22222;">comment " : " 2</span> ( (h (I am in brackets: do not : change <span style="color: #8b2252;">"me"</span>)) i))) ,('j k) l <span style="color: #b22222;">; </span><span style="color: #b22222;">comment</span> (a c)) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">b</span> <span style="color: #483d8b;">:n</span> o) <span style="color: #8b2252;">"second defun : with a docstring!"</span> (message <span style="color: #8b2252;">"I am here"</span>) t) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">c</span> e f) ((g)) ( (h (i)) (j)) '(()) (k) l (m)) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">_</span> :) :) (_ b) (<span style="color: #a020f0;">define</span> (<span style="color: #0000ff;">d</span>) (<span style="color: #a020f0;">let</span> ((a b) (c d)))) (a (((c)))) (<span style="color: #a020f0;">let</span> ((a b) (c))) (<span style="color: #a020f0;">let</span> ((a b))) a </pre> </div> </div> </div> <div id="outline-container-sec-29" class="outline-2"> <h2 id="sec-29"><span class="section-number-2">29</span> tests/continuation.w</h2> <div class="outline-text-2" id="text-29"> <div class="org-src-container"> <pre class="src src-wisp"><span style="color: #0000ff;">a</span> b c d e <span style="color: #a020f0;"> . </span>f g h <span style="color: #a020f0;"> . </span>i j k <span style="color: #0000ff;">concat</span> <span style="color: #8b2252;">"I want "</span> <span style="color: #0000ff;"> getwish</span> from me <span style="color: #a020f0;"> . </span><span style="color: #8b2252;">" - "</span> username </pre> </div> </div> </div> <div id="outline-container-sec-30" class="outline-2"> <h2 id="sec-30"><span class="section-number-2">30</span> tests/continuation.scm</h2> <div class="outline-text-2" id="text-30"> <div class="org-src-container"> <pre class="src src-scheme">(a b c d e f g h i j k) (concat <span style="color: #8b2252;">"I want "</span> (getwish from me) <span style="color: #8b2252;">" - "</span> username) </pre> </div> </div> </div> <div id="footnotes"> <h2 class="footnotes">Footnotes: </h2> <div id="text-footnotes"> <div class="footdef"><sup><a id="fn.1" name="fn.1" class="footnum" href="#fnr.1">1</a></sup> <p> To run the tests in the wisp testsuite with a separately built GNU Guile, you can use any given guile interpreter by adjusting the following command: <code>PATH=~/guile-2.0.11/meta:${PATH} ./runtests.sh</code> </p></div> </div> </div></div> <div id="postamble" class="status"> <p class="author">Author: Arne Babenhauserheide</p> <p class="date">Created: 2014-12-23 Di 22:50</p> <p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.3.1 (<a href="http://orgmode.org">Org</a> mode 8.2.6)</p> <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p> </div> </body> </html>