Page 1 of 1

finding duplicates in array

Posted: Sun Oct 06, 2013 8:59 pm
by tester
How to automatically find/remove duplicated entries witin an array?

Can be with sorting, but... doable without sorting?

Re: finding duplicates in array

Posted: Sun Oct 06, 2013 9:29 pm
by RJHollins

Re: finding duplicates in array

Posted: Sun Oct 06, 2013 9:56 pm
by tester
As a module with input and output to connect something - it could help. Could you make it?

Re: finding duplicates in array

Posted: Mon Oct 07, 2013 6:16 am
by RJHollins
tester wrote:As a module with input and output to connect something - it could help. Could you make it?


Not following you here :?:

The link I posted was to highlight the 'UNIQ' command.
'Returns a new array by removing duplicate values in self.'

There are several variations too.

Unless I'm misunderstanding :?

Re: finding duplicates in array

Posted: Mon Oct 07, 2013 11:39 am
by tester
I have no idea how to compile working ruby module in FS from that thing. I'm not kidding :-) I really don't get the ruby part yet, and my head is offline on that.

Re: finding duplicates in array

Posted: Mon Oct 07, 2013 5:25 pm
by Nubeat7
just that

Re: finding duplicates in array

Posted: Mon Oct 07, 2013 9:20 pm
by tester
Now you killeed me... :lol:
It looks that my thinking is just too complex. I tried various things (none worked of course). But not this one.

Thanks!

Re: finding duplicates in array

Posted: Mon Oct 07, 2013 9:59 pm
by trogluddite
Yes - those API documents are "auto-created" from the Ruby interpreter's source code, so they take some getting used to! :?

The thing to look for is the "#=>" - that's not any kind of special Ruby code; "#" just means that the rest of the line is a programmer's comment (i.e. ignored by Ruby). But in the doc's they often write "#=>" to mean "Here's the result of that example".

Re: finding duplicates in array

Posted: Tue Oct 08, 2013 6:41 pm
by tester
Yep, and every language has their own scheme of marking and explaining things. These rubyish examples should be converted into FS pieces of simple codes, with addidional simple comments on that. Like the old SM-style user packs. I read these descriptions, and make very big eyes, trying to figure out what the writer of that wanted to say....

Re: finding duplicates in array

Posted: Tue Oct 08, 2013 8:29 pm
by RJHollins
I hear ya !

When I look for a RUBY solution, I hit GOOGLE to find related topics.

If there is a related solution, some of them can be 'way out there', and other RUBY guys will post different solutions or optimizations. It can be most helpful, AND confusing ... but at least it gets me started.

Just typing in the code in FS is helpful to a nube as me ... it forces me to think about the syntax and logic. I'm still at a snails pace understanding ... but a little success spurs me on :lol:

Just got to keep at it. There are definately things RUBY brings to a possible solution that would take many primitives to replicate. It can really clean up a schematic. It may not be for everything, but when I have gone the RUBY route ... it was very much worth it.

Thanks for all the Guys here who help with ALL of this FS stuff ... my project ideas have become a reality :D
8-)