[Libguestfs] [PATCH v3 4/5] daemon/parted: work around part table type misreporting by "parted"
Laszlo Ersek
lersek at redhat.com
Thu Nov 25 15:57:12 UTC 2021
On 11/25/21 16:46, Richard W.M. Jones wrote:
> On Thu, Nov 25, 2021 at 04:27:42PM +0100, Laszlo Ersek wrote:
>> It provides the following examples, and states that they are equivalent:
>>
>> let sum = fun i j -> i + j;;
>> let sum = (fun i -> (fun j -> i + j));;
>> let sum i j = i + j;;
>>
>> Why is the usage of "fun" awkward here?
>
> They are equivalent, but no one is using the "fun" form in real code
> because it's longer and more obscure for no reason.
>
>> Is the problem more that I used an explicit "offset" parameter, so
>> sec0at is not defined as a partial function application?
>
> I made two changes but didn't explain that well. Firstly get rid of
> the "fun" as above:
>
> let sec0at offset = Bytes.get_uint8 sec0 offset in
>
> Secondly, you can drop the argument to produce this equivalent and
> shorter form:
>
> let sec0at = Bytes.get_uint8 sec0 in
>
> (https://rosettacode.org/wiki/Partial_function_application#OCaml)
OK, thanks for explaining. I'll send a v4 later. (Probably tomorrow.)
Laszlo
More information about the Libguestfs
mailing list