Loading...

factor-talk@lists.sourceforge.net

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Factor-talk] Beginner question about style and stack shuffling [EMAIL PROTECTED] Mon Mar 12 12:01:59 2012

Thank you very much for both answers.

They both are very instructive.

This one is really amazing though:
>
> ```
> TUPLE: array-ref index array ;
> C: <array-ref> array-ref
> : >array-ref< ( array-ref -- index array )
>    [ index>> ] [ array>> ] bi ;
> : get-ref ( array-ref -- elt )
>    >array-ref< nth ;
> : set-ref ( value array-ref -- elt )
>    >array-ref< set-nth ;
>
> : swap-refs ( x-ref y-ref -- )
>    [ [ get-ref ] bi@ swap ] 2keep
>    [ set-ref ] bi-curry bi* ;
> ```
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Factor-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/factor-talk