markyrocks Posted January 12, 2022 Share Posted January 12, 2022 (edited) Hello again one and all. As you may or may not know i'm playing around with an array sort dll, which is actually making pretty good progress. I'm pretty excited about it. I'll get right to the point here. I'm looking for opinions on the situation where you have an array with blank spaces in it. for instance Global $array[6]=[10,9,8] $array[5]=11 ; i.e [10,9,8, , ,11] if the array was to be sorted does it make more sense to leave the blank spaces where they currently are and sort the numbers as if they were contiguous so the result would be [8,9,10, , ,11] , does it make more sense to shift the blanks to the end or should this be an option? If its an option which one makes more sense to be the default? I realize that the situation has alot to do with it. I realize that this is an odd question. I know I don't usually roll around with arrays that have voids in them but maybe others do? I guess another option would be to simply remove the blanks and resize the array. This almost sounds like it could be a separate function like SortAndResize(). The way that i'm currently doing it is that i'm leaving the blanks where they are but that's a byproduct of the original design. The reasoning being that I read the entire array memory space and remove any blanks. Then copy the data at those addresses, sort it and then just write it back to the addresses. in order. Thats a value sort, what I should probably be doing is an element sort which just shifts the pointers around in the actual array, that's usually faster if the data itself is bigger like strings but i'm keeping it simple for now. When I get my own variant class integrated into this then I'll move into swapping pointers around but its kinda hard to do that because attempting to actually dereference a pointer causes a crash. Being able to do so would be nice but I think its owned by another thread. Anyways I got problems for days but I do feel like this could result is some ground breaking stuff. Drag this language into the 2020's kicking and screaming. I appreciate any input thanks. (I promise not to argue with anyone!!!! I SWEAR) theres' no wrong or right opinion. Edited January 12, 2022 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
argumentum Posted January 12, 2022 Share Posted January 12, 2022 4 minutes ago, markyrocks said: if the array was to be sorted does it make more sense to leave the blank spaces where they currently are All values are expected to be sorted. Those of blank should be sorted too. The option to add those blank to the end or the beginning, is something that I would find useful. markyrocks 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
markyrocks Posted January 12, 2022 Author Share Posted January 12, 2022 12 hours ago, argumentum said: All values are expected to be sorted. Those of blank should be sorted too. The option to add those blank to the end or the beginning, is something that I would find useful. I honestly think since there is no right or wrong answer and endless possibilities adding in the option or atleast a separate function that's specifically for arrays with blank spaces. The option could be if it's 0 ignore them, if it's positive push the blanks to the end it it's negative push them to the beginning. Simple as that. If I decide to get fancy I could make it figure out which region has more blanks and push them towards that side. Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
markyrocks Posted January 14, 2022 Author Share Posted January 14, 2022 (edited) Ok so I got it to push blanks to one side or the other. The issue is that if I have mixed data types (if it's doing a number sort) the strings get pushed to the same side as the blanks. They're treated exactly the same which just kinda happened on accident but it's a happy accident. In that scenario it's possible for blank elements to get mixed in with strings bc theres currently no distinction in that particular path. My question is how should I handle this? Put the blanks at the very end and check to see if the blank is a string and group them all together after the blanks? Before the blanks, separate sides? I can pretty much do whatever at this point. I'm not too concerned with 2d array and so on bc its still stored in sequential memory there's a formula to deal with that. I just don't have it in me to think about it rn. Sleepy thanks. Also in the above the reverse should be true for basic types that get mixed into a string sort. Comments on that awell. Edited January 14, 2022 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
bobomb Posted January 15, 2022 Share Posted January 15, 2022 The irony here is strong Link to comment Share on other sites More sharing options...
markyrocks Posted January 17, 2022 Author Share Posted January 17, 2022 On 1/15/2022 at 12:29 PM, bobomb said: The irony here is strong care to explain? Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
bobomb Posted January 18, 2022 Share Posted January 18, 2022 You already owe me 5$ for my comment. We can do the explanation when you're all paid up. Good luck in your array adventures. 👍 argumentum 1 Link to comment Share on other sites More sharing options...
markyrocks Posted January 19, 2022 Author Share Posted January 19, 2022 11 hours ago, bobomb said: You already owe me 5$ for my comment. We can do the explanation when you're all paid up. Good luck in your array adventures. 👍 When you got skillz you don't need luck son. Xandy and bobomb 2 Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
argumentum Posted January 19, 2022 Share Posted January 19, 2022 @markyrocks, I like the attention to detail and exploration of possibilities when looking at the array functions we have to work with. But on the other hand ( there's a golden band .. ) the hint of money exchange for a product that is itself free.., not cool. The devs don't need this product, but I do, due to not knowing different or being mentality limited, either/or, is the same to me. I would have to learn programming, if not for AutoIt. Again, I like what your doing, but your people skills .. is confrontational. And is very probably that confrontational nature that pushed you to look for a solution to the slow array handling in AutoIt, so is not bad as a nature. I do make money with the code I do for clients using AutoIt ( coffee and cigarettes are not free ) but when I can share something with this community that I feel is needed, I do. In itself is a form of donation in my view ( but I suffer cognitive dissonance from time to time, so my mile may vary ). If you're posting in this forum is because you are fond of AutoIt and any favorable contribution ( without ranting much if possible ) will always be welcomed in my book. Musashi and bobomb 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
juxwillx Posted February 18, 2022 Share Posted February 18, 2022 Aren't all the values supposed to be sorted? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now