I have function like this:
(defun swap-region-ring ()
"replace selected text with the one from kill ring"
(interactive)
(backward-delete-char (- (point) (mark)))
(yank))
(global-set-key (kbd "C-c y") 'swap-region-ring)
How can I rewrite that function to call yank with argument and have also optional argument so it act the same as yank? So I can call C-u 2 C-c y