finding duplicates in array

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

finding duplicates in array

Post by tester »

How to automatically find/remove duplicated entries witin an array?

Can be with sorting, but... doable without sorting?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: finding duplicates in array

Post by RJHollins »

tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: finding duplicates in array

Post by tester »

As a module with input and output to connect something - it could help. Could you make it?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: finding duplicates in array

Post 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 :?
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: finding duplicates in array

Post 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.
Attachments
and-then-what.fsm
(327 Bytes) Downloaded 1054 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
Nubeat7
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna
Contact:

Re: finding duplicates in array

Post by Nubeat7 »

just that
Attachments
and-then-what.fsm
(385 Bytes) Downloaded 1069 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: finding duplicates in array

Post 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!
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: finding duplicates in array

Post 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".
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: finding duplicates in array

Post 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....
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: finding duplicates in array

Post 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-)
Post Reply