Hi,
Why is dropPS for PackedString not completely analogous to drop for
String? For example,
drop 5 "hello" yields ""
whereas
unpackPS (dropPS 5 (packString "hello")) yields "hello"
Given the straightforward source of dropPS below, this inconsistency
seems to be more a feature than a bug.
dropPS :: Int -> PackedString -> PackedString
dropPS (I# n) ps
| n ==# len = ps
| otherwise = substrPS# ps n (lengthPS# ps -# 1#)
where
len = lengthPS# ps
TIA,
Bake
Inconsistency in PackedString vs. String
Bonard B. Timmons III Wed, 17 Jun 1998 15:22:56 +0200 (MET DST)
- Re: Inconsistency in PackedString vs. String Bonard B. Timmons III
- Re: Inconsistency in PackedString vs. String Sigbjorn Finne
