From: Ashley Roeckelein Date: 2001-05-22T16:11:25+09:00 Subject: [ruby-talk:15532] Re: Newbie GC question Mathieu Bouchard wrote: > On Tue, 22 May 2001, Ashley Roeckelein wrote: > > OK, thanks for the reply matz. I will stick with symbols for now... I > > like the symbol notation better than the string notation anyway, the : > > being kind of like the ' in Lisps. > > It's closely like the # in SmallTalk. It is a very constrained version of > Lisp's quote: it is a quote that only applies to symbols. In constrast, > Lisp's quote can be wrapped around any kind of expression, transforming it > into a literal: > > (+ 2 2) returns 4 > '(+ 2 2) returns (+ 2 2) Yep. "..kind of like...", but not quite the same :^) Internally, my program uses arrays to represent Prolog clauses, and symbols as both variables and constants (I distinquish variables by their initial uppercase letter or underscore). Example: [[:likes,:X,:Y],[:likes,:Y,:X]] (which corresponds to likes(X,Y) :- likes(Y,X). in Prolog) This is a little bit easier on the eye and pinky than [['likes','X','Y'],['likes','Y','X']]. > The equivalent in ruby would be to add something like a %e{} block, which > would return instances of subclasses of RubyNode, if those classes were > visible from Ruby programs, which they are not and won't for the > foreseeable future. That would be cool, one day! Neat stuff could spring from exposing more internals. > > FYI, my "learn Ruby" program is a Prolog-in-Ruby (I know I know - good > > lord, why?), and it is coming along nicely! I am very impressed with > > Ruby's powers so far! Bravo! > > Please, please, please publish this once you're done or half-done. > > matju > I plan on it! I'll announce it here (if that's appropriate to do - gotta read a faq) -ash