From: Juan R.
Subject: LISP code example matching an abstract construct
Date: 
Message-ID: <1151582935.980049.190590@d56g2000cwd.googlegroups.com>
Sorry if this question sound a bit strange or off-topic.

I use notation (operator argument) --> result

e.g. (SQR 2) --> 1.4142...

I would know if anyone used both next -with A and B generic simbols-

(A B) --> C

(B A) --> D

in a LISP-Scheme program.


Juan R.

Center for CANONICAL |SCIENCE)

From: Tayssir John Gabbour
Subject: Re: LISP code example matching an abstract construct
Date: 
Message-ID: <1151583184.335253.177360@y41g2000cwy.googlegroups.com>
Juan R. wrote:
> I would know if anyone used both next -with A and B generic simbols-
>
> (A B) --> C
>
> (B A) --> D
>
> in a LISP-Scheme program.

Assuming I understand you correctly, maybe something like the
following?
(list entries)
(entries list)

MfG,
Tayssir
From: Kaz Kylheku
Subject: Re: LISP code example matching an abstract construct
Date: 
Message-ID: <1151626307.587749.282020@j72g2000cwa.googlegroups.com>
Juan R. wrote:
> Sorry if this question sound a bit strange or off-topic.
>
> I use notation (operator argument) --> result
>
> e.g. (SQR 2) --> 1.4142...
>
> I would know if anyone used both next -with A and B generic simbols-
>
> (A B) --> C
>
> (B A) --> D
>
> in a LISP-Scheme program.

I might have, in some program using the object system or classes.

Firstly, it's not uncommon to use the name of a class for instances.
E.g.:

(defmethod frobnicate ((widget widget)) ;; (instance class)
 ...)


It's not uncommon to have a 1:1 two-way navigable relationship between
classes. The accessors to retrieve the links could be named after the
class.

So for instance

  (engine car) ;; accessor to fetch the car's engine
  (car engine) ;; accessor to fetch engine's car

ENGINE and CAR are accessors, class names and instance names, all at
the same time.
From: Pascal Bourguignon
Subject: Re: LISP code example matching an abstract construct
Date: 
Message-ID: <87veqjzlxm.fsf@thalassa.informatimago.com>
"Juan R." <··············@canonicalscience.com> writes:

> Sorry if this question sound a bit strange or off-topic.
>
> I use notation (operator argument) --> result
>
> e.g. (SQR 2) --> 1.4142...
>
> I would know if anyone used both next -with A and B generic simbols-
>
> (A B) --> C
>
> (B A) --> D
>
> in a LISP-Scheme program.

Of course.  I can't see what you'll learn from it.
Are you here to learn how to program in Lisp?



In Common Lisp:

(defun a (x) 'c)
(defun b (x) 'd)
(defvar a 1)
(defvar b 2)

LISP> (a b)
C
LISP> (b a)
D




In Scheme:

This is Pseudoscheme 2.12.

scheme[164]> (define (a x) 'c)
a defined.
scheme[165]> (define (b x) 'd)
b defined.
scheme[166]> (a b)
c
scheme[167]> (b a)
d
scheme[168]> 

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink. 
From: Juan R.
Subject: Re: LISP code example matching an abstract construct
Date: 
Message-ID: <1151664095.800904.316430@y41g2000cwy.googlegroups.com>
Tayssir John Gabbour, Pascal Bourguignon, and Kaz Kylheku many thanks
by this useful clarification. Now i can understand my headaches at this
list.

Basically the problem was we were talking "different" languages; my
apologies! For me something as

(list entries)
(entries list)

has really no sense and, therefore, i was very confused about this kind
of code and part of the criticism i received in the list. Do not forget
that I become from a different community!

I also see that some LISPers would find above code incorrect and even
unelegant, therefore my ideas are not so strange.

<blockquote>
In [CL], deciding whether to use the function or the value is
impossible unless the context is known. These two forms result in
different interpretations of an expression, x:

(x ...)
(... x ...)

To some programmers, a basic 'rule' of Lisp style is that code is
clearest when the least amount of context is necessary to determine the
meaning of an expression. Unfortunately, that rule is violated in [CL].
</blockquote>

Once i understood this (and see that some LISPers think similar) i can
see that probably my original proposal for CanonCode (transformation of
CanonML documents somewhat as XSLT is for transformation of XML) could
work in a minimalist approach.

(X ...)

and

(... X ...)

both mean the same X command, whereas in CL only (X ...) can be
interpreted that way. Therefore, i can write

[[partial rho over partial rho] = L rho]

just as i had thought in a principle and datument could be translated
to TeX for printing and to LISP dialects or some other PL (e.g.
Mathematica) for simbolic evaluation.

I will update a new entry in Canonical Science Today with this
information and my last thoughts about programming module. Many thanks!


Juan R.

Center for CANONICAL |SCIENCE)
From: Pascal Bourguignon
Subject: Re: LISP code example matching an abstract construct
Date: 
Message-ID: <87r716y9gs.fsf@thalassa.informatimago.com>
"Juan R." <··············@canonicalscience.com> writes:
> [...]
> Once i understood this (and see that some LISPers think similar) i can
> see that probably my original proposal for CanonCode (transformation of
> CanonML documents somewhat as XSLT is for transformation of XML) could
> work in a minimalist approach.
>
> (X ...)
>
> and
>
> (... X ...)
>
> both mean the same X command, whereas in CL only (X ...) can be
> interpreted that way. 

Have a look at scheme.  This is a question of Lisp-1 vs. Lisp-2.

In scheme, X is interpreted the same in both places (but it would
still be called in first position, and just passed as argument in the
other positions; it's still (verb complement...)).


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

PLEASE NOTE: Some quantum physics theories suggest that when the
consumer is not directly observing this product, it may cease to
exist or will exist only in a vague and undetermined state.