[Icfp04-discuss] Scheme, Ruby ?

Jed Davis jdev+icfp at xlerb.net
Wed Jun 16 16:09:49 EDT 2004


Dmitri Kondratiev <d_kondr at yahoo.com> writes:

> Greetings,
>
> Have anybody used Scheme or Ruby to write tools for
> the contest ?

Not for the contest proper, and not as interesting language-use-wise
as a simulator, but more recently I've been writing new code
generation tools in Scheme; I've been trying to elicit interesting
collective behaviors from the ants, and while the tools I have were
good enough for the contest, lately they've been getting a little
annoying.


By way of demonstration: My new lower-level control flow mechanism,
being heavily inspired by Forth, is probably one of the stranger ant
languages anyone's come up with; the ant from the problem overview,
for example, can be written thusly:

(define (s1walk sought onsense) 
  (seq loop (sense 'ahead sought) onsense else reloop
       else loop (flip 3) left else
                 (flip 2) right else
                 move else repeat then then repeat))
(genant (s1walk 'food (aand move pickup)) ; "aand" is high-level; see below
	(s1walk 'home (seq move drop)))

However, because the manual braiding of control-flow threads isn't
always the most enjoyable thing --- for instance, that (aand move
pickup) is really (seq move pickup (cs-broll 2) then else) --- I built
some C-like high-level constructs on top of the low-level words; this
allows one to write much less alien code, like this:

(define (s1walk sought onsense) 
  (while true
    (while (sense 'ahead sought)
	   (aif onsense (nbreak 1)))
    (dowhile
     (aif (flip 3) (seq left break)
	  (aif (flip 2) (seq right break)))
     (anot move))))
(genant (s1walk 'food (aand move pickup))
	(s1walk 'home (seq move drop))) ; This is still a low-level-ism


Next thing to do: fake variables, for which I'll probably need some
sort of goto.

-- 
dn: cn=Jed Davis, o=panix.com  ##          see also jldavis at cs.oberlin.edu
objectclass: person
mail;personal: jdev at panix.com  ##    PGP Key FP:   A098 903E 9B9A DEF4 168F
mail;work:     jld@/           ##  [id 0xF33659F9] AA09 BF07 807E F336 59F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
Url : http://lists.seas.upenn.edu/pipermail/icfp04-discuss/attachments/20040616/ea3aa818/attachment.bin


More information about the Icfp04-discuss mailing list