From: SourceForge.net <noreply@so...>  20060731 21:21:11

Bugs item #1052382, was opened at 20041022 14:33 Message generated for change (Comment added) made by macrakis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1052382&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core  Assume Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: assume hard to use programmatically Initial Comment: assume(r>0 and r<1) works fine. However, if I have a function withassume(pred,expr) := ( assume(pred), expand(expr) ); you get withassume(r>0 and r<1, abs(r)) => ERROR: can't eval predicate r>0 Quoting doesn't help: withassume('(r>0 and r<1), abs(r)) => error withassume('('(r>0) and '(r<1)), abs(r)) => error withassume(('"and")(r>0) and '(r<1)), abs(r)) => error withassume('("and")(r>0) and '(r<1)), abs(r)) => error There is a workaround, however: withassume(pred,expr) := ( apply('assume,[pred]), expand(expr) ); You still have to quote the argument, but it works now: withassume('(r>0 and r<1), abs(r)) => r Alternatively, you can use the noun form of AND: withassume('("and")(r>0,r<1),abs(r)) => r Yuck in both cases.  Discussion The underlying problem is that "is", "assume", "forget", etc. quote their arguments then depend on their own little idiosyncratic evaluator.... Also that nounform logical connectives (and, or, if) aren't really supported. Maxima version: 5.9.0.9beta2 Maxima build date: 10:50 7/27/2004 host type: i686pcmingw32 lispimplementationtype: Kyoto Common Lisp lispimplementationversion: GCL 2.6.3  >Comment By: Stavros Macrakis (macrakis) Date: 20060731 17:21 Message: Logged In: YES user_id=588346 Writing withassume as a macro instead of a function only works in the case of a constant argument. There is still no way to pass around the expression '(r>0 and r<1). For example, using the macro definition of withassume, the following still doesn't work: condition: '(r>0 and r<1)$ withassume(condition, abs(r)) Remember, macros are a syntactic fix. The underlying problems  1) that is/assume/etc. quote their arguments and 2) that "and" cannot handle unevaluated conditions  remain.  Comment By: Robert Dodier (robert_dodier) Date: 20060731 00:51 Message: Logged In: YES user_id=501686 I know that this report is mostly about the general problem of using assume programmatically, but, writing withassume as a macro instead of a function yields the intended behavior I think: withassume(pred,expr) ::=buildq([pred, expr], block([result], assume(pred), result:expand(expr), forget(pred),result )); withassume(r>0 and r<1, abs(r)); => r facts(); => []  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1052382&group_id=4933 