Google Groups Home
Help | Sign in
Functional Geometry for fishes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  18 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Frank Buss  
View profile
 More options Jan 23 2005, 1:17 pm
Newsgroups: comp.lang.lisp
From: Frank Buss <f...@frank-buss.de>
Date: Sun, 23 Jan 2005 18:17:44 +0000 (UTC)
Local: Sun, Jan 23 2005 1:17 pm
Subject: Functional Geometry for fishes
I never really understood how to use higher order functions as combinators,
until I read the article from Peter Henderson about Functional Geometry.
Now it is easy for me to use it in Lisp:

http://www.frank-buss.de/lisp/functional.html
http://www.frank-buss.de/lisp/fishes.pdf

--
Frank Buß, f...@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Joswig  
View profile
 More options Jan 23 2005, 2:18 pm
Newsgroups: comp.lang.lisp
From: Rainer Joswig <jos...@lisp.de>
Date: Sun, 23 Jan 2005 20:18:14 +0100
Local: Sun, Jan 23 2005 2:18 pm
Subject: Re: Functional Geometry for fishes
In article <ct0po8$57...@newsreader2.netcologne.de>,
 Frank Buss <f...@frank-buss.de> wrote:

> I never really understood how to use higher order functions as combinators,
> until I read the article from Peter Henderson about Functional Geometry.
> Now it is easy for me to use it in Lisp:

> http://www.frank-buss.de/lisp/functional.html
> http://www.frank-buss.de/lisp/fishes.pdf

Nice.

See also AIM-986.pdf or the corresponding article of Byte 1988, February.

ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-986.pdf

and

Hal Abelson and Gerald Jay Sussman. "Lisp: A Language for Stratified Design". BYTE. February 1988.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Emre Sevinc  
View profile
 More options Jan 23 2005, 3:34 pm
Newsgroups: comp.lang.lisp
From: Emre Sevinc <em...@bilgi.edu.tr>
Date: Sun, 23 Jan 2005 22:34:45 +0200
Local: Sun, Jan 23 2005 3:34 pm
Subject: Re: Functional Geometry for fishes

Frank Buss <f...@frank-buss.de> writes:
> I never really understood how to use higher order functions as combinators,
> until I read the article from Peter Henderson about Functional Geometry.
> Now it is easy for me to use it in Lisp:

> http://www.frank-buss.de/lisp/functional.html
> http://www.frank-buss.de/lisp/fishes.pdf

As Rainer Joswig pointed out, Scheme designers were interested
with Henderson's examples, too.

For people who want to see Henderson's ideas in action
this video set is a good choice. I guess it is the 4th or 5th
.avi file that includes a lecture about how to produce
Escher style pictures using a functional programming
language and Henderson's ideas:

 http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/

Now that we have Common Lisp version which produces
Postscript output, we're one step closer to total world
domination! ;-)

--
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Battyani  
View profile
 More options Jan 23 2005, 4:11 pm
Newsgroups: comp.lang.lisp
From: "Marc Battyani" <Marc.Batty...@fractalconcept.com>
Date: Sun, 23 Jan 2005 22:11:11 +0100
Local: Sun, Jan 23 2005 4:11 pm
Subject: Re: Functional Geometry for fishes

"Emre Sevinc" <em...@bilgi.edu.tr> wrote

> For people who want to see Henderson's ideas in action
> this video set is a good choice. I guess it is the 4th or 5th
> .avi file that includes a lecture about how to produce
> Escher style pictures using a functional programming
> language and Henderson's ideas:

>  http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/

> Now that we have Common Lisp version which produces
> Postscript output, we're one step closer to total world
> domination! ;-)

Postscript is deprecated. Today, world domination requires that you produce
PDF output with cl-pdf ;-)

Marc


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Joswig  
View profile
 More options Jan 23 2005, 4:33 pm
Newsgroups: comp.lang.lisp
From: Rainer Joswig <jos...@lisp.de>
Date: Sun, 23 Jan 2005 22:33:39 +0100
Local: Sun, Jan 23 2005 4:33 pm
Subject: Re: Functional Geometry for fishes
In article <ct13tb$...@library2.airnews.net>,
 "Marc Battyani" <Marc.Batty...@fractalconcept.com> wrote:

Actually if you use CLIM, you can directly generate
Postscript from its graphics routines.

See:

http://www.lispworks.com/documentation/lw44/CLIM/html/climguide-341.h...

What would be neat is to generate PDF like that (perhaps with cl-pdf)
from McCLIM (http://common-lisp.net/project/mcclim/).


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Battyani  
View profile
 More options Jan 23 2005, 4:54 pm
Newsgroups: comp.lang.lisp
From: "Marc Battyani" <Marc.Batty...@fractalconcept.com>
Date: Sun, 23 Jan 2005 22:54:36 +0100
Local: Sun, Jan 23 2005 4:54 pm
Subject: Re: Functional Geometry for fishes

"Rainer Joswig" <jos...@lisp.de> wrote

>  "Marc Battyani" <Marc.Batty...@fractalconcept.com> wrote:
> > Postscript is deprecated. Today, world domination requires that you
produce
> > PDF output with cl-pdf ;-)

> Actually if you use CLIM, you can directly generate
> Postscript from its graphics routines.

> See:

http://www.lispworks.com/documentation/lw44/CLIM/html/climguide-341.h...
d-44383

> What would be neat is to generate PDF like that (perhaps with cl-pdf)
> from McCLIM (http://common-lisp.net/project/mcclim/).

Well it should be easy, Postscript and PDF share the same graphic model.

Marc


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Trent Buck  
View profile
 More options Jan 23 2005, 10:14 pm
Newsgroups: comp.lang.lisp
From: Trent Buck <gerago...@tznvy.pbz>
Date: Mon, 24 Jan 2005 03:14:22 GMT
Local: Sun, Jan 23 2005 10:14 pm
Subject: Re: Functional Geometry for fishes
Up spake Emre Sevinc:

> For people who want to see Henderson's ideas in action
> this video set is a good choice.

http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/Lec...

...about halfway through that video.

--
-trent
I'm not sure if this is a good or a bad thing.  Probably a bad thing;
most things are bad things. -- Nile Evil Bastard


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank Buss  
View profile
 More options Jan 23 2005, 11:28 pm
Newsgroups: comp.lang.lisp
From: Frank Buss <f...@frank-buss.de>
Date: Mon, 24 Jan 2005 04:28:53 +0000 (UTC)
Local: Sun, Jan 23 2005 11:28 pm
Subject: Re: Functional Geometry for fishes

Trent Buck <gerago...@tznvy.pbz> wrote:
> Up spake Emre Sevinc:
>> For people who want to see Henderson's ideas in action
>> this video set is a good choice.

> http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/Lectu
> re-3a.avi

> ...about halfway through that video.

Interesting lecture. The base concept is slightly different: My
"picture" returns a list of lines when called, while his picture draws
itself when called, but the rest is the same. But I don't like the Scheme
notation, because for me it is more clear to see a "funcall" when a
function is being called.

Another good part: at the end of the lecture he compares the top-down
methodology with the "levels of languages" methodology and explains why
it is more robust to use embedded languages in Lisp.

Regarding the picture: Would be nice to enhance the program to produce a
more exact reproduction of the original picture, filled with color, with
curved lines and recursive to level n (see "Square Limit"):

http://www.dartmouth.edu/~matc/math5.pattern/lesson7math.html

--
Frank Buß, f...@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
GP lisper  
View profile
 More options Jan 24 2005, 9:24 am
Newsgroups: comp.lang.lisp
From: GP lisper <spamb...@CloudDancer.com>
Date: Mon, 24 Jan 2005 14:24:13 GMT
Local: Mon, Jan 24 2005 9:24 am
Subject: Re: Functional Geometry for fishes

On Mon, 24 Jan 2005 04:28:53 +0000 (UTC), <f...@frank-buss.de> wrote:

> Regarding the picture: Would be nice to enhance the program to produce a
> more exact reproduction of the original picture, filled with color, with
> curved lines and recursive to level n (see "Square Limit"):

Well, if you examine the Escher picture, you can see at least 2
different 'fish'.  Henderson claimed that there are 4, but I couldn't
find 2 more.  In the second paper, Henderson describes a 'triangle
effect' (the second fish is the first fish with this triangle merged
into one wing), which alas, is also visible in your graphics (p,q,r,s
are incomplete apparently).  Adding color will only enhance the
triangles.  Escher covered them up rather well by two-tone shading and
partial line segments to trick your eye.

The second papers discussion of there actually being a single curved
line segment that generates the outline of the fish is the more
interesting piece (IMO).  That curve is drawn about a right triangle,
with some simple operations occurring, but the key rot45 appears on
the hypotenuse.  Following up this concept with a line generator which
is then mapped onto the right triangle for the tessellations, in
common lisp with .ps (or .pdf) output would be neat.

Thanks for providing some interesting reading and thinking Frank!

--
Everyman has three hearts;
one to show the world, one to show friends, and one only he knows.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Geoffrey Summerhayes  
View profile
 More options Jan 27 2005, 2:35 am
Newsgroups: comp.lang.lisp
From: "Geoffrey Summerhayes" <sumr...@NhOoStPmAaMil.com>
Date: Thu, 27 Jan 2005 02:35:34 -0500
Local: Thurs, Jan 27 2005 2:35 am
Subject: Re: Functional Geometry for fishes

"GP lisper" <spamb...@CloudDancer.com> wrote in message news:1106576653.d99305b82a9725848d1fded3b202ba9a@teranews...
> On Mon, 24 Jan 2005 04:28:53 +0000 (UTC), <f...@frank-buss.de> wrote:

>> Regarding the picture: Would be nice to enhance the program to produce a
>> more exact reproduction of the original picture, filled with color, with
>> curved lines and recursive to level n (see "Square Limit"):

> Well, if you examine the Escher picture, you can see at least 2
> different 'fish'.  Henderson claimed that there are 4, but I couldn't
> find 2 more.  In the second paper, Henderson describes a 'triangle
> effect' (the second fish is the first fish with this triangle merged
> into one wing), which alas, is also visible in your graphics (p,q,r,s
> are incomplete apparently).  Adding color will only enhance the
> triangles.  Escher covered them up rather well by two-tone shading and
> partial line segments to trick your eye.

Well, curve support looks easy to add, just use
((x1 y1)(x2 y2)(x3 y3)(x4 y4))
to define a bezier curve, change the loop in GRID to:

(loop for line in s collect
      (mapcar (lambda (point)
                (p+ (p/ (p* b (first point)) m) a (p/ (p* c (second point)) n)))
              line))

and alter PLOT:

(ecase (length line)
    (2  (... "~D ~D moveto ~D ~D lineto~%" ...))
    (4  (... "~D ~D moveto ~D ~D ~D ~D ~D ~D curveto~%" ...)))

That should do it. (untested)

--
Geoff


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Joswig  
View profile
 More options Jan 29 2005, 11:42 pm
Newsgroups: comp.lang.lisp
From: Rainer Joswig <jos...@lisp.de>
Date: Sun, 30 Jan 2005 05:42:17 +0100
Local: Sat, Jan 29 2005 11:42 pm
Subject: Re: Functional Geometry for fishes
In article <ct0po8$57...@newsreader2.netcologne.de>,
 Frank Buss <f...@frank-buss.de> wrote:

> I never really understood how to use higher order functions as combinators,
> until I read the article from Peter Henderson about Functional Geometry.
> Now it is easy for me to use it in Lisp:

> http://www.frank-buss.de/lisp/functional.html
> http://www.frank-buss.de/lisp/fishes.pdf

A picture of playing around with the code in LispWorks CLIM
on my iMac G5:

http://lispm.dyndns.org/lisp/pics/fg.jpg

Note that you can have commands to manipulate pictures
(via command line, menus or even drag&drop) and
that CLIM can generate postscript.

The code looks like this:

(define-presentation-type picture ())

(define-presentation-method presentation-typep (object (type picture))
  (typep object 'function))

;;; Plotting

(defun clim-plot (p  &optional (stream *standard-output*))
  (fresh-line stream)
  (with-output-as-presentation (stream p 'picture :single-box t)
    (with-room-for-graphics (stream)
      (with-scaling (stream 200 200)
        (with-translation (stream 0.1 0.1)
          (loop for (x0 y0 x1 y1) in '((0 0 1 0) (1 0 1 1) (1 1 0 1) (0 1 0 0))
                do (draw-line* stream x0 y0 x1 y1))
          (dolist (line (funcall p (make-point 0 0) (make-point 1 0) (make-point 0 1)))
            (destructuring-bind (p0 p1) line
              (draw-line stream p0 p1))))))))

(defun clim-plot-in-window (p &optional (stream *standard-output*))
  (clim-plot p stream))

(defun clim-plot-to-postscript (p &optional (pathname "/Users/joswig/Desktop/test-clim.ps"))
  (with-open-file (file-stream pathname
                               :direction :output
                               :if-exists :supersede
                               :if-does-not-exist :create)
   (with-output-to-postscript-stream (stream file-stream)
     (clim-plot p stream))))

(clim-demo::define-lisp-listener-command (clim-demo::save-picture-as-postscript :name t)
    ((picture 'picture :provide-default nil :prompt "picture")
     (file 'pathname :provide-default nil :prompt "file"))
  (clim-plot-to-postscript picture file)
  (values file picture))

(clim-demo::define-lisp-listener-command (clim-demo::com-beside :name t)
    ((picture0 'picture :provide-default nil :prompt "picture 0")
     (picture1 'picture :provide-default nil :prompt "picture 1"))
  (let ((new-picture (beside picture0 picture1)))
    (clim-plot new-picture)
    new-picture))

(clim-demo::define-lisp-listener-command (clim-demo::com-above :name t)
    ((picture0 'picture :provide-default nil :prompt "picture 0")
     (picture1 'picture :provide-default nil :prompt "picture 1"))
  (let ((new-picture (above picture0 picture1)))
    (clim-plot new-picture)
    new-picture))

(clim-demo::define-lisp-listener-command (clim-demo::com-rot :name t)
    ((picture 'picture :provide-default nil :prompt "picture"))
  (let ((new-picture (rot picture)))
    (clim-plot new-picture)
    new-picture))

(clim-demo::define-lisp-listener-command (clim-demo::com-cycle :name t)
    ((picture 'picture :provide-default nil :prompt "picture"))
  (let ((new-picture (cycle picture)))
    (clim-plot new-picture)
    new-picture))

(clim-demo::define-lisp-listener-command (clim-demo::com-quartet :name t)
    ((picture0 'picture :provide-default nil :prompt "picture 0")
     (picture1 'picture :provide-default nil :prompt "picture 1")
     (picture2 'picture :provide-default nil :prompt "picture 2")
     (picture3 'picture :provide-default nil :prompt "picture 3"))
  (let ((new-picture (quartet picture0 picture1 picture2 picture3)))
    (clim-plot new-picture)
    new-picture))

(define-presentation-to-command-translator rot
    (picture clim-demo::com-rot clim-demo::lisp-listener :menu t :gesture :menu)
    (object)
  (list object))

(define-presentation-to-command-translator cycle
    (picture clim-demo::com-cycle clim-demo::lisp-listener :menu t :gesture :menu)
    (object)
  (list object))

(define-drag-and-drop-translator besides
    (picture command picture clim-demo::lisp-listener
             :tester ((object destination-object)
                      (not (eq object destination-object))))
    (object destination-object)
  `(clim-demo::com-beside ,object ,destination-object))


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first