Bug with compiling "find first"

When I compile the "find first" block, and click help, the help screen doesn't appear. For some reason this only happens with this block and not the other blocks that I tried it with.

Hi, welcome to the forum!

Confirmed. Thanks for reporting this.

Why is compile even an option on some blocks? it’s strange to not have them just always compiled

Especially because this block’s definition is basically just
untitled script pic 37
I don’t know how you could make it “faster” or whatever compile does

Some blocks cause issues when complied if used in some situations (Or certainly used to - I stopped using the facility when I encountered a problem a few years ago)

Compiling itself takes (a very short) time. So if one of these operations is processing a tiny list, the compiled version may actually be slower than its interpreted counterpart.



This may be one of the reasons why compiling is optional.

More importantly, I ran a few functional tests, confirming @cymplecy’s experiences. If the function to be mapped, or the list being processed, is even a little complicated, the compiled version won’t work. On closer inspection I found that the Reference Manual (p. 123) confirms this, too.

(How did you make that block?

Programming tools SANDBOX script pic (51)

... copied it from @dardoro :grinning:

I think that's now officially obsolete; compiling was initially explicitly an experimental feature, but these days it's supposed to fail softly, i.e., if an example can't be compiled successfully it's supposed to just silently run without being compiled. But I'll double-check.

Oh, it's faster even without compilation. Your implementation traverses the entire list, looking for all the items that match the condition, then throws out all but the first one. The actual primitive stops as soon as it finds one matching item.

I recently checked with a complicated project with a sub-sub-function that has a MAP inside a KEEP. When I select "compile" with these HOF's, the code when executed generates enigmatic (for an ordinary user) messages. I wouldn't call it soft failing.

Okay, thanks for the report. I guess that means I don't have to change the manual. :~)

Well, yes … not having to change the manual is the upside of it :wink: