This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -0,0 +1,19 @@
(task=
( oracle
= (predicate="is made of green cheese")
(generateTruth=.str$(!arg " " !(its.predicate) "."))
(generateLie=.str$(!arg " " !(its.predicate) "!"))
)
& new$oracle:?SourceOfKnowledge
& put
$ "You may ask the Source of Eternal Wisdom ONE thing.
Enter \"Truth\" or \"Lie\" on the next line and press the <Enter> key.
"
& whl
' ( get':?trueorlie:~Truth:~Lie
& put$"Try again\n"
)
& put$(str$("You want a " !trueorlie ". About what?" \n))
& get'(,STR):?something
& (SourceOfKnowledge..str$(generate !trueorlie))$!something
);

View file

@ -0,0 +1,14 @@
Class Unknown.Example Extends %RegisteredObject
{
Method Foo()
{
Write "This is foo", !
}
Method Bar()
{
Write "This is bar", !
}
}

View file

@ -0,0 +1,5 @@
local example = { }
function example:foo (x) return 42 + x end
local name = "foo"
example[name](example, 5) --> 47

View file

@ -0,0 +1,12 @@
#lang racket
(define greeter
(new (class object% (super-new)
(define/public (hello name)
(displayln (~a "Hello " name "."))))))
; normal method call
(send greeter hello "World")
; sending an unknown method
(define unknown 'hello)
(dynamic-send greeter unknown "World")