Re: [Factor-talk] parallel combinators

2013-04-14 Thread Alexander Mueller
looks like it starts a thread for each element but waits until all quotations are done to continue. i can't think of a usefull threaded code that's completely without side effects ... but maybe that's just me. On Sun, Apr 14, 2013 at 6:15 AM, mr w wzr...@gmail.com wrote: Also wondering about

Re: [Factor-talk] parallel combinators

2013-04-14 Thread mr w
''Spawns a new thread for applying quot to every element of seq, blocking until all quotations complete.'' -- http://docs.factorcode.org/content/word-parallel- each%2Cconcurrency.combinators.html On Sun, Apr 14, 2013 at 6:51 AM, Alexander Mueller ddo...@gmail.com wrote: looks like it

[Factor-talk] n-slice

2013-04-14 Thread mr w
Is there an n-slices word, that attempts to chop a sequence into n slices? Could also imagine a slices-n word, that attempts to chop a sequence into slices of length n. Should be easy to code with head-slice and rest-slice, but I'm not playing with a full deck of cards yet when it comes to

Re: [Factor-talk] n-slice

2013-04-14 Thread Samuel Tardieu
2013/4/14 mr w wzr...@gmail.com Could also imagine a slices-n word, that attempts to chop a sequence into slices of length n. How would that be different from sliced-groups? Is there an n-slices word, that attempts to chop a sequence into n slices? If you start with a sequence of length

Re: [Factor-talk] n-slice

2013-04-14 Thread mr w
On Sun, Apr 14, 2013 at 8:38 AM, mr w wzr...@gmail.com wrote: On Sun, Apr 14, 2013 at 8:03 AM, Samuel Tardieu s...@rfc1149.net wrote: 2013/4/14 mr w wzr...@gmail.com Could also imagine a slices-n word, that attempts to chop a sequence into slices of length n. How would that be

Re: [Factor-talk] n-slice

2013-04-14 Thread mr w
On Sun, Apr 14, 2013 at 9:07 AM, Boyko Bantchev boyk...@gmail.com wrote: On 14 April 2013 15:03, Samuel Tardieu s...@rfc1149.net wrote: If you start with a sequence of length 6, how do you split it into 4 slices? 1 1 1 3? 2 2 2 0? 3 2 1 0? I would think of 2 2 1 1, which is monotonically

Re: [Factor-talk] n-slice

2013-04-14 Thread mr w
On Sun, Apr 14, 2013 at 9:10 AM, Samuel Tardieu s...@rfc1149.net wrote: 2013/4/14 Boyko Bantchev boyk...@gmail.com On 14 April 2013 15:03, Samuel Tardieu s...@rfc1149.net wrote: If you start with a sequence of length 6, how do you split it into 4 slices? 1 1 1 3? 2 2 2 0? 3 2 1 0? I

Re: [Factor-talk] n-slice

2013-04-14 Thread Boyko Bantchev
On 14 April 2013 16:10, Samuel Tardieu s...@rfc1149.net wrote: My point was that there isn't a one-suits-them-all solution for grouping an arbitrary sized sequence into a fixed number of slices. I did understand that and I fully agree. And my point was to propose a definition that: • enjoys

Re: [Factor-talk] n-slice

2013-04-14 Thread Joe Groff
groups will give you a sequences-of-sequences view over an existing sequence. -Joe On Sun, Apr 14, 2013 at 6:18 AM, mr w wzr...@gmail.com wrote: On Sun, Apr 14, 2013 at 9:10 AM, Samuel Tardieu s...@rfc1149.net wrote: 2013/4/14 Boyko Bantchev boyk...@gmail.com On 14 April 2013

[Factor-talk] filter-index

2013-04-14 Thread mr w
Is there a version of filter-index that only puts the index on the stack, without the corresponding element? -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The

Re: [Factor-talk] filter-index

2013-04-14 Thread Loryn Jenkins
I'm not sure about filter-index - I don't see any documentation about that word. But here's a version of map-index that fulfils your request: USING: kernel sequences fry ; : map-index' ( ... seq quot: ( ... elt index -- ... newelt ) -- ... newseq ) '[ [ nip @ ] map-index ] call ; inline

Re: [Factor-talk] filter-index

2013-04-14 Thread mr w
On Sun, Apr 14, 2013 at 9:43 PM, Loryn Jenkins lor...@gmail.com wrote: I'm not sure about filter-index - I don't see any documentation about that word. http://docs.factorcode.org/content/word-filter-index,sequences.extras.html

Re: [Factor-talk] filter-index

2013-04-14 Thread Loryn Jenkins
Thank you. Anyway: You get my point about wrapping filter-index such that you can get a word that throws away the element? USING: kernel sequences.extras fry ; : filter-index' '[ [ nip @ ] filter-index ] call ; inline On Mon, Apr 15, 2013 at 12:24 PM, mr w wzr...@gmail.com wrote: On Sun,

Re: [Factor-talk] filter-index

2013-04-14 Thread Loryn Jenkins
Sorry: that was supposed to be: USING: kernel sequences.extras fry ; : filter-index' ( ... seq quot: ( ... elt i -- ... ? ) -- ... seq' ) '[ [ nip @ ] filter-index ] call ; inline On Mon, Apr 15, 2013 at 12:35 PM, Loryn Jenkins lor...@gmail.com wrote: Thank you. Anyway: You get my point

Re: [Factor-talk] filter-index

2013-04-14 Thread John Benediktsson
If you just want indices you can do length iota [ foo ] filter On Apr 14, 2013, at 6:12 PM, mr w wzr...@gmail.com wrote: Is there a version of filter-index that only puts the index on the stack, without the corresponding element?