[m-users.] Possiblt stupid list question....

Sean Charles (emacstheviking) objitsu at gmail.com
Wed Dec 22 04:42:05 AEDT 2021


Zoltan
(a) Thanks for correcting my use of the terminology as an ex-Haskell hacker I should have known better!
(b) I will have a look at your suggestion for a bit of plagiarism, I mean, research…

Thanks,
Sean

> On 21 Dec 2021, at 16:52, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> 
> 
> 
> On Tue, 21 Dec 2021 16:42:49 +0000, "Sean Charles (emacstheviking)" <objitsu at gmail.com> wrote:
>> :- type rop
>>    --->    t(string)
>>    ;       tnl(string)
>>    ;       nl
>>    ;       tab(list(rop))
>>    ;       rops(list(rop)).
>> 
>> By adding a new type constructor, which I have done,
>> 
>>    ;       seq(string, list())
> 
> Ah, we use the same phrase differently. For Mercury implementors,
> a "type constructor" is something that constructs a new type
> from zero or more other types. In your example, "rop" is the only
> type constructor. Since it constructs a new type from nothing,
> its an arity-0 type constructor. We would call "seq" a *data* constructor.
> (Both phrases originate in the functional programming community.)
> 
>>        Call = rops([
>>            t(FunctionName), t("("), seq(“, “, ArgsOut), t(")")
>>        ]),
> 
> Yes, that would work.
> 
> I think compiler/error_util.m is close enough to what you are doing
> that if you had a look, you might find some ideas worth stealing ...
> 
> Zoltan.
> 
> 
> 



More information about the users mailing list