Your image urls can't have blob at the beginning. Blobs get deleted. You should instead, download the image, the upload it to the forum, by dragging and dropping it into the text field, or by clicking on the image button.
oh wait, it might be a limitation new users have. I can't keep track of what new users can and can't do. They change pretty often (at one point, new users couldn't create new topics, which is kind of funny, because usually new users come to ask questions).
Don't worry, you'll be able to have the limitations removed when you get trust level 1 (trust level 0 is pretty much just to keep away spammers).
Anyway, the links work fine.
I've looked at it, and I think I found the problem.
I agree with you. I never use the PRIMITIVE blocks for functions that are in libraries. I don't know how the functions work, and it's much easier for someone to understand what the code is doing if it uses library blocks.
I figured out the problem, in calling the weighted compare function in the sort function, one has to use the diamond ring block. Thanks @bh for your insight and @ego for your kind help.
I had the hunch that something on that line has to be done.
Now, I am still experimenting how to write the help function (in this case, the compare function, but in general, could be just function block) right inside the custom block one is writing, that way, the code is cleaner. So far, I has not made much progress, I think it's also my limited knowledge of ringnify.
We don't have blocks that are local to other blocks. (It's on my someday list, but I think Jens is skeptical.) As of the 8.0 release, you can define a block inside another block (see Chapter X of the Reference Manual) but that definition will be global or sprite-local, not script-local.
P.S. But of course you could put the entire body of the helper block inside the grey ring if you want.
I tried the local compare function (as a local variable) approach, and surprisingly it's working, and I think it's local, could you please take a look and see whether it's legit?
I was about to give up after tried many many times, but I have to put another diamond ring around compare before I feed it into the library sort function, and voila, it worked. Here is the link to the mega drive:
Yes, your "too" function works just fine without the additional diamond ring, however, my compare function does not work the same, your suspicion of something to do with the weight function might be the reason, although I could not figure out the reason.
Basically, I am applying a weight function before the normal compare. I could accomplish it in some other ways, but this is the most direct and general method in my way of thinking. For example, I could apply a map to the original list using the weight function, and sort it to get the sorted indices list, such as using the APL grade up or grade down function, and get the result by re-indexed the original list.
By the way, could you first try to use the script pic to get my code into a snap project? Due to the restriction, it's a little complicated on my end. You will notice without using the additional diamond ring, it will pop up an error.
first of all, now I understand by adding the additional ring will truthy the result, since my original test case (in the 2nd post) was constructed to have a reverse order, I thought it was working, but it was not,
but as I said, without the diamond ring, it will have an error pop up. Here is the test case #2:
When I used the external function, it will work. I will use the external function as a work around until I figure out the reason through your help.
Wait, you can't use a random value as the "weighted function" and expect it to work! Each value participates in comparisons more than once. (If it's a good sort algorithm, on average each value participates in O(lg N) comparisons where N is the length of the list.) If your weighted "function" gives different results when called repeatedly with the same input, it's not a surprise if the sort blows up.