PasteRack.org
Paste # 14369
2024-11-30 05:52:26

Fork as a new paste.

Paste viewed 197 times.


Embed:

  1. #lang racket
  2.  
  3. (define (last2 lista)
  4. (let ((reverselist (reverse lista)))
  5. (cond
  6. ((null? reverselist) '())
  7. ((<= (length reverselist) 2) lista)
  8. (else (list (second reverselist) (first reverselist))))))

=>