"Haris Bogdanovic" <fbogdanovic / xnet.hr> writes:
> "Pascal J. Bourguignon" <pjb / informatimago.com> wrote in message 
> news:87hc48bsgp.fsf / informatimago.com...
>> "Haris Bogdanovic" <fbogdanovic / xnet.hr> writes:
>>
>>> In Ruby everything is an object. That's my favourite Ruby's feature. And 
>>> you
>>> showed that by just making one module you can have Lisp like functional
>>> programming. So I'll stick with Ruby.
>>
>> In Lisp too, everything is an object.  But there are several kinds of
>> objects, and you can create your own kinds too (you can write new
>> meta-classes in CLOS).
>
> I meant, every expression is an object. Not sure that's the case with clisp.


Expressions, in ruby are nothing.        Expression in lisp are objects.

The result of evaluating an expresssion  The result of evaluating an expression
in ruby is an object.                    in lisp is an object.

Since expression in ruby are nothing     Since expressions in lisp are objects
we stop here.                            some expressions may return objects 
                                         that are other expressions.

                                         Therefore you can write in lisp
                                         program that write programs
                                         (little Santa's helpers), more
                                         easily than you can in ruby.


C/USER[127]>  (let ((expression '(+ 1 2)))
                (values (class-of expression)
                        (eval expression)
                        (class-of (eval expression))))
#1=#<BUILT-IN-CLASS CONS> ;
3 ;
#1=#<BUILT-IN-CLASS INTEGER>
C/USER[128]>  (let ((expression '(list '+ 1 2)))
                (values (class-of expression)
                        (eval expression)
                        (class-of (eval expression))))
#1=#<BUILT-IN-CLASS CONS> ;
(+ 1 2) ;
#1=#<BUILT-IN-CLASS CONS>
C/USER[129]> 


But of course, you can get it only when you become lazy and want to
automate not only a bank teller's job, but yours also.



(Of course, like in any programming language, you can in Ruby put
expressions into strings, and have the interpreter read again these
strings, and you can even use libraries (because it is hard enough
most ruby programmers couldn't do it themselves) to parse ruby text
into ruby objects (Array, Symbol, and other ruby Object), and back
from these R-expr into a string.  Oops, you don't get an expression
yet.  You have again to feed back the interpreter with this string, to
let it do again the parsing, build the expression in some internal
opaque and inaccessible object (not a ruby object, IIRC ruby is
written in C, that would mean that ruby expressions are actually C
structures, not ruby objects)).

-- 
__Pascal Bourguignon__