Skip to content

Instantly share code, notes, and snippets.

@VaughnGH
Created February 28, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VaughnGH/812fd4fef21b14e0a077fcd5c368bf74 to your computer and use it in GitHub Desktop.
Save VaughnGH/812fd4fef21b14e0a077fcd5c368bf74 to your computer and use it in GitHub Desktop.
Every third, `et':
(defun et(in)
(COND
( (EQUAL NIL in) NIL)
( (< (LIST-LENGTH in) 3) NIL )
( T (CONS (caddr in) (et (cdddr in))) )
)
)
Break 13 [17]> (et `(1 2 3 4 ))
(3)
Break 13 [17]> (et `(1 2))
NIL
Break 13 [17]> (et `(1 2 3 4 5 6 7 8 9 0))
(3 6 9)
Break 13 [17]> (et `(1 2 3 4 5 6 7 8 9 0 2))
(3 6 9)
Break 13 [17]> (et `(1 2 3))
(3)
/////////////////////// PRACTICE /////////////////////////
def et(in):
return (CONS caddr(in) et(cdddr(in)))
(defun et(in)(COND ((EQUAL NIL in) NIL) (T (CONS (caddr in) (et (cdddr in)) ) ) ))
(defun et(in)
(COND
( ((< (LIST-LENGTH in) 3) NIL)
(T
(CONS (caddr in) (et (cdddr in)))
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment