Created
January 6, 2015 21:30
-
-
Save jxnl/a7d3ad2e0d95fb016108 to your computer and use it in GitHub Desktop.
Generates a template for cs116 assginments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This script generates a template rkt file for cs116 assignments | |
| Generates the assignment header. sample contract and sample function. | |
| Usage: | |
| python new_assignment.py A Q NameOfAssignment | |
| Author: Jason Liu | |
| Date: May 20th, 2014 | |
| """ | |
| import sys | |
| temp = """ | |
| ;; ************************************************* | |
| ;; Jiaxin Liu (20468322) | |
| ;; CS 116 Winter 2015 | |
| ;; Assignment {}, Problem {} | |
| ;; ({}) | |
| ;; ************************************************* | |
| ;; (function-name inputs) --- | |
| ;; Requires: --- | |
| ;; Effects: --- | |
| ;; function-name: Type -> Type | |
| ;; Examples: | |
| (check-expect (function-name inputs) outputs) | |
| (define (function-name inputs) ...) | |
| """ | |
| def main(): | |
| _, assignment, question, name = sys.argv | |
| assignment_title = "a{}q{}.rkt".format(assignment, question) | |
| with open(assignment_title, 'a') as fs: | |
| fs.write(temp.format(assignment, question, name)) | |
| print('Made {}'.format(assignment_title)) | |
| if __name__ == "__main__": | |
| sys.exit(main()) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps it should read a
YAMLscript and turn it into a.rkttemplate. LOL