Can someone suggest how to make the packets received on a socket into
a lazy sequence?
The application I'm making is a log file parser. A (Java) program is
producing log output using log4j, the output can go to file(s) or be
sent to a socket. So, the program has this outline:

(defn fileLines [fileNameSeq]
        "Return a lazy sequence of lines from the given lazy sequence of file
names.
        Return nil at end of file." ...)

(defn socketLines [ipAddr portN]
        "Return a lazy sequence of lines from a server socket at the given
place.
        Return nil if socket error." ...)

(defn parseLine [line] ... )

(defn parseLines [lineSeq]
        "Parse the lines from lineSeq."
        (loop [line (first lineSeq) tail (rest lineSeq)]
                (when line
                        (parseLine line)
                        (recur (first tail) (rest tail)))))

I think I know how to do fileLines, but not socketLines. (Each
received packet should contain one line as it would have been written
to a file, I think). My problem is not how to manage a server socket,
but how to make an ISeq -- i.e. what exactly is the contract that ISeq
defines (the source code has no comments).

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to