Daniel Herring | 2 Nov 05:12 2008

Alexandria/SBCL buglet

There's a subtle bug in the 'include' target in alexandria/doc/Makefile.

include:
         sbcl --eval '(progn (require :asdf) (require :alexandria) (rename-package :alexandria
:alexandria))' \
         --eval '(load (merge-pathnames "doc/manual/docstrings" (posix-getenv "SBCL_SOURCE_ROOT")))' \
         --eval '(sb-texinfo:generate-includes "include/" :alexandria)' \
         --eval '(quit)'
         mv include/fun-alexandria-type=.texinfo include/fun-alexandria-type-equal.texinfo

When the SBCL manual is built, it creates a directory named "docstrings"; 
so you now have both
doc/manual/docstrings and
doc/manual/docstrings.lisp

Thus (load (merge-pathnames "doc/manual/docstrings" ...) fails with a

debugger invoked on a SB-INT:SIMPLE-STREAM-ERROR in thread #<THREAD "initial thread" RUNNING {100274FC21}>:
   couldn't read from #<SB-SYS:FD-STREAM for "file /path/to/sbcl/doc/manual/docstrings" {1002871401}>:
     Is a directory

[SBCL 1.0.22.7 on x86-64 linux]

- Daniel

P.S.  Since "clean:" is the first target in this Makefile, it runs by 
default when you simply type `make`.  That surprised me; I expected the 
first rule to be something like

all: pdf html
(Continue reading)

Leslie P. Polzer | 11 Nov 14:59 2008
Picon

ECOND


Would this be a suitable addition to Alexandria?
Leslie P. Polzer | 11 Nov 16:21 2008
Picon

Re: ECOND


>> Would this be a suitable addition to Alexandria?
>
> fyi, no attachment.

Yeah, the subject sums it up for a first stab I guess. :)
Attila Lendvai | 16 Nov 13:52 2008
Picon

ensure-functionf

dear list,

i've got this patch pending:

(defmacro ensure-functionf (&rest places)
  "Call ENSURE-FUNCTION for each place in PLACES and store back the results."
  `(progn
     , <at> (mapcar (lambda (place)
                 `(setf ,place (ensure-function ,place)))
               places)))

it might be controversial, so i'll first send it here. if noone
complains for a week or two, then i'll push it eventually.

--

-- 
 attila
Attila Lendvai | 16 Nov 18:47 2008
Picon

Re: ensure-functionf

> Shouldn't you be using define-modify-macro and/or setf-macro-expander for that?
>
> e.g.
> (define-macro-expander ensure-functionf/1 (x) ensure-function)
> (defmacro ensure-functionf (&rest places)
>  `(progn , <at> (mapcar (lambda (x) `(ensure-functionf/1 ,x)))))

good point!

so, i'll push this eventually in the absent of other comments.

--

-- 
 attila
Tobias C. Rittweiler | 16 Nov 18:21 2008
Picon

Re: ensure-functionf

"Attila Lendvai" <attila.lendvai <at> gmail.com> writes:

> dear list,
>
> i've got this patch pending:
>
> (defmacro ensure-functionf (&rest places)
>   "Call ENSURE-FUNCTION for each place in PLACES and store back the results."
>   `(progn
>      , <at> (mapcar (lambda (place)
>                  `(setf ,place (ensure-function ,place)))
>                places)))
>
> it might be controversial, so i'll first send it here. if noone
> complains for a week or two, then i'll push it eventually.

It's leaky.

Better consider adopting CALLF &c

  http://common-lisp.net/pipermail/alexandria-devel/2007-September/000259.html

You'd then write ENSURE-FUNCTIONF as

  (defmacro ensure-functionf (&rest places)
    (loop for place in places collect `(CALLF #'ENSURE-FUNCTION ,place)))

  -T.

PS: Available in my alexandria branch.
(Continue reading)

Faré | 16 Nov 18:17 2008
Picon

Re: ensure-functionf

2008/11/16 Attila Lendvai <attila.lendvai <at> gmail.com>:
> dear list,
>
> i've got this patch pending:
>
> (defmacro ensure-functionf (&rest places)
>  "Call ENSURE-FUNCTION for each place in PLACES and store back the results."
>  `(progn
>     , <at> (mapcar (lambda (place)
>                 `(setf ,place (ensure-function ,place)))
>               places)))
>
> it might be controversial, so i'll first send it here. if noone
> complains for a week or two, then i'll push it eventually.

Shouldn't you be using define-modify-macro and/or setf-macro-expander for that?

e.g.
(define-macro-expander ensure-functionf/1 (x) ensure-function)
(defmacro ensure-functionf (&rest places)
  `(progn , <at> (mapcar (lambda (x) `(ensure-functionf/1 ,x)))))

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
Suicidal terrorists may have short shelf lives.  -- John McCarthy
Kevin Reid | 17 Nov 03:26 2008
Picon

Re: ensure-functionf

On Nov 16, 2008, at 7:52, Attila Lendvai wrote:

> dear list,
>
> i've got this patch pending:
>
> (defmacro ensure-functionf (&rest places)
>  "Call ENSURE-FUNCTION for each place in PLACES and store back the  
> results."
>  `(progn
>     , <at> (mapcar (lambda (place)
>                 `(setf ,place (ensure-function ,place)))
>               places)))
>
> it might be controversial, so i'll first send it here. if noone
> complains for a week or two, then i'll push it eventually.

For what little it's worth: I think this and ENSURE-FUNCTION are abuse  
of the naming conventions employed by the CL specification.

"ensure" is a mutating concept: see cl:ensure-generic-function,  
cl:ensure-directories-exist. These potentially mutate a function slot  
and the filesystem, respectively. (alexandria:ensure-symbol is an  
example of correct usage.)

That is, this proposed operator should be called ENSURE-FUNCTION and  
the current ENSURE-FUNCTION should be called something else. (Perhaps  
ACTUALLY-FUNCTION or AS-FUNCTION or some sort of name expressing de- 
indirection?)

(Continue reading)

Knut Olav Bøhmer | 17 Nov 10:29 2008
Picon

Re: ensure-functionf

2008/11/16 Attila Lendvai <attila.lendvai <at> gmail.com>:
> dear list,
>
> i've got this patch pending:
>
> (defmacro ensure-functionf (&rest places)
>  "Call ENSURE-FUNCTION for each place in PLACES and store back the results."
>  `(progn
>     , <at> (mapcar (lambda (place)
>                 `(setf ,place (ensure-function ,place)))
>               places)))
>
> it might be controversial, so i'll first send it here. if noone
> complains for a week or two, then i'll push it eventually.

How about makeing ensure-functionf with define-modify-macro

(define-modify-macro ensure-functionf x
	   (ensure-function x))

then

(defun map-ensure-functionf (list)
  (mapl (lambda (fnames)
	  (ensure-functionf (first fnames)))
	list))

I did not understand how you plan to use this macro. Maybe there is a
reason you made it a macro, and not a function.
Can you explain?
(Continue reading)

Knut Olav Bøhmer | 17 Nov 11:51 2008
Picon

Re: ensure-functionf

2008/11/17 Knut Olav Bøhmer <bohmer <at> gmail.com>:
> 2008/11/16 Attila Lendvai <attila.lendvai <at> gmail.com>:
>> dear list,
>>
>> i've got this patch pending:
>>
>> (defmacro ensure-functionf (&rest places)
>>  "Call ENSURE-FUNCTION for each place in PLACES and store back the results."
>>  `(progn
>>     , <at> (mapcar (lambda (place)
>>                 `(setf ,place (ensure-function ,place)))
>>               places)))
>>
>> it might be controversial, so i'll first send it here. if noone
>> complains for a week or two, then i'll push it eventually.
>
> How about makeing ensure-functionf with define-modify-macro
>
> (define-modify-macro ensure-functionf x
>           (ensure-function x))

ok, that was wrong. Sorry. "Think before act"...
(define-modify-macro ensure-functionf x ensure-function x)
As I can see someone else also wrote..

> then
>
> (defun map-ensure-functionf (list)
>  (mapl (lambda (fnames)
>          (ensure-functionf (first fnames)))
(Continue reading)


Gmane