View unanswered posts | View active topics It is currently Thu Sep 09, 2010 4:33 am



Post new topic Reply to topic  [ 2 posts ] 
ends-with 
Author Message

Joined: Thu May 08, 2008 1:24 am
Posts: 321
Location: Croatia
Post ends-with
currently:

(ends-with "hiho" "ho") => true
(ends-with '(h i h o) 'o) => true

should it be:

(ends-with '(h i h o) '(o)) => true
(ends-with '(h i h o) '(h o)) => true ?

same for starts-with

_________________
Institute for Programming; Kazimir Majorinc's blog


Fri Feb 12, 2010 9:52 pm
Profile WWW

Joined: Thu Sep 26, 2002 4:45 pm
Posts: 4159
Location: Boca Raton, Florida
Post Re: ends-with
I believe when using lists, you mostly look for the single element with 'starts/ends-with'.

But you could use 'match' for that case:

Code:
> (match '(* h o) '(h i h o))
((h i))
> (match '(h i *) '(h i h o))
((h o))
> (match '(x y *) '(h i h o))
nil
>


the first two cases are Boolean 'true'

Ps: there was a time when 'match' could also be used for strings, but it got deprecated for the more powerful regex string matching. Although less powerful, perhaps the string matching with 'match' had some attractiveness to it? It definitely was easier to grasp mentally.


Sat Feb 13, 2010 1:30 am
Profile E-mail WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Forum style by Vjacheslav Trushkin for Free Forums/DivisionCore.