From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Steven M. Haflich" Newsgroups: gmane.emacs.help Subject: Re: How to implement line sorting, uniquifying and counting function in emacs? Date: Tue, 01 Oct 2002 08:00:01 GMT Organization: Franz Inc. Sender: help-gnu-emacs-admin@gnu.org Message-ID: <3D9950FA.8050007@alum.mit.edu> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1033460150 7122 127.0.0.1 (1 Oct 2002 08:15:50 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 1 Oct 2002 08:15:50 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17wIC2-0001qH-00 for ; Tue, 01 Oct 2002 10:15:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17wICK-0002nz-00; Tue, 01 Oct 2002 04:16:04 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.cwix.com!prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr14.news.prodigy.com.POSTED!351d80e2!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.lang.lisp,gnu.utils.help,comp.unix.shell,comp.unix.programmer Original-Lines: 17 User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en,ja,de,fr Original-NNTP-Posting-Host: 67.119.196.186 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: newssvr14.news.prodigy.com 1033459201 ST000 67.119.196.186 (Tue, 01 Oct 2002 04:00:01 EDT) Original-NNTP-Posting-Date: Tue, 01 Oct 2002 04:00:01 EDT X-UserInfo1: TSU[@IONSRRQBQ@ZGRHBOFTBTR\B@GXLN@GZ_GYO^ZUDUWYAKVUOPCW[ML\JXUCKVFDYZKBMSFX^OMSAFNTINTDDMVW[X\THOPXZRVOCJTUTPC\_JSBVX\KAOTBAJBVMZTYAKMNLDI_MFDSSOLXINH__FS^\WQGHGI^C@E[A_CF\AQLDQ\BTMPLDFNVUQ_VM Original-Xref: nntp.stanford.edu gnu.emacs.help:105581 comp.lang.lisp:95126 gnu.utils.help:4067 comp.unix.shell:133655 comp.unix.programmer:143597 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2126 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2126 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.