Computer Science Canada A Challenge |
Author: | wtd [ Sat Dec 24, 2005 12:14 am ] | ||||
Post subject: | A Challenge | ||||
Beyond the usual TYS questions, I have a challenge for those who consider themselves good Ruby programmers. I have the following C function:
Make it possible to call this function from Ruby. Do not modify the "print_foo" C function itself, though you may add more code to the "foo.c" source file.
|
Author: | wtd [ Sat Dec 24, 2005 12:59 am ] | ||
Post subject: | |||
A further challenge along the same lines. Write pure Ruby code which does the same as this Ruby extension written in C.
|
Author: | rdrake [ Sat Dec 24, 2005 8:00 pm ] | ||||||||
Post subject: | |||||||||
The first one I can get to work, but not 100% correctly.
It looks like the second would be something like the following.
|
Author: | wtd [ Sat Dec 24, 2005 8:14 pm ] |
Post subject: | |
Close, but not quite. |
Author: | rdrake [ Sat Dec 24, 2005 8:24 pm ] | ||
Post subject: | |||
How about this for the second?
|
Author: | wtd [ Sat Dec 24, 2005 8:35 pm ] | ||||
Post subject: | |||||
cartoon_shark wrote: How about this for the second?
Very good. Your answer to the first one is too complicated.
|
Author: | wtd [ Sat Dec 24, 2005 10:34 pm ] |
Post subject: | |
http://ruby-doc.org/doxygen/1.8.2/ruby_8h.html |
Author: | rdrake [ Sun Dec 25, 2005 9:44 am ] |
Post subject: | |
No wonder why I turned to Ruby... |