Popular recipes tagged "whitespace"http://code.activestate.com/recipes/tags/whitespace/popular/2011-07-17T19:48:14-07:00ActiveState Code RecipesWhitespace Memory Manager (Python) 2011-07-17T19:45:38-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577673-whitespace-memory-manager/ <p style="color: grey"> Python recipe 577673 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/management/">management</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/whitespace/">whitespace</a>). Revision 3. </p> <p>Related to <a href="http://code.activestate.com/recipes/577108/">recipe 577108</a> and <a href="http://code.activestate.com/recipes/577110/">recipe 577110</a>, this library of functions was written for those that wish to explore more in experimental programming in the Whitespace language (and more specifically, assembly derived from the language). The code is divided into several sections, starting with an explanation of some special memory locations and a list of functions available grouped by their general purpose. Next comes a table of errors that could raised while the code is running and the body of the main test function for the entire program. The next three sections (in order) are three untested functions, the functions intended for usage, and individual test functions for the preceding code. Most of the documentation is written in modified Python to express how all of the code operates.</p> <p>If you have any comments or wish to vote this recipe down, please provide an explanation as to what you find fault with in this program and also a solution that you would implement to fix the problem.</p> Whitespace Interpreter (Python) 2010-05-24T12:02:11-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577110-whitespace-interpreter/ <p style="color: grey"> Python recipe 577110 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/interpreter/">interpreter</a>, <a href="/recipes/tags/whitespace/">whitespace</a>). Revision 2. </p> <p>Runs programs in "Programs" and creates *.WSO files when needed.</p> <p>Can be executed directly by double-click or on the command line.</p> <p>If run on command line, add "ASM" flag to dump program assembly.</p> Whitespace Stack Calculator (Python) 2010-03-14T18:03:24-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577112-whitespace-stack-calculator/ <p style="color: grey"> Python recipe 577112 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/assembly/">assembly</a>, <a href="/recipes/tags/whitespace/">whitespace</a>). </p> <p>This is a stack-based calculator that can run in Whitespace.</p> <p>Several functions and strings are written in its 1330 lines.</p> <p>Modifications were made to the interpreter for debugging it.</p> Whitespace Assembler (Python) 2011-07-17T19:48:14-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577108-whitespace-assembler/ <p style="color: grey"> Python recipe 577108 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/assembler/">assembler</a>, <a href="/recipes/tags/whitespace/">whitespace</a>). Revision 3. </p> <p>Compiles a program from "Assembly" folder into "Program" folder.</p> <p>Can be executed directly by double-click or on the command line.</p> <p>Give name of *.WSA file without extension (example: stack_calc).</p> Whitespace Helpers (Python) 2010-03-14T15:36:03-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577109-whitespace-helpers/ <p style="color: grey"> Python recipe 577109 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/helpers/">helpers</a>, <a href="/recipes/tags/whitespace/">whitespace</a>). </p> <p>Includes a function to encode Python strings into my WSA format.</p> <p>Has a "PRINT_LINE" function that can be copied to a WSA program.</p> <p>Contains a "PRINT" function and documentation as an explanation.</p> Clean preceeding and trailing whitespace in complex list dictionary tuple structures (Python) 2008-08-06T15:16:54-07:00Willhttp://code.activestate.com/recipes/users/4166209/http://code.activestate.com/recipes/576409-clean-preceeding-and-trailing-whitespace-in-comple/ <p style="color: grey"> Python recipe 576409 by <a href="/recipes/users/4166209/">Will</a> (<a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/tuple/">tuple</a>, <a href="/recipes/tags/whitespace/">whitespace</a>). Revision 2. </p> <p>Function to clean trailing and or preceeding whitespace from string types in complex list, dictionary, and tuple structures. This is a recursive function to allow for complete coverage of all items in the structure. Wanted to share it as I needed it and after searching for a while I gave up and wrote one.</p> <p>For example a = ["\rText \r\n", "This one is fine", ["stuff ", [" Something Else"], 4, "Another ", "one", " with"], "\twhitespace\r\n"]</p> <p>print cleanWhiteSpace(a) Result: ["Text", "This one is fine", ["stuff", ["Something Else"], 4, "Another", "one", "with"], "whitespace"]</p>