0
$\begingroup$

This works fine:

data = {{97, 63, 88}, {1, 20, 35}, {174, 42, 122}, {172, 152, 
   18993}, {7, 2, 2}, {173, 86, 112}};
DeleteCases[data, {u_, v_, w_} /; u <= 10]

But this does not always work:

Remove["Global`*"]; data = {{97, 63, 88}, {1, 20, 35}, {174, 42, 
   122}, {172, 152, 18993}, {7, 2, 2}, {173, 86, 112}};
DeleteCases[data, {u_, v_, w_} /; u <= 10]
$\endgroup$
6
  • 4
    $\begingroup$ Global`data is created during parsing and then removed during evaluation of your first line $\endgroup$
    – ilian
    Commented Jun 5, 2018 at 18:20
  • $\begingroup$ looks like a duplicate: Why does removing a function and defining it on the same line not work? $\endgroup$
    – Kuba
    Commented Jun 5, 2018 at 19:43
  • $\begingroup$ What if you enter a return character between Remove[...]; and the data definition? $\endgroup$
    – ktm
    Commented Jun 5, 2018 at 19:57
  • $\begingroup$ @user6014 each line is parsed separately so it will work. $\endgroup$
    – Kuba
    Commented Jun 5, 2018 at 20:25
  • $\begingroup$ @kuba Yup. Not all users are familiar with the "parsing" and the evaluation procedure, so being a little more explicit about it may help someone who isn't an expert and has this issue $\endgroup$
    – ktm
    Commented Jun 5, 2018 at 20:29

0

Browse other questions tagged or ask your own question.