Using iterate after installing with Quicklisp
Asked Answered
M

3

6

When I load the "iterate" package using Quicklisp ( (ql:quickload "iterate") ), it seems to load fine but none of the functions really work. When I enter (iterate:iter (for i from 0 to 10) (collect i)), I get an error saying "The variable I is unbound" and several style warnings saying that COLLECT and FOR are undefined functions and FROM is an undefined variable. The same thing happens if I try to use ITER or ITERATE instead of ITERATE:ITER. I'm using SBCL.

Manilla answered 20/5, 2013 at 16:18 Comment(0)
L
4

The "operators" of the clauses also reside in the iterate package:

(iterate:iter (iterate:for i from 1 to 10) (iterate:collect i))

Iterate is a package that is often convenient to use-package (or :use in the package definition).

Limbert answered 20/5, 2013 at 20:26 Comment(1)
Thanks. I've put in a :use at the beginning of my file, but it fails to compile and gives a warning that the package "also exports the following symbols: (preprocess-clause define-clause config2 ...)" and a huge list of symbols. At the beginning of my file, I have (defpackage :foo (:use :cl :iterate)) (in-package :foo). All of the documentation I've read about this seems to indicate this should work, but it doesn't for some reason.Manilla
W
2

defining it as part of the package with :use is probably the best way style-wise, but I just used

(use-package "ITERATE")

and it seemed to work just fine.

Wilds answered 10/7, 2019 at 21:17 Comment(0)
G
1

This isn't a working solution, but I am very curious to find one myself, so, perhaps someone will hep me too :)

(defun old-package () (package-name *package*))

(defmacro i++ (&body body)
  (let ((old (package-name *package*))
        (new (package-name (find-package 'iterate))))
    (in-package #.(package-name (find-package 'iterate)))
    (prog1
        `(unwind-protect
              (progn
                (in-package ,new)
                (iter ,@body))
           (in-package ,old))
      (in-package #.(old-package)))))

Now, this won't work because the symbols of the body are getting defined in the old (cl-user for example) package and then once you try to use them in iterate package it all breaks. But there has to be some way... beside replacing all symbols potentially in iterate package...

Grinder answered 21/5, 2013 at 5:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.