~statianzo/sevenlangs

sevenlangs/io/actors.io -rw-r--r-- 415 bytes
2fcd4511Jason Staten day one logic style 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Lookup := Object clone do(
  find := method(query, caller,
    wait(2);
    caller @@onFind(query asUppercase)
  )
)

UI := Object clone do(
  run := method(
    stdin := File standardInput
    loop(
      "Give me a movie" println
      line := stdin readLine
      Lookup clone @@find(line, self)
      yield
    )
  )

  onFind := method(response,
    "Got response: " println
    response println
  )
)

UI run