The gen function generates a list of numbers specified by its starting point, range, and step. It uses the type card [expr] by default and can be combined with task cards. It also uses the disp function and uses the [list] type card to display the list.
The task cards that can be used are:
{<value>,<value>} , which acts as the starting point and its end point (included in the list).{<value>,<value>,<value>} , which acts as the starting point, its end point (included in the list) and the step value (if applicable).{abc} to toggle letter generation. First specify the range (1-26), and then display the list. By default, letters are generated in uppercase.The function also uses the following:
<condition> , which acts as a conditional for the function. See Conditional Notation for more information.For some examples on how to use this function, we’d like to generate the following lists:
The syntax for the above examples are:
disp [list] (gen [expr] # {1,20})
//Expected output: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
disp [list] (gen [expr] #^2 {1,15})
//Expected output: [1,4,9,16,25,36,49,64,81,100,121,144,169,196,225]
disp [list] (gen [expr] 2*#+3 <<calc [expr] #%2 == [expr] 0>> {1,40})
//Expected output: [7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83]
disp [list] (gen [expr] # {1,26} {abc}) {lwr}
//Expected output: [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]