On Jan 31, 2008 5:45 PM, Mark Fredrickson [EMAIL PROTECTED] wrote:
Compiling with -X docinfo could add all of this to a unit.db file
which could be optionally loaded, so we could eliminate overhead for
cases where you don't need the info. Perhaps (use-with-info xyz) to
load?
The svn trunk
On Jan 31, 2008 5:45 PM, Mark Fredrickson [EMAIL PROTECTED] wrote:
I assume you mean extending (declare (exports )) to something like
(declare
(exports
((square ((required int) (docstring Returns the square of it's
input))
I recommend not to use declare. There is already a
Hallo,
On Jan 31, 2008 2:27 PM, Elf [EMAIL PROTECTED] wrote:
we could just define a special form
(define-with-docstring name|lambda list list|string body...)
which would just be syntactic sugar for a define and a procedure-data.
this of course leaves variables and macros undefined.
a third possibility is similar to whats in place already... have
explicitly
named elements of an associated proplist with each var/func,
optionally.
I assume you mean extending (declare (exports )) to something like
(declare
(exports
((square ((required int) (docstring Returns
On Thu, Jan 31, 2008 at 02:43:39PM -0200, Alex Queiroz wrote:
(define-macro (defun name args docstr . body)
`(let ()
(define ,name (lambda ,args ,@body)
(put! ,name 'docstring ,docstr)))
In common lisp, the docstring is optional. Basically, if (string?
docstring) then use it,
Hallo,
On Jan 31, 2008 2:51 PM, David Brown [EMAIL PROTECTED] wrote:
On Thu, Jan 31, 2008 at 02:43:39PM -0200, Alex Queiroz wrote:
(define-macro (defun name args docstr . body)
`(let ()
(define ,name (lambda ,args ,@body)
(put! ,name 'docstring ,docstr)))
In common lisp,
we could just define a special form
(define-with-docstring name|lambda list list|string body...)
which would just be syntactic sugar for a define and a procedure-data.
this of course leaves variables and macros undefined.
we could also change how define itself works and try to make it smart
this brings to mind a fourth possibility:
chicken-man is hopelessly out of date.
an entirely new chicken-man-ish system, and export external docs that can
be loaded if desired. this gives the same set of functionality without
requiring strings on the stack, and should be slightly easier to
i had previously read that, kon. i was thinking of an alternate representation
for arity when i mentioned that it should be simple. it should have gone
into a diff post.
simplest arity is a pair, int . bool, required args and rest?.
optionals present a problem: do we want to keep defaults,
On Jan 31, 2008, at 9:02 AM, Elf wrote:
this brings to mind a fourth possibility:
chicken-man is hopelessly out of date.
an entirely new chicken-man-ish system, and export external docs
that can be loaded if desired. this gives the same set of
functionality without
requiring strings on
Sorry,
Example didn't handle curry'ed defines.
(use procedure-decoration)
(define-procedure-extender docstring procedure-documentation
documented-procedure?)
(define-macro (define/doc ?head ?docstr . ?body)
(let ([nam (let loop ([hd ?head])
(if (pair? hd)
Elf scripsit:
simplest arity is a pair, int . bool, required args and rest?.
Better yet, return two values.
optionals present a problem: do we want to keep defaults, names, or just
ordering?
I don't much care; the above would be plenty for me, as it allows you
to correctly invoke the
On Jan 31, 2008, at 10:28 AM, Elf wrote:
i had previously read that, kon. i was thinking of an alternate
representation
for arity when i mentioned that it should be simple. it should
have gone
into a diff post.
simplest arity is a pair, int . bool, required args and rest?.
optionals
i was bringing up the case-lambda and parameters as being special cases of
forms with the number of required args not necessarily the same as the
maximum number of args, ie its 'rest?' but its not a true rest, in that only
certain values are valid arities.
im fundamentally opposed to
On Thu, 31 Jan 2008, Kon Lovett wrote:
snip
What about SRFI-89, available for Chicken; Marc Feeley's alternative to the
DSSSL style? Could use this as a canonical form, mapping the DSSSL style.
The default values are probably only relevant to documentation, not runtime
arity checking.
Elf scripsit:
i was bringing up the case-lambda and parameters as being special cases
of forms with the number of required args not necessarily the same as
the maximum number of args, ie its 'rest?' but its not a true rest,
in that only certain values are valid arities.
Well, sure. But
On Thu, 31 Jan 2008, John Cowan wrote:
Elf scripsit:
i was bringing up the case-lambda and parameters as being special cases
of forms with the number of required args not necessarily the same as
the maximum number of args, ie its 'rest?' but its not a true rest,
in that only certain values
Elf scripsit:
unless the procedure accepts unlimited arguments (explicitly or implicitly),
it should be possible to trace how many args are absorbed.
Consider this:
(define (foo . rest) (if (= 1 (random 1)) (car rest) #f)
How many arguments does it consume?
any compiler should know the
Scripsi:
See SRFI 8, which Chicken implements and which is designed to make
receiving multiple values very easy.
SRFI-11 (which provides let-values and let*-values) and SRFI-71 (which nicely
extends let and let*) are more advanced solutions to this problem: there
don't seem to be Chicken
SRFI 11 is built into Chicken.
#;2 (feature? 'srfi-11)
#t
On 1/31/08, John Cowan [EMAIL PROTECTED] wrote:
SRFI-11 (which provides let-values and let*-values) and
SRFI-71 (which nicely extends let and let*) are more
advanced solutions to this problem: there don't seem to be
Chicken
On Thu, 31 Jan 2008, John Cowan wrote:
Elf scripsit:
unless the procedure accepts unlimited arguments (explicitly or implicitly),
it should be possible to trace how many args are absorbed.
Consider this:
(define (foo . rest) (if (= 1 (random 1)) (car rest) #f)
in this case, 0. this
im aware of the various srfis on the matter. thats one of the things i was
griping about earlier. receive is entirely counterintuitive... one
extra set of parens around the vars and producer would make it so much
easier to follow. let-values is a nicer solution to the problem but
still
Elf scripsit:
(define (foo . rest) (if (= 1 (random 1)) (car rest) #f)
in this case, 0. this entire expression should have been removed by the
compiler and replaced by #f, though.
Okay, make it (random 2) then, smartass.
additionally, this is enough information, even unevaluated, to do
Elf scripsit:
i take the number of srfi's relating to binding (values ...) clauses in
different ways as evidence of its confusing and unnecessary nature. :)
Whereas I think of TMTOWTDI as one of Scheme's virtues. Anyhow, we've
come a long way from being required to use call-values. It also
On Thu, 31 Jan 2008, John Cowan wrote:
Elf scripsit:
i take the number of srfi's relating to binding (values ...) clauses in
different ways as evidence of its confusing and unnecessary nature. :)
Whereas I think of TMTOWTDI as one of Scheme's virtues. Anyhow, we've
i would agree, on
On Thu, 31 Jan 2008, John Cowan wrote:
Elf scripsit:
(define (foo . rest) (if (= 1 (random 1)) (car rest) #f)
in this case, 0. this entire expression should have been removed by the
compiler and replaced by #f, though.
Okay, make it (random 2) then, smartass.
sure, min 0, max 1.
On Jan 31, 2008 8:51 PM, Elf [EMAIL PROTECTED] wrote:
On Thu, 31 Jan 2008, John Cowan wrote:
Elf scripsit:
(define (foo . rest) (if (= 1 (random 1)) (car rest) #f)
in this case, 0. this entire expression should have been removed by
the
compiler and replaced by #f, though.
Elf scripsit:
sorry, clarify what you mean by 'multiple arguments' then?
I mean neither more nor less than allowing procedures to have more
than one argument. (I suspect you are reading multiple arguments
and interpreting it as a rest argument.)
values isnt a first-class object, its just a
On Thu, 31 Jan 2008, John Cowan wrote:
Elf scripsit:
they'll all be call-with-values on the inside, or the equivalent thereof.
Almost. When you have one of these restricted macros, you can be quite
sure that the producer and consumer lambdas don't escape the construct.
That allows certain
Kon Lovett wrote:
On Jan 29, 2008, at 11:08 AM, Hans Nowak wrote:
(get-docstring foo)
docstring for foo
Yes, but not with a documented interface. The procedure
'(##sys#decorate-lambda proc pred decorator)' can create arbitrary
decorations for a procedure. Then, '(##sys#lambda-decoration
On Jan 29, 2008, at 11:08 AM, Hans Nowak wrote:
First of all, thanks to everybody who replied.
Re docstrings: My next question would be, is it possible to add
them (e.g. as a library)? And would it be desirable to do so?
Apparently it is already possible to write code like:
(define
First of all, thanks to everybody who replied.
Re docstrings: My next question would be, is it possible to add them (e.g. as a
library)? And would it be desirable to do so? Apparently it is already
possible to write code like:
(define (foo x)
docstring for foo
...body...)
It just has
Hans Nowak scripsit:
Re docstrings: My next question would be, is it possible to add them (e.g.
as a library)? And would it be desirable to do so? Apparently it is
already possible to write code like:
(define (foo x)
docstring for foo
...body...)
Yes, but that will not work for
On Jan 29, 2008, at 1:11 PM, Hans Nowak wrote:
Kon Lovett wrote:
On Jan 29, 2008, at 11:08 AM, Hans Nowak wrote:
(get-docstring foo)
docstring for foo
Yes, but not with a documented interface. The procedure
'(##sys#decorate-lambda proc pred decorator)' can create arbitrary
decorations
34 matches
Mail list logo