Created
March 26, 2009 05:51
-
-
Save JustinTulloss/85920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (let [channel-agents [ | |
| ; For every item in (:1 channels) (a list of channels), create | |
| ; an agent. Then do this for (:2 channels), which is a list of | |
| ; channels that belong in the second column. | |
| (map | |
| (fn [channel] | |
| (send-off | |
| (agent "") | |
| (fn [_] | |
| (flockr.channels/render-channel | |
| channel | |
| session)))) | |
| (:1 channels)) | |
| (map | |
| (fn [channel] | |
| (send-off | |
| (agent "") | |
| (fn [_] | |
| (flockr.channels/render-channel | |
| channel | |
| session)))) | |
| (:2 channels))]] | |
| ; Wait for agents to return. | |
| (apply | |
| await | |
| (concat | |
| (first channel-agents) | |
| (second channel-agents)))) | |
| ;Render the output of the channels in our html. | |
| (html | |
| [:div#col1 {:class "feed-column left"} | |
| (map | |
| (fn [ch-agent] | |
| (html [:div.feed-panel @ch-agent])) | |
| (first channel-agents)) | |
| ] | |
| [:div#col2 {:class "feed-column right"} | |
| (map | |
| (fn [ch-agent] | |
| (html [:div.feed-panel @ch-agent])) | |
| (second channel-agents)) | |
| ]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment