Skip to Content.
Sympa Menu

maude-help - Re: [[Maude-help] ] ambiguity in lists of integers

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [[Maude-help] ] ambiguity in lists of integers


Chronological Thread 
  • From: Paco Durán <duran AT lcc.uma.es>
  • To: maude-help AT lists.cs.illinois.edu
  • Cc: Francisco Durán <duran AT lcc.uma.es>, razvan.diaconescu AT ymail.com
  • Subject: Re: [[Maude-help] ] ambiguity in lists of integers
  • Date: Sun, 6 May 2018 20:47:03 +0200
  • Authentication-results: illinois.edu; spf=pass smtp.mailfrom=duran AT lcc.uma.es; dmarc=none

Hi,

The usual solutions are the one that Julia gave and using the alternative
pre-fix syntax:

1 + - 2
_-_(1, 2)

The reason why (1 + 2).Int doesn't work is because parsing is many sorted,
for the kinds, and Int and List{Int} are in the same connected component.

Best,

Paco


> On 6 May 2018, at 13:27, Julia Sapiña Sanchis
> <jsapina AT dsic.upv.es>
> wrote:
>
> Hi Razvan,
>
> If you want a list of two elements { 1, -2 } then try
>
> parse 1 (- 2) .
>
> and if you want the list of one element { 1-2 } then
>
> parse (1 + - 2) .
>
> Hope this helps.
>
> Best regards,
>
> Julia
>
> El 06/05/2018 a las 13:16, Razvan Diaconescu escribió:
>> Does not seems to work?
>> Best,
>> Razvan
>> ------------------
>> Maude> mod LISTINT is protecting LIST{Int} . endm
>> Advisory: redefining module LISTINT.
>> Maude> parse 1 - 2 .
>> Warning: <standard input>, line 45: ambiguous term, two parses are:
>> 1 - 2
>> -versus-
>> 1 -2
>> Arbitrarily taking the first as correct.
>> Int: 1 - 2
>> Maude> parse 1 (-) 2 .
>> Warning: <standard input>, line 46: didn't expect token ):
>> 1 ( - ) <---*HERE*
>> Warning: <standard input>, line 46: no parse for term.
>>> On 6 May 2018, at 14:00, Santiago Escobar
>>> <sescobar AT dsic.upv.es
>>>
>>> <mailto:sescobar AT dsic.upv.es>>
>>> wrote:
>>>
>>> A very simple solution is m (- n) for list and m (-) n for integer.
>>>
>>> --Santiago
>>>
>>>> On 6 May 2018, at 12:54, Razvan Diaconescu
>>>> <Razvan.Diaconescu AT ymail.com
>>>>
>>>> <mailto:Razvan.Diaconescu AT ymail.com>>
>>>> wrote:
>>>>
>>>> Thanks a lot Santiago,
>>>>
>>>> I knew this solution, but I wondered whether there is an
>>>> alternative to this such as sort disambiguation or just something else.
>>>> And I do not understand why (m - n).Int does not work.
>>>>
>>>> Best,
>>>> Razvan
>>>>
>>>>> On 6 May 2018, at 13:40, Santiago Escobar
>>>>> <sescobar AT dsic.upv.es
>>>>>
>>>>> <mailto:sescobar AT dsic.upv.es>>
>>>>> wrote:
>>>>>
>>>>> Best thing is to rename __ from LIST{Int} into another symbol, eg _._
>>>>> or _:_.
>>>>>
>>>>> --Santiago
>>>>>
>>>>>> On 6 May 2018, at 11:40,
>>>>>> <razvan.diaconescu AT ymail.com
>>>>>>
>>>>>> <mailto:razvan.diaconescu AT ymail.com>>
>>>>>>
>>>>>> <razvan.diaconescu AT ymail.com<mailto:razvan.diaconescu AT ymail.com>>
>>>>>> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> How do you solve the following ambiguity problem:
>>>>>>
>>>>>> When working with LIST{Int} list of integers (which may
>>>>>> be a very common module to work with) I cannot find a way
>>>>>> to disambiguate m - n, where m and n are integers.
>>>>>> The system considers two parses of this,
>>>>>> as the list m (- n) and as the integer number m - n.
>>>>>>
>>>>>> I have tried (m - n).Int and it does not work.
>>>>>>
>>>>>> Any help is greatly appreciated.
>>>>>>
>>>>>> Thanks,
>>>>>> Razvan Diaconescu




Archive powered by MHonArc 2.6.19.

Top of Page