chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] grep should use string-search?


From: Felix Winkelmann
Subject: Re: [Chicken-users] grep should use string-search?
Date: Tue, 10 Aug 2004 06:58:55 +0200
User-agent: Opera M2/7.52 (Win32, build 3834)

On Fri, 6 Aug 2004 12:55:16 -0500, Alejandro Forero Cuervo <address@hidden> wrote:


The manual tells us that grep could be implemented as:

(define (grep regex lst)
  (filter (lambda (x) (string-match regex x)) lst) )

Indeed, (grep "f"  (list "ale" "fore" "cuer"))  returns the empty
list.

Shouldn't  grep use  string-search  instead  of string-match?   I
would be more consistant with what the Unix grep command does:

  echo -e "ale\nfore\ncuer" | grep f


That's reasonable. Especially since string-search is the same
as string-match "^...$".

cheers.
felix




reply via email to

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