There are several ways to get this effect, and what you choose may depend on more details about what you intend to do with it.
The simplest is to use a 2 argument eval(or subs, since the evaluation should happen due to automatic simplification for a product with an exact 1 or 0).
> eval( 5*true, [true=1,false=0]);
5
> eval( x*false, [true=1,false=0]);
0
And of course, you can create a procedure to handle this assessment,
> T := expr -> eval(expr,[true=1,false=0]):
> T( 5*true );
5
> T( x*false );
0
(, , " " ) *.
. * "true" "false" , , . ( , "true" "false" , , . .)
> M:=module() option package; export `*`;
> `*`:=proc(ee::seq(anything))
> :-`*`(op(eval([ee],[true=1,false=0])));
> end proc;
> end module:
> with(M):
> 5*true;
5
> x*false;
0
> a*b*c;
a b c
> eval( %, b=false );
a false c
, "false" 0. , a * b * c ( a, b c) : - *, *. b = false *. , , ( , , "" - , ),
> M:=module() option package; export `*`;
> `*`:=proc(ee::seq(anything))
> local res;
> res:=:-`*`(op(eval([ee],[true=1,false=0])));
> if type(res,:-`*`) then
> 'procname'(op(res));
> else
> res;
> end if;
> end proc;
> end module:
> with(M):
> 5*true;
5
> x*false;
0
> a*b*c;
`*`(`*`(a, b), c)
> eval( %, b=false );
0
, * (* (a, b), c), *. , b = false , *, . (, , .)