]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/channels/channels.factor
factor: trim using lists
[factor.git] / basis / channels / channels.factor
index 0eb7881f95915c9c336ba09400e731ac2aaf1d1f..8424d50572ac7d5a6508b93978652b6bf8172ef6 100644 (file)
@@ -2,8 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 !
 ! Channels - based on ideas from newsqueak
-USING: kernel sequences threads continuations
-random math accessors ;
+USING: accessors kernel random sequences threads ;
 IN: channels
 
 TUPLE: channel receivers senders ;
@@ -17,7 +16,7 @@ GENERIC: from ( channel -- value )
 <PRIVATE
 
 : wait ( channel -- )
-    [ senders>> push ] curry
+    [ self ] dip senders>> push
     "channel send" suspend drop ;
 
 : (to) ( value receivers -- )
@@ -31,12 +30,12 @@ GENERIC: from ( channel -- value )
 
 PRIVATE>
 
-M: channel to ( value channel -- )
+M: channel to
     dup receivers>>
     [ dup wait to ] [ nip (to) ] if-empty ;
 
-M: channel from ( channel -- value )
-    [
-        notify senders>>
-        [ (from) ] unless-empty
-    ] curry "channel receive" suspend ;
+M: channel from
+    [ self ] dip
+    notify senders>>
+    [ (from) ] unless-empty
+    "channel receive" suspend ;