【发布时间】:2016-05-10 20:26:50
【问题描述】:
我还是不明白字节串是如何工作的
import qualified Data.ByteString.Lazy as BS
let x = BS.readFile "somefile.txt" --some large file
let z = ((reverse (BS.unpack x)) !! 2) --do stuff here
我知道字节串可以用来读取大量数据,非常快速有效。但是拆包装没有意义。
let z = readArray x 1 --can you read the bytestring like its a array?(something like this)
你不能不解包就读取字节串形式的数据吗?还是只是解压一部分数据?
你能解释一下它是如何工作的吗?(代码示例)
【问题讨论】:
-
您有更具体的示例来说明您想要执行的操作吗?
标签: haskell bytestring