From: Alessio Stalla on
I have coded some simple syntax sugar to provide a vaguely "C-like"
syntax for Lisp, part as a proof of concept, part with the intention
of actually using it in a library. It's not meant to replace sexps but
just to be less scary for newbies AND to show that the syntax argument
against Lisp is just dumb. I'd never use it myself of course ;)

The syntax is based on the Lisp reader, with these simple rules:

, (comma) is considered whitespace.
expressions are separated by ;
( ) still delimit lists.
expressions consisting of multiple tokens are automatically wrapped in
a list. Expressions consisting of a single token are not listified, so
foo is read as a symbol while (foo) as a list.
foo { ... } is roughly like `(foo ,@(list ...)) i.e. the expressions
inside the braces are inserted in the outer expression.

That's pretty much all, and it turns out - surprisingly - to cover
many common expressions you can find in Lisp. Plus, reader macros
still work (though of course they don't understand the "C-like"
syntax).

An example:

with-output-to-string (str) {
print #\c str;
if (> foo 45) {
progn { print 3; print 4; }
print 5;
}
}

If anyone's interested, the code is here:
http://alessiostalla.altervista.org/software/c-like-lisp/cll.lisp

it's far from perfect; for example, braces inside lists are read as
literal characters. But, as a quick hack it came out pretty good,
imho.

Cheers,
Alessio
From: Slobodan Blazeski on
On Apr 19, 12:53 am, Alessio Stalla <alessiosta...(a)gmail.com> wrote:
> I have coded some simple syntax sugar to provide a vaguely "C-like"
> syntax for Lisp, part as a proof of concept, part with the intention
> of actually using it in a library.

Burn the witch.


From: grucidipo on
On 19 abr, 00:53, Alessio Stalla <alessiosta...(a)gmail.com> wrote:
> I have coded some simple syntax sugar to provide a vaguely "C-like"
> syntax for Lisp, part as a proof of concept, part with the intention
> of actually using it in a library. It's not meant to replace sexps but
> just to be less scary for newbies AND to show that the syntax argument
> against Lisp is just dumb. I'd never use it myself of course ;)
>
> The syntax is based on the Lisp reader, with these simple rules:
>
> , (comma) is considered whitespace.
> expressions are separated by ;
> ( ) still delimit lists.
> expressions consisting of multiple tokens are automatically wrapped in
> a list. Expressions consisting of a single token are not listified, so
> foo is read as a symbol while (foo) as a list.
> foo { ... } is roughly like `(foo ,@(list ...)) i.e. the expressions
> inside the braces are inserted in the outer expression.
>
> That's pretty much all, and it turns out - surprisingly - to cover
> many common expressions you can find in Lisp. Plus, reader macros
> still work (though of course they don't understand the "C-like"
> syntax).
>
> An example:
>
> with-output-to-string (str) {
>   print #\c str;
>   if (> foo 45) {
>     progn { print 3; print 4; }
>     print 5;
>   }
>
> }
>
> If anyone's interested, the code is here:http://alessiostalla.altervista.org/software/c-like-lisp/cll.lisp
>
> it's far from perfect; for example, braces inside lists are read as
> literal characters. But, as a quick hack it came out pretty good,
> imho.
>
> Cheers,
> Alessio

Perhaps you should find interesting Maxima, it is based in Lisp and
use a C-like syntax, you can define operators and obtain the desired
preference using left and right binding power. It also has a way of
declaring the type of the arguments in order to translate to lisp with
optimize for speed setting.

I have been doing google code-jam problems for improving my Lisp
skills and project euler, but I still find it easier to use python.
Emacs is better than idle, you can redefine functions on the fly with
alt-e ctr-e, in python you must copy and paste the function definition
in the shell (python repl).

I also think that the current thread about improving asdf could be
better used if used with maxima.
From: o.jasper on
Alessio Stalla wasn't be the first and won't be the last :), i did it
once too(http://www.lispforum.com/viewtopic.php?
f=20&t=300&p=2044&hilit=unlisp#p2044, just ftr, it sucks), i don't
think it is all that bad an idea, if it gets nubs to use lisp.. But we
don't want them using a dozen different ones.. Perhaps try emulate
something like Python closely..(Or just be plain compatible with
it :).)

> I also think that the current thread about improving asdf could be better used if used with maxima.

What do you mean? You mean Maxima should use (the newer)asdf? I don't
get why maxima isn't asdf-installable at this point.. (And multiple
asd files please.. for instance the alternate syntax should probably
be a separate package & system..
From: Peter Keller on
Alessio Stalla <alessiostalla(a)gmail.com> wrote:
> An example:
>
> with-output-to-string (str) {
> print #\c str;
> if (> foo 45) {
> progn { print 3; print 4; }
> print 5;
> }
> }

How would you write a macro to do a non-trivial code transformation in the
above syntax?

-pete