collect clause in progn in loop facility

Discussion of Common Lisp

collect clause in progn in loop facility

Postby jiyoo » Sun Sep 22, 2013 3:28 am

Suppose I have a loop form (using the loop facility) and within it is a do clause, and within the do clause is a let form, and somewhere deep within the let form are two collect clauses (like COLLECT .. INTO ..), except it's not a legal syntax to put collect clauses or any clauses in those positions. What are my options in this case?

If it were just one collect clause, I could instead put the entire let form inside a collect clause. Things seem tricky when there are two collect clauses.

I could turn the two collect clauses into two push forms but then I would be sort of reinventing the loop facility's collect feature.
jiyoo
 
Posts: 1
Joined: Wed Sep 11, 2013 12:26 am

Re: collect clause in progn in loop facility

Postby nuntius » Mon Sep 23, 2013 10:37 am

CL's LOOP can be a useful tool, but it is not fully general purpose. Many language purists find it to be an abomination. Many pragmatists find it to be beautiful despite its rough spots.

Recommendation: Value results over style. Only worry about style when bugs keep cropping up in the same section of ugly code. Then refactor that code, remembering to value results over style.

:-)
User avatar
nuntius
 
Posts: 498
Joined: Sat Aug 09, 2008 10:44 am
Location: Burlington, MA

Re: collect clause in progn in loop facility

Postby Goheeca » Mon Sep 23, 2013 12:26 pm

It's better to specify a particular snippet why do you need have collects in a let form than just saying. In this case I can only link you to loop that it has also intial and final clauses which with collect might be used in your issue.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version).
User avatar
Goheeca
 
Posts: 205
Joined: Thu May 10, 2012 12:54 pm


Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 2 guests