From: John B. <mr...@gm...> - 2011-10-09 16:21:30
|
Hi Michael, You might also be interested in some of the words in "sequences" which handle this particular use-case. For example, see "find", "find-from", and "find-last". ( scratchpad ) { "bread" "eggs" "milk" } [ "eggs" = ] find --- Data stack: 1 "eggs" If you're curious how it is implemented, you can type: "\ find see" and then click on different parts of the word definition to see its implementation. Best, John. On Sun, Oct 9, 2011 at 6:06 AM, Michael Clagett <mcl...@ho...>wrote: > Hi --- > > Finally getting around to developing my first serious Factor code and I > have a quick question. I'm a Forth programmer (although of late it has been > mostly my own bastardized version of Forth). I'm thinking of one immediate > use of Combinators as a way of eliminating some of the unsightly procedural > code that lives in the kind of Forth function I would write inside of, say, > a Begin While Repeat loop. > > But if what I would have wanted to do with my loop is loop through every > item in a collection of some sort until some condition was true and at that > point exit the loop early, is there a way to do this using Combinators? Are > there versions of the primary ones that will operate on the target sequence > only until a condition is reached? I will of course peruse the > documentation, but I thought I would just ask in case someone could steer me > there more quickly (and in case some other newbie has the same question). > > Thanks much. > > Mike > > > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2dcopy2 > _______________________________________________ > Factor-talk mailing list > Fac...@li... > https://lists.sourceforge.net/lists/listinfo/factor-talk > > |