
Internet Explorer's enhanced security configuration just blocked it's own "about:internet" page. No, I'm not making this up, and I didn't Photoshop it ;)
This is a purely technical blog concerning topics such as Python, Ruby, Dart, Linux, open source software, the Web, and lesser-known programming languages.
Ad maiorem Dei gloriam inque hominum salutem.

{- Implement breadth-first tree traversal.
Name: Shannon -jj Behrens
Date: Tue Dec 13 03:18:34 PST 2005 -}
module Main where
-- The main definition of a tree.
data Tree a = Leaf a | Branch a (Tree a) (Tree a)
-- Depth-first tree traversal.
depthFirst :: Tree a -> [a]
depthFirst (Leaf x) = [x]
depthFirst (Branch x left right) = depthFirst left ++ [x] ++
depthFirst right
-- Breadth-first tree traversal.
breadthFirst :: Tree a -> [a]
breadthFirst x = _breadthFirst [x]
_breadthFirst :: [Tree a] -> [a]
_breadthFirst [] = []
_breadthFirst xs = map treeValue xs ++
_breadthFirst (concat (map immediateChildren xs))
-- Get the value of a given tree.
treeValue :: Tree a -> a
treeValue (Leaf x) = x
treeValue (Branch x left right) = x
-- Get the immediate children of a tree.
immediateChildren :: Tree a -> [Tree a]
immediateChildren (Leaf x) = []
immediateChildren (Branch x left right) = [left, right]
-- Define some tree.
mytree = Branch "1"
(Branch "2"
(Leaf "4")
(Leaf "5"))
(Branch "3"
(Leaf "6")
(Leaf "7"))
{- 1
/ 2 3
/ \ / 4 5 6 7
Here's another.
mytree = Branch "0"
(Leaf "1")
(Branch "2"
(Branch "3"
(Leaf "4")
(Leaf "5"))
(Leaf "6"))
0
/ 1 2
/ 3 6
/ 4 5 -}
-- Create one "do" out of a list of things to do.
doList :: [IO ()] -> IO ()
doList = foldr (>>) (return ())
-- Main.
main :: IO ()
main = do doList (map putStrLn (breadthFirst mytree))
The result is:$ runhugs main.hs
1
2
3
4
5
6
7
(multiple ptys) <-> screen <-> ssh <-> your terminalYou type commands into your terminal, and screen does something with them. Sometimes the commands influence screen itself. Other times, screen passes them onto the active pty. Now, imagine an improved graphical version of screen. For the time being, I'll call it scrim, SCReen IMproved:
(multiple ptys) <-> scrim server <-> ssh <-> scrim client <-> (multiple GUI terminals, such as gnome-terminal)Note that you now have 4 windows on the client, the scrim client and the 3 terminal applications. Perhaps you might use a terminal that supports tabs to consolidate the 3 terminals. Since the scrim client has its own window, it can be really easy to use, and there are no keybinding conflicts. The terminal applications each act like separate terminal sessions. A lot of multiplexing is going on between the scrim server and scrim client. There's a "tunnel" for each terminal, and a "tunnel" for the server and client to talk about configuration. Nonetheless, you can still close the scrim client and reconnect later without loosing anything. I'm not really proposing anything new except to say that an interface that's more like Remote Desktop could make using screen a lot more pleasant and reduce the learning curve.