Path: news.media.mit.edu!grapevine.lcs.mit.edu!olivea!decwrl!nic.hookup.net!swrinde!cs.utexas.edu!howland.reston.ans.net!europa.eng.gtefsd.com!library.ucla.edu!agate!anarres.CS.Berkeley.EDU!bh
From: bh@anarres.CS.Berkeley.EDU (Brian Harvey)
Newsgroups: comp.lang.logo
Subject: Re: Ideas for logo program sought
Date: 19 Jan 1994 04:50:29 GMT
Organization: University of California, Berkeley
Lines: 29
Message-ID: <2hie6l$chu@agate.berkeley.edu>
References: <CJuK5q.IMK@discus.technion.ac.il>
NNTP-Posting-Host: anarres.cs.berkeley.edu

s2810149@techst02.technion.ac.il (Pelleg Dan ) writes:
>I need to implement a project in Logo in order to complete a course in CS.
>Does anybody have any bright ideas? 

Well, here's a favorite hard project of mine:  Write a procedure that
writes procedures from sample output.  For example, if you say

REGROUP "PAIRUP [[1 2] [3 4] ...]

(with those three dots really in the list!) then REGROUP (the thing you
write) should create a new Logo procedure definition like this:

to pairup :stuff
if (count :stuff) < 2 [output []]
output fput (list (item 1 :stuff) (item 2 :stuff)) (pairup bf bf :stuff)
end

Of course regroup really uses DEFINE rather than TO to create this new
procedure.  You should also be able to say things like

REGROUP "THIRD 3
REGROUP "OVERLAP [[1 2] [2 3] ...]
REGROUP "SWAP [2 1 4 3 ...]
REGROUP "TRIANGLE [[1 2 ...] [2 3 ...] ...]

The general idea is that the second input to regroup shows what the
result should be if you apply the newly-created procedure to a list
containing a bunch of numbers [1 2 3 4 5 ...] (in this case the ...
is *not* really part of the list!).

