Re: Recovering the once true meaning of type NIL in LOOP

Sam Steingold <[email protected]> Tue, 05 Dec 2017 11:40:39 -0500
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
> *  <[email protected]> [2017-12-05 15:53:46 +0000]:
>
> Sam wrote:
>>Could you please also add a test case?
> I had no idea how to do that short of scanning the macro-expansion, which
> does not really look like a test.

--8<---------------cut here---------------start------------->8---
(defun find-in-tree (tree atom)
  (and (consp tree)
       (if (eq atom (car tree))
           tree
           (or (find-in-tree (car tree) atom)
               (find-in-tree (cdr tree) atom)))))
--8<---------------cut here---------------end--------------->8---

currently:
--8<---------------cut here---------------start------------->8---
(find-in-tree (macroexpand-1 '(loop for (i j k) of-type (fixnum) across #())) 'DECLARE)
==> (DECLARE (TYPE FIXNUM I) (TYPE (OR NULL NIL) J K))
--8<---------------cut here---------------end--------------->8---

with your patch:
--8<---------------cut here---------------start------------->8---
(find-in-tree (macroexpand-1 '(loop for (i j k) of-type (fixnum) across #())) 'DECLARE)
(DECLARE (TYPE FIXNUM I))
--8<---------------cut here---------------end--------------->8---

> ]> (loop with v = #(1 2) for x across v sum x)
> Yet I was upset that such trivial examples fail while tests and sacla-tests pass.
> So indeed, we need many more loop tests.

Indeed.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://honestreporting.com
http://camera.org http://www.dhimmitude.org http://mideasttruth.com
Only adults have difficulty with child-proof caps.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list