objeck / objeck-lang

Objeck is a modern object-oriented programming language with functional features tailored for machine learning. It emphasizes expression, simplicity, portability, and scalability. The programming environment consists of a compiler, virtual machine, REPL shell, and command line debugger with IDE plugins.
https://objeck.org
Other
157 stars 11 forks source link

Please add `Collection.UnorderedSet` #448

Closed ghost closed 9 months ago

ghost commented 9 months ago

Delphi's Set data type is unordered. Collection.UnorderedSet helps porting Delphi code.

objeck commented 9 months ago

Thanks, I will look into this further

objeck commented 9 months ago

This would be an invert of the MultiMap with keys instead of values. Is this what you're looking for?

ghost commented 9 months ago

This would be an invert of the MultiMap with keys instead of values. Is this what you're looking for?

I don't know. I don't know the underlying of the data structures I'm using. It's like this. There is a tutorial of the language, Delphi in this case. The tutorial talks very few about the data structures and tell me how to use them and which should be used for a specific purpose. I blindly follow the tutorial. I have never been trained in CS and I'm a pure hobbyist. I bought some programming books but have never seriously read them. The DT&Algorithms stuffs make me headache. The only material I relying entirely on are simple tutorials in the internet. This is the very reason why it's so hard for me to utilize Objeck. There is no such tutorial exists for Objeck. Getting Started doesn't count. It's too few on the details. You can just think I'm a loser and ignore this. I'm having a headache now.

objeck commented 9 months ago

Not at all, thank you for the feedback.

Objeck was designed as a minimalistic language. I believe I have not achieved this goal as more features are added with minimal benefit. I observe this trend in Java as well C#, and wanted to avoid it.

ghost commented 9 months ago

Objeck was designed as a minimalistic language. I believe I have not achieved this goal as more features are added with minimal benefit. I observe this trend in Java as well C#, and wanted to avoid it.

Objeck is still minimalism. Most of the features added are to the libraries, not the language itself. Objeck is too minimalism. It even lacks the most basic math functions! It's me that asked you to add them. I still remember. The only thing that I think could be considered as with minimal benefit is the symlinks and hardlinks classes I asked you to add to System.IO.Filesystem. This is my bad. And yup, it's still System.IO.Filesystem even though you said with me you did change it to System.IO.FileSystem.

ghost commented 9 months ago

Why do you reopen this issue? I'm not even sure what I'm wanting. I'm not asking for something exactly the same as Delphi's Set data type. Delphi's Set is implemented using bitmask (I got this from Google, and I admit I don't understand, but with the limit of 256 elements of it then it's very useless for Objeck). What I'm thinking is simple. The nature of Delphi's Set is unordered. Objeck's Set is ordered. If Objeck has an unordered Set, the code could map 1:1 easier. But frankly speaking, most of the Delphi code using Sets I know, they will work exactly the same regardless of Set is ordered or unordered. I think I need to think twice before opening any feature requests. I'm sorry.

objeck commented 9 months ago

Thanks for the feedback, implementing an unordered map is not difficult however it requests time to implement. I have not come across a used case for such a data structure.

Please do not take my feedback as criticism as many of your requests have been implemented.

ghost commented 9 months ago

Oops, C++ has unordered_set!

https://www.geeksforgeeks.org/unordered_set-in-cpp-stl/

I have never fully know all of the C++ containers, though. Most of the time I use std::vector and std::unordered_map.

ghost commented 9 months ago

Please do not take my feedback as criticism as many of your requests have been implemented.

Yes, I know. It's only me that know I'm a bad coder. I have never take your feedback as criticism.

objeck commented 9 months ago

In C++, an unordered_set contains keys while an unordered_map contains keys and values. The implementations are nearly identical.

On Sat, Jan 20, 2024 at 1:56 PM iahung2 @.***> wrote:

Please do not take my feedback as criticism as many of your requests have been implemented.

Yes, I know. It's only me that know I'm a bad coder. I have never take your feedback as criticism.

— Reply to this email directly, view it on GitHub https://github.com/objeck/objeck-lang/issues/448#issuecomment-1902274137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHRT4OY6JYMB4SIHNZZ2GLYPQ4QPAVCNFSM6AAAAABCC35AXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGI3TIMJTG4 . You are receiving this because you modified the open/close state.Message ID: @.***>

ghost commented 9 months ago

So this mean implementing of Collection.UnorderedSet is very easy to you? I dropped the request for Tuples. Please reconsider the unordered maps in #451 and Collection.UnorderedSet. As I have read on various tutorials in the internet and I strictly followed them, unordered containers have their own performance benefits. If you can, why don't we have both ordered and unordered?

objeck commented 9 months ago

Maybe this is semantics, consider using the Hash class as it is an unordered collection of keys. I thought you were asking for a data structure that contains multiple keys with no associated values.

Can you please clarify?

https://www.geeksforgeeks.org/map-vs-unordered_map-c/amp/

On Sat, Jan 20, 2024 at 2:20 PM iahung2 @.***> wrote:

So this mean implementing of Collection.UnorderedSet is very easy to you? I dropped the request for Tuples. Please reconsider the unordered maps in

451 https://github.com/objeck/objeck-lang/issues/451 and

Collection.UnorderedSet. As I have read on various tutorials in the internet and I strictly followed them, unordered containers have their own performance benefits. If you can, why don't we have both ordered and unordered?

— Reply to this email directly, view it on GitHub https://github.com/objeck/objeck-lang/issues/448#issuecomment-1902278499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHRT4P2TFSJML66KW457DTYPQ7KTAVCNFSM6AAAAABCC35AXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGI3TQNBZHE . You are receiving this because you modified the open/close state.Message ID: @.***>

objeck commented 9 months ago

Add SetHash to support unordered_map like C++ functionality.

ghost commented 9 months ago

Time will tell if what you added is what I really need or not. Real usage will tell everything. I'm confused by all of this terminology. I can't answer most of your questions. Mostly because I have no ideas. I guess you will find it annoying when talking with stupid people like me. I'm sorry for wasting your time.