Comments (8)
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.
@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:
(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.
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 atext
and splits it according toby
, returning the tokens and the indices of those tokens in the original string. - join -
text = join(token, index, with)
- essentially the opposite of split, takestokens
and theirindices
and joins them together withwith
, returning the full string astext
. - char-at -
char = char-at(text, index)
- returns the character intext
and positionindex
- find -
found = find(text, subtext)
- Finds every instance ofsubtext
intext
, returns the index of each match. - length -
len = length(text)
- Returns the number of characters intext
. - replace -
new = replace(text, subtext, with)
- replaces every instance ofsubtext
intext
withwith
, 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.
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.
@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.
Yeah, we still need some of these, so any help is appreciated!
from rfcs.
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.
Jimmy, I'll post some feedback for you, sorry I had forgotten to take a look at that!
from rfcs.
Related Issues (4)
- Syntax HOT 146
- Rename "given" to "the" HOT 2
- SVG path element HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rfcs.