|
Boost : |
From: dherring_at_[hidden]
Date: 2008-05-29 17:14:13
More fodder:
(I didn't check that this is 100% compatible with the current API.)
this/is/stuff/last.my.name = path
this/is/stuff = path.dirname()
last.my.name = path.basename()
last.my = path.basename(".name")
.name = path.suffix()
this/is/stuff/ = path
this/is = path.dirname()
stuff/ = path.basename()
/ = path.suffix()
From Perl's File::Basename,
It is guaranteed that
# Where $path_separator is / for Unix, \ for Windows, etc...
dirname($path) . $path_separator . basename($path);
is equivalent to the original path for all systems but VMS.
- Daniel
On Thu, 29 May 2008, Johan Råde wrote:
> Beman Dawes wrote:
>> Beman Dawes wrote:
>
> [snip]
>
>> That leaves leaf(). tail() is arguably slightly better, but not by a
>> lot. Other possibilities:
>>
>> leaf() // cryptic
>> tail() // slightly better
>> right() // cryptic
>> rightmost() // better
>> rightmost_name() // very explicit, but longish
>>
>
> In functional programming you often build a list by appending
> one element at a time. The word head is then used to refer to
> the last added element, and tail to the rest of the list.
> This suggests that the leaf is the head, not the tail.
> Since different people have different intuition about
> what is the head and what is the tail, I think the terms
> head and tail should not be used in this context.
>
> Here are two other possible alternatives to leaf:
>
> name()
> own_name()
>
> --Johan
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk