If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
stock substring find inconsistency
11 posts
• Page 1 of 2 • 1, 2
stock substring find inconsistency
I just found an inconsistency in stock "string array find" primitive.
It looks that it finds only first matching "rows" not "substrings" (associated with indexed rows).
Another primitive to upgrade or replace with ruby.
Generally it is enough if it finds first match, and points in which line is it (index)...
...but for geeks it could generate a list of all indexes (not needed here).
Was this topic earlier touched, or I'm starting to have deja vu?
//edit: silly me; I have can get that index directly. from other place.
It looks that it finds only first matching "rows" not "substrings" (associated with indexed rows).
Another primitive to upgrade or replace with ruby.
Generally it is enough if it finds first match, and points in which line is it (index)...
...but for geeks it could generate a list of all indexes (not needed here).
Was this topic earlier touched, or I'm starting to have deja vu?
//edit: silly me; I have can get that index directly. from other place.
- Attachments
-
- substring-search-issue.fsm
- (299 Bytes) Downloaded 856 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stock substring find inconsistency
That's how it should work isn't tester..?
In the second example it dosn't find the string cause the string don't exist...
Its searching array for index of sub-string, not searching each string for your string.
In the second example it dosn't find the string cause the string don't exist...
Its searching array for index of sub-string, not searching each string for your string.
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: stock substring find inconsistency
by "substring" ("substring to find") I understand a fraction of a longer string (string array is also a string, just with line separators witnin it, isn't it?). I would expect that it finds first match (even if it's a single letter) and points index of a line. It's confusing and not obvious.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stock substring find inconsistency
tester wrote:by "substring" ("substring to find") I understand a fraction of a longer string (string array is also a string, just with line separators witnin it, isn't it?
Yes is also a string, but the "string array find" don't care, cause it's looking
in every array slot for an exact match.
if you try the 'string find' instead of"string array find", it does pick up the index,
note that gives the index where the sub-string ends...not where it
starts....... not sure why its the preferred behavior...
.
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: stock substring find inconsistency
Typical non-programmer (who uses excel/word from time to time) "natural expectation".
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stock substring find inconsistency
Here's a module that does a much more versatile form of string array searching - I made it for scanning the patch names listed by one of my MIDI FX...
...might be a cool thing to add to the preset manager one day...
INPUTS...
- Items: An array of strings that you want to search
- Find: The string that you're looking for.
- Position: An integer index representing the place in the string that you want to find the search term...
...0 -> Find the search term anywhere in the string.
...1 -> Only if the search term is at the start of the string.
...2 -> Only if the search term is at the end of the string.
...3 -> Must match the whole string from beginning to end.
...4 -> Find only the whole word (i.e. separated from other words with whitespace)
- Match case: Set true for case sensitive matches, otherwise case is ignored.
- Do it: Trigger to begin the search.
OUTPUTS...
- Indexes: An integer array of the indexes where a match was found.
- Matches: A string array of the found items.
...might be a cool thing to add to the preset manager one day...
INPUTS...
- Items: An array of strings that you want to search
- Find: The string that you're looking for.
- Position: An integer index representing the place in the string that you want to find the search term...
...0 -> Find the search term anywhere in the string.
...1 -> Only if the search term is at the start of the string.
...2 -> Only if the search term is at the end of the string.
...3 -> Must match the whole string from beginning to end.
...4 -> Find only the whole word (i.e. separated from other words with whitespace)
- Match case: Set true for case sensitive matches, otherwise case is ignored.
- Do it: Trigger to begin the search.
OUTPUTS...
- Indexes: An integer array of the indexes where a match was found.
- Matches: A string array of the found items.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: stock substring find inconsistency
Thanks!
Because these "little useful things" can be explored with ruby - I'm afraid nothing will change for most original green prims. It's a paradox somewhat. On one hand - a lot of thigs can be done in ruby, but on the other - only a few people (i.e. small percentage) know (or will know) how to implement it correctly, completely and performance efficiently. So I guess - the focus on new prims, will be only on these, that perform certain tasks faster in regards to other solutions in general FS.
I wonder what new will bring the incoming update (besides this CPU related fix). Should be posted within few days as far I remember.
Because these "little useful things" can be explored with ruby - I'm afraid nothing will change for most original green prims. It's a paradox somewhat. On one hand - a lot of thigs can be done in ruby, but on the other - only a few people (i.e. small percentage) know (or will know) how to implement it correctly, completely and performance efficiently. So I guess - the focus on new prims, will be only on these, that perform certain tasks faster in regards to other solutions in general FS.
I wonder what new will bring the incoming update (besides this CPU related fix). Should be posted within few days as far I remember.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: stock substring find inconsistency
Really nice TROG !!!
This might be able using PRIMS ... but given all the search options available to this RUBY module ... it could get complex wiring up PRIMS to do the equivalent ... I don't know.
This Ruby version goes in the ToolBox !
Thanks TROG !
This might be able using PRIMS ... but given all the search options available to this RUBY module ... it could get complex wiring up PRIMS to do the equivalent ... I don't know.
This Ruby version goes in the ToolBox !
Thanks TROG !
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: stock substring find inconsistency
You're welcome, folks!
I've kind of always seen Ruby as the "green" equivalent of the "stream" assembly primitive...
DSPr is basically one programmer, Malc, and he is the only guy that can make primitives - but he also must do all of the bug fixing and 'core' upgrades. So I treat Ruby/ASM as something like an API - a way for at least some of us to extend the set of "tools" for everybody.
Bear in mind that most competing products - e.g. SynthEdit, only offer these kind of 'user upgrades' using an extremely complex C++ API - you need a ton of extra software, have to learn an extremely ugly programming language, fight with compositors and compilers, and have to wait ages to see the result of the simplest program edits. (seriously, if you ever tried C++, you would know why I think of Ruby as 'elegant'!)
I agree with tester about the 'paradox', though. The big advantage of FS is that the visual linking style is a very simple and quick way to program, for beginners and experienced programmers alike - but that requires the supply of intuitive primitives/modules to make it work - which, in turn, needs some people, either here or at DSPr, to keep on building them. Trouble is, the module makers are mostly keen "hobbyists", with their own projects on the go, and their own personal tastes for what they make and how they should work - considering that, the quantity and quality of stuff that gets posted is really quite amazing, but there's just too few of us (yet?!?).
I've kind of always seen Ruby as the "green" equivalent of the "stream" assembly primitive...
DSPr is basically one programmer, Malc, and he is the only guy that can make primitives - but he also must do all of the bug fixing and 'core' upgrades. So I treat Ruby/ASM as something like an API - a way for at least some of us to extend the set of "tools" for everybody.
Bear in mind that most competing products - e.g. SynthEdit, only offer these kind of 'user upgrades' using an extremely complex C++ API - you need a ton of extra software, have to learn an extremely ugly programming language, fight with compositors and compilers, and have to wait ages to see the result of the simplest program edits. (seriously, if you ever tried C++, you would know why I think of Ruby as 'elegant'!)
I agree with tester about the 'paradox', though. The big advantage of FS is that the visual linking style is a very simple and quick way to program, for beginners and experienced programmers alike - but that requires the supply of intuitive primitives/modules to make it work - which, in turn, needs some people, either here or at DSPr, to keep on building them. Trouble is, the module makers are mostly keen "hobbyists", with their own projects on the go, and their own personal tastes for what they make and how they should work - considering that, the quantity and quality of stuff that gets posted is really quite amazing, but there's just too few of us (yet?!?).
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: stock substring find inconsistency
I'm working on a slight brain tweezer here for part of a project idea.
This 'String Finder' routine is very nice, and I'm trying to figure out how it could help solve for a result I need.
From the String Finder example, searching for 'cats' ... we can get several different find results along with an index.
Here is what I need to add ...
I have 2 lists of arrays. The 1st is like the example list: Names. But I have a 2nd list with a corresponding number.
[this 'number' is NOT an Index, but it is directly related to the Name.
When a search is done on the NAME list, I need the corresponding 'number' from the 2nd list so that both list stay in separate arrays.
As I read more about RUBY arrays, I realize there are so many ways to do this ... I seem to be getting confused early in the process I looked at combining the 2 arrays into a 2-dimensional array and then figure out how to search just the Name portion. It didn't go well. Plus, the OUTPUT was in a format that I could not change ... I need plain Text and numeric output to be used for display and as MIDI data.
Personally, I could also use 'Da Id-gits Guide to Ruby Arrays' ... anyone know where a copy can be found
This 'String Finder' routine is very nice, and I'm trying to figure out how it could help solve for a result I need.
From the String Finder example, searching for 'cats' ... we can get several different find results along with an index.
Here is what I need to add ...
I have 2 lists of arrays. The 1st is like the example list: Names. But I have a 2nd list with a corresponding number.
[this 'number' is NOT an Index, but it is directly related to the Name.
When a search is done on the NAME list, I need the corresponding 'number' from the 2nd list so that both list stay in separate arrays.
As I read more about RUBY arrays, I realize there are so many ways to do this ... I seem to be getting confused early in the process I looked at combining the 2 arrays into a 2-dimensional array and then figure out how to search just the Name portion. It didn't go well. Plus, the OUTPUT was in a format that I could not change ... I need plain Text and numeric output to be used for display and as MIDI data.
Personally, I could also use 'Da Id-gits Guide to Ruby Arrays' ... anyone know where a copy can be found
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
11 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: Google [Bot] and 57 guests