Hi,
I need to split a string at fixed locations (some of the locations may
eventully be calculated, like with a lookup of '/', but at first
approximation fixed locations are ok).
I came with this example string and quotatiom:
NAXIS =3 / number of data axes
[ 0 swap 8
Maybe something like this:
: subseqs ( indices seq -- subseqs )
[ subseq [ CHAR: \s = ] trim ] curry { } assocmap ;
You can see it works by returning an array of subseqs:
IN: scratchpad NAXIS =3 / number of data axes
{ { 0
Or locals:
:: foo ( seq -- a b c )
0 8 seq subseq
10 30 seq subseq
33 80 seq subseq
[ CHAR: \s = ] tri@ ;
On Sun, Feb 9, 2014 at 7:06 AM, John Benediktsson mrj...@gmail.com wrote:
Maybe something like this:
: subseqs ( indices seq -- subseqs )
[ subseq [ CHAR:
Hi,
you can get rid of most of the repetition by defining a word that operates
on lists instead of using tri/tri@, for example:
: subseqs ( seq indices -- subseqs )
swap [ subseq ] curry { } assocmap ;
NAXIS =3 / number of data
axes
{ { 0 8 } {
2014-02-09 14:41 GMT+01:00 Jean-Marc Lugrin hb9...@lugrin.ch:
Hi,
I need to split a string at fixed locations (some of the locations may
eventully be calculated, like with a lookup of '/', but at first
approximation fixed locations are ok).
I came with this example string and quotatiom: