Skip to content

Instantly share code, notes, and snippets.

@sfaleron
Last active November 7, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfaleron/fafab3c2d7bc1d8048ec155434d4f30d to your computer and use it in GitHub Desktop.
Save sfaleron/fafab3c2d7bc1d8048ec155434d4f30d to your computer and use it in GitHub Desktop.
Scrapes the commands from a Mathomatic session
# Scrape a Mathomatic session for the commands. Does not catch special
# prompts, such as "Enter <identifier>: " after a calc command.
# Mathomatic: lightweight command-line Computer Algebra System
# http://mathomatic.orgserve.de/math/
from __future__ import print_function
import sys
import re
r = re.compile(r'^\d+-> (.*)$')
for ln in sys.stdin:
m = r.match(ln)
if m:
print(m.group(1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment