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
ends-with
-
- Posts: 388
- Joined: Thu May 08, 2008 1:24 am
- Location: Croatia
- Contact:
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:
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.
But you could use 'match' for that case:
Code: Select all
> (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
>
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.