public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* (kawa pictures) square-limit pictures
@ 2016-10-30 15:56 Sudarshan S Chawathe
  2016-10-30 16:39 ` Per Bothner
  0 siblings, 1 reply; 5+ messages in thread
From: Sudarshan S Chawathe @ 2016-10-30 15:56 UTC (permalink / raw)
  To: kawa

I just put up a rather trivial "project" on GitLab that uses the (kawa
pictures) library to recreate the classic square-limit pictures example
from the SICP textbook:

  https://gitlab.com/chaw/square-limit

It was a fun trip down memory lane for me, and perhaps it will interest
others too.

Regards,

-chaw

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (kawa pictures) square-limit pictures
  2016-10-30 15:56 (kawa pictures) square-limit pictures Sudarshan S Chawathe
@ 2016-10-30 16:39 ` Per Bothner
  2016-10-30 18:54   ` Sudarshan S Chawathe
  0 siblings, 1 reply; 5+ messages in thread
From: Per Bothner @ 2016-10-30 16:39 UTC (permalink / raw)
  To: Sudarshan S Chawathe, kawa



On 10/30/2016 08:55 AM, Sudarshan S Chawathe wrote:
> I just put up a rather trivial "project" on GitLab that uses the (kawa
> pictures) library to recreate the classic square-limit pictures example
> from the SICP textbook:
>
>   https://gitlab.com/chaw/square-limit

Neat.  What do you think of the idea of taking
the SICP functions and moving them into a new library?
Perhaps named (kawa pictures sicp) ?
Or maybe just (sicp pictures) ?
Racket uses (require sicp-pict)

Unfortunately, I haven't found any clear copyright
statement for the code in SICP, but I think there
implied permission - and also fair use should apply.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (kawa pictures) square-limit pictures
  2016-10-30 16:39 ` Per Bothner
@ 2016-10-30 18:54   ` Sudarshan S Chawathe
  2016-10-30 19:10     ` Per Bothner
  0 siblings, 1 reply; 5+ messages in thread
From: Sudarshan S Chawathe @ 2016-10-30 18:54 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa

> From: Per Bothner <per@bothner.com>
> Date: Sun, 30 Oct 2016 09:39:11 -0700

> Neat.  What do you think of the idea of taking the SICP functions and
> moving them into a new library?  Perhaps named (kawa pictures sicp) ?
> Or maybe just (sicp pictures) ?  Racket uses (require sicp-pict)

I think it's a great idea.

An issue related (I think) to the choice of names is how closely the
library follows the original SICP pictures language v. how closely it
tries to match Kawa's composable pictures style.  Here I am thinking
about, for instance, the implementation of "below" using SICP's explicit
notion of painting into frames (and frame transformations) v. using
Kawa's re-center and vbox.  When I first started writing the
square-limit example, I went with the first option, but then decided
that is probably not in the spirit of the Kawa pictures library.  There
is probably value in having both methods.

I will take a look at how the Racket library does things.

Regards,

-chaw



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (kawa pictures) square-limit pictures
  2016-10-30 18:54   ` Sudarshan S Chawathe
@ 2016-10-30 19:10     ` Per Bothner
  2016-10-31 22:11       ` Sudarshan S Chawathe
  0 siblings, 1 reply; 5+ messages in thread
From: Per Bothner @ 2016-10-30 19:10 UTC (permalink / raw)
  To: Sudarshan S Chawathe; +Cc: kawa



On 10/30/2016 11:54 AM, Sudarshan S Chawathe wrote:

> An issue related (I think) to the choice of names is how closely the
> library follows the original SICP pictures language v. how closely it
> tries to match Kawa's composable pictures style.  Here I am thinking
> about, for instance, the implementation of "below" using SICP's explicit
> notion of painting into frames (and frame transformations) v. using
> Kawa's re-center and vbox.  When I first started writing the
> square-limit example, I went with the first option, but then decided
> that is probably not in the spirit of the Kawa pictures library.  There
> is probably value in having both methods.

I've considered adding a procedure to help bridge the SICP
model and the Kawa model.  Something like:

(transform-to RECT PICTURE)

This would be equivalent to some (with-transform TRANSFORM PICTURE)
such that the bounds of the result matches RECT.

More generally RECT could be a parallelogram.  (Note a rotated rectangle is
a parallelogram but is not considered a rectangle.) In that case the
bounds of the transform would not match RECT, but would have the
same bounds as RECT.

The RECT corresponds to the "frame" of SICP.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (kawa pictures) square-limit pictures
  2016-10-30 19:10     ` Per Bothner
@ 2016-10-31 22:11       ` Sudarshan S Chawathe
  0 siblings, 0 replies; 5+ messages in thread
From: Sudarshan S Chawathe @ 2016-10-31 22:11 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa

> I've considered adding a procedure to help bridge the SICP
> model and the Kawa model.  Something like:
> 
> (transform-to RECT PICTURE)
> 
> This would be equivalent to some (with-transform TRANSFORM PICTURE)
> such that the bounds of the result matches RECT.

This procedure would be nice to have.

> More generally RECT could be a parallelogram.  (Note a rotated rectangle is
> a parallelogram but is not considered a rectangle.) In that case the
> bounds of the transform would not match RECT, but would have the
> same bounds as RECT.
> 
> The RECT corresponds to the "frame" of SICP.

On a related note, regarding Racket's sicp-pict package you noted
earlier: Based on a quick look at the source code, it seems to use a
bitmapped drawing canvas as the basis for segments->picture from SICP,
with the other SICP procedures being mostly verbatim (with some flipped
names, such as frame-edge1 instead of edge1-frame, I assume to conform
to current Scheme naming conventions).

I'm thinking of writing something similar with Kawa.  Actually I have a
lot of it done, but I'm working on how best to hook things into the Kawa
graphics interface.  (The way I did it earlier was a bad hack.)

Regards,

-chaw

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-31 22:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-30 15:56 (kawa pictures) square-limit pictures Sudarshan S Chawathe
2016-10-30 16:39 ` Per Bothner
2016-10-30 18:54   ` Sudarshan S Chawathe
2016-10-30 19:10     ` Per Bothner
2016-10-31 22:11       ` Sudarshan S Chawathe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).