On Sat, 25 Aug 2012 20:05:49 +0800, Alan Manuel Gloria announced:
> Subject: [Readable-discuss] Finally, an example application!
> Heya world,
>
> I've built an example application using sweet-expressions in Guile!
>
> It's a simple game where you must type in the falling letter before it
> falls completely to the bottom of the window.
Awesome!
I think this *clearly* demonstrates that our notation is a big improvement and
very usable. We now have at least two programs (sweeten and letterfall) in
sweet-expressions, written by two different people.
I looked through the code to see "how it looks". After all, we're trying to
improve readability - and I think it's remarkably better than traditional
formatting. In font.sscm the vectors are remarkably clear, for example.
In general, you use "$" in several places where I would use parens; both seem
quite reasonable and I don't think we can easily argue one or the other is
"better". And frankly, if we're having arguments about that, we're having great
success. Besides, we're both using both forms, so there's no evidence that we
should drop either one.
E.G., in font.sscm:
define font-data(c)
! let
! $ n $ char->integer c
! cond
....
I would have used:
define font-data(c)
! let
! $ n char->integer(c)
! cond
...
The "screen.sscm" has some very interesting examples of these capabilities
combined together, e.g.:
~~~~
; virtually draw a single point on the pixmap, with x and y
; in a 320x200 screen
define draw-point(x y pen)
let
\\
x-rescaled $ compute-x x
y-rescaled $ compute-y y
x+1-rescaled $ compute-x { x + 1 }
y+1-rescaled $ compute-y { y + 1 }
gdk-draw-rectangle pixmap pen 1
x-rescaled \\ y-rescaled
max 1 { x+1-rescaled - x-rescaled }
max 1 { y+1-rescaled - y-rescaled }
define compute-x(x)
inexact->exact $ floor
{{ screen-width / 2 } + {{ x - 160 } * scaling-factor }}
define compute-y(y)
inexact->exact $ floor
{{ screen-height / 2 } + {{ y - 100 } * scaling-factor }}
~~~~
Very cool. And WAY easier to read than the traditional format.
--- David A. Wheeler
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/readable-discuss