Paste: multi-methods

Author: mrjbq7
Mode: factor
Date: Mon, 19 Sep 2011 19:05:29
Plain Text |
( scratchpad ) QUALIFIED: multi-methods

( scratchpad ) multi-methods:GENERIC: plus ( obj1 obj2 -- obj3 )
               METHOD: plus { real real } + ;
               METHOD: plus { string string } append ;

( scratchpad ) 1 2 plus .
3

( scratchpad ) "hello " "world" plus .
"hello world"

Annotation: what haskell can't do

Author: rien
Mode: factor
Date: Fri, 11 Nov 2011 01:23:12
Plain Text |
IN: scratchpad Loading resource:extra/multi-methods/multi-methods.factor
Loading resource:basis/shuffle/shuffle.factor
Loading resource:basis/shuffle/shuffle-docs.factor
QUALIFIED: math QUALIFIED: multi-methods
IN: scratchpad 
IN: scratchpad multi-methods:GENERIC: + ( a b -- a+b )
IN: scratchpad 
IN: scratchpad Command: restart
multi-methods:METHOD: + { real real } math:+ ;
IN: scratchpad 
IN: scratchpad multi-methods:METHOD: + { string string } append ;
IN: scratchpad 
IN: scratchpad 1 2 + .
3
IN: scratchpad "hello " "world" + .
"hello world"

New Annotation

Summary:
Author:
Mode:
Body: