Skip to content

Commit

Permalink
extra: minor combinator cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jan 31, 2024
1 parent 56b7739 commit 745f921
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions extra/audio/aiff/aiff.factor
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ STRUCT: sound-data-chunk

:: read-aiff-chunks ( -- comm ssnd )
f :> comm! f :> ssnd!
[ { [ comm ssnd and not ] [ read-chunk ] } 0&& dup ]
[ { [ comm ssnd and not ] [ read-chunk ] } 0&& ]
[ {
{
[ dup COMM-MAGIC common-chunk check-chunk ]
Expand All @@ -59,7 +59,7 @@ STRUCT: sound-data-chunk
[ sound-data-chunk memory>struct ssnd! ]
}
[ drop ]
} cond ] while drop
} cond ] while*
comm ssnd 2dup and [ invalid-audio-file ] unless ;

: (read-aiff) ( -- audio )
Expand Down
4 changes: 2 additions & 2 deletions extra/libudev/libudev.factor
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ FUNCTION: c-string udev_list_entry_get_value (

! Helper to iterate over all entries of a list.
: udev_list_entry_foreach ( ... first_entry quot: ( ... x -- ... ) -- ... )
[ [ dup ] ] dip '[ _ keep udev_list_entry_get_next ]
while drop ; inline
'[ _ keep udev_list_entry_get_next dup ] loop drop ; inline


! Get all list entries _as_ a list
: udev-list-entries ( first_entry -- seq )
Expand Down
4 changes: 2 additions & 2 deletions extra/mediawiki/api/api.factor
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ PRIVATE>
:: call-continue ( params quot1: ( params -- obj assoc )
quot2: ( ... -- ... ) -- seq )
f f [
"continue" of dup
"continue" of
] [
params assoc-union quot1 call
[ quot2 call >alist append ] dip
] do while drop ; inline
] do while* ; inline

: query ( params -- seq )
[ (query) ] [ ] call-continue ;
Expand Down
5 changes: 3 additions & 2 deletions extra/zeromq/examples/hwserver.factor
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ IN: zeromq.examples.hwserver
<zmq-context> &dispose
ZMQ_REP <zmq-socket> &dispose
dup "tcp://*:5555" zmq-bind
[ t ] [
[
dup
[ 0 zmq-recv >string "Received " write print flush ]
[ drop 1 seconds sleep ]
[ "World" >byte-array 0 zmq-send ]
tri
] while drop
t
] loop drop
] with-destructors ;

MAIN: hwserver

0 comments on commit 745f921

Please sign in to comment.