Loopy Pro: Create music, your way.
What is Loopy Pro? — Loopy Pro is a powerful, flexible, and intuitive live looper, sampler, clip launcher and DAW for iPhone and iPad. At its core, it allows you to record and layer sounds in real-time to create complex musical arrangements. But it doesn’t stop there—Loopy Pro offers advanced tools to customize your workflow, build dynamic performance setups, and create a seamless connection between instruments, effects, and external gear.
Use it for live looping, sequencing, arranging, mixing, and much more. Whether you're a live performer, a producer, or just experimenting with sound, Loopy Pro helps you take control of your creative process.
Download on the App StoreLoopy Pro is your all-in-one musical toolkit. Try it for free today.
Algorithm question ... reducing a list of folders to top-most parents
The user and all related content has been deleted.
Comments
Can't you just split on the slash, then sort on the first field, removing duplicates?
Or use perl; split on the slash, then use each first field as the key to add "1" to a hash. That'll remove the duplicates.
How about not even bother to split lines, just use Awk (or Perl), test if there's a slash '/' in text of line, print line only if there's no slash? (Whoops, that doesn't work if not all entries have have top level directories included. . . )
What is the performance requirement, exactly? It's fun to get a nicely crafted sed/awk script, but you seem to already have a bash solution that works, and which I expect is plenty fast. Have you tested and found it lacking with what you consider long lists? ("Thousands and thousands of lines" doesn't sound particularly large by computer standards.)
I scratched my head over it for some time but the coffee didn't kick in sufficiently to solve it.
I thought it would be entertaining to see what chatGPT would come up with. I wasn't wrong. 😂
I entertained myself for almost an hour showing it how the results the command lines it happily and confidently spewed out were wrong and seeing the various creative ways it could solve the problem incorrectly. Good fun! But no answer for you unfortunately.
Ha. Yes, of course. But I expect there's also a fairly easy way to convert the Awk approach to a bash script. Might be twice as slow, but would be of little concern. There's also little reason to spend time optimizing an algorithm unless there's an actual need for it. . . Unless you just want to have fun, which is valid reason, too. But it's ALWAYS good to know when you're doing it just for fun, and when there's an actual need.