Re: Kawa picture language
Per Bothner 09 Jul 2020 20:49 UTC
On 7/8/20 11:32 PM, Vladimir Nikishkin wrote:
> I will add a reference to the Kawa's picture-language into the srfi.
> Would you like to contribute an implementation of SICP's picture language on top of Kawa's?
I took a look at it. Part of the problem is SICP is incomplete, and as far as I could see
the only actual library among your links is in Racket - which is not Scheme, so it would have
to be converted. So a lot of pieces would have to have brought together.
I did write:
(define (segments->painter segment-list)
(lambda (frame)
(draw
@(map
(lambda (segment)
(line
((frame-coord-map frame) (start-segment segment))
((frame-coord-map frame) (end-segment segment))))
segment-list))))
but actually testing it still needs a lot more.
A definition of 'wave' as a segment-list would be a start.
(draw @lst) is essentially the same as (apply draw lst).
Note the above segments->painter, when combined when a frame,
returns a Picture value. It doesn't actually display anything in itself.
It gets displayed in a DomTerm-based or Swing-based REPL, or you can use:
https://www.gnu.org/software/kawa/Composable-pictures.html#Displaying-and-exporting-pictures
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/