No worries, here's a few ideas:

1) a version that use a "locals" method:

:: matrix-contains? ( m n -- ? ) n m [ member? ] with any? ;

2) a version that uses an inner locals quotation (i changed their names so
you can see it "renames" what is on the stack for the purposes of figuring
out what you mean):

: matrix-contains? ( m n -- ? )
    [| matrix number | number matrix [ member? ] with any? ; ] call ;

3) a version that uses fry quotations:

: matrix-contains? ( m n -- ? ) '[ _ swap member? ] any? ;

4) a version that just uses simple words (note the "swap" since you pass
the matrix and then the number to search for):

: matrix-contains? ( m n -- ? ) swap [ member? ] with any? ;

5) or this version that doesn't use swap:

: matrix-contains? ( m n -- ? ) [ swap member? ] curry any? ;



On Wed, Jan 9, 2013 at 9:10 PM, Leonard P <leonard14...@gmail.com> wrote:

> IN: scratchpad 5 { { 1 2 } { 3 4 } } [ member? ] with any?
>
>
> I'm really going to give away my newb status with this question.
>
> How does one turn the above into a "method"?
>
> Something like this ...
>
> : matrix-contains? ( m n -- ? ) n m [ member? ] with any?
>
>
>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to