From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: Why is booleanp defined this way? Date: Sat, 18 Apr 2015 06:09:04 +0200 Organization: Informatimago Message-ID: <877ftam61r.fsf@kuiper.lan.informatimago.com> References: <87twwemaxx.fsf@debian.uxu> <138bf565-898d-4b5a-8bea-eecd223c652b@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1429330820 6807 80.91.229.3 (18 Apr 2015 04:20:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Apr 2015 04:20:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 18 06:20:19 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YjKEs-0003eX-TL for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Apr 2015 06:20:19 +0200 Original-Received: from localhost ([::1]:44450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjKEr-00029d-OC for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Apr 2015 00:20:17 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 92 Original-X-Trace: individual.net RDzQY+qrYejq+WPUDF1Z6wgoUpUzoq2igIqP7oaHTfGovgoog2 Cancel-Lock: sha1:YTg5NzlmMGFlYmI4ZTAyNWI3NWUzMzMwMTM3MmZiYTY1M2ZjMjMzOQ== sha1:XBwRGwlMt6WROnayUHvokAZMVVg= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:211521 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103803 Archived-At: Rusi writes: >> I never used `booleanp' and I never experienced that >> the boolean built-in type was missing from my >> "ontology". > > If you how to write (and grok) an 'if' you have boolean in your > ontology. Not exactly. There's something magical occuring in if. if takes an expression that is _used_ _as_ a condition. Often, that expression is a boolean, but that depends on the language. For example, in C, the expression is any expression, and it is tested against 0 to define the (negation of the) condition. You could define a language without ANY predefined types, and then you would have to declare the mapping between the values of some user-defined type and the condition used by any "conditional" instruction or operator. (deftype booleen () `(member vrai faux)) (declare-if-conditions :then (eql vrai) :else (eql faux)) (if t 'yes 'no) --> # (if 'vrai 'yes 'no) --> yes (declare-if-conditions :else (function zerop)) (if 'vrai 'yes 'no) --> # (let ((a 2)) (if (- a 2) 'yes 'no)) --> yes (Of course, it is not too useful to have such things in lisp, we're happy with generalized booleans, but once upon a time, I fancied a language with no predefined types, as a way to achieve better portability. Like C is "good" for I/O by reason of having no I/O operator (compared to eg. Pascal), a typeless static language would be good for portability, because it would have no implicit dependence on the processor data types such as int32 or int64; you'd declare your own integer ranges and the compilers would ensure it works everywhere. (deftype my-int () `(integer -20 1000000)) (let ((a 0)) (declare (type (my-int a))) (incf a)) But again, for lisp or any other non-statically typed programming language, this is mute. Actually, any solution to any programming problem is silly, because lisp doesn't even need such a solution because it doesn't have the problem to begin with. > That you dont know that you know is ok; most programmers dont get that their > 'thinking language' is a superset of their programming language. > > eg When we were students we learnt flowcharts (or flawcharts) > Most today's kids think thats irrelevant but then they think UML is relevant. > The Dijkstra school would tout logic > The FP school will tout lambda calculus (or dependent types) > Even the box-and-arrow diagrams of classic data structures books goes beyond the > language the book claims to be using And that's where lisp excells, for the reason that we don't write code, but actually, we write data. S-exprs are a syntax for lisp data structures. (Lisp code was intended to be written as M-expr, and they indeed were used in early papers and documentations, cf. eg. LISP 1.5 Programmer's Manual). Since we write DATA, we can denote any superset of programming languages we need. We can represent flowcharts, UML diagrams (some UML tools actually used S-exps to store the diagrams, before the XML mode), or box-and-arrow diagrams, and so on... Then you just write the data describing the glue macros and functions needed to "interpret" the "data" you write to solve your problem. So, yes, "most" programmers don't get that their 'thinking language' is a superset of their programming language, but that's not the case of (reasoned) lispers. Again, see above, any problem is ALREADY inexistant or solved in lisp. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk