I figured there would be a word designed for that already... Here's my take
on this anyway.
I would append the items to a sequence as the algorithm goes along:
{ } swap [ dup 1 > ] [ dup 2 /i [ suffix ] dip ] while suffix
accomplishes the task.
Marshall
On Tue, Jun 19, 2012 at 10:50 PM, Graham
group in the grouping vocabulary splits a sequence into subsequences, like
this:
( scratchpad ) { 3 6 2 5 8 7 } 2 group .
{ { 3 6 } { 2 5 } { 8 7 } }
It would be a good idea to first flatten the list and then run 2 group on
it.
Marshall
On Sat, Mar 10, 2012 at 7:44 AM, Robert Herman wrote:
>
In terms of tools to use, the listener is for interactive evaluation. Since
Factor programs are often short enough to fit on a few lines, you can type
them into the listener and see what they do.
Programming in a concatenative language is very different. You certainly
don't want to think in terms
2drop should have stack effect ( x y -- ) . I have no idea why it should
refuse to do that in the compiler. Maybe try replacing it with drop drop ?
Marshall
On Sun, Dec 11, 2011 at 3:13 AM, CW Alston wrote:
> Greetings, Factorials -
> I've been working through mrjbq7's re-factor utilities, part