Student Support Forum: 'If same element exists in a list, gives 0.' topicStudent Support Forum > General > "If same element exists in a list, gives 0."

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response yehuda 02/20/13 3:25pm In Response To 'Re: If same element exists in a list, gives 0.' --------- Bill, this is not fully correct, since Union sorts the list, and if the list is not sorted in the first place, you will get a wrong answer Therefore the solution should be f[v_]:=If[Length[Union[v]]==Length[v],1,0]; yehuda [World: Please be aware that Bill posted his erratum before Yehuda's comment become Public. -FM] URL: ,

 Subject (listing for 'If same element exists in a list, gives 0.') Author Date Posted If same element exists in a list, gives 0. simple 02/19/13 9:31pm Re: If same element exists in a list, gives 0. Bill Simpson 02/20/13 1:34pm Re: Re: If same element exists in a list, gives... yehuda 02/20/13 3:25pm Re: If same element exists in a list, gives 0. Bill Simpson 02/20/13 4:08pm Re: If same element exists in a list, gives 0. yehuda 02/21/13 3:08pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic