Extend LOOP BEING THE ELEMENTS OF extension

Bug #1850277 reported by Michał "phoe" Herda on 2019-10-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Wishlist
Unassigned

Bug Description

http://www.lispworks.com/documentation/lcl50/loop/loop-50.html mentions further extensions to LOOP ... BEING THE ELEMENTS OF iteration path, for example:

;; Print the characters in a string, which is also a vector.
> (loop for x being the elements of "abcde" from 2
        do (print x))
#\c
#\d
#\e
NIL

This example currently fails on SBCL due to `FROM 2` not being expected in this LOOP context.

Douglas Katzman (dougk) wrote :

A loop extension would make sense only when there is no portable way to iterate on a thing.
This loop has a portable equivalent of:
(loop with v = "abcde" for i from 2 below (length v)
      for x = (aref v i) do (print x))

Quicklisp has a bunch of extensible iteration macros to choose from.

Stas Boukarev (stassats) wrote :

there's no portable way of iterating on sequences.

Stas Boukarev (stassats) on 2020-05-02
Changed in sbcl:
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers