! Copyright (C) 2009 Your name. ! See http://factorcode.org/license.txt for BSD license. USING: kernel threads io io.sockets io.encodings.utf8 prettyprint math ; IN: mudclient : setup-streams ( object object -- object ) utf8 drop dup [ [ [ [ print "hello" print ] each-line t ] loop ] with-input-stream ] curry "input-thread" spawn drop ; : read-keyboard-loop ( object -- object ) ! dup [ [ [ yield readln dup [ write flush ] [ drop ] if t ] loop ] with-output-stream ] curry "output-thread" spawn ; : runme ( -- object ) "mud.arctic.org" 2700 setup-streams read-keyboard-loop ; MAIN: runme ! [ [ print ] each-line ] with-client ; ! type "IN: mudclient" in listener first, then f2 ! ./factor -run=mudclient