Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defparameter/subseq issue #302

Closed
ericlesaquiles opened this issue Jul 18, 2018 · 3 comments
Closed

defparameter/subseq issue #302

ericlesaquiles opened this issue Jul 18, 2018 · 3 comments

Comments

@ericlesaquiles
Copy link
Contributor

(defparameter *searched-list*
  '(b b a b b b b b b b a b a b b b a b a b b b a a a a b a a b a a a a a
      a b a b b a b a a b a a a b b a a b a a a a b b a b a b a a a b a b
      b a b a a b b b b b a a a a a b a b b b b b a b a b b a b a b))

No problems up to here, but

(defparameter *pattern-sublists*
  (remove-duplicates
   (let* ((s *searched-list*) (len (length s)))
     (loop for x from 0 to 8 nconc
           (loop for y from 0 to (- len x)
                 collect (subseq s y (+ y x)))))
   :test #'equal))

yields
/opt/ros/kinetic/share/euslisp/jskeus/eus/Linux64/bin/irteusgl: ERROR th=0 illegal start/end index in (subseq s y (+ y x))E:

I realize there's been a discussion on subseq-related issues lately, but it seems to me (perhaps wrongly) to be of a different kind.

obs.: that is using the loop library, which does (pretty much seem to) work.

@Affonso-Gui
Copy link
Member

Addressed on #298.

Problem is to give :start equal to lenght, such as in:

(let ((lst (list 1 2 3))) (subseq lst (length lst) (length lst)))

This returns nil in sbcl and error in eus.

@Affonso-Gui
Copy link
Member

test with:

(defparameter *pattern-sublists*
  (remove-duplicates
   (let* ((s *searched-list*) (len (length s)))
     (loop for x from 0 to 8 nconc
           (loop for y from 0 to (- len x)
                 collect (if (zerop x) ;; y = y+x = len
                             nil
                           (subseq s y (+ y x))))))
   :test #'equal))

@Affonso-Gui
Copy link
Member

Duplicate of #298.
Can we close this?

@k-okada k-okada closed this as completed Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants