Question: Writing a "Range-to-List" Function

Hello everyone

First day using Maple and I've been given the following task: 

Design a function rangetolist(intrange) which expects an expression intrange of the type .., i.e., of the form m..n as its argument and converts it to the list
[m,m+1,...n] Also test what happens if m is larger than n. Hint: This readily works using seq

I can't quite seem to get it working, online resources haven't been too helpful in resolving the issue unfortunately. 

Here is my attempt 

rangetolist := (x::range) -> seq(i = op(1, x), i .. op(nops(x), x), 1);
which gives me this error:  Error, (in rangetolist) unable to execute seq
Very grateful for any constructive input, thanks :)



Please Wait...