guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python-style doctests in Guile (implemented, please comment)


From: Chaos Eternal
Subject: Re: Python-style doctests in Guile (implemented, please comment)
Date: Tue, 01 Aug 2017 01:36:51 +0000

No, I don't think so.
First, s-exp itself can be very literal written just like the srfi-64:
#+begin_src
(test 'foo
         (test-equal 1
                            (one)))
#+end_src
the meanning of this code is very straightforward: do a test whether result
of (one) equals to 1.
and now with my `define-examples‘
#+begin_src
(define-examples
  (test 'foo
          (test-equal 1
                             (one))))
(define (one)
            1)
#+end_src
this code is also straightforward.
and even we can do this:
#+begin_src
(define-examples
  (doc
  "the purpose of one is just return 1")
  (test 'foo
          (test-equal 1
                             (one))))
(define (one)
            1)
#+end_src
IMHO
 the real problem of putting codes into literal string is that breaks the
consistency of lisp, that say, the semantics defined by the embed code can
not be extracted with just s-exp reader.
on the other hand, the s-exp is the ultimate way to represent structures,
and it shall be adopted whenever possible.

On Tue, Aug 1, 2017 at 1:46 AM Arne Babenhauserheide <address@hidden>
wrote:

>
> Chaos Eternal <address@hidden> writes:
>
> > Great job!
> >
> > I have a new idea using s-exps to define tests:
> > simple way:
> > (define-syntax define-examples
> > (syntax-rules () ((_ e ...) (quote (e ...)))))
> >
> > then we can simply (read the-file)  then (match e ((define-examples e
> ...))
> > (do-test e))
>
> So you’d write something like the following?
>
> (define (foo)
>         (define-examples
>             ((foo) 'foo))
>         'foo)
>
> It has the same limitations as I see for define-with-tests (see my other
> answer), do you see advantages over the define-with-tests approach?
>
> Best wishes,
> Arne
> --
> Unpolitisch sein
> heißt politisch sein
> ohne es zu merken
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]