mardi 14 mars 2017

Getting items from a list in Racket

I am wondering if in Racket I could get n number of items from a list I've already created. So lets say I made a list in Racket

(define base(list 1 2 3 4 5 6 7 8 9 10))

Now I want to define a function which will pick n number of items from this list and display them in a new list. So lets say n=4 I would want 4 random items from the base list I've made above. An example of the output im looking for would be

'(9 4 3 10)

Is there a way I can do this in Racket?




Aucun commentaire:

Enregistrer un commentaire