Skip to content

Instantly share code, notes, and snippets.

@kwrooijen
Created January 2, 2016 01:53
Show Gist options
  • Save kwrooijen/7b09aecf08589cf023d5 to your computer and use it in GitHub Desktop.
Save kwrooijen/7b09aecf08589cf023d5 to your computer and use it in GitHub Desktop.
(use-modules (srfi srfi-1)
(rnrs))
(define (transform-at l i val)
(let-values (((left right) (split-at l i)))
(append left (cons val (cdr right)))))
(display (transform-at '(1 2 3) 1 5)) ;=> '(1 5 3)
@guiprav
Copy link

guiprav commented Jan 2, 2016

Makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment