[GAP Forum] [Devel] Strange output

Dmitrii (Dima) Pasechnik dima at ntu.edu.sg
Sun Feb 10 12:49:11 GMT 2013


On 10 February 2013 20:11, Bill Allombert
<Bill.Allombert at math.u-bordeaux1.fr> wrote:
> On Sun, Feb 10, 2013 at 07:25:14PM +0800, Dmitrii (Dima) Pasechnik wrote:
>> On 10 February 2013 14:25, Laurent Bartholdi
>> <laurent.bartholdi at gmail.com> wrote:
>> > The [a, b .. c] in GAP means { a, b, 2b-a, ..., a+i(b-a), ..., c } in
>> > mathematics.
>>
>> I've been using GAP for 20 years, and I never saw or heard about this
>> one. Sorry.
>> IMHO it is confusing, counter-intuitive, goes against well-established practices
>> in other programming languages and CAS's, etc...
>>
>> I can probably list a dozen programming languages / CAS's, where such
>> lists (or/and loops) are constructed by the triple of parameters
>> ("beginning","end","step"), in this order.
>
> Haskell works like GAP too: [1,3..11] give [1,3,5,7,9,11]

not quite:

gap> [1,3..16];
Error, Range: <last>-<first> (15) must be divisible by <inc> (2)
not in any function at line 1 of *stdin*

(Using a recent Haskell (ghci)):

Prelude> [1,3..16]
[1,3,5,7,9,11,13,15]

(why  <last>-<first>  must be divisible by <inc> in GAP is another
good question).

Anyway, syntactically Haskell is much closer to "usual" mathematical
notation than GAP.
While it would be great if GAP had many more Haskell features, it's
too far from it...

Best,
Dima


>
> Cheers,
> Bill.

CONFIDENTIALITY:This email is intended solely for the person(s) named and may be confidential and/or privileged.If you are not the intended recipient,please delete it,notify us and do not copy,use,or disclose its content.

Towards A Sustainable Earth:Print Only When Necessary.Thank you.



More information about the Forum mailing list