help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to implement line sorting, uniquifying and counting function in


From: Steven M. Haflich
Subject: Re: How to implement line sorting, uniquifying and counting function in emacs?
Date: Tue, 01 Oct 2002 08:00:01 GMT
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.1) Gecko/20020826

gnuist006 wrote:

Lisp has sort-lines, but no uniq -u or uniq -d available. Also I do not
know the equivalent to wc.

A pure Common Lisp equivalent is the following, reading standard-input:

(loop with last-line
    for line in (sort (loop as x = (read-line *standard-input* nil nil)
                          while x collect x)
                      #'string<)
    unless (equal last-line line)
    count 1
    do (setf last-line line))

Probably not want you wanted.  Probably meaningless to you.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]