zl sub three in a row limitation
The zl sub object finds only once the sequence 5 5 in this list: 1 2 3 4 5 5 5 6 and at position 6 (instead of 5). I'm not the best at counting, but the result for position is something disagreeable, from my perspective.
Matching appears to be done starting at the end, and every match is then removed from the list. Another possible outcome would be that zl sub would find two matches, at positions 5 and 6.
Example: according to zl sub the string www.zlsub.com does not start with the sequence ww.
_
johan
I can reproduce, [zl sub] finds the second match in that string and reports position 6, it does seem to remove the match once found. However I don't understand your example. Firstly "www.zlsub.com" doesn't begin with "ww." and secondely even if it did the [zl] objects are for lists. You would need to use [regexp] to search within a string.
lh
Quote:However I don't understand your example.
The period is to close the sentence, it's not part of the search. After an atoi it would read: according to zl sub the list 119 119 119 46 122 108 115 117 98 46 99 111 109 does not start with 119 119. I happened to stumble across this while matching symbols in this fashion. Thanks for the regexp hint, but it won't work because the argument for matching should change.
_
johan
Hi Johan, sorry it has taken me a while to respond. I've written a couple of javascripts that will do [zl sub] like searching but check from every index in a list rather than jumping to the end of a match each time. The first is for lists and uses .toString() which is a bit of a hack when comparing arrays, the second is for symbols and uses a regular expression. Here they both are.
lh
// lh.lsub.js
inlets = 2;
outlets = 2;
var mem = [];
var search = [];
for (i=1; i
// lh.ssub.js
inlets = 2;
outlets = 2;
var find = jsarguments[1];
var str;
var myre = new RegExp(find,"g");
var mem;
function bang() {
mem = [];
recurse();
outlet(1,mem.length);
for (i=0; i