Re: a golden oldie challenge: Eliza
  Home FAQ Contact Sign in
comp.lang.functional only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: a golden oldie challenge: Eliza         

Group: comp.lang.functional · Group Profile
Author: Stevan Apter
Date: Feb 24, 2008 05:59

yes it does.

prompts:

e"hi. i'm going to be your worst nightmare"
e"i think you're full of it."
e"my mother told me so."
e"no. you tell me about yours."
e"you're obviously retarded."
e"damn your eyes!"
e"understand a kick in the pants?"
e"i always ignore idiots."
e"i am afraid of dinosaurs"

responses:

"have you always been going to be my worst nightmare?
"why do you think i am full of it?"
"tell me about your mother."
"please don't be so personal."
"can you elaborate on that?"
"can you elaborate on that?"
"that's very interesting. do go on."
"why do you always ignore idiots?"
"have you always been afraid of dinosaurs?"

a few observations:

the 'i' function gives you prompt-and-respond in the console by
call 'e' until the user gives no prompt:

i:{while[count r:read0 0;-1"? ",e r;]}

the 'P' function maps first- and second-person:

P:{(y,x,z)(x,y)?z}.`$(("you";"your";"yourself";"i'm";"i am");("i";"my";"myself";"you are";"you're"))

instead of rotating multiple-responses, the k version picks a
response randomly from the set. this is less predictable than
rotation.

but i'm not surprised that the ruby version is so small. it's
a nice language, and i like the enthusiasm of its practitioners.

"William James" yahoo.com> wrote in message news:a404c407-ac00-4665-9f49-6bca822c1239@v3g2000hsc.googlegroups.com...
> On Feb 24, 6:06 am, Mark Tarver ukonline.co.uk> wrote:
>> Sorry I missed a couple of later attempts
>>
>> Lisp 150 LOC ................ Peter Norvig
>> Qi (slightly revised) 63 LOC .................Mark Tarver
>> Ruby 53 LOC .................William James
>> Q 10 LOC ..................Steven Apter
>> K 3 LOC ...................Steven Apter
>> Ruby (again) 17 LOC ...................William James
>> Mathematica 20 LOC .................. Szabolcs
>>
>> Mark
>
> The K version doesn't do everything that the Ruby
> versions do. It doesn't change "I" in the user's
> response to "you" when throwing it back at the user,
> for example.
>
> When there are multiple possible replies to a user's
> input, the Ruby program rotates those replies so that
> not one will be repeated until all have been used.
no comments
diggit! del.icio.us! reddit!