Anonymous user
String append: Difference between revisions
Emacs Lisp: Correct example, demonstrate buffer solution
(Emacs Lisp: Correct example, demonstrate buffer solution) |
|||
Line 636:
=={{header|Emacs Lisp}}==
While strings in Emacs Lisp are mutable, they're fixed size. Therefore the <code>concat</code> function creates a new string and the existing string must be referenced twice:
<lang Lisp>(defvar str "foo")
(setq str (concat
str ;=> "foobar"</lang>
Buffers can be thought of as expandable strings:
<lang Lisp>(let ((buf (get-buffer-create "*foo*")))
(with-current-buffer buf
(insert "foo"))
(with-current-buffer buf
(goto-char (point-max))
(insert
(buffer-string)))
;; => "foobar"</lisp>
=={{header|Erlang}}==
|