select "segmentation fault"

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

select "segmentation fault"

Post by newdep »

Hi Lutz,

Should this happen?
Perhpas its just a little too nested?


newLISP v.9.0 on Linux, execute 'newlisp -h' for more info.

> (select D (index true? (map directory? (setq D (directory)))))
Segmentation fault


Norman.
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

just an addon...

The above was on my path by creating the smalest directory selection from a bunch of files.. So if the above doesn't work then i guess this is
the smallest a "directory filter" can get in newlisp ->

(and (setq X (index true? (map directory? (setq D (directory))))) (select D X))

Norman.
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The first definition crashes because D is modified by 'setq' while beeing used by 'select'.

Also using 'select' with an index list constructed using 'index' is the same as using 'filter', so why not just doing?

Code: Select all

(filter directory? (directory))
or if you want all files not a directory:

Code: Select all

(clean directory? (directory))
Lutz

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

yes right I was a little overclocking the function ;-)

But 'clean? actualy how long does that one exist already? I never
seen it befor ;-) Great way to wake up again ;-)

Norman.
-- (define? (Cornflakes))

lisp
Posts: 15
Joined: Tue Oct 10, 2006 1:01 pm
Location: Lispville, LSP
Contact:

Post by lisp »

It was put in @ v.8.8.7 according to the 8.9 release notes.

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Aaa im always running behind the mind expantion of Lutz...
-- (define? (Cornflakes))

Locked