For example if the input is x and x<10 the output is Sequence[x,0],if x>10 the output is Sequence[0,x] but obviously
Which[#<10,Sequence[#,0],#>10,Sequence[0,#]]&
does not work. How to solve this problem? Thank you!
but I find
Piecewise[{{Sequence[#, 0], # < 10}, {Sequence[0, #], # > 10}}] &
is worked minutes age why?. I feel very confused.
Sequence @@ Which[# < 10, {#, 0}, # > 10, {0, #}] &? – kglr May 20 '15 at 15:33Which[# < 10, Unevaluated@Sequence[#, 0], # > 10, Unevaluated@Sequence[0, #]] &I will leave it as a comment, I'm not good at explaining evaluation. – Kuba May 20 '15 at 15:34Sequence[{#,0}]...– N.J.Evans May 20 '15 at 15:35{a, Sequence[{b,c}], d}evaluates to{a,{b,c},d}, not{a,b,c,d}– LLlAMnYP May 20 '15 at 15:58Sequenceis not a function to use lightly, particularly as the head of a result. Is there some compelling case for using it here in preference to, say,List? – Daniel Lichtblau May 20 '15 at 19:11