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 Store

Loopy Pro is your all-in-one musical toolkit. Try it for free today.

Algorithm question ... reducing a list of folders to top-most parents

edited February 28 in Other
The user and all related content has been deleted.

Comments

  • The user and all related content has been deleted.
  • 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.

  • heshes
    edited February 28

    @uncledave said:
    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. . . )

  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • @tja said:

    @hes said:

    @uncledave said:
    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. . . )

    Yes...
    I was thinking hard about sed and awk, for performance reasons - I may have long lists of such pathe

    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.)

  • The user and all related content has been deleted.
  • wimwim
    edited February 29

    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.

  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • edited February 29
    The user and all related content has been deleted.
  • edited February 29
    The user and all related content has been deleted.
  • edited February 29
    The user and all related content has been deleted.
  • heshes
    edited February 29

    @tja said:
    Not even 2 seconds :-D

    And because of this, @hes it is ALWAYS worth to spend time optimizing an algorithm or the structure of data!
    Honor your Knuth ;-)

    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.

  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • edited February 29
    The user and all related content has been deleted.
Sign In or Register to comment.