 ! Copyright (C) 2008 Bruno Deferrari
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel fry splitting ascii calendar accessors combinators qualified
-       arrays classes.tuple math.order quotations ;
+       arrays classes.tuple math.order inverse ;
 RENAME: join sequences => sjoin
 EXCLUDE: sequences => join ;
 IN: irc.messages

M: mode command-parameters>> ( mode -- seq )
    [ name>> ] [ channel>> ] [ mode>> ] tri 3array ;

GENERIC: (>>command-parameters) ( params irc-message -- )

M: irc-message (>>command-parameters) ( params irc-message -- ) 2drop ;

M: names-reply (>>command-parameters) ( params names-reply -- )
    [ >r first r> (>>who) ] [ >r third r> (>>channel) ] 2bi ;
M: mode    (>>command-parameters) ( params mode -- )
    { { [ >r 2array r> ] [ [ (>>mode) ] [ (>>channel|nickname) ] bi ] }
      { [ >r 3array r> ] [ [ (>>parameter) ] [ (>>mode) ] [ (>>channel) ] tri ] }
    } switch ;

PRIVATE>

