From 741d856187b2477bde931a65a41dae1b4ab65c32 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 29 Mar 2008 03:16:44 +0000 Subject: [PATCH] fix some scribble->latex problems svn: r9106 --- collects/scribble/base-render.ss | 3 + collects/scribble/basic.ss | 35 +- collects/scribble/html-render.ss | 3 + collects/scribble/latex-render.ss | 77 +-- collects/scribble/scribble.tex | 82 +++ .../tests/mzscheme/benchmarks/common/auto.ss | 3 +- .../mzscheme/benchmarks/common/takr2.sch | 528 ++++++++++++++++++ .../tests/mzscheme/benchmarks/common/takr2.ss | 2 + 8 files changed, 655 insertions(+), 78 deletions(-) create mode 100644 collects/scribble/scribble.tex create mode 100644 collects/tests/mzscheme/benchmarks/common/takr2.sch create mode 100644 collects/tests/mzscheme/benchmarks/common/takr2.ss diff --git a/collects/scribble/base-render.ss b/collects/scribble/base-render.ss index 8d1b60ac54..0c7865db19 100644 --- a/collects/scribble/base-render.ss +++ b/collects/scribble/base-render.ss @@ -21,6 +21,9 @@ (define/public (get-suffix) #".txt") + (define/public (index-manual-newlines?) + #f) + (define/public (format-number number sep) (if (or (null? number) (andmap not number)) diff --git a/collects/scribble/basic.ss b/collects/scribble/basic.ss index 465f6d9397..2f8096846c 100644 --- a/collects/scribble/basic.ss +++ b/collects/scribble/basic.ss @@ -221,10 +221,12 @@ (make-table 'index (map (lambda (row) (list (make-flow (list (make-paragraph row))))) rows))) - (define line-break (make-element 'newline '("\n"))) (define contents (lambda (renderer sec ri) (define l null) + (define line-break (if (send renderer index-manual-newlines?) + (make-element 'newline '("\n")) + "")) (define alpha-starts (make-hash-table)) (hash-table-for-each (let ([parent (collected-info-parent (part-collected-info sec ri))]) @@ -235,7 +237,8 @@ (when (and (pair? k) (eq? 'index-entry (car k))) (set! l (cons (cons (cadr k) v) l))))) (set! l (sort l cadr-string-lists (lambda (let) - (make-element (make-url-anchor - (format "alpha:~a" (char-upcase let))) - (list e)))] - [else e])) - l)))) + ((if (send renderer index-manual-newlines?) + list + (lambda (v) + (map list v))) + (map (lambda (i) + (define e + (make-link-element "indexlink" + `(,@(commas (caddr i)) ,line-break) + (car i))) + (cond [(hash-table-get alpha-starts i #f) + => (lambda (let) + (make-element (make-url-anchor + (format "alpha:~a" (char-upcase let))) + (list e)))] + [else e])) + l))))) (list (make-delayed-flow-element contents))) ;; ---------------------------------------- diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 0df04334f8..36e6acbc62 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -193,6 +193,9 @@ (define/override (get-suffix) #".html") + (define/override (index-manual-newlines?) + #t) + ;; ---------------------------------------- (define/override (start-collect ds fns ci) diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 55e3a0042f..a4653bc84a 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -1,7 +1,10 @@ (module latex-render scheme/base (require "struct.ss" - mzlib/class) + mzlib/class + scheme/runtime-path + scheme/port + (for-syntax scheme/base)) (provide render-mixin) (define current-table-mode (make-parameter #f)) @@ -10,6 +13,8 @@ (define-struct (toc-paragraph paragraph) ()) + (define-runtime-path scribble-tex "scribble.tex") + (define (render-mixin %) (class % (define/override (get-suffix) #".tex") @@ -20,75 +25,21 @@ install-file format-number) - (define (define-color s s2) - (printf "\\newcommand{\\~a}[1]{{\\mytexttt{\\color{~a}{#1}}}}\n" s s2)) - (define/override (render-one d ri fn) - (printf "\\documentclass{article}\n") - (printf "\\parskip=10pt%\n") - (printf "\\parindent=0pt%\n") - (printf "\\usepackage{graphicx}\n") - (printf "\\usepackage{hyperref}\n") - (printf "\\renewcommand{\\rmdefault}{ptm}\n") - ;; (printf "\\usepackage{fullpage}\n") - (printf "\\usepackage{longtable}\n") - (printf "\\usepackage[usenames,dvipsnames]{color}\n") - (printf "\\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}\n") - (printf "\\newcommand{\\mytexttt}[1]{{\\small \\texttt{#1}}}\n") - (define-color "schemeplain" "black") - (printf "\\newcommand{\\schemekeyword}[1]{{\\color{black}{\\mytexttt{\\textbf{#1}}}}}\n") - (printf "\\newcommand{\\schemesyntaxlink}[1]{\\schemekeyword{#1}}\n") - (printf "\\definecolor{CommentColor}{rgb}{0.76,0.45,0.12}\n") - (printf "\\definecolor{ParenColor}{rgb}{0.52,0.24,0.14}\n") - (printf "\\definecolor{IdentifierColor}{rgb}{0.15,0.15,0.50}\n") - (printf "\\definecolor{ResultColor}{rgb}{0.0,0.0,0.69}\n") - (printf "\\definecolor{ValueColor}{rgb}{0.13,0.55,0.13}\n") - (printf "\\definecolor{OutputColor}{rgb}{0.59,0.00,0.59}\n") - (define-color "schemecomment" "CommentColor") - (define-color "schemeparen" "ParenColor") - (define-color "schemeinputbg" "ParenColor") - (define-color "schemesymbol" "IdentifierColor") - (define-color "schemevalue" "ValueColor") - (define-color "schemevaluelink" "blue") - (define-color "schememodlink" "blue") - (define-color "schemeresult" "ResultColor") - (define-color "schemestdout" "OutputColor") - (define-color "schememeta" "IdentifierColor") - (define-color "schememod" "black") - (define-color "schemereader" "black") - (define-color "schemevariablecol" "IdentifierColor") - (printf "\\newcommand{\\schemevariable}[1]{{\\schemevariablecol{\\textsl{#1}}}}\n") - (define-color "schemeerrorcol" "red") - (printf "\\newcommand{\\schemeerror}[1]{{\\schemeerrorcol{\\textrm{\\textit{#1}}}}}\n") - (printf "\\newcommand{\\schemeopt}[1]{#1}\n") - (printf "\\newcommand{\\textsub}[1]{$_{#1}$}\n") - (printf "\\newcommand{\\textsuper}[1]{$^{#1}$}\n") - (printf "\\newcommand{\\refcolumn}[1]{#1}\n") - (printf "\\newcommand{\\refcontent}[1]{#1}\n") - (printf "\\newcommand{\\smaller}[1]{{\\footnotesize #1}}\n") - (printf "\\definecolor{PaleBlue}{rgb}{0.90,0.90,1.0}\n") - (printf "\\definecolor{LightGray}{rgb}{0.90,0.90,0.90}\n") - (printf "\\newcommand{\\intextcolor}[2]{\\textcolor{#1}{#2}}\n") - (printf "\\newcommand{\\intextrgbcolor}[2]{\\textcolor[rgb]{#1}{#2}}\n") - (printf "\\newcommand{\\incolorbox}[2]{{\\fboxrule=0pt\\fboxsep=0pt\\colorbox{#1}{#2}}}\n") - (printf "\\newcommand{\\inrgbcolorbox}[2]{{\\fboxrule=0pt\\fboxsep=0pt\\colorbox[rgb]{#1}{#2}}}\n") - (printf "\\newcommand{\\schemeinput}[1]{\\incolorbox{LightGray}{\\schemeinputbg{#1}}}\n") - (printf "\\newcommand{\\highlighted}[1]{\\colorbox{PaleBlue}{\\hspace{-0.5ex}\\schemeinputbg{#1}\\hspace{-0.5ex}}}\n") - (printf "\\newcommand{\\plainlink}[1]{#1}\n") - (printf "\\newcommand{\\techlink}[1]{#1}\n") - (printf "\\newcommand{\\badlink}[1]{#1}\n") - (printf "\\newcommand{\\indexlink}[1]{#1}\n") - (printf "\\newcommand{\\imageleft}[1]{} % drop it\n") - (printf "\\begin{document}\n\\sloppy\n") + (with-input-from-file scribble-tex + (lambda () + (copy-port (current-input-port) + (current-output-port)))) + (printf "\\begin{document}\n\\preDoc\n") (when (part-title-content d) - (printf "\\title{") + (printf "\\titleAndVersion{") (render-content (part-title-content d) d ri) - (printf "\\\\{\\normalsize Version ~a}}\\maketitle\n" + (printf "}{~a}\n" (or (and (versioned-part? d) (versioned-part-version d)) (version)))) (render-part d ri) - (printf "\\end{document}\n")) + (printf "\\postDoc\n\\end{document}\n")) (define/override (render-part d ri) (let ([number (collected-info-number (part-collected-info d ri))]) diff --git a/collects/scribble/scribble.tex b/collects/scribble/scribble.tex new file mode 100644 index 0000000000..fe24dbc3e6 --- /dev/null +++ b/collects/scribble/scribble.tex @@ -0,0 +1,82 @@ +% This is the default prefix for Scribble-generated HTML + +\documentclass{article} + +\parskip=10pt +\parindent=0pt + +% Adjust margins to match HTML width for +% fixed-width font +\advance \oddsidemargin by -0.15in +\advance \evensidemargin by -0.15in +\advance \textwidth by 0.3in + +\usepackage{graphicx} +\usepackage{hyperref} +\renewcommand{\rmdefault}{ptm} +\usepackage{longtable} +\usepackage[htt]{hyphenat} +\usepackage[usenames,dvipsnames]{color} +\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true} + +\newcommand{\inColor}[2]{{\mytexttt{\color{#1}{#2}}}} +\definecolor{CommentColor}{rgb}{0.76,0.45,0.12} +\definecolor{ParenColor}{rgb}{0.52,0.24,0.14} +\definecolor{IdentifierColor}{rgb}{0.15,0.15,0.50} +\definecolor{ResultColor}{rgb}{0.0,0.0,0.69} +\definecolor{ValueColor}{rgb}{0.13,0.55,0.13} +\definecolor{OutputColor}{rgb}{0.59,0.00,0.59} +\definecolor{PaleBlue}{rgb}{0.90,0.90,1.0} +\definecolor{LightGray}{rgb}{0.90,0.90,0.90} + +\newcommand{\mytexttt}[1]{{\texttt{#1}}} +\newcommand{\schemeplain}[1]{\inColor{black}{#1}} +\newcommand{\schemekeyword}[1]{{\color{black}{\mytexttt{\textbf{#1}}}}} +\newcommand{\schemesyntaxlink}[1]{\schemekeyword{#1}} +\newcommand{\schemecomment}[1]{\inColor{CommentColor}{#1}} +\newcommand{\schemeparen}[1]{\inColor{ParenColor}{#1}} +\newcommand{\schemeinputbg}[1]{\inColor{ParenColor}{#1}} +\newcommand{\schemesymbol}[1]{\inColor{IdentifierColor}{#1}} +\newcommand{\schemevalue}[1]{\inColor{ValueColor}{#1}} +\newcommand{\schemevaluelink}[1]{\inColor{blue}{#1}} +\newcommand{\schememodlink}[1]{\inColor{blue}{#1}} +\newcommand{\schemeresult}[1]{\inColor{ResultColor}{#1}} +\newcommand{\schemestdout}[1]{\inColor{OutputColor}{#1}} +\newcommand{\schememeta}[1]{\inColor{IdentifierColor}{#1}} +\newcommand{\schememod}[1]{\inColor{black}{#1}} +\newcommand{\schemereader}[1]{\inColor{black}{#1}} +\newcommand{\schemevariablecol}[1]{\inColor{IdentifierColor}{#1}} +\newcommand{\schemevariable}[1]{{\schemevariablecol{\textsl{#1}}}} +\newcommand{\schemeerrorcol}[1]{\inColor{red}{#1}} +\newcommand{\schemeerror}[1]{{\schemeerrorcol{\textrm{\textit{#1}}}}} +\newcommand{\schemeopt}[1]{#1} +\newcommand{\textsub}[1]{$_{#1}$} +\newcommand{\textsuper}[1]{$^{#1}$} +\newcommand{\refcolumn}[1]{#1} +\newcommand{\refcontent}[1]{#1} +\newcommand{\intextcolor}[2]{\textcolor{#1}{#2}} +\newcommand{\intextrgbcolor}[2]{\textcolor[rgb]{#1}{#2}} +\newcommand{\incolorbox}[2]{{\fboxrule=0pt\fboxsep=0pt\colorbox{#1}{#2}}} +\newcommand{\inrgbcolorbox}[2]{{\fboxrule=0pt\fboxsep=0pt\colorbox[rgb]{#1}{#2}}} +\newcommand{\schemeinput}[1]{\incolorbox{LightGray}{\schemeinputbg{#1}}} +\newcommand{\highlighted}[1]{\colorbox{PaleBlue}{\hspace{-0.5ex}\schemeinputbg{#1}\hspace{-0.5ex}}} +\newcommand{\plainlink}[1]{#1} +\newcommand{\techlink}[1]{#1} +\newcommand{\badlink}[1]{#1} +\newcommand{\indexlink}[1]{#1} +\newcommand{\imageleft}[1]{} % drop it +\newcommand{\smaller}[1]{{\footnotesize #1}} + +\newcommand{\titleAndVersion}[2]{\title{#1\\{\normalsize Version #2}}\maketitle} + +\newcommand{\preDoc}{\sloppy} +\newcommand{\postDoc}{} + +% Scribble then generates the following: +% +% \begin{document} +% \preDoc +% \titleAndVersion{...}{...} +% ... document content ... +% \postDoc +% \end{document} diff --git a/collects/tests/mzscheme/benchmarks/common/auto.ss b/collects/tests/mzscheme/benchmarks/common/auto.ss index d07a49dc18..db84442da3 100755 --- a/collects/tests/mzscheme/benchmarks/common/auto.ss +++ b/collects/tests/mzscheme/benchmarks/common/auto.ss @@ -216,7 +216,7 @@ exec mzscheme -qu "$0" ${1+"$@"} bm))) extract-mzscheme-times clean-up-extension - (append '(takr) + (append '(takr takr2) mutable-pair-progs)) (make-impl 'mzscheme-j mk-mzscheme @@ -299,6 +299,7 @@ exec mzscheme -qu "$0" ${1+"$@"} tak takl takr + takr2 triangle)) (define (run-benchmark impl bm) diff --git a/collects/tests/mzscheme/benchmarks/common/takr2.sch b/collects/tests/mzscheme/benchmarks/common/takr2.sch new file mode 100644 index 0000000000..c6deb8dc01 --- /dev/null +++ b/collects/tests/mzscheme/benchmarks/common/takr2.sch @@ -0,0 +1,528 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; File: takr.sch +; Description: TAKR benchmark +; Author: Richard Gabriel +; Created: 12-Apr-85 +; Modified: 12-Apr-85 10:12:43 (Bob Shaw) +; 22-Jul-87 (Will Clinger) +; Language: Scheme +; Status: Public Domain +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; TAKR -- 100 function (count `em) version of TAK that tries to defeat cache +;;; memory effects. Results should be the same as for TAK on stack machines. +;;; Distribution of calls is not completely flat. + +(define (tak x y z) + (define (tak0 x y z) + (cond ((not (< y x)) z) + (else (tak1 (tak37 (- x 1) y z) + (tak11 (- y 1) z x) + (tak17 (- z 1) x y))))) + (define (tak1 x y z) + (cond ((not (< y x)) z) + (else (tak2 (tak74 (- x 1) y z) + (tak22 (- y 1) z x) + (tak34 (- z 1) x y))))) + (define (tak2 x y z) + (cond ((not (< y x)) z) + (else (tak3 (tak11 (- x 1) y z) + (tak33 (- y 1) z x) + (tak51 (- z 1) x y))))) + (define (tak3 x y z) + (cond ((not (< y x)) z) + (else (tak4 (tak48 (- x 1) y z) + (tak44 (- y 1) z x) + (tak68 (- z 1) x y))))) + (define (tak4 x y z) + (cond ((not (< y x)) z) + (else (tak5 (tak85 (- x 1) y z) + (tak55 (- y 1) z x) + (tak85 (- z 1) x y))))) + (define (tak5 x y z) + (cond ((not (< y x)) z) + (else (tak6 (tak22 (- x 1) y z) + (tak66 (- y 1) z x) + (tak2 (- z 1) x y))))) + (define (tak6 x y z) + (cond ((not (< y x)) z) + (else (tak7 (tak59 (- x 1) y z) + (tak77 (- y 1) z x) + (tak19 (- z 1) x y))))) + (define (tak7 x y z) + (cond ((not (< y x)) z) + (else (tak8 (tak96 (- x 1) y z) + (tak88 (- y 1) z x) + (tak36 (- z 1) x y))))) + (define (tak8 x y z) + (cond ((not (< y x)) z) + (else (tak9 (tak33 (- x 1) y z) + (tak99 (- y 1) z x) + (tak53 (- z 1) x y))))) + (define (tak9 x y z) + (cond ((not (< y x)) z) + (else (tak10 (tak70 (- x 1) y z) + (tak10 (- y 1) z x) + (tak70 (- z 1) x y))))) + (define (tak10 x y z) + (cond ((not (< y x)) z) + (else (tak11 (tak7 (- x 1) y z) + (tak21 (- y 1) z x) + (tak87 (- z 1) x y))))) + (define (tak11 x y z) + (cond ((not (< y x)) z) + (else (tak12 (tak44 (- x 1) y z) + (tak32 (- y 1) z x) + (tak4 (- z 1) x y))))) + (define (tak12 x y z) + (cond ((not (< y x)) z) + (else (tak13 (tak81 (- x 1) y z) + (tak43 (- y 1) z x) + (tak21 (- z 1) x y))))) + + (define (tak13 x y z) + (cond ((not (< y x)) z) + (else (tak14 (tak18 (- x 1) y z) + (tak54 (- y 1) z x) + (tak38 (- z 1) x y))))) + (define (tak14 x y z) + (cond ((not (< y x)) z) + (else (tak15 (tak55 (- x 1) y z) + (tak65 (- y 1) z x) + (tak55 (- z 1) x y))))) + (define (tak15 x y z) + (cond ((not (< y x)) z) + (else (tak16 (tak92 (- x 1) y z) + (tak76 (- y 1) z x) + (tak72 (- z 1) x y))))) + (define (tak16 x y z) + (cond ((not (< y x)) z) + (else (tak17 (tak29 (- x 1) y z) + (tak87 (- y 1) z x) + (tak89 (- z 1) x y))))) + (define (tak17 x y z) + (cond ((not (< y x)) z) + (else (tak18 (tak66 (- x 1) y z) + (tak98 (- y 1) z x) + (tak6 (- z 1) x y))))) + (define (tak18 x y z) + (cond ((not (< y x)) z) + (else (tak19 (tak3 (- x 1) y z) + (tak9 (- y 1) z x) + (tak23 (- z 1) x y))))) + (define (tak19 x y z) + (cond ((not (< y x)) z) + (else (tak20 (tak40 (- x 1) y z) + (tak20 (- y 1) z x) + (tak40 (- z 1) x y))))) + (define (tak20 x y z) + (cond ((not (< y x)) z) + (else (tak21 (tak77 (- x 1) y z) + (tak31 (- y 1) z x) + (tak57 (- z 1) x y))))) + (define (tak21 x y z) + (cond ((not (< y x)) z) + (else (tak22 (tak14 (- x 1) y z) + (tak42 (- y 1) z x) + (tak74 (- z 1) x y))))) + (define (tak22 x y z) + (cond ((not (< y x)) z) + (else (tak23 (tak51 (- x 1) y z) + (tak53 (- y 1) z x) + (tak91 (- z 1) x y))))) + (define (tak23 x y z) + (cond ((not (< y x)) z) + (else (tak24 (tak88 (- x 1) y z) + (tak64 (- y 1) z x) + (tak8 (- z 1) x y))))) + (define (tak24 x y z) + (cond ((not (< y x)) z) + (else (tak25 (tak25 (- x 1) y z) + (tak75 (- y 1) z x) + (tak25 (- z 1) x y))))) + (define (tak25 x y z) + (cond ((not (< y x)) z) + (else (tak26 (tak62 (- x 1) y z) + (tak86 (- y 1) z x) + (tak42 (- z 1) x y))))) + (define (tak26 x y z) + (cond ((not (< y x)) z) + (else (tak27 (tak99 (- x 1) y z) + (tak97 (- y 1) z x) + (tak59 (- z 1) x y))))) + (define (tak27 x y z) + (cond ((not (< y x)) z) + (else (tak28 (tak36 (- x 1) y z) + (tak8 (- y 1) z x) + (tak76 (- z 1) x y))))) + (define (tak28 x y z) + (cond ((not (< y x)) z) + (else (tak29 (tak73 (- x 1) y z) + (tak19 (- y 1) z x) + (tak93 (- z 1) x y))))) + (define (tak29 x y z) + (cond ((not (< y x)) z) + (else (tak30 (tak10 (- x 1) y z) + (tak30 (- y 1) z x) + (tak10 (- z 1) x y))))) + (define (tak30 x y z) + (cond ((not (< y x)) z) + (else (tak31 (tak47 (- x 1) y z) + (tak41 (- y 1) z x) + (tak27 (- z 1) x y))))) + (define (tak31 x y z) + (cond ((not (< y x)) z) + (else (tak32 (tak84 (- x 1) y z) + (tak52 (- y 1) z x) + (tak44 (- z 1) x y))))) + (define (tak32 x y z) + (cond ((not (< y x)) z) + (else (tak33 (tak21 (- x 1) y z) + (tak63 (- y 1) z x) + (tak61 (- z 1) x y))))) + (define (tak33 x y z) + (cond ((not (< y x)) z) + (else (tak34 (tak58 (- x 1) y z) + (tak74 (- y 1) z x) + (tak78 (- z 1) x y))))) + (define (tak34 x y z) + (cond ((not (< y x)) z) + (else (tak35 (tak95 (- x 1) y z) + (tak85 (- y 1) z x) + (tak95 (- z 1) x y))))) + (define (tak35 x y z) + (cond ((not (< y x)) z) + (else (tak36 (tak32 (- x 1) y z) + (tak96 (- y 1) z x) + (tak12 (- z 1) x y))))) + (define (tak36 x y z) + (cond ((not (< y x)) z) + (else (tak37 (tak69 (- x 1) y z) + (tak7 (- y 1) z x) + (tak29 (- z 1) x y))))) + (define (tak37 x y z) + (cond ((not (< y x)) z) + (else (tak38 (tak6 (- x 1) y z) + (tak18 (- y 1) z x) + (tak46 (- z 1) x y))))) + (define (tak38 x y z) + (cond ((not (< y x)) z) + (else (tak39 (tak43 (- x 1) y z) + (tak29 (- y 1) z x) + (tak63 (- z 1) x y))))) + (define (tak39 x y z) + (cond ((not (< y x)) z) + (else (tak40 (tak80 (- x 1) y z) + (tak40 (- y 1) z x) + (tak80 (- z 1) x y))))) + (define (tak40 x y z) + (cond ((not (< y x)) z) + (else (tak41 (tak17 (- x 1) y z) + (tak51 (- y 1) z x) + (tak97 (- z 1) x y))))) + (define (tak41 x y z) + (cond ((not (< y x)) z) + (else (tak42 (tak54 (- x 1) y z) + (tak62 (- y 1) z x) + (tak14 (- z 1) x y))))) + (define (tak42 x y z) + (cond ((not (< y x)) z) + (else (tak43 (tak91 (- x 1) y z) + (tak73 (- y 1) z x) + (tak31 (- z 1) x y))))) + (define (tak43 x y z) + (cond ((not (< y x)) z) + (else (tak44 (tak28 (- x 1) y z) + (tak84 (- y 1) z x) + (tak48 (- z 1) x y))))) + (define (tak44 x y z) + (cond ((not (< y x)) z) + (else (tak45 (tak65 (- x 1) y z) + (tak95 (- y 1) z x) + (tak65 (- z 1) x y))))) + (define (tak45 x y z) + (cond ((not (< y x)) z) + (else (tak46 (tak2 (- x 1) y z) + (tak6 (- y 1) z x) + (tak82 (- z 1) x y))))) + (define (tak46 x y z) + (cond ((not (< y x)) z) + (else (tak47 (tak39 (- x 1) y z) + (tak17 (- y 1) z x) + (tak99 (- z 1) x y))))) + (define (tak47 x y z) + (cond ((not (< y x)) z) + (else (tak48 (tak76 (- x 1) y z) + (tak28 (- y 1) z x) + (tak16 (- z 1) x y))))) + (define (tak48 x y z) + (cond ((not (< y x)) z) + (else (tak49 (tak13 (- x 1) y z) + (tak39 (- y 1) z x) + (tak33 (- z 1) x y))))) + (define (tak49 x y z) + (cond ((not (< y x)) z) + (else (tak50 (tak50 (- x 1) y z) + (tak50 (- y 1) z x) + (tak50 (- z 1) x y))))) + (define (tak50 x y z) + (cond ((not (< y x)) z) + (else (tak51 (tak87 (- x 1) y z) + (tak61 (- y 1) z x) + (tak67 (- z 1) x y))))) + (define (tak51 x y z) + (cond ((not (< y x)) z) + (else (tak52 (tak24 (- x 1) y z) + (tak72 (- y 1) z x) + (tak84 (- z 1) x y))))) + (define (tak52 x y z) + (cond ((not (< y x)) z) + (else (tak53 (tak61 (- x 1) y z) + (tak83 (- y 1) z x) + (tak1 (- z 1) x y))))) + (define (tak53 x y z) + (cond ((not (< y x)) z) + (else (tak54 (tak98 (- x 1) y z) + (tak94 (- y 1) z x) + (tak18 (- z 1) x y))))) + (define (tak54 x y z) + (cond ((not (< y x)) z) + (else (tak55 (tak35 (- x 1) y z) + (tak5 (- y 1) z x) + (tak35 (- z 1) x y))))) + (define (tak55 x y z) + (cond ((not (< y x)) z) + (else (tak56 (tak72 (- x 1) y z) + (tak16 (- y 1) z x) + (tak52 (- z 1) x y))))) + (define (tak56 x y z) + (cond ((not (< y x)) z) + (else (tak57 (tak9 (- x 1) y z) + (tak27 (- y 1) z x) + (tak69 (- z 1) x y))))) + (define (tak57 x y z) + (cond ((not (< y x)) z) + (else (tak58 (tak46 (- x 1) y z) + (tak38 (- y 1) z x) + (tak86 (- z 1) x y))))) + (define (tak58 x y z) + (cond ((not (< y x)) z) + (else (tak59 (tak83 (- x 1) y z) + (tak49 (- y 1) z x) + (tak3 (- z 1) x y))))) + (define (tak59 x y z) + (cond ((not (< y x)) z) + (else (tak60 (tak20 (- x 1) y z) + (tak60 (- y 1) z x) + (tak20 (- z 1) x y))))) + (define (tak60 x y z) + (cond ((not (< y x)) z) + (else (tak61 (tak57 (- x 1) y z) + (tak71 (- y 1) z x) + (tak37 (- z 1) x y))))) + (define (tak61 x y z) + (cond ((not (< y x)) z) + (else (tak62 (tak94 (- x 1) y z) + (tak82 (- y 1) z x) + (tak54 (- z 1) x y))))) + (define (tak62 x y z) + (cond ((not (< y x)) z) + (else (tak63 (tak31 (- x 1) y z) + (tak93 (- y 1) z x) + (tak71 (- z 1) x y))))) + (define (tak63 x y z) + (cond ((not (< y x)) z) + (else (tak64 (tak68 (- x 1) y z) + (tak4 (- y 1) z x) + (tak88 (- z 1) x y))))) + (define (tak64 x y z) + (cond ((not (< y x)) z) + (else (tak65 (tak5 (- x 1) y z) + (tak15 (- y 1) z x) + (tak5 (- z 1) x y))))) + (define (tak65 x y z) + (cond ((not (< y x)) z) + (else (tak66 (tak42 (- x 1) y z) + (tak26 (- y 1) z x) + (tak22 (- z 1) x y))))) + (define (tak66 x y z) + (cond ((not (< y x)) z) + (else (tak67 (tak79 (- x 1) y z) + (tak37 (- y 1) z x) + (tak39 (- z 1) x y))))) + (define (tak67 x y z) + (cond ((not (< y x)) z) + (else (tak68 (tak16 (- x 1) y z) + (tak48 (- y 1) z x) + (tak56 (- z 1) x y))))) + (define (tak68 x y z) + (cond ((not (< y x)) z) + (else (tak69 (tak53 (- x 1) y z) + (tak59 (- y 1) z x) + (tak73 (- z 1) x y))))) + (define (tak69 x y z) + (cond ((not (< y x)) z) + (else (tak70 (tak90 (- x 1) y z) + (tak70 (- y 1) z x) + (tak90 (- z 1) x y))))) + (define (tak70 x y z) + (cond ((not (< y x)) z) + (else (tak71 (tak27 (- x 1) y z) + (tak81 (- y 1) z x) + (tak7 (- z 1) x y))))) + (define (tak71 x y z) + (cond ((not (< y x)) z) + (else (tak72 (tak64 (- x 1) y z) + (tak92 (- y 1) z x) + (tak24 (- z 1) x y))))) + (define (tak72 x y z) + (cond ((not (< y x)) z) + (else (tak73 (tak1 (- x 1) y z) + (tak3 (- y 1) z x) + (tak41 (- z 1) x y))))) + (define (tak73 x y z) + (cond ((not (< y x)) z) + (else (tak74 (tak38 (- x 1) y z) + (tak14 (- y 1) z x) + (tak58 (- z 1) x y))))) + (define (tak74 x y z) + (cond ((not (< y x)) z) + (else (tak75 (tak75 (- x 1) y z) + (tak25 (- y 1) z x) + (tak75 (- z 1) x y))))) + (define (tak75 x y z) + (cond ((not (< y x)) z) + (else (tak76 (tak12 (- x 1) y z) + (tak36 (- y 1) z x) + (tak92 (- z 1) x y))))) + (define (tak76 x y z) + (cond ((not (< y x)) z) + (else (tak77 (tak49 (- x 1) y z) + (tak47 (- y 1) z x) + (tak9 (- z 1) x y))))) + (define (tak77 x y z) + (cond ((not (< y x)) z) + (else (tak78 (tak86 (- x 1) y z) + (tak58 (- y 1) z x) + (tak26 (- z 1) x y))))) + (define (tak78 x y z) + (cond ((not (< y x)) z) + (else (tak79 (tak23 (- x 1) y z) + (tak69 (- y 1) z x) + (tak43 (- z 1) x y))))) + (define (tak79 x y z) + (cond ((not (< y x)) z) + (else (tak80 (tak60 (- x 1) y z) + (tak80 (- y 1) z x) + (tak60 (- z 1) x y))))) + (define (tak80 x y z) + (cond ((not (< y x)) z) + (else (tak81 (tak97 (- x 1) y z) + (tak91 (- y 1) z x) + (tak77 (- z 1) x y))))) + (define (tak81 x y z) + (cond ((not (< y x)) z) + (else (tak82 (tak34 (- x 1) y z) + (tak2 (- y 1) z x) + (tak94 (- z 1) x y))))) + (define (tak82 x y z) + (cond ((not (< y x)) z) + (else (tak83 (tak71 (- x 1) y z) + (tak13 (- y 1) z x) + (tak11 (- z 1) x y))))) + (define (tak83 x y z) + (cond ((not (< y x)) z) + (else (tak84 (tak8 (- x 1) y z) + (tak24 (- y 1) z x) + (tak28 (- z 1) x y))))) + (define (tak84 x y z) + (cond ((not (< y x)) z) + (else (tak85 (tak45 (- x 1) y z) + (tak35 (- y 1) z x) + (tak45 (- z 1) x y))))) + (define (tak85 x y z) + (cond ((not (< y x)) z) + (else (tak86 (tak82 (- x 1) y z) + (tak46 (- y 1) z x) + (tak62 (- z 1) x y))))) + (define (tak86 x y z) + (cond ((not (< y x)) z) + (else (tak87 (tak19 (- x 1) y z) + (tak57 (- y 1) z x) + (tak79 (- z 1) x y))))) + (define (tak87 x y z) + (cond ((not (< y x)) z) + (else (tak88 (tak56 (- x 1) y z) + (tak68 (- y 1) z x) + (tak96 (- z 1) x y))))) + (define (tak88 x y z) + (cond ((not (< y x)) z) + (else (tak89 (tak93 (- x 1) y z) + (tak79 (- y 1) z x) + (tak13 (- z 1) x y))))) + (define (tak89 x y z) + (cond ((not (< y x)) z) + (else (tak90 (tak30 (- x 1) y z) + (tak90 (- y 1) z x) + (tak30 (- z 1) x y))))) + (define (tak90 x y z) + (cond ((not (< y x)) z) + (else (tak91 (tak67 (- x 1) y z) + (tak1 (- y 1) z x) + (tak47 (- z 1) x y))))) + (define (tak91 x y z) + (cond ((not (< y x)) z) + (else (tak92 (tak4 (- x 1) y z) + (tak12 (- y 1) z x) + (tak64 (- z 1) x y))))) + (define (tak92 x y z) + (cond ((not (< y x)) z) + (else (tak93 (tak41 (- x 1) y z) + (tak23 (- y 1) z x) + (tak81 (- z 1) x y))))) + (define (tak93 x y z) + (cond ((not (< y x)) z) + (else (tak94 (tak78 (- x 1) y z) + (tak34 (- y 1) z x) + (tak98 (- z 1) x y))))) + (define (tak94 x y z) + (cond ((not (< y x)) z) + (else (tak95 (tak15 (- x 1) y z) + (tak45 (- y 1) z x) + (tak15 (- z 1) x y))))) + (define (tak95 x y z) + (cond ((not (< y x)) z) + (else (tak96 (tak52 (- x 1) y z) + (tak56 (- y 1) z x) + (tak32 (- z 1) x y))))) + (define (tak96 x y z) + (cond ((not (< y x)) z) + (else (tak97 (tak89 (- x 1) y z) + (tak67 (- y 1) z x) + (tak49 (- z 1) x y))))) + (define (tak97 x y z) + (cond ((not (< y x)) z) + (else (tak98 (tak26 (- x 1) y z) + (tak78 (- y 1) z x) + (tak66 (- z 1) x y))))) + (define (tak98 x y z) + (cond ((not (< y x)) z) + (else (tak99 (tak63 (- x 1) y z) + (tak89 (- y 1) z x) + (tak83 (- z 1) x y))))) + (define (tak99 x y z) + (cond ((not (< y x)) z) + (else (tak0 (tak0 (- x 1) y z) + (tak0 (- y 1) z x) + (tak0 (- z 1) x y))))) + + (tak0 x y z)) + +;;; call: (tak0 18 12 6) + +(let ((input (with-input-from-file "input.txt" read))) + (time + (let loop ((n 500) (v 0)) + (if (zero? n) + v + (loop (- n 1) (tak 18 12 (if input 6 0))))))) diff --git a/collects/tests/mzscheme/benchmarks/common/takr2.ss b/collects/tests/mzscheme/benchmarks/common/takr2.ss new file mode 100644 index 0000000000..24c5898bab --- /dev/null +++ b/collects/tests/mzscheme/benchmarks/common/takr2.ss @@ -0,0 +1,2 @@ + +(module takr2 "wrap.ss")