On Tue, Nov 1, 2011 at 2:09 AM, P. <[email protected]> wrote:
> The article you want can be found by typing the following in the listener
> and pressing <enter>:
>
> "accessors" help
>
>
> A bit about objects in Factor:
>
> First take a look at this example from the homepage (the code sample is
> different at each reload, keep trying):
>
> USING: accessors kernel math math.constants
> math.functions prettyprint ;
> IN: shapes
>
> TUPLE: circle radius ;
> TUPLE: rectangle width height ;
>
> GENERIC: area ( shape -- area )
> M: circle area radius>> sq pi * ;
> M: rectangle area [ width>> ] [ height>> ] bi * ;
>
> rectangle new 10 >>width 20 >>height area .
>
>
> In factor, methods and slots are logically separated from each other. If
> you know Common Lisp and its CLOS this'll be familiar.
> TUPLE: takes a name for the objects "class" you're defining, followed by
> all of the slots that class of objects contains. That's how you declare a
> "class".
> GENERIC: takes a word name and a stack effect. That's how you declare a
> name to be used for methods (as opposed to declaring a regular
> word/function).
> M: takes a "class" (something declared via TUPLE:), a method name
> (something declared via GENERIC:), and a function body.
>
> Let us know if you have any more questions after browsing the docs.
>
> rien
>
What does >> mean?
- Leonard
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk