                  (cons filename linum))))))
         (candidates
          (let ((prefix (merlin/completion-prefix arg)))
-           (mapcar #'(lambda (x)
-                       (propertize (merlin/completion-entry-text prefix x)
-                                   'merlin-compl-type
-                                    (merlin/completion-entry-short-description x)
-                                   'merlin-arg-type (cdr (assoc 'argument_type x))
-                                   'merlin-compl-doc (cdr (assoc 'info x))))
-                   (merlin/complete arg))))
+           (cl-loop for x in (merlin/complete arg)
+                    collect
+                    (propertize (merlin/completion-entry-text prefix x)
+                                'merlin-compl-type
+                                (merlin/completion-entry-short-description x)
+                                'merlin-arg-type (cdr (assoc 'argument_type x))
+                                'merlin-compl-doc (cdr (assoc 'info x))))))
         (post-completion
          (let ((minibuffer-message-timeout nil))
            (minibuffer-message "%s : %s" arg (merlin-company--get-candidate-type arg))))

    (interactive (list 'interactive))
    (when merlin-mode
      (case command
        (interactive (company-begin-backend 'company-my-backend))
        (prefix
         (let* ((bounds (merlin/completion-bounds))
                (result (merlin/buffer-substring (car bounds) (cdr bounds))))
           (when (and (boundp 'company-candidates-cache)
                      (or (string-match "\\.$" result)
                          (member '("" "") company-candidates-cache)))
             ;; for some reason, company doesn't always clear its cache
             (setq company-candidates-cache nil))


(require 'merlin)
(require 'company)
(require 'cl-lib)

;; (require 'merlin-company) should be enough to get merlin to work within
;; company.
