Files
Thun/docs/notebook_preamble.py
T
Simon Forman 669c86cbf1 Change project name to Thun.
I waited too long to upload to PyPI and some other bastard snagged the name.  I originally wanted to call it "Thun" as a tribute to Manfred von Thun, but I was concerned that this might seem to violate the thrid clause in the license of the original Joy code, to wit:

3. The name of the author may not be used to endorse or promote products  derived from this software without specific prior written permission.

Since the author is deceased I don't know of whom to ask permission to call this project Thun, but since I am not trying to "endorse or promote" this project with his name it should be alright.  In any event if anyone complains I can rename the project again.
2018-04-21 21:26:41 -07:00

49 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
#
# Copyright © 2017 Simon Forman
#
# This file is part of Thun
#
# Thun 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.
#
# Thun 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.
#
# You should have received a copy of the GNU General Public License
# along with Thun. If not see <http://www.gnu.org/licenses/>.
#
from traceback import print_exc, format_exc
from joy.joy import run
from joy.library import initialize, DefinitionWrapper
from joy.utils.stack import stack_to_string
from joy.utils.pretty_print import TracePrinter
D = initialize()
S = ()
def J(text, stack=S, dictionary=D):
print stack_to_string(run(text, stack, dictionary)[0])
def V(text, stack=S, dictionary=D):
tp = TracePrinter()
try:
run(text, stack, dictionary, tp.viewer)
except:
exc = format_exc()
tp.print_()
print '-' * 73
print exc
else:
tp.print_()
define = lambda text: DefinitionWrapper.add_def(text, D)