Something like this would be simpler:
http://paste.factorcode.org/paste?id=2914#1329
You don't need a symbol to pass the variable around, and even though it is
"side-effecting", I'm not sure that is undesirable here...?
On Mon, Apr 22, 2013 at 7:17 AM, Loryn Jenkins <lor...@gmail.com> wrote:
> Hi
>
> In "Factor Philosophy", slava writes: "Imperative programming and indexed
> loops are almost always not the most idiomatic solution."
>
> I've implemented this puzzle (
> http://mindyourdecisions.com/blog/2013/04/22/100-light-bulbs-puzzle/ )
> using a side-effecting function: http://paste.factorcode.org/paste?id=2914
>
> The words do-switching and toggle-switches implement the equivalent of a
> nested loop.
>
> Without using recursion, counted for loops or side-effecting functions,
> what is an idiomatic way of implementing this nested iteration?
>
> Loryn Jenkins
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk