Timeline for Position built-in function with "test" instead of "pattern matching"?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 20, 2017 at 16:53 | comment | added | Picaud Vincent | @alucard thanks, I will do that next time... It is just that I am not very proud of this duh "question" :-/ | |
Nov 20, 2017 at 16:51 | comment | added | Alucard | @PicaudVincent i suggest you to wait a little longer before accepting an answer, the experts may want to add their solution | |
Nov 20, 2017 at 16:46 | comment | added | Picaud Vincent | @Alucard, good catch, that works. Thanks. My "Number" was something stupid, this is not the Head of "numbers"... | |
Nov 20, 2017 at 16:43 | comment | added | Alucard |
@PicaudVincent try Position[Range[10], _Integer?OddQ]
|
|
Nov 20, 2017 at 16:42 | comment | added | Picaud Vincent | @Alucard for instance Position[Range[10], _Number?OddQ] returns {}... I certainly miss something... | |
Nov 20, 2017 at 16:37 | comment | added | Alucard | why? i find it elegant: it select all the string elements and test them with UpperCaseQ | |
Nov 20, 2017 at 16:34 | comment | added | Picaud Vincent | Thanks, I only hope this can work in all cases, the syntax _String?UpperCaseQ is not the most natural one. | |
Nov 20, 2017 at 16:33 | comment | added | Bob Brooks | @Picaud Vincent Nice! | |
Nov 20, 2017 at 16:31 | comment | added | Picaud Vincent | Thanks, for your answer. I just found something that seems to work ( Position[{"a", "b", "A", "a", "B", "c", "b"}, _String?UpperCaseQ] ) | |
Nov 20, 2017 at 16:29 | history | answered | Bob Brooks | CC BY-SA 3.0 |