In the following code:

STRUCT: quat
  { data double-4 } ;

STRUCT: vec3
  { data double-4 } ;


GENERIC: rotate ( quat vec3 -- vec3 )

TYPED:: rotate_quat_vec3 ( q: quat  v: vec3 -- v': vec3 )
  v
;

METHOD: rotate { quat vec3 } rotate_quat_vec3 ;


Is there a way to merge the TYPED:: and METHOD: declarations into one? I.e.
something like:

METHOD: rotate { quat vec3 } TYPED:: ( q: quat v: vec3 -- v': vec3 ) .... ;

?



On Thu, Dec 23, 2010 at 7:14 PM, Joe Groff <[email protected]> wrote:

> On Dec 24, 2010, at 7:32 AM, beo wulf wrote:
>
> multi-methods vocab only shows parsing words
>
> GENERIC:
> M:
> METHOD:
>
> Those look like they only dispatch on one arg. What am I missing?
>
>
> The version of GENERIC: from multi-methods defines methods with multiple
> dispatch. The METHOD: syntax takes an array of dispatch types, as follows:
>
> USING: multi-methods kernel ;
> ! override the default GENERIC: syntax with multi-methods GENERIC:
> FROM: multi-methods => GENERIC: ;
>
> SINGLETON: paper
> SINGLETON: scissors
> SINGLETON: rock
>
> GENERIC: beats? ( obj1 obj2 -- ? )
>
> METHOD: beats? { paper scissors } 2drop t ;
> METHOD: beats? { scissors rock } 2drop t ;
> METHOD: beats? { rock paper } 2drop t ;
> METHOD: beats? { object object } 2drop f ;
>
> Unfortunately, it looks like the vocabulary isn't fully documented;
> however, you can see additional examples under extra/multi-methods/tests/ .
>
> -Joe
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment,
> and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to