Re: The beauty of LATEX

Joel de Guzman <[email protected]>
Newsgroups gmane.comp.lib.boost.documentation
Message-ID <[email protected]>
On 10/23/2011 7:57 PM, Dave Abrahams wrote:
> 
> on Sat Oct 22 2011, Joel de Guzman <joel-AT-boost-consulting.com> wrote:
> 
>> On 10/23/2011 7:49 AM, Joel de Guzman wrote:
>>> On 10/23/2011 4:15 AM, Dave Abrahams wrote:
>>
>>>> Especially if you're inspired by S-expressions, I can't imagine any good
>>>> excuse to invent a new syntax when lisp already has a syntax for this
>>>> sort of thing.  If we need to use square brackets instead of round ones
>>>> for legacy (or other) reasons, that's fine, but I don't at all see why
>>>> it makes sense to choose a syntax where of all things there's no outer
>>>> set of parens around the entire
>>>> function/macro/template/whatever-you-call-this-thing.  Why not do this:
>>>>
>>>>   [def foo[a] [a]]
>>>
>>> You are right Dave. I totally mixed it up! My concern was legacy
>>> Qbk code. I wanted something that can be applied to legacy code
>>> using simple grep. But I fumbled and mixed it up. I see that
>>> the old syntax has the syntax you wrote! I'll fix it.
>>
>> Following scheme/lisp more closely, that should be:
>>
>>   [def [foo a] [a]]
> 
> 
> I don't think so, at least not for lisp.  I don't know Scheme, but this
> works in lisp:
> 
>   (defun identity (a) a)  (assert (eq (identity 'bar) 'bar))
>   (defun foo (a) (list a)) (assert (equal (foo 'bar) '(bar)))
>   (defun foo (a) `(,a)) ; alternate spelling

Here's Scheme's define:

http://tinyurl.com/68r8a7d

E.g.:

(define (factorial n)
  (if (<= n 0) 1
    (* n (factorial (- n 1)))))

>> (Fine. That should still be grep-able).
>>
>> Now we have it very close to scheme including the dot notation
>> for variable args. E.g.
>>
>>   [decl [table title . rows]]
> 
> Dot notation doesn't mean variable arguments in lisp.  It's a cons
> operation.
> 
>     a . b == (cons a b)

Here's var-args in RScheme:

  http://tinyurl.com/3duefnd

There are lots of Scheme and Lisp-ish syntax variants and
dialects. These dialects have conflicting var-args syntax.
We'll just have to choose one.

>> and lambda. E.g.:
>>
>>   [lambda [x] [dup [x]]]
> 
> This one looks just like lisp to me.

Ok.

Regards,
-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.