Giter Site home page Giter Site logo

Strings about rfcs HOT 8 OPEN

witheve avatar witheve commented on August 15, 2024
Strings

from rfcs.

Comments (8)

RubenSandwich avatar RubenSandwich commented on August 15, 2024

While all of your proposals will fit the baseline of "search-as-you-type", I suggest with aiming for a fuzzy search algorithm from the start. For the simple reason that the general computing publics most used search is Google and Google utilizes fuzzy search; so any deviation from this might be confusing to the new comer. (Especially ones without software backgrounds.) Might I suggest using: https://github.com/krisk/Fuse?

from rfcs.

shamrin avatar shamrin commented on August 15, 2024

@RubenSandwich Thank you for the Fuse link! Another JavaScript library I've found interesting is Lunr.js.

(I don't think we can use any of these libraries except for inspiration. Eve runtime is currently written in C and Lua.)

If we are talking about search engines, they work somewhat differently. Compared to Fuse they are transparent about their fuzziness. Compare:

searrch at duckduckgo

(Personally, I've found Fuse search results confusing. That said, I have a software background… I am likely biased in the wrong way.)

Maybe it makes sense to come up with a minimal set of features for Eve. Developers could then use those features to implement search the way they want.

from rfcs.

cmontella avatar cmontella commented on August 15, 2024

We talked a little about this today, and we've decided on some basic string functions that we can start implementing immediately.

  • concat - this is already implemented in the form of string interpolation.
  • split - (token, index) = split(text, by) takes a text and splits it according to by, returning the tokens and the indices of those tokens in the original string.
  • join -
    text = join(token, index, with) - essentially the opposite of split, takes tokens and their indices and joins them together with with, returning the full string as text.
  • char-at -
    char = char-at(text, index) - returns the character in text and position index
  • find -
    found = find(text, subtext) - Finds every instance of subtext in text, returns the index of each match.
  • length -
    len = length(text) - Returns the number of characters in text.
  • replace -
    new = replace(text, subtext, with) - replaces every instance of subtext in text with with, returns the resulting string.

I think advanced string features need some more discussion. For example, regarding regex, we could certainly do such a thing, but maybe there is a better way? For instance, being able to support BNF-style grammars. What are the expectations here for people?

from rfcs.

cmontella avatar cmontella commented on August 15, 2024

This RFC hasn't seen attention in a while. Sometime next week I'm going to close this RFC and open a new RFC that is generally about the standard library. We can talk about strings and math and anything else that we feel needs to be in the std lib.

from rfcs.

jimmyhmiller avatar jimmyhmiller commented on August 15, 2024

@cmontella I know you mentioned closing this and starting a general std lib, but I was wondering if you were still interested in these functions. I started implementing them as an exercise to understand eve internals more.

from rfcs.

cmontella avatar cmontella commented on August 15, 2024

Yeah, we still need some of these, so any help is appreciated!

from rfcs.

jimmyhmiller avatar jimmyhmiller commented on August 15, 2024

So, I started implementing a bunch of string functions and noticed a pattern. I ended up implementing a higher-order function to make constraints.

The code can definitely use some clean-up, but I wanted to see if you were open to this sort of approach. It vastly simplified implementing javascript string functions and seems to work as long as your results are value types.

from rfcs.

cmontella avatar cmontella commented on August 15, 2024

Jimmy, I'll post some feedback for you, sorry I had forgotten to take a look at that!

from rfcs.

Related Issues (4)

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.