[REBOL] Re: open? opened? close? closed? for schemes and ports
From: greggirwin:mindspring at: 20-Aug-2002 10:28
Hi Norman,
Paul Tretter came up with a way to see if a port is open I think. Paul, you
around?
As far as checking which words are ports (if I understand your request), you
can iterate over the global words to find them, but that won't find them if
they live inside a context. You can also find objects and iterate into them,
but the best approach will depend on what you actually want to accomplish.
Try: "help tuple!" at the console and you will see that it finds all the
tuple! values. You can use SOURCE on HELP as well to see how it works.
Here's a basic example:
find-words: func [test-fn words /local result] [
result: make block! 50
foreach w words [
if test-fn try [get to-lit-word :w] [append result :w]
]
sort result
]
find-words :tuple? first system/words
find-words :integer? first system/words
find-words :object? first system/words
HTH!
--Gregg