subst(lambda ...), was: multiple evaluations & integrate



On 2013-06-23, Barton Willis <willisb at unk.edu> wrote:

> The function sublis controls evaluation of lambda forms using mqapply
> (not mquote):

Thanks for the reminder -- I had forgotten about that.

> (%i3) sublis(['sin =3D lambda([x],42)], sin(z)), sublis_apply_lambda : false;
>   1> (MSUBLIS-SUBST ((%SIN SIMP) $Z) T)
>     2> (MSUBLIS-SUBST ($Z) NIL)
>       3> (MSUBLIS-SUBST $Z T)
>       <3 (MSUBLIS-SUBST $Z)
>       3> (MSUBLIS-SUBST NIL NIL)
>       <3 (MSUBLIS-SUBST NIL)
>     <2 (MSUBLIS-SUBST ($Z))
>     2> (MSUBLIS-SUBST %SIN T)
>     <2 (MSUBLIS-SUBST ((LAMBDA SIMP) ((MLIST) $X) 42))
>  <1 (MSUBLIS-SUBST ((MQAPPLY) ((LAMBDA SIMP) ((MLIST) $X) 42) $Z))
> (%o3) lambda([x],42)(z)

> Maybe $substitute could be modified to use the mqapply trick.

Yeah -- I've been working on that. But I wonder if subst and sublis
should be merged -- aside from sublis being parallel and subst being
serial, do they have any different effect? If we are satisfied that
they are otherwise the same, we could nuke the existing subst and
have it punt to sublis instead (looping to get serial substitutions).

> As for extending the (obscure) option variable sublis_apply_lambda
> to substitute, I dunno--generally I lean toward fewer (obscure)
> option variables.

Agreed -- I'm inclined to nuke sublis_apply_lambda.

> Is mqapply used this way a crazy hack that just happens to wrork?

Looks to me like it is working just as one would expect.

best

Robert Dodier