# Why did python took over scheme/lisp in popularity ?



## Alain De Vos (Oct 31, 2021)

I'm currently downgrading from python 3.9 to python 3.8 and need to recompile 700 ports.
Proving how intrusive python is.
But this made me wonder why scheme became less popular than python ?


----------



## bakul (Oct 31, 2021)

For an explanation see


			Dan Weinreb’s blog  » Blog Archive   » Why Did M.I.T. Switch from Scheme to Python?
		

and


			MIT Admissions | Blog Entry: "The End of an Era"
		


That is part of the larger trend. I believe everything you can do with Python could've been done in Scheme but for some reason most programmers don't like Lisp or Scheme. So it goes. I am a long term fan of Scheme but must admit Scheme was not really very popular except in top tier schools like MIT and such. And it lacked low level features or was hard to interface with C/C++.


----------



## astyle (Oct 31, 2021)

The reasoning is the difference in programming paradigms. Scheme implements a _functional programming paradigm, _which basically allows you to redefine a function based on the program's scoping. Python implements an _imperative programming paradigm_, which allows for object orientation. Wikipedia is a good read for all that.


----------



## Alain De Vos (Oct 31, 2021)

It's time I start to learn <racket>  which is general purpose scheme language.
Note1 : there is "functional stuff" in the <nim> compiler&language
Note2:  The way our brain processes written text might also be reason for the succes of python ?


----------



## bakul (Oct 31, 2021)

You can do imperative programming in Scheme too, using all those functions ending in '!' such as `set!`.  Object orientation was all the rage for a few decades but now there is lots of criticism of it. Someone has even called it a trillion dollar disaster! Even newer languages such as nim ("inspired" by python) don't tout object-orientedness. More and more we are realizing now that the bigger issue is mutability, which needs to be controlled tightly, while OO actually _encourages_ mutability!


----------



## zirias@ (Oct 31, 2021)

I used neither python nor scheme myself, but would add some general thoughts anyways:

Many "modern" languages are in fact "multi-paradigm", thus offering constructs for functional, imperative _and_ object-oriented styles, leaving the choice to the programmer. These languages often become somewhat popular for their versatility.

It even makes sense to "mix" paradigms in the same codebase. As an example, functional and object-oriented programming doesn't have to be mutually exclusive. Applying both just means that the objects are the (immutable) values handled by functions. There's still something to gain from "member functions" (methods): You'll still have functions "mutating" objects, but instead of doing that directly, they create and return a modified copy. These are still logically tied to the object type, so having them as member functions there helps the structure of your project.

Of course, that's different from the original OOP ideas. Code reuse by inheritance once was considered a great idea, now we know it just leads to unmaintainably complex object graphs, and when you add the directly mutating methods to that, you'll have bugs by the dozen.

In theory, you can program anything following any paradigm, but still, some are better suited to specific tasks than others. Take for example some GUI logic: Almost nobody would want to use a strictly functional style there. It's possible, but as soon as you need "side effects", the functional style gets very cumbersome. You will mostly use some OOP style for GUIs. OTOH, for your "core logic" (what the program is actually doing), you should separate that from layers with side effects (like UI, persistence, ...) anyways, so very often, doing it functional is the best choice there is. Even a language like C++ added constructs (lambdas) to enable some things functional, although it isn't complete there.

As I said, I didn't use python so far, but assuming it has somewhat sane support for different paradigms, that might be a reason for popularity. Having to learn just a single language and not having to think about integration of parts written in different languages is a big plus for a software project.


----------



## Alain De Vos (Nov 1, 2021)

I've done a few tests with chicken-scheme but i found it slow. Yet it has libraries for many things.


----------



## drhowarddrfine (Nov 2, 2021)

The bar to taking over from scheme was pretty low. Even today I'd bet a lot of new languages have surpassed scheme. That's not saying anything bad about it. It's just that "nobody" uses scheme.


----------



## bakul (Nov 2, 2021)

chez-scheme & gambit-scheme are usually the fastest. I wrote the following 8 years back (first ran it on the original Pi). Gambit-scheme runs it the fastest thanks to its superior multiplication algorithm:

```
(define (pi digits)
  (let* ((A 13591409)
     (B 545140134)
     (C 640320)
     (C^3/24 (quotient (expt 640320 3) 24))
     (D 12))
    (define (-1^n*g n g) (if (odd? n) (- g) g))
    (define (split m n)
      (if (= 1 (- n m))
    (let* ((6n (* 6 n)) (g (* (- 6n 5) (- (+ n n) 1) (- 6n 1))))
      (list g (* C^3/24 (expt n 3)) (* (-1^n*g n g) (+ (* n B) A))))
    (let* ((mid (quotient (+ m n) 2))
           (gpq1 (split m mid))
           (gpq2 (split mid n))
           (g1 (car gpq1)) (p1 (cadr gpq1)) (q1 (caddr gpq1))
           (g2 (car gpq2)) (p2 (cadr gpq2)) (q2 (caddr gpq2)))
      (list (* g1 g2) (* p1 p2) (+ (* q1 p2) (* q2 g1))))))
    (let* ((num-terms (inexact->exact (floor (+ 2 (/ digits 14.181647462)))))
       (sqrt-C (integer-sqrt (* C (expt 100 digits))))
       (gpq (split 0 num-terms))
       (g (car gpq)) (p (cadr gpq)) (q (caddr gpq)))
      (quotient (* p C sqrt-C) (* D (+ q (* p A)))))))
```

Invoke as `(pi 1000000000)` to compute billion digits of pi. On chez-scheme you will have to define `integer-sqrt`. Usually this runs about 16-17 times slower than optimized C code using gmp. Not bad for the (more or less) clearest translation of Chudnovsky brothers' algorithm! The last N records for pi digits (since Fabrice Ballard computed 2.7 trillion digits on 31-Dec-2009) have all been using this formula but of course they employ plenty of tricks to speed up computation, which obfuscates the algorithm.

Gambit nicely hides the multiplication complexity behind the `*` function! I give this example to point out that Scheme can be used for nontrivial things. Of course the above simple code will fall apart if you want to compute trillion+ digits as just the storage alone for a single such number will require 500GB and not fit in memory of a consumer machine! But I can imagine writing a program to _convert_ such a program where disk storage is used intelligently. Would you rather programmatically convert 22 lines of Scheme or 1000+ lines of C/C++ code?

No other language is as simple as Scheme and at the same time as powerful. Unfortunately that has meant many people write a toy interpreter for Scheme just for fun but very very few people spend time on creating an industrial strength implementation.


----------



## a6h (Nov 2, 2021)

I use perl for everything, and I am not knowledgeable enough to compare python with other languages, down to the source code.
But one thing is obvious, Python circle know how to market their product. Just look at the web. Their branding strategy is superior.


----------



## Crivens (Nov 2, 2021)

Scheme left a veritable knot in my brain after university. Python does the same. I wanted to start some common lisp learning, but my assembly and fortran skills are fighting back 
There is a CL implementation based on LLVM, btw. That ought to be the fastest of the flock, no?


----------



## eternal_noob (Nov 2, 2021)

Reading (trying to read) the source code bakul posted, i know why people abandoned Scheme. It's just unreadable.


----------



## Alain De Vos (Nov 2, 2021)

Guile has wisp, a Python-like whitespace-significant language, which is according to me quite readable,


			Learn to program with Wisp
		

Racket has sweet expressions,


			Sweet: an alternative to s-expressions


----------



## SirDice (Nov 2, 2021)

Popularity of programming languages change all the time. For a variety of reasons. 





_View: https://www.youtube.com/watch?v=Og847HVwRSI_


----------



## eternal_noob (Nov 2, 2021)

Alain De Vos said:


> whitespace-significant language


Any language which uses whitespaces for syntax is suspicious.



			https://wiki.c2.com/?SyntacticallySignificantWhitespaceConsideredHarmful


----------



## covacat (Nov 2, 2021)

because people never heard of teco....





						Worlds Greatest Pathological Language: TECO | ScienceBlogs
					

I've got a real treat for you pathological programming fans! Today, we're going to take a quick look at the worlds most *useful* pathological programming language: TECO. TECO is one of the most influential pieces of software ever written. If, by chance, you've ever heard of a little editor...




					scienceblogs.com


----------



## Alain De Vos (Nov 2, 2021)

An interesting remark on (),[],{},
The advantage of having parens is that you don't have to worry about formatting at all.  You can insert newlines anywhere or remove them and the code automatically gets indented to reflect the nesting.
With tabs & spaces you are responsible of formatting the code.


----------



## SirDice (Nov 2, 2021)

Alain De Vos said:


> the code automatically gets indented to reflect the nesting.
> With tabs & spaces you are responsible of formatting the code.


Both situations are handled by using a proper syntax checker/helper from your editor. There are often linters and style checkers for the language of your choice.


----------



## msplsh (Nov 2, 2021)

It's, uh, pretty simple: Lisp isn't a mental model that is instantly intuitive to people.

To me, Python has simply taken over the space BASIC and Perl used to occupy.  The addition of things like Numpy and Pandas pushed it into spaces where specialized and useless-outside-of-domain software ruled such as Matlab.  Python eating into these little niches (embedded with MicroPython) has significantly increased its popularity, which increases the quality and availability of libraries, making it more attractive for more people.

Things that are difficult to learn or use only keep the most dedicated programmers.


----------



## bakul (Nov 2, 2021)

eternal_noob said:


> Reading (trying to read) the source code bakul posted, i know why people abandoned Scheme. It's just unreadable.


Start with the wikipedia article on the Chudnovsky algorithm. Here is C code for the same, using GMP, if it helps!


----------



## astyle (Nov 2, 2021)

bakul and eternal_noob : Now that I looked at the Scheme code and the equivalent in C - yeah, I can see that Scheme does have a selling point - Scheme code is very compact, and can fit into far less lines than its C equivalent. Unfortunately, to write Scheme scheme code that _works correctly_, you have to understand RPN (Reverse Polish Notation), and apply the logic when typing in the text. C is much easier to follow along than Scheme, at least for me. I think that it's _not impossible_ to implement Scheme-style recursion in C, and have it work correctly, but this is more than I want to even think about at this time. The way I see it - Python is trying to be a compromise between the two.


----------



## Emrion (Nov 2, 2021)

I recall lisp learning at school. It was a nightmare, far from all common computer logic.

I've been always surprised that some people, not only like that beast but also did powerful softwares with it. Anyway, that's a fact, but... I'm not surprised as well that most people can't stand this especially ugly programming language.


----------



## astyle (Nov 2, 2021)

Emrion said:


> I recall lisp learning at school. It was a nightmare, far from all common computer logic.
> 
> I've been always surprised that some people, not only like that beast but also did powerful softwares with it. Anyway, that's a fact, but... I'm not surprised as well that most people can't stand this especially ugly programming language.


Lisp and Emacs seem to go hand in hand... I never got a handle on either. The impression I got back in college is that those are popular among old-school grizzled admins who pine for the days of PDP-11 and DEC.


----------



## bakul (Nov 2, 2021)

Do you know that different natural languages have different word order for subject, object, verbs etc.? You can be fluent in multiple languages but it requires learning the language and practicing. And if/when you do learn a language, your opinion may change.

If you have a bad teacher and a language is forced upon you're likely to hate it. In my case no one forced any language on me (I took one computer class as an undergrad but attended only the first lecture. And in grad school they expected you to know your stuff!). I learned probably about 20-24 programming languages  pretty much on my own, mostly out of curiosity. I don't have much experience in some of these languages but enough to know what I like/dislike about them. They all got created because they filled some niche at a point in time. Of all these, Scheme is my favorite.

It helps to know a variety of languages and become proficient at at least a couple of them. Many of these languages force you to think and solve a problem in a different way and that is a plus. Of these, Scheme  can perhaps be used the best to explore different paradigms. To that end I encourage people to read the Structure and Interpretation of Computer Programs book and do some exercises!

But I think the incentive to learn from such books has gone down quite a bit in the past few decades. Now most programmers are _assembly programmers _-- they assemble something out of existing pieces of software and don't write a lot of new code. There really is no reason to implement, for example, a hash-table from scratch. So many pieces exist -- why waste your time writing something equivalent, which may turn out to be buggy or take a lot of time to get right? On the other hand, how do you evaluate which of N different packages for doing something should be chosen for your particular project? Do you even know how to evaluate them or are you going to pick one at random and when that breaks, look for something else?


----------



## astyle (Nov 2, 2021)

bakul said:


> Now most programmers are _assembly programmers _-- they assemble something out of existing pieces of software and don't write a lot of new code


Dunno if _assembly programmers _is a very accurate term - My impression of it is that they program in actual Assembler (devel/nasm, anyone?) I do agree with the rest of the point - I myself try to follow the principle of code reuse. But - you do have to have some basics firmly down. If you can't write a hash table from scratch even in Java, and don't even know how that is supposed to work, it's impossible to recognize the same logic at work in Python or Scheme or Ruby.


----------



## bakul (Nov 2, 2021)

I was using _assembly programmers _ironically_. _But you'd be surprised to know how many folks don't really know how to build such things (to a certain extent this is true for most of us when it comes to more advanced things like databases!). This is why in my last job I had my team members implement a simple/toy version of such things to get some intuition for how their s/w was supposed to work before going hunting for similar open source projects on github; and to impress upon them that open source (possibly) saves them time and gives them a head start but in the end they would still be responsible for maintaining their piece of code!


----------



## Crivens (Nov 2, 2021)

astyle said:


> Unfortunately, to write Scheme scheme code that _works correctly_, you have to understand RPN (Reverse Polish Notation), and apply the logic when typing in the text. C is much easier to follow along than Scheme,


When was the last time you looked up the seven circles of hell, aka the operator precedent table for C/C++?


----------



## zirias@ (Nov 2, 2021)

Crivens said:


> aka the operator precedent table for C/C++?


Smartass mode : C and C++ don't have this concept. They just define a grammar, and "precedence" results from it. This can be a case-by-case thing, so all tables are slightly wrong. (E.g. the ternary operator is an interesting beast)

*edit:* doesn't have to be hell though, just write your expressions in a readable way, like, spend some parentheses for clarity. Problem solved.


----------



## eternal_noob (Nov 2, 2021)

I like how PHP screwed up when it comes to operator precendece. "||" has a different precedence than "or"

```
// The result of the expression (false || true) is assigned to $e
// Acts like: ($e = (false || true))
$e = false || true;

// The constant false is assigned to $f and then true is ignored
// Acts like: (($f = false) or true)
$f = false or true;
```


----------



## zirias@ (Nov 2, 2021)

Is there something PHP _didn't_ screw up? Btw, what's the difference between them? I don't expect one of them would be "bitwise"?


----------



## eternal_noob (Nov 2, 2021)

Zirias said:


> Is there something PHP _didn't_ screw up?


Nope. PHP just sucks.








						Why Does PHP Suck? | Why Does It Suck?
					

A hilariously extensive summary of all things wrong with PHP that will take you on a journey from its origins through all the notoriously bad design decisions leading to the **abomination** that is now the most widely used web programming language.




					whydoesitsuck.com


----------



## msplsh (Nov 2, 2021)

I like PHP, not enough to defend it in a stupid forum war, but that post is from 2014 before PHP 7 and 8 were around.  They're aware.  Here's a funny tweet too.


__ https://twitter.com/i/web/status/1447150924846313475_View: https://twitter.com/woketopus/status/1447150924846313475_


----------



## hruodr (Nov 2, 2021)

I think, the question is, why did python get so popular.

LISP / Scheme has a readability problem. Too much parenthesis, too much "quote" necessary, programs
are like big sentences. But there were perl and tcl, perhaps other scripting languages. And pythons syntax,
in which blanks have sematic, is also not without problems.


----------



## Crivens (Nov 2, 2021)

Zirias said:


> *edit:* doesn't have to be hell though, just write your expressions in a readable way, like, spend some parentheses for clarity. Problem solved.


You mean like Lots of Irritating Silly Parenthesis? No wait, that acrynom is taken...


----------



## eternal_noob (Nov 2, 2021)

msplsh said:


> that post is from 2014 before PHP 7 and 8 were around


I don't want to start a flame war either but i think 90% of that article is still valid.


----------



## zirias@ (Nov 2, 2021)

Crivens I guess there's some sweet spot for the amount of parentheses to make it human-readable


----------



## Crivens (Nov 2, 2021)

Zirias said:


> Crivens I guess there's some sweet spot for the amount of parentheses to make it human-readable


Yes. Zero. Forth to the rescue!


----------



## Alain De Vos (Nov 2, 2021)

Allow me to give an example.
Next program is "object oriented scheme".
It will print 3.3 on the screen.

```
(define (myclass)
  (define t 0.0)
  (define(fn m)
    (define (addm x)(set! t (+ t x)))
    (define (getm) t)
    (if (equal? m "add") addm getm))
  fn)
(define Instance (myclass))
((Instance "add") 1.1)
((Instance "add") 2.2)
((Instance "get"))
```

In the end i found myself trying to avoid mutable state because it was alot of typing.
And then you pass just function pointers around wherever you can.


----------



## zirias@ (Nov 2, 2021)

```
puts("3.3");
```
(but nice to see some "enterprisy" scheme code *scnr*)


----------



## a6h (Nov 2, 2021)

Zirias said:


> Is there something PHP _didn't_ screw up?


Yes, there is one. It has written in C language.


----------



## Crivens (Nov 2, 2021)

Zirias said:


> ```
> puts("3.3");
> ```
> (but nice to see some "enterprisy" scheme code *scnr*)


" 3.3" .


----------



## astyle (Nov 2, 2021)

Zirias said:


> Crivens I guess there's some sweet spot for the amount of parentheses to make it human-readable


In college, I remember some instructors docked points for over-doing on parentheses in code. And that was frosh class for C programming.


----------



## zirias@ (Nov 2, 2021)

vigole said:


> Yes, there is one. It has written in C language.


Well, if that's a quality in itself? 

I still like languages that come with a compiler written in that very language…   (Yes, I'm old…)


----------



## astyle (Nov 2, 2021)

Rust compiler is self-hosting.


----------



## eternal_noob (Nov 2, 2021)

A classical "the chicken or the egg" situation. How did they compile the first compiler?


----------



## hardworkingnewbie (Nov 2, 2021)

Python got so popular because Perl sucks.


----------



## astyle (Nov 2, 2021)

eternal_noob said:


> A classical "the chicken or the egg" situation. How did they compile the first compiler?


use v. 1 to implement a compiler that can compile both v. 1 and v.2.  Version 1 was written in a different language, of course.


----------



## eternal_noob (Nov 2, 2021)

Ok, but the compiler of the different language had to be compiled too. If you go backwards in time to the very first compiler ever, how did they compile that?


----------



## Alain De Vos (Nov 2, 2021)

Simple by increasing level of abstraction from physics and real world ?


----------



## msplsh (Nov 2, 2021)

eternal_noob said:


> If you go backwards in time to the very first compiler ever, how did they compile that


Assembler


----------



## astyle (Nov 2, 2021)

eternal_noob said:


> Ok, but the compiler of the different language had to be compiled too. If you go backwards in time to the very first compiler ever, how did they compile that?


See this wikipedia article:






						Compiler - Wikipedia
					






					en.wikipedia.org
				



You can thank Rear Admiral Grace Murray Hopper for that.


----------



## Alain De Vos (Nov 2, 2021)

You figger out the action the cpu has to do , you look up the mnemonics and convert it with a table to some hex. No ?
[Cpu being a collection of nor and nand gates performing a task]


----------



## Crivens (Nov 2, 2021)

eternal_noob said:


> Ok, but the compiler of the different language had to be compiled too. If you go backwards in time to the very first compiler ever, how did they compile that?


Rear Admiral Grace Hopper would know.
Edit: got beaten to this. It is one of my go-to arguments when "women in IT" gets discussed.


----------



## astyle (Nov 2, 2021)

Crivens said:


> Rear Admiral Grace Hopper would know.
> Edit: got beaten to this. It is one of my go-to arguments when "women in IT" gets discussed.


So would Wikipedia.  (Smartass mode, as taught by Zirias )


----------



## eternal_noob (Nov 2, 2021)

I heard of Grace Hopper. Didn't know she developed the first compiler, though. Truly a hero.


----------



## Alain De Vos (Nov 2, 2021)

Show me your code, it will speak for itself ?


----------



## eternal_noob (Nov 2, 2021)

If you show me yours, i show you mine.


----------



## bakul (Nov 2, 2021)

eternal_noob said:


> Ok, but the compiler of the different language had to be compiled too. If you go backwards in time to the very first compiler ever, how did they compile that?


Nicklaus Wirth on the first working Pascal compiler (the first attempt was to write the compiler in Fortran and it failed):


> The second attempt at building a compiler therefore began with its formulation in the source language itself, which by that time had evolved into what was published as Pascal in 1970 [Wirth, 1970], The compiler was to be a single-pass system based on the proven top-down, recursive-descent principle for syntax analysis. We note here that this method was eligible because the ban against recursion had been lifted: recursivity of procedures was to be the normal case. The team of implementors consisted of U. Ammann, E. Marmier, and R. Schild. After the program was completed – a healthy experience in programming in an unimplemented language! – Schild was banished to his home for two weeks, the time it took him to translate the program into an auxiliary, low-level language available on the CDC computer. Thereafter, the bootstrapping process could begin [Wirth, 1971b]. This compiler was completed by mid 1970, and at this time the language definition was published. With the exception of some slight revisions in 1972, it remained stable thereafter.


My one time boss told me he had written a compiler for a Fortran subset and _keyed in the code_ through the front panel switches! This was on a Soviet era Minsk-2 computer with a whopping 4K words of RAM! No assembler either!


----------



## zirias@ (Nov 2, 2021)

Yes, front panel switches is as low as you can go. With a computer equipped with these (like e.g. the famous Altair 8800), entering code needs nothing but the hardware. So that's probably your answer on how to bootstrap anything on a microcomputer.

Of course, nobody would do something like this any more even with a completely new architecture. It's nowadays much easier to create some cross-development tools (relying on existing software on other machines) to get something up and running on the new one.


----------



## eternal_noob (Nov 2, 2021)

```
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
```
This is a valid Perl program. 
(It prints "Just another Perl / Unix hacker")


----------



## Alain De Vos (Nov 2, 2021)

Interesting ideas.
But there is also a very simple way.
When you code use brackets, when you reread your own code for errors hide the brackets simply in your editor, in order not to spoil your view.
The advantage of using brackets when you code is that the editor can quickly indent as needed and check if they are balanced, so you wrote what you meant.
I remember my problems when writing a bit of ansible yaml and braking my head over a wrong space or tab.


----------



## astyle (Nov 3, 2021)

eternal_noob said:


> ```
> @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
> @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
> ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
> ...


Holy crap!!!


----------



## a6h (Nov 3, 2021)

Zirias said:


> Well, if that's a quality in itself?


Not really. You are correct. I was just kidding.



Zirias said:


> I still like languages that come with a compiler written in that very language…  (Yes, I'm old…)


Did you use the word "old" as logical equivalence of "wise"?



eternal_noob said:


> Ok, but the compiler of the different language had to be compiled too. If you go backwards in time to the very first compiler ever, how did they compile that?



Technically all you need is _digital logic_ and _ISA_. Assembler, compilers and OSes are higher abstraction, i.e. there are not essential for a computer to function [*] -- pre 1951 (Maurice Wilkes) machines without hardware level microprogram(microarchitecture) interpreters.

[*] Reference
Tanenbaum, Structured Computer Organization | Section 1.1


----------



## astyle (Nov 3, 2021)

vigole said:


> Tanenbaum, Structured Computer Organization


I have that book from my college years. It was the textbook for one of my classes very early in the curriculum. And it was surprisingly useful reference for explaining stuff much later on.


----------



## a6h (Nov 3, 2021)

astyle said:


> I have that book from my college years. It was the textbook for one of my classes very early in the curriculum. And it was surprisingly useful reference for explaining stuff much later on.


Indeed. It helped me to understand the problem which eternal_noob was referring to as the "the chicken or the egg".
The questions like how they wrote the first compiler, bootloader, etc. could easily be answered via reading some history.
That book contains enough historical background on computer engineering, to help a reader to answer to his questions.


----------



## zirias@ (Nov 3, 2021)

Mr. Salty said:


> Perl has 64 global special variables.


Except they're not global. They're special, they're globally available, but their value depends on context, thus has limited scope.

Now you could say "global" also means "globally available". Sure, but see how choice of words serves to mislead people (they know what a "global variable" means in programming). An often (maybe involuntarily) used technique when "bashing" something.

It's true though you _can_ write extremely obfuscated perl code. To an extent that some call it a _WOL_ (write only language). But you can do similar in C as well. Still, you _can_ write very readable and well-structured perl code, and I'd always prefer to manually parse this over a heap of parentheses. Yes, in Lisp code, you often have to count them… text markers might help 

BTW, functional languages don't _have_ to look like this. Functions applied after each other can just be written consecutive, instead of nested, for example.


----------



## Alain De Vos (Nov 3, 2021)

If you want to write a parser/interpreter there is,


			PLAI Typed Language


----------



## hardworkingnewbie (Nov 3, 2021)

Here's a guy designing a bad programming language on purpose by getting inspiration of the worst traits of existent programming languages like PHP (PHP hates programmers), Python and many others, and mixing them together in his own Frankenstein creation thingy. On top of it he's inventing some annoyances on his own. 

The language is called BS, tag line: "Why? Because f**k you, that's why!" It's a fun overview about the worst traits of many established programming languages. 





_View: https://www.youtube.com/watch?v=2mnYf7L7Amw_


----------



## zirias@ (Nov 3, 2021)

hardworkingnewbie said:


> designing a bad programming language on purpose


Pretty old idea btw: INTERCAL famously features a `COME FROM` instruction, for _much_ better spaghetti code than you could ever build with just boring `GO TO`.


----------



## hardworkingnewbie (Nov 3, 2021)

Yeah, but back then in the 70s when INTERCAL was being invented, many of the inspirational sources used by Mark Rendle were not even invented yet. 

And part of the fun lies in these inspirations.


----------



## zirias@ (Nov 3, 2021)

Of course, just saying the idea for such parodies isn't new  back then, some "inspirational" languages offered not much more besides a "goto" for control structures


----------



## hardworkingnewbie (Nov 3, 2021)

Agreed!

Talking about Perl: this is some type of more tragic language to me. I mean in the beginning it was what literally powered the first interactions on the web, before Sun decided that putting Java on the web is a good thing. Back then Matt's Script Archive was the thing!

One problem is for me it's slogan "There's more than one way to do it." Later "but sometimes consistency is not a bad thing either" was added. This is a clear contrast to Python's philosophy which is "There should be one-- and preferably only one --obvious way to do it."

So if you've not written some stuff let's just say that many Perl script/programs are not exactly the easiest thing to read and understand around due to that. Meanwhile then PHP happened, which was way easier to setup and integrate within Apache and took off, leaving Perl in the dust.

Another thing was what in the beginning was called Perl 6, and it's long development cycle, which basically is a new programming language. Due to that many programmers left forever.

Perl is one of these languages which got huge momentum in the past, but was unable to build a lasting legacy around it. Aside some standard tools being written in it, it's for sure for most nowadays not the language of choice when writing something up from scratch. 

In contrast PHP had huge momentum in the past, but was able to build a lasting legacy around it. Which is why the WWW is still so much depending on it nowadays, rewriting all of that into something else - good luck with that one.


----------



## Alain De Vos (Nov 3, 2021)

In chez-cheme function arguments are evaluated in any order.
In Racket-cheme the evaluation is guaranteed from left to right.
In other words they do have a standard problem


----------



## Alain De Vos (Nov 3, 2021)

I just did a speed comparison of 3 schemes,

1. Kawa-scheme : Time duration : 1.9s

```
(define (fib n ::long) ::long
  (if (< n 2)
      n
      (+ (fib(- n 1)) (fib(- n 2)))
  )
)
(display (fib 42))
```

2.Racket-scheme :Time duration: 4.5s

```
#lang typed/racket
(define (fib [n : Integer]) : Integer
  (if (< n 2)
      n
      (+ (fib(- n 1)) (fib(- n 2)))
  )
)
(display (fib 42))
```

3.Chicken-scheme : Time duration 20s

```
(: fib (fixnum -> fixnum))
(define (fib n)
  (if (< n 2)
      n
      (+ (fib(- n 1)) (fib(- n 2)))
  )
)
(display (fib 42))
```


----------



## astyle (Nov 3, 2021)

Alain De Vos said:


> I just did a speed comparison of 3 schemes,
> 
> 1. Kawa-scheme : Time duration : 1.9s
> 
> ...


I would assume that the times are what it took to *run* those snippets... is that a correct assumption?


----------



## Alain De Vos (Nov 4, 2021)

Yes. Some things are implicit, the word is runtime. It took me longer to write snippets.


----------



## astyle (Nov 4, 2021)

Mr. Salty said:


> You can compile Chicken using `-optimize-level N` where N is 0-5. Using 5, I gain 4 seconds (0m16.638s).


Seriously, nearly 17 seconds???   for that one code snippet??? I bet that equivalent C code will run much faster on the same processor, even if it takes way more LOC's. (LOC = Lines Of Code).

Did you guys know that Scheme is absent from the list of *parallel* programming languages (unlike C and Python), and barely supports concurrent (not necessarily parallel) programming?


----------



## Alain De Vos (Nov 4, 2021)

Test of non-tail-recursive fibonnaci was to test only the "stack behavior" of the language. Which is only one aspect.
The slow to .exe compile time of racket is not a problem as you can fast compile to bytecode for testing.

Personally i find the documentation of chicken-scheme & eggs very good. Which is a big plus.
For instance for one of its eggs,


			srfi-13 - The CHICKEN Scheme wiki


----------



## astyle (Nov 4, 2021)

Alain De Vos said:


> Test of non-tail-recursive fibonnaci was to test only the "stack behavior" of the language. Which is only one aspect.
> The slow to .exe compile time of racket is not a problem as you can fast compile to bytecode for testing.
> 
> Personally i find the documentation of chicken-scheme & eggs very good. Which is a big plus.
> ...


I'm sorry, but this does make me a bit lost... which times are for compile, and which times are for execution?


----------



## Alain De Vos (Nov 4, 2021)

For the racket scheme non-tail-recursive fibonacci of 42:
-Compile time of the program to bytecode : 10seconds
-Compile time of the program to executable : 20seconds
-Runtime to calculate fib(42) using the executable: 4.5seconds

For the chicken-scheme non-tail-recursive fibonacci of 42:
-Compile time of the program to executable : 0.2 seconds
-Runtime to calculate fib(42) using the bytecode: 20seconds


----------



## astyle (Nov 4, 2021)

Alain De Vos said:


> For the racket scheme non-tail-recursive fibonacci of 42:
> -Compile time of the program to bytecode : 10seconds
> -Compile time of the program to executable : 20seconds
> -Runtime to calculate fib(42) using the executable: 4.5seconds
> ...


So, chicken-scheme doesn't allow for compilation to executable? or does racket-scheme not allow for bytecode to run? I realize this is a quick-and-dirty comparison,  but still... 

The only valid comparison that I see is that chicken-scheme *compiles to bytecode* way faster than racket-scheme (by a factor of 50).  After that, the comparisons are not there any more.


----------



## Alain De Vos (Nov 4, 2021)

I made a lapsus & corrected it. Both can compile to an executable and compile time can differ in the range of 100.
They differ in that as intermediate step racket-scheme is able to compile to interpreted bytecode,
and chicken-scheme is able to interpret the scheme source files without a compilation step.
But for racket the slow compile time to an executable is not a problem as you can "incrementally" compile to bytecode which is acceptable in speed.
Note : there is :








						Ypsilon (Scheme implementation) - Wikipedia
					






					en.wikipedia.org


----------



## astyle (Nov 4, 2021)

So, if I got you straight:

racket-scheme cannot run bytecode, bytecode needs to be compiled first.
chicken-scheme can run bytecode without further compilation.
chicken-scheme can run a compiled executable just fine.
So, if you put racket-scheme through 3 steps (source -> bytecode -> executable -> run), shouldn't chicken-scheme be put through *exactly the same steps *for a valid comparison?


----------



## Alain De Vos (Nov 4, 2021)

Racket-scheme :   Source  ---> (interpreted) "racket/scheme"-bytecode  --->  executable
Chicken-cheme :  (interpreted) Source  - -->      .c       -->      executable
Implementations differ so it's not as easy to compare as an llvm or gcc compiler.
The compilation to c , as used by Chicken you can also find in the languages zig & nim, meaning these 3 integrate well.


----------



## astyle (Nov 4, 2021)

So, Racket-scheme requires bytecode as an intermediate step in compilation, while Chicken-scheme doesn't...

Even with that, what I said in post #90 in this thread applies. The baseline in your comparison is same algorithm (non-tail-recursive fibonacci of 42) and same processor. Steps taken to run both implementations should be exactly the same, as well. That's academic standards for fair comparisons.


----------



## Alain De Vos (Nov 4, 2021)

A politician would gladly compare apples and pears, but since i'm not a politician i agree with you.


----------



## Alain De Vos (Nov 4, 2021)

The optional step of compilation to c by chicken-scheme opens alot of possibilities.
You could write a part in dlang or ocaml and compile to c.
You could compile and link both c-files with the zig-compiler.


----------



## msplsh (Nov 4, 2021)

Is this thread just lisp-alike posturing now?  Is question and answer time over?  Can I unfollow it?


----------



## eternal_noob (Nov 4, 2021)

Yeah, i like how he hijacked his own thread.


----------



## Alain De Vos (Nov 4, 2021)

msplsh said:


> Is this thread just lisp-alike posturing now?  Is question and answer time over?  Can I unfollow it?


I consider Off-topic like being in a bar and drinking a beer. Nobody tells to enter the bar.
In fact being in this bar give me some ideas. Compiler&intepreters are just tools like hammers and nails. And it's not a wrong question to ask if i use the best tool.


----------



## astyle (Nov 4, 2021)

As an analogy, you can compare apples and pears using the process of jam-making. For the comparison to be fair, the recipe needs to be the same (same amounts of water, sugar, pectin, cooking time, cooking temperature), both species of tree should be growing in the same area (same farm is best), both kinds of fruit should be fresh-picked... then it would be fair to see which fruit is more profitable to grow. If customers like apples better than pears, would that change if you made jam?


----------



## Alain De Vos (Nov 4, 2021)

After comparing apples and pears, i would like to add carrots, hoping i don't give anybody a head-ache.
In ocaml:

```
let rec fib n =
  if n < 2 then n
  else fib (n - 2) + fib (n - 1)
let _ =
  Printf.printf "%d\n" (fib 42)
```
Runtime to calculate fib(42) , 1.4seconds.
Yet, comparing ocaml/mlton to Chicken-Scheme looks like something interesting.


----------



## bakul (Nov 4, 2021)

A simple puzzle: Try to figure out the fib implementation below. I used nothing beyond R4RS Scheme features (except for measuring run time).

```
> (define x 0)
> (time (set! x (fib 1000000)
(time (set! x (fib 1000000)))
    0.027409 secs real time
    0.029737 secs cpu time (0.029735 user, 0.000002 system)
    no collections
    1352112 bytes allocated
    3613 minor faults
    no major faults
```
Time to compute: under 30 milliseconds! [Interpreted, not need to compile!]
I used `(set! x ..)` to avoid printing (as time for number->string conversion & printing will dominate for large numbers). To check that your code works correctly, `(fib 1000000)` is a 208,988 _digit_ number "1953282128...8242546875". FYI: this is on a $300 Ryzen laptop. If you want, you can write a C program using gmp and see if it is faster!


----------



## msplsh (Nov 4, 2021)

Alain De Vos said:


> I consider Off-topic like being in a bar and drinking a beer.


Yeah, but there are still threads of conversation..


----------



## bakul (Nov 4, 2021)

Alain De Vos said:


> Note : there is :
> 
> 
> 
> ...


Ypsilon was a very good implementation of R6RS. The most up to date sources seem to be at https://github.com/fujita-y/ypsilon


----------



## Alain De Vos (Nov 4, 2021)

msplsh said:


> Yeah, but there are still threads of conversation..


It was not my intention to pose scientific or mathematical facts with my snippets.
In the process of creativity you must allow to diverge from the original question, this without falling in the trap on nonsensical chaos.


----------



## Alain De Vos (Nov 8, 2021)

Today i learned, let is sugar for a lambda function.


----------



## Alain De Vos (Nov 9, 2021)

FreeBSD has many choices of scheme

```
chez-scheme-9.5.2              Chez Scheme system
chibi-scheme-0.10.0            Minimal Scheme implementation for use as a C extension language
chicken5-5.2.0                 Scheme-to-C compiler
elk-3.99.8_2                   Embeddable Scheme interpreter
gauche-0.9.10                  Scheme script interpreter with multibyte character handling
kawa-3.1.1                     Java-based Scheme implementation
mit-scheme-9.2_4               MIT Scheme: includes runtime, compiler, and edwin binaries
mosh-scheme-0.2.7_6            Fast R6RS Scheme interpreter
owl-lisp-0.1.23                Functional dialect of Scheme
qscheme-0.5.1_10               Small and fast Scheme interpreter
racket-8.2                     Interactive, integrated, graphical Scheme programming environment
sagittarius-scheme-0.9.7       R6RS/R7RS Scheme system
scm-5f2_10                     Scheme interpreter
siod-3.6.2                     Small footprint implementation of the Scheme programming language
sketchy-20070218_1             Interpreter for purely applicative Scheme
slib-3b6                       Portable scheme library
ypsilon-0.9.6.3_11             Scheme implementation for real-time applications
```


----------



## Alain De Vos (Nov 9, 2021)

Today I learned car stands for,
contents of address registry.
cdr stands for,
contents of decrement registry.


----------



## bakul (Nov 29, 2021)

Alain De Vos https://github.com/udem-dlteam/ribbit -- A Small Scheme VM, Compiler, and REPL in 4K
From http://www.iro.umontreal.ca/~feeley/papers/YvonFeeleyVMIL21.pdf -- on many standard Scheme benchmarks Ribbit runs faster than Chicken Scheme (csi), Scm, SIOD, MiniScheme & TinyScheme! Possibly due to the entire VM fitting in L1 cache.


----------



## Alain De Vos (Nov 29, 2021)

T.i.l. "false",0,nil count as true(#t).

PS, object-oriented, type-annotated, infix Scheme can look like this

```
#lang typed/racket (require infix) (require typed/racket/class)
(define-type Fish% ;--type definition
  (Class(init[size Real])
         [getsize(-> Real)]
         [grow(Real -> Void)]
         [eat((Instance Fish%) -> Void)]))
(: fish% : Fish%) ;--class type annotation
(define fish% ;--class definition
  (class object%
    (super-new)
    (init size)
     (: currentsize Real)
    (define currentsize size)
     (define/public(getsize)currentsize)
    (define/public(grow amt)
      (set! currentsize($"amt+currentsize")))
    (define/public (eat otherfish)
      (grow(send otherfish getsize)))))
(define afish1(new fish%[size 1]))(define afish2(new fish%[size 2]))
(send afish1 grow 4)(send afish1 getsize)(send afish1 eat afish2)(send afish1 getsize)
```


----------



## Voltaire (Jun 29, 2022)

Why was Python's popularity so sudden?
					

Python first appeared in 1991, but it was somewhat unknown until 2004, if the TIOBE rankings quantify anything meaningful.  What happened?  What caused the interest in this 13 year old language to go




					softwareengineering.stackexchange.com
				



_Google started using Python heavily and reinvesting in development of the language. Google is the corporate backing. It became a top-tier implementation language at Google earlier in the decade, and this had an impact in how seriously it was taken._









						The Python Quiz | Which company said “Python where we can, C++ where we must.”?
					

New Python questions every day




					www.thepythonquiz.com
				



_Early on at Google, there was an engineering decision to use “Python where we can, C++ where we must.” Python was used for parts that required rapid delivery and maintenance. Then, they used C++ for the parts of the software stack where it was important to have very low latency and/or tight control of memory._






						r/learnpython - Comment by u/pandres on ”Why did python become so popular in the last 4 years?”
					

56 votes and 52 comments so far on Reddit




					www.reddit.com
				



_It was one of the four official languages at Google. So it was bound to grow._









						Top 10 Reasons Why Python is So Popular With Developers in 2022 | upGrad blog
					

Python has become the one factor powering every field today. Read this article to know the top reasons why Python is so popular with developers.




					www.upgrad.com
				



_Python Programming language is heavily backed by Facebook, Amazon Web Services, and especially Google. Google adopted python language way back in 2006 and have used it for many applications and platforms since then. Lots of Institutional effort and money have been devoted to the training and success of the python language by Google. They have even created a dedicated portal only for python._

Much of the popularity of the current programming languages JS, Python, Visual Basic, C#, Swift, Objective-C, Groovy, Kotlin, Java, C++, Golang, etc has been caused by *Apple, Microsoft, Facebook, AWS and Google*. *These five players now determine the majority of programming languages demanded by companies.* In my opinion this is very unfortunate because none of these eleven popular languages is a decent language. 

For programming operating systems and drivers, C and Rust are the most suitable. For all other things I would usually use Common Lisp, Nim, Chez Scheme or Haskell. These offer high expressiveness, performance, stability, and productivity. Haskell is easier for concurrency than Golang. Etc.


----------



## Phishfry (Jun 29, 2022)

Since we are having beers let me ask.

What is the BFD about python27 and how much different is python3x.

From the sidelines I am confused how a major version upgrade could upend so much valuable but unmaintained software.

How could this break so badly? Is python3 when Google came into the room and let a big nasty stinker?
How could python break their own ecosystem so badly.
Why exactly can't they keep a legacy python2x branch?
After watching this debacle I threw away all my python books.
I have no desire to learn that anymore. Something is wrong over there.


----------



## Phishfry (Jun 29, 2022)

Python 2 Vs. Python 3: Key Difference Between 2.x & 3.x
					

What is Python 2? Python 2 made code development process easier than earlier versions. It implemented technical details of Python Enhancement Proposal (PEP). Python 2.7 (last version in 2.x ) is no lo




					www.guru99.com
				



So print statement changed and how division is done.
Changed the syntax. New range function.

So if you changed your base system between 2 and 3 so much why not fork it?
Very confusing to use the same name for different software.

Was C developed the same way? C99 brought changes but breaking everything?
Did all software require a rewrite there too when various versions of C were ratified?



			StackPath


----------



## hardworkingnewbie (Jun 29, 2022)

The issue is Python v3 was created to fix some problems which Python 2 had, and also add new functionality. But instead of just releasing v3.0 they've adopted to a different approach: v2.7 will be maintained with security patches, but no new features, until v3 gains traction. In the meantime all development going into v3 of Python.

So there would be a transitional period, where both versions are being maintained, but only v3 being developed further and further. This is now officially over, Python 2.7 reached end of life two years ago. Python 3 also comes with a script which does maybe roughly 80% or so of code migration in an automatted kind of way.

There are way more changes, subtle ones and more obvious. In Python3 for example every string is Unicode, in Python2 it is not - you had to prefix stuff.

Here's the Changelog of v3.0 - since then much more stuff has been done in the last 12 years.









						What’s New In Python 3.0
					

Author, Guido van Rossum,. This article explains the new features in Python 3.0, compared to 2.6. Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever intentionally backwards incomp...




					docs.python.org
				




And here you've got a statement of Python core developer Brett Cannon why Python3 came into being. 








						Why Python 3 exists
					

This month I invited to Q&A at PuPPy [https://youtu.be/2XviXtxWKO8?list=PL4S0lvhXvdhIV2C28Ia_DeIeloBrsQBOW] (the Puget Sound Python users group) that eventually led to me explaining why Python 3 came into existence and the whole string/bytes deal. I ended up receiving a compliment on the...




					snarky.ca


----------



## Phishfry (Jun 29, 2022)

At least he says they will never break it again that bad.
Ack the mess.


----------



## Phishfry (Jun 29, 2022)

*Why did python take over scheme/lisp in popularity ?*
Because AutoCAD dropped AutoLISP in favor of .NET

Just kidding. That was my primary LISP usage since early nineties.
They probably got huge kickbacks for promoting that .NET garbage.
AutoLISP still lives on in AutoCAD 2022. Hallelujah for that.


----------



## hardworkingnewbie (Jun 30, 2022)

Emacs still uses LISP, so you've just got to promote Emacs more! 

BTW: in the good old days people mocked Emacs as "Eight Megabytes and continously swapping." This is a mockery really fallen out of time given the fact, that many smartphones today have 6+ GB and more of RAM.


----------

