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:

The function also uses the following:

For some examples on how to use this function, we’d like to generate the following lists:

  1. $x \text{ where } 1 \leq x \leq 20$
  2. $x^2 \text{ where } 1 \leq x \leq 15$
  3. $2x+3 \text{ where }1 \leq x \leq 40 \text{ and } x \text{ mod } 2 = 0$
  4. The letters of the Alphabet from A to Z in lowercase.

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]