Re: The order of arguments in diff

2016-11-29 Thread Bruno Franco
Wao, the next release?! Thank you! I'm really glad my question could help
that much. I'm looking forward to it!

On Tue, Nov 29, 2016 at 1:18 AM, Alexander Burger 
wrote:

> On Mon, Nov 28, 2016 at 01:35:30PM -0500, Bruno Franco wrote:
> > So, a better description of diff might be "Returns all the elements in
> the
> > first argument that are not in the second argument"?
>
> Right, very good! I changed it, will be in the next release.
>
> Thanks!
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: The order of arguments in diff

2016-11-28 Thread Alexander Burger
On Mon, Nov 28, 2016 at 01:35:30PM -0500, Bruno Franco wrote:
> So, a better description of diff might be "Returns all the elements in the
> first argument that are not in the second argument"?

Right, very good! I changed it, will be in the next release.

Thanks!

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: The order of arguments in diff

2016-11-28 Thread Bruno Franco
Thanks Alex.
So, a better description of diff might be "Returns all the elements in the
first argument that are not in the second argument"?

On Sun, Nov 27, 2016 at 2:45 AM, Alexander Burger 
wrote:

> On Sat, Nov 26, 2016 at 09:05:44PM -0500, Bruno Franco wrote:
> > I was trying out the diff function and I noticed something:
> >
> > : (diff '(1 2 3 4) '(3 4))
> > -> (1 2)
> >
> > but
> >
> > : (diff '(3 4) '(1 2 3 4))
> > -> NIL
> >
> > I think this means that there is an order to the arguments of diff, where
>
> It is analogous to the arithmetic difference, where A - B is not the
> same as B - A.
>
>
> > the second argument must be the shortest.
>
> This is not the case. The length is not relevant:
>
>: (diff (1 2 3) (8 6 4 2))
>-> (1 3)
>
>
> > I also tried this:
> >
> > : (diff (1 2 3 4) 2)
> > -> (1 3 4)
> >
> > So, why does diff work even if the second argument isn't a list?
>
> This is a result of how 'diff' is implemented internally. It takes all
> elements into account, I think it is a welcome feature. Note that this
> also works:
>
>: (diff (1 2 3) (1 . 2))
>-> (3)
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: The order of arguments in diff

2016-11-26 Thread Alexander Burger
On Sat, Nov 26, 2016 at 09:05:44PM -0500, Bruno Franco wrote:
> I was trying out the diff function and I noticed something:
> 
> : (diff '(1 2 3 4) '(3 4))
> -> (1 2)
> 
> but
> 
> : (diff '(3 4) '(1 2 3 4))
> -> NIL
> 
> I think this means that there is an order to the arguments of diff, where

It is analogous to the arithmetic difference, where A - B is not the
same as B - A.


> the second argument must be the shortest.

This is not the case. The length is not relevant:

   : (diff (1 2 3) (8 6 4 2))
   -> (1 3)


> I also tried this:
> 
> : (diff (1 2 3 4) 2)
> -> (1 3 4)
> 
> So, why does diff work even if the second argument isn't a list?

This is a result of how 'diff' is implemented internally. It takes all
elements into account, I think it is a welcome feature. Note that this
also works:

   : (diff (1 2 3) (1 . 2))
   -> (3)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe