On 11/25/21 16:57, Laszlo Ersek wrote:
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.)
In the end I figured posting v4 was overkill just for this update, so I
did it on top of v3, retested the series (and the test suite), and
pushed the series (adding a note to the patch#4 commit message).
Commit range e7f72ab146b9..d829f9ff9ae0.
Thank you!
Laszlo