Here’s what I have…
Select[roll, # <= 3 &]
Now, the list that follows may have one 3 or two three’s. I want it to stop at the first three from left to right.
Mathematician trying to code.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: I removed my original posting, which was basically like that of belisarius. Here’s another try…
If you are sure that the number 3 is a member of
rollthen this should work:This is equivalent to:
If you cannot make this assumption, just test first with
MemberQEDIT: Credit goes to TomD for suggesting the +1 in the second solution, which eliminates the need to use
Append.