Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
ce037856
Commit
ce037856
authored
Nov 09, 2004
by
Jay Belanger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(math-rewrite, math-rewrite-phase): Use declared variable math-mt-many.
(math-rewrite): Use declared variable math-mt-func.
parent
f7917133
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
lisp/calc/calc-rewr.el
lisp/calc/calc-rewr.el
+20
-20
No files found.
lisp/calc/calc-rewr.el
View file @
ce037856
...
...
@@ -166,7 +166,7 @@
(
defun
math-rewrite
(
whole-expr
rules
&optional
mmt-many
)
(
defun
math-rewrite
(
whole-expr
rules
&optional
m
ath-
mt-many
)
(
let
((
crules
(
math-compile-rewrites
rules
))
(
heads
(
math-rewrite-heads
whole-expr
))
(
trace-buffer
(
get-buffer
"*Trace*"
))
...
...
@@ -176,20 +176,20 @@
(
calc-line-numbering
nil
)
(
calc-show-selections
t
)
(
calc-why
nil
)
(
mmt-func
(
function
(
lambda
(
x
)
(
let
((
result
(
math-apply-rewrites
x
(
cdr
crules
)
heads
crules
)))
(
if
result
(
progn
(
if
trace-buffer
(
let
((
fmt
(
math-format-stack-value
(
list
result
nil
nil
))))
(
save-excursion
(
set-buffer
trace-buffer
)
(
insert
"\nrewrite to\n"
fmt
"\n"
))))
(
setq
heads
(
math-rewrite-heads
result
heads
t
))))
result
)))))
(
m
ath-
mt-func
(
function
(
lambda
(
x
)
(
let
((
result
(
math-apply-rewrites
x
(
cdr
crules
)
heads
crules
)))
(
if
result
(
progn
(
if
trace-buffer
(
let
((
fmt
(
math-format-stack-value
(
list
result
nil
nil
))))
(
save-excursion
(
set-buffer
trace-buffer
)
(
insert
"\nrewrite to\n"
fmt
"\n"
))))
(
setq
heads
(
math-rewrite-heads
result
heads
t
))))
result
)))))
(
if
trace-buffer
(
let
((
fmt
(
math-format-stack-value
(
list
whole-expr
nil
nil
))))
(
save-excursion
...
...
@@ -197,22 +197,22 @@
(
setq
truncate-lines
t
)
(
goto-char
(
point-max
))
(
insert
"\n\nBegin rewriting\n"
fmt
"\n"
))))
(
or
mmt-many
(
setq
mmt-many
(
or
(
nth
1
(
car
crules
))
(
or
m
ath-
mt-many
(
setq
m
ath-
mt-many
(
or
(
nth
1
(
car
crules
))
math-rewrite-default-iters
)))
(
if
(
equal
mmt-many
'
(
var
inf
var-inf
))
(
setq
mmt-many
1000000
))
(
if
(
equal
mmt-many
'
(
neg
(
var
inf
var-inf
)))
(
setq
mmt-many
-1000000
))
(
if
(
equal
m
ath-
mt-many
'
(
var
inf
var-inf
))
(
setq
m
ath-
mt-many
1000000
))
(
if
(
equal
m
ath-
mt-many
'
(
neg
(
var
inf
var-inf
)))
(
setq
m
ath-
mt-many
-1000000
))
(
math-rewrite-phase
(
nth
3
(
car
crules
)))
(
if
trace-buffer
(
let
((
fmt
(
math-format-stack-value
(
list
whole-expr
nil
nil
))))
(
save-excursion
(
set-buffer
trace-buffer
)
(
insert
"\nDone rewriting"
(
if
(
=
mmt-many
0
)
" (reached iteration limit)"
""
)
(
if
(
=
m
ath-
mt-many
0
)
" (reached iteration limit)"
""
)
":\n"
fmt
"\n"
))))
whole-expr
))
(
defun
math-rewrite-phase
(
sched
)
(
while
(
and
sched
(
/=
mmt-many
0
))
(
while
(
and
sched
(
/=
m
ath-
mt-many
0
))
(
if
(
listp
(
car
sched
))
(
while
(
let
((
save-expr
whole-expr
))
(
math-rewrite-phase
(
car
sched
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment