# Mystery regarding use of Sequence function ...

Posted 9 years ago
4758 Views
|
2 Replies
|
1 Total Likes
|
 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} TrueThis doesn't work ... Or[Sequence @@ {False, True}] (out) Sequence[False, True]This works ... Or[False, Sequence @@ {False, True}] TrueWhy does the 3rd expression work when the 2nd does not?Thank you. Attachments:
2 Replies
Sort By:
Posted 9 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 9 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}