Code Monkey home page Code Monkey logo

Comments (6)

pachacamac avatar pachacamac commented on August 29, 2024 1

This is probably the best place to ask instead of opening a new issue. I must know what tool/algorithm you used to create that convoluted beast of a RegEx! Please don't say you did this by hand :D

from microlight.

asvd avatar asvd commented on August 29, 2024

wow. thanks!

(sorry, I'm not gonna fix this issue)

from microlight.

Qix- avatar Qix- commented on August 29, 2024
  • filed as wontfix

from microlight.

asvd avatar asvd commented on August 29, 2024

@pachacamac yes, that was built by hand :-)

But that's not that complicated as you might assume. First I also started with googling for an algorithm which would do that for me, but then I realized that the principle is simple. Roughly speaking, it makes sence to "factor out" in case if there are four or more words starting with the same letter:

lambda|let|lock|long
l(ambda|et|ock|ong)    <-- one byte saved!

If we only have three or less words, there is no sence to factor out:

global|goto|guard
g(lobal|oto|uard)      // same length

do|double
d(o|ouble)             // even bigger

This was the most typical case for taking a decision. For others, in case of doubt I just compared the length.

from microlight.

pachacamac avatar pachacamac commented on August 29, 2024

Really wonder though if that could be done automatically. Huffman encoding comes to mind but right now I can't think of how to implement it nor if it's worth it, but its kind of interesting :D

EDIT: Almost. Not Huffman tree but https://en.wikipedia.org/wiki/Radix_tree

from microlight.

brasofilo avatar brasofilo commented on August 29, 2024

Keeps being cool!
Thanks for not fixing it :)

from microlight.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.