0
|
5717 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

# Mystery regarding use of Sequence function ...

Posted 10 years ago
 Because some Boolean functions work on Lists and others on argument lists only, I need to better understand the Sequence command for converting the former to the latter. For example, why ... ? I want to give Or a list of boolean literals. This works ... Or @@ {False, True}  True This doesn't work ... Or[Sequence @@ {False, True}]  (out) Sequence[False, True] This works ... Or[False, Sequence @@ {False, True}]  True Why does the 3rd expression work when the 2nd does not? Thank you. Attachments:
2 Replies
Sort By:
Posted 10 years ago
 Thank you!As you imply, I need to learn much more about the "evaluation process."For example, thanks to your advice re Trace I can see differences between what works and what doesn't, but still don't understand why.I'll save that question and related exploration for another day.-- Mark
Posted 10 years ago
 The evaluation process can be tricky and is best studied with Trace. In[2]:= Or[Sequence@@{False,True}]//Trace Out[2]= {Or[Sequence@@{False,True}],{Sequence@@{False,True},HoldForm[False,True]},HoldForm[False,True]} In[5]:= Or[False,Sequence@@{False,True}]//Trace Out[5]= {False||Sequence@@{False,True},{Sequence@@{False,True},HoldForm[False,True]},Or[Sequence[False,True]],False||True,True}