comparison lisp/calc/calcsel2.el @ 41047:73f364fd8aaa

Style cleanup; don't put closing parens on their own line, add "foo.el ends here" to each file, and update copyright date.
author Colin Walters <walters@gnu.org>
date Wed, 14 Nov 2001 09:09:09 +0000
parents 2fb9d407ae73
children fcd507927105
comparison
equal deleted inserted replaced
41046:14b73d89514a 41047:73f364fd8aaa
1 ;; Calculator for GNU Emacs, part II [calc-sel-2.el] 1 ;; Calculator for GNU Emacs, part II [calc-sel-2.el]
2 ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. 2 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
3 ;; Written by Dave Gillespie, daveg@synaptics.com. 3 ;; Written by Dave Gillespie, daveg@synaptics.com.
4 4
5 ;; This file is part of GNU Emacs. 5 ;; This file is part of GNU Emacs.
6 6
7 ;; GNU Emacs is distributed in the hope that it will be useful, 7 ;; GNU Emacs is distributed in the hope that it will be useful,
107 (calc-pop-push-record-list 107 (calc-pop-push-record-list
108 1 "left" 108 1 "left"
109 (list (calc-replace-sub-formula expr parent new)) 109 (list (calc-replace-sub-formula expr parent new))
110 num 110 num
111 (list (and (or (not (eq arg 0)) reselect) 111 (list (and (or (not (eq arg 0)) reselect)
112 sel))))))))) 112 sel))))))))))
113 )
114 113
115 (defun calc-commute-right (arg) 114 (defun calc-commute-right (arg)
116 (interactive "p") 115 (interactive "p")
117 (if (< arg 0) 116 (if (< arg 0)
118 (calc-commute-left (- arg)) 117 (calc-commute-left (- arg))
191 (calc-pop-push-record-list 190 (calc-pop-push-record-list
192 1 "rght" 191 1 "rght"
193 (list (calc-replace-sub-formula expr parent new)) 192 (list (calc-replace-sub-formula expr parent new))
194 num 193 num
195 (list (and (or (not (eq arg 0)) reselect) 194 (list (and (or (not (eq arg 0)) reselect)
196 sel))))))))) 195 sel))))))))))
197 )
198 196
199 (defun calc-build-assoc-term (op lhs rhs) 197 (defun calc-build-assoc-term (op lhs rhs)
200 (cond ((and (eq op '+) (or (math-looks-negp rhs) 198 (cond ((and (eq op '+) (or (math-looks-negp rhs)
201 (and (eq (car-safe rhs) 'cplx) 199 (and (eq (car-safe rhs) 'cplx)
202 (math-negp (nth 1 rhs)) 200 (math-negp (nth 1 rhs))
213 (list '/ lhs (nth 2 rhs))) 211 (list '/ lhs (nth 2 rhs)))
214 ((and (eq op '/) (and (eq (car-safe rhs) '/) 212 ((and (eq op '/) (and (eq (car-safe rhs) '/)
215 (or (math-equal-int (nth 1 rhs) 1) 213 (or (math-equal-int (nth 1 rhs) 1)
216 (equal (nth 1 rhs) '(cplx 1 0))))) 214 (equal (nth 1 rhs) '(cplx 1 0)))))
217 (list '/ lhs (nth 2 rhs))) 215 (list '/ lhs (nth 2 rhs)))
218 (t (list op lhs rhs))) 216 (t (list op lhs rhs))))
219 )
220 217
221 (defun calc-sel-unpack () 218 (defun calc-sel-unpack ()
222 (interactive) 219 (interactive)
223 (calc-wrapper 220 (calc-wrapper
224 (calc-preserve-point) 221 (calc-preserve-point)
232 (error "Selection must be a function of one argument")) 229 (error "Selection must be a function of one argument"))
233 (calc-pop-push-record-list 1 "unpk" 230 (calc-pop-push-record-list 1 "unpk"
234 (list (calc-replace-sub-formula 231 (list (calc-replace-sub-formula
235 expr sel (nth 1 sel))) 232 expr sel (nth 1 sel)))
236 num 233 num
237 (list (and reselect (nth 1 sel)))))) 234 (list (and reselect (nth 1 sel)))))))
238 )
239 235
240 (defun calc-sel-isolate () 236 (defun calc-sel-isolate ()
241 (interactive) 237 (interactive)
242 (calc-slow-wrapper 238 (calc-slow-wrapper
243 (calc-preserve-point) 239 (calc-preserve-point)
264 (calc-pop-push-record-list 1 "isol" 260 (calc-pop-push-record-list 1 "isol"
265 (list (calc-replace-sub-formula 261 (list (calc-replace-sub-formula
266 expr eqn soln)) 262 expr eqn soln))
267 num 263 num
268 (list (and reselect sel))) 264 (list (and reselect sel)))
269 (calc-handle-whys))) 265 (calc-handle-whys))))
270 )
271 266
272 (defun calc-sel-commute (many) 267 (defun calc-sel-commute (many)
273 (interactive "P") 268 (interactive "P")
274 (let ((calc-assoc-selections nil)) 269 (let ((calc-assoc-selections nil))
275 (calc-rewrite-selection "CommuteRules" many "cmut")) 270 (calc-rewrite-selection "CommuteRules" many "cmut"))
276 (calc-set-mode-line) 271 (calc-set-mode-line))
277 )
278 272
279 (defun calc-sel-jump-equals (many) 273 (defun calc-sel-jump-equals (many)
280 (interactive "P") 274 (interactive "P")
281 (calc-rewrite-selection "JumpRules" many "jump") 275 (calc-rewrite-selection "JumpRules" many "jump"))
282 )
283 276
284 (defun calc-sel-distribute (many) 277 (defun calc-sel-distribute (many)
285 (interactive "P") 278 (interactive "P")
286 (calc-rewrite-selection "DistribRules" many "dist") 279 (calc-rewrite-selection "DistribRules" many "dist"))
287 )
288 280
289 (defun calc-sel-merge (many) 281 (defun calc-sel-merge (many)
290 (interactive "P") 282 (interactive "P")
291 (calc-rewrite-selection "MergeRules" many "merg") 283 (calc-rewrite-selection "MergeRules" many "merg"))
292 )
293 284
294 (defun calc-sel-negate (many) 285 (defun calc-sel-negate (many)
295 (interactive "P") 286 (interactive "P")
296 (calc-rewrite-selection "NegateRules" many "jneg") 287 (calc-rewrite-selection "NegateRules" many "jneg"))
297 )
298 288
299 (defun calc-sel-invert (many) 289 (defun calc-sel-invert (many)
300 (interactive "P") 290 (interactive "P")
301 (calc-rewrite-selection "InvertRules" many "jinv") 291 (calc-rewrite-selection "InvertRules" many "jinv"))
302 ) 292
303 293 ;;; calcsel2.el ends here