Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Lisp functions

samham1218 Nov 17th, 2018 (edited) 86 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. Write a function remv to remove list elements from a list (single elements or lists). ex: (remv '(a b) '(a b) c)) -> (a b c)
  2.  
  3. Write a function remv_dub to remove duplicate elements (single elements or lists) from a list. ex: (remv_dub '(a b (a) c b (a))) -> (a b c (a)))
  4.  
  5. Write a function lists to return the list elements of a list. ex: (lists '(1 (2 3) (4) 5)) -> ((2 3) (4))
  6.  
  7. Write a function sec_min to return the second smallest integer in a list. ex: (sec_min '(1 3 2 5 4)) -> 2
  8.  
  9. Write a function tri that will determine whether an integer is a triangular number (the formula (n*(n-1)/2) must not be used). ex: (tri 21) -> T
  10.  
  11. Write a function perm to generate the permutations of the identity list from 1 to n. The higher order function mapcar will be useful. ex: (perm'(3)) -> ((1 2 3) (2 1 3) (2 3 1) (1 3 2) (3 1 2) (3 2 1))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top