From: ···············@wmconnect.com
Subject: Purely applicative programming?
Date: 
Message-ID: <1114805952.526389.59330@g14g2000cwa.googlegroups.com>
"(1) A purely applicative program uses the following procedures
exclusively:
CAR CDR COND CONS EQ? LET LAMBDA LIST PAIR? QUOTE."

HOWEVER, A REPLACE-CAR is required at some level for hardware control.
( A.K.A. RPL-CAR, RPLCAR, etc. ( RPLCDR is/(may be) a subclass.))

True or false?

maw

From: ················@gmail.com
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <1114809540.838501.203710@l41g2000cwc.googlegroups.com>
> True or false?

This is True due to The Law of the Excluded Middle.
From: ···············@wmconnect.com
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <1114809998.587593.49590@f14g2000cwb.googlegroups.com>
················@gmail.com wrote:
> > True or false?
>
> This is True due to The Law of the Excluded Middle.

How does the existence of boolean logic prove 'True'?
maw
From: Joe Marshall
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <8y31e0mm.fsf@ccs.neu.edu>
················@gmail.com writes:

>> True or false?
>
> This is True due to The Law of the Excluded Middle.

I don't think you need the law of the excluded middle for this.  Had
the question been `Is this not true?', then maybe...
From: Joe Marshall
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <4qdpe0c7.fsf@ccs.neu.edu>
···············@wmconnect.com writes:

> "(1) A purely applicative program uses the following procedures
> exclusively:
> CAR CDR COND CONS EQ? LET LAMBDA LIST PAIR? QUOTE."

Whom are you quoting?

LAMBDA, COND, and QUOTE aren't procedures.

Do you mean purely functional?

CONS, LAMBDA, and LIST aren't quite purely functional if you have EQ?

> HOWEVER, A REPLACE-CAR is required at some level for hardware control.

Huh?

> ( A.K.A. RPL-CAR, RPLCAR, etc. ( RPLCDR is/(may be) a subclass.))

A subclass of what?!

> True or false?

I'm pretty sure it's either one or the other.
From: Christopher C. Stacy
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <ur7gtxnfn.fsf@news.dtpq.com>
Joe Marshall <···@ccs.neu.edu> writes:
> Huh?

There's a funny computer program at MIT that 
generates nonesense writings sort of like that.
(They've even had such a paper accepted at a conference!)
From: Arthur Lemmens
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <opsp0lckvdk6vmsw@news.xs4all.nl>
Christopher C. Stacy wrote:

> There's a funny computer program at MIT that generates nonesense
> writings sort of like that.

The level of the MIT program (http://pdos.csail.mit.edu/scigen/)
is high enough that it makes you wonder if they've tried it out
on Usenet as well ;-).

It generates pretty nice nonsense graphs too, by the way.
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <d4uo6v$3mn$1@ulric.tng.de>
Arthur Lemmens schrieb:
> Christopher C. Stacy wrote:
> 
>> There's a funny computer program at MIT that generates nonesense
>> writings sort of like that.
> 
> 
> The level of the MIT program (http://pdos.csail.mit.edu/scigen/)
> is high enough that it makes you wonder if they've tried it out
> on Usenet as well ;-).
> 
> It generates pretty nice nonsense graphs too, by the way.

OMG, this is absolutely cool, I am laughing my ass off *lol*


Here, read the introduction of one of my papers:

Many mathematicians would agree that, had it not
been for the emulation of linked lists, the construction
of red-black trees might never have occurred.
In this paper, we show the analysis of Web services
that paved the way for the deployment of digitalto-
analog converters, which embodies the unproven
principles of robotics. Of course, this is not always
the case. In order to answer this grand challenge, we
investigate how multicast frameworks can be applied
to the evaluation of consistent hashing.


Great link, thanks Arthur!


Andr�
--
From: Pascal Bourguignon
Subject: Re: Purely applicative^Wfunctional programming?
Date: 
Message-ID: <87mzrhf223.fsf_-_@thalassa.informatimago.com>
···············@wmconnect.com writes:

> "(1) A purely applicative program uses the following procedures
                                                       functions
> exclusively:
> CAR CDR COND CONS EQ? LET LAMBDA LIST PAIR? QUOTE."

LET is not a primitive:

(defmacro mlet (bindings &body body)
  `((lambda ,(mapcar (lambda (b) (if (consp b) (car  b) b)) bindings) ,@body)
    ,@(mapcar (lambda (b) (if (consp b) (cadr b) nil)) bindings)))

(macroexpand-1 '(mlet ((a (* 3 5)) (b 42) (c) d) (cond (c a) (d b))))
-->
((LAMBDA (A B C D) (COND (C A) (D B))) (* 3 5) 42 NIL NIL) ;
T


LIST is not a primitive:

(list a b c) === (cons a (cons b (cons c ())))



> HOWEVER, A REPLACE-CAR is required at some level for hardware control.
> ( A.K.A. RPL-CAR, RPLCAR, etc. ( RPLCDR is/(may be) a subclass.))

No.

1- Who needs hardware?  With these primitive functions you can simulate
   a virtual machine on which you can implement these primitive
   functions.  Therefore you don't need hardware: just run it over
   itself.

2- You can setup the hardware so as when you boot, it reads input and
   builds a list passed as argument to the boot LAMBDA, and when this
   function returns, the result is processed by the hardware and
   output, like a Turing Machine.  Eg. the hardware can do all the I/O
   out of this minimal lisp.  



(defun mini-apply (fun args)
  ...
  )
(defun mini-eval (expr)
  ...
  )

(defun sexprp (form)
  (cond
   ((symbolp form) t)
   ((consp   form) (every (function sexprp) form))
   (t              nil)))

(defun %make-integer (value) (cons (quote (())) value))
(defun %make-char    (value) (cons (quote ((()))) value))
(defun %make-string  (value) (cons (quote (((())))) value))
(defun %make-cons    (value) (cons (quote ((((()))))) value))
(defun %make-symbol  (value) (cons (quote (((((())))))) value))

(defun get-value (tagged-value) (cdr tagged-value))
(defun get-tag   (tagged-value) (car tagged-value))

(defun %integerp  (tagged-value) (eq (get-tag (%make-integer nil))
                                     (get-tag tagged-value)))
(defun %charp     (tagged-value) (eq (get-tag (%make-char nil))
                                     (get-tag tagged-value)))
(defun %stringp   (tagged-value) (eq (get-tag (%make-string nil))
                                     (get-tag tagged-value)))
(defun %consp     (tagged-value) (eq (get-tag (%make-cons nil))
                                     (get-tag tagged-value)))
(defun %symbolp   (tagged-value) (eq (get-tag (%make-symbol nil))

                                    
(defun convert-input (input)
  (cond
   ((null       input) '())
   ((consp      input) (%make-cons (cons (convert-input (car input))
                                        (convert-input (cdr input)))))
   ((integerp   input) (%make-integer (%make-list integer
                                                :initial-element '())))
   ((characterp input) (%make-char    (%make-list (char-code integer)
                                                :initial-element '())))
   ((symbolp    input) (%make-symbol (map 'list (function convert-input)
                                         (symbol-name input))))
   ((stringp    input) (%make-string (map 'list (function convert-input) input)))
   (t (error "Invalid input"))))


(defun convert-output (output)
  (cond
   ((null      output) '())
   ((%consp    output) (cons (convert-output (car (get-value output))
                                          (cdr (get-value output)))))
   ((%integerp output) (length (get-value output)))
   ((%charp    output) (code-char (length (get-value output))))
   ((%symbolp  output) (make-symbol (map 'string (function convert-output)
                                         (get-value output))))
   ((%stringp  output) (map 'string (function convert-output)
                            (get-value output)))
   (t (error "Internal error: invalid output"))))


(defun hardware ()
  (loop
   (let ((program (progn (princ "Program:    ") (read)))
         (input   (progn (princ "Input data: ") (convert-input (read)))))
     (assert (sexprp program))
     (let ((output (mini-apply program (list input))))
       (print (convert-output))))))


> True or false?

True.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink. 
From: Mark Tarver
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <1114897526.360416.141450@l41g2000cwc.googlegroups.com>
Actually false as far as I understand 'applicative'.

To say that a language follows applicative order evaluation
means that it follows an evaluation strategy whereby the
arguments to a function are evaluated left to right before
applying the function to the results.  Practically any FPL
suspends applicative order evaluation for the evaluation
of branching constructions such as COND and IF and other
boolean operations like AND and OR.  Your COND is not
applicative.

Possibly the question refers to whether a Turing equivalent
language can be constructed out of the primitives given.  I
believe the answer is 'yes' through LAMBDA might be better
replaced by DEFUN.  You do not need LIST if you have CONS,
EQ? is EQ and LET is not needed for Turing equivalence nor
PAIR? (not too sure what that is).  You are left with

                  DEFUN CONS CAR CDR EQ COND

You might need some way of testing for a non-empty list (eg. CONSP).

The best way to prove Turing equivalence from any FPL subset
is to build a lambda calculus interpreter with it.

Mark

···············@wmconnect.com wrote:
> "(1) A purely applicative program uses the following procedures
> exclusively:
> CAR CDR COND CONS EQ? LET LAMBDA LIST PAIR? QUOTE."
>
> HOWEVER, A REPLACE-CAR is required at some level for hardware
control.
> ( A.K.A. RPL-CAR, RPLCAR, etc. ( RPLCDR is/(may be) a subclass.))
> 
> True or false?
> 
> maw
From: Matthias Blume
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <m2acnfluan.fsf@hanabi.local>
"Mark Tarver" <··········@ukonline.co.uk> writes:

> Possibly the question refers to whether a Turing equivalent
> language can be constructed out of the primitives given.  I
> believe the answer is 'yes' through LAMBDA might be better
> replaced by DEFUN.

Why would LAMBDA better be replaced by DEFUN?  

> not need LIST if you have CONS,
> EQ? is EQ and LET is not needed for Turing equivalence nor
> PAIR? (not too sure what that is).  You are left with
>
>                   DEFUN CONS CAR CDR EQ COND

If you have LAMBDA and variables and application, you need nothing else.
From: Mark Tarver
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <1114939443.131833.98800@z14g2000cwz.googlegroups.com>
'Convenience' is the one word answer.

Matthias Blume wrote:
> "Mark Tarver" <··········@ukonline.co.uk> writes:
>
> > Possibly the question refers to whether a Turing equivalent
> > language can be constructed out of the primitives given.  I
> > believe the answer is 'yes' through LAMBDA might be better
> > replaced by DEFUN.
>
> Why would LAMBDA better be replaced by DEFUN?
>
> > not need LIST if you have CONS,
> > EQ? is EQ and LET is not needed for Turing equivalence nor
> > PAIR? (not too sure what that is).  You are left with
> >
> >                   DEFUN CONS CAR CDR EQ COND
>
> If you have LAMBDA and variables and application, you need nothing
else.
From: Matthias Blume
Subject: Re: Purely applicative programming?
Date: 
Message-ID: <m27jijhr6f.fsf@hanabi.local>
"Mark Tarver" <··········@ukonline.co.uk> writes:

> 'Convenience' is the one word answer.

You are reducing the language to five primitives, and then you talk
about /convenience/ ?!?

> Matthias Blume wrote:
>> "Mark Tarver" <··········@ukonline.co.uk> writes:
>>
>> > Possibly the question refers to whether a Turing equivalent
>> > language can be constructed out of the primitives given.  I
>> > believe the answer is 'yes' through LAMBDA might be better
>> > replaced by DEFUN.
>>
>> Why would LAMBDA better be replaced by DEFUN?
>>
>> > not need LIST if you have CONS,
>> > EQ? is EQ and LET is not needed for Turing equivalence nor
>> > PAIR? (not too sure what that is).  You are left with
>> >
>> >                   DEFUN CONS CAR CDR EQ COND
>>
>> If you have LAMBDA and variables and application, you need nothing
> else.