Lojic Technologies

Posts Tagged ‘sml

Programming Language Popularity – Part Nine

with one comment

I made a number of Google searches of the forms below and summed the results:

"implemented in <language>"
"written in <language>"
"developed in <language>"
"programmed in <language>"

See Part Eight for prior results 17 months ago. I finally got around to writing a program (in Racket) to automate the collection of the search results, so it was much easier!

I’ve divided the table into sections based on percentage increases of more than 50% from one language to the next. To compute the rank delta, I excluded the newly added languages.

|------+-----------------+------------+-------+-------|
| Rank | Language        | # Search   | Prev. |  Rank |
|      |                 | Results    |  Rank | Delta |
|------+-----------------+------------+-------+-------|
|    1 | C               | 54,696,000 |     2 |     1 |
|------+-----------------+------------+-------+-------|
|    2 | R               | 22,784,600 |    12 |    10 |
|------+-----------------+------------+-------+-------|
|    3 | Java            |  1,490,000 |     6 |     3 |
|    4 | C++             |  1,256,600 |     3 |    -1 |
|    5 | PHP             |  1,082,000 |     1 |    -4 |
|    6 | C#              |  1,065,900 |     5 |    -1 |
|    7 | Python          |  1,016,500 |     4 |    -3 |
|    8 | Lisp Family (1) |    951,300 |    11 |     3 |
|    9 | JavaScript      |    764,100 |     8 |    -1 |
|   10 | FORTRAN         |    565,000 |     9 |    -1 |
|   11 | Perl            |    541,700 |     7 |    -4 |
|   12 | Ruby            |    509,900 |    10 |    -2 |
|   13 | ML Family (2)   |    445,716 |    13 |       |
|   14 | Scheme          |    381,200 |    19 |     5 |
|   15 | Go              |    378,200 |    16 |     1 |
|   16 | (S)ML (3)       |    376,116 |    21 |     5 |
|   17 | Lisp            |    357,900 |    15 |    -2 |
|------+-----------------+------------+-------+-------|
|   18 | Scala           |    236,770 |    23 |     5 |
|   19 | Haskell         |    220,580 |    17 |    -2 |
|   20 | Prolog          |    152,450 |    20 |       |
|   21 | Lua             |    133,360 |    22 |     1 |
|   22 | COBOL           |    113,700 |    14 |    -8 |
|   23 | Erlang          |    101,840 |    18 |    -5 |
|   24 | Common Lisp     |    100,580 |    25 |     1 |
|   25 | Rust            |     90,860 |   N/A |   N/A |
|   26 | Clojure         |     85,930 |    27 |     2 |
|   27 | Smalltalk       |     75,000 |    24 |    -2 |
|   28 | OCaml           |     69,600 |    26 |    -1 |
|   29 | Coffeescript    |     60,420 |    29 |     1 |
|   30 | Julia           |     51,315 |   N/A |   N/A |
|   31 | Forth           |     50,920 |    28 |    -1 |
|------+-----------------+------------+-------+-------|
|   32 | Racket          |     25,660 |    30 |       |
|------+-----------------+------------+-------+-------|
|   33 | Elixir          |      8,112 |   N/A |   N/A |
|------+-----------------+------------+-------+-------|

Update Oct. 6: I added Bing search results, and they’re significantly different. For a while Elixir was #2 because one of the four phrases resulted in no results, so Bing automatically switched to an unquoted search which skewed the results. I caught that and looked over the raw data and didn’t see anything similar for other languages. It’s interesting that C# came out #1 on Bing ūüôā

|------+-----------------+----------|
| Rank | Language        | # Search |
|      |                 |  Results |
|------+-----------------+----------|
|    1 | C#              | 32100000 |
|    2 | C++             | 31900000 |
|------+-----------------+----------|
|    3 | C               |  4845000 |
|    4 | Java            |  3319000 |
|------+-----------------+----------|
|    5 | R               |  1219310 |
|    6 | Python          |  1123700 |
|    7 | Php             |  1093800 |
|    8 | Javascript      |   945200 |
|------+-----------------+----------|
|    9 | Lisp Family (1) |   525530 |
|   10 | Perl            |   460360 |
|   11 | Common Lisp     |   398039 |
|   12 | Ruby            |   301740 |
|   13 | Go              |   270593 |
|   14 | FORTRAN         |   245500 |
|   15 | Lua             |   214200 |
|   16 | Scala           |   188570 |
|   17 | Haskell         |   188520 |
|   18 | Lisp            |   160930 |
|   19 | COBOL           |   140910 |
|   20 | Scheme          |    98012 |
|   21 | ML Family (2)   |    97425 |
|   22 | Prolog          |    75740 |
|   23 | Erlang          |    63270 |
|   24 | (S)ML (3)       |    56375 |
|   25 | OCaml           |    41050 |
|   26 | Smalltalk       |    27960 |
|   27 | Julia           |    25319 |
|   28 | Clojure         |    23091 |
|   29 | Coffeescript    |    20322 |
|   30 | Forth           |    17529 |
|   31 | Rust            |    17086 |
|------+-----------------+----------|
|   32 | Racket          |     6388 |
|------+-----------------+----------|
|   33 | Elixir          |     2542 |
|------+-----------------+----------|

Here is the delta difference between Google and Bing:

|--------+------+-------+-----------------|
| Google | Bing | Delta | Language        |
|   Rank | Rank | G - B |                 |
|--------+------+-------+-----------------|
|      1 |    3 |    -2 | C               |
|      2 |    5 |    -3 | R               |
|      3 |    4 |    -1 | Java            |
|      4 |    2 |     2 | C++             |
|      5 |    7 |    -2 | Php             |
|      6 |    1 |     5 | C#              |
|      7 |    6 |     1 | Python          |
|      8 |    9 |    -1 | Lisp Family (1) |
|      9 |    8 |     1 | Javascript      |
|     10 |   14 |    -4 | FORTRAN         |
|     11 |   10 |     1 | Perl            |
|     12 |   12 |       | Ruby            |
|     13 |   21 |    -8 | ML Family (2)   |
|     14 |   20 |    -6 | Scheme          |
|     15 |   13 |     2 | Go              |
|     16 |   24 |    -8 | (S)ML (3)       |
|     17 |   18 |    -1 | Lisp            |
|     18 |   16 |     2 | Scala           |
|     19 |   17 |     2 | Haskell         |
|     20 |   22 |    -2 | Prolog          |
|     21 |   15 |     6 | Lua             |
|     22 |   19 |     3 | COBOL           |
|     23 |   23 |       | Erlang          |
|     24 |   11 |    13 | Common Lisp     |
|     25 |   31 |    -6 | Rust            |
|     26 |   28 |    -2 | Clojure         |
|     27 |   26 |     1 | Smalltalk       |
|     28 |   25 |     3 | OCaml           |
|     29 |   29 |       | Coffeescript    |
|     30 |   27 |     3 | Julia           |
|     31 |   30 |     1 | Forth           |
|     32 |   32 |       | Racket          |
|     33 |   33 |       | Elixir          |
|--------+------+-------+-----------------|

(1) combines Lisp, Common Lisp, Scheme, Clojure & Racket
(2) combines (S)ML & OCaml
(3) summed separate searches for standard ml, sml & ml

Written by Brian Adkins

October 6, 2015 at 3:53 am

Programming Language Popularity – Part Eight

with 2 comments

I compiled some programming language popularity statistics in¬†April 2009,¬†October 2009,¬†October 2010,¬†September 2011,¬†August 2012, Februrary 2013 and September 2013. Here’s an update for May 2014:

I made a number of Google searches of the forms below and summed the results:

"implemented in <language>"
"written in <language>"
"developed in <language>"
"programmed in <language>"

I’ve divided the table into sections based on large percentage drops from one language to the next.

|------+-----------------+------------+-------+-------|
| Rank | Language        | # Search   | Prev. |  Rank |
|      |                 | Results    |  Rank | Delta |
|------+-----------------+------------+-------+-------|
|    1 | PHP             | 41,418,000 |     1 |       |
|------+-----------------+------------+-------+-------|
|    2 | C               | 22,892,000 |     2 |       |
|    3 | C++             | 15,498,000 |     4 |     1 |
|    4 | Python          | 13,313,000 |     3 |    -1 |
|    5 | C#              | 12,279,000 |     5 |       |
|------+-----------------+------------+-------+-------|
|    6 | Java            |  6,997,000 |     6 |       |
|    7 | Perl            |  5,857,000 |     7 |       |
|    8 | JavaScript      |  4,917,000 |     8 |       |
|------+-----------------+------------+-------+-------|
|    9 | FORTRAN         |  3,124,000 |    10 |     1 |
|   10 | Ruby            |  3,066,000 |     9 |    -1 |
|   11 | Lisp Family (1) |  2,106,580 |    11 |       |
|------+-----------------+------------+-------+-------|
|   12 | R               |  1,267,000 |    16 |     4 |
|   13 | ML Family (2)   |    874,760 |    12 |    -1 |
|   14 | COBOL           |    731,600 |    17 |     3 |
|   15 | Lisp            |    711,300 |    18 |     3 |
|   16 | Go              |    650,970 |    23 |     7 |
|   17 | Haskell         |    629,700 |    20 |     3 |
|   18 | Erlang          |    594,900 |    19 |     1 |
|   19 | Scheme          |    580,800 |    24 |     5 |
|   20 | Prolog          |    542,200 |    14 |    -6 |
|   21 | (S)ML (3)       |    505,160 |    21 |       |
|   22 | Lua             |    490,700 |    13 |    -9 |
|   23 | Scala           |    472,300 |    25 |     2 |
|   24 | Smalltalk       |    407,400 |    15 |    -9 |
|   25 | Common Lisp     |    396,380 |    22 |    -3 |
|   26 | OCaml           |    369,600 |    26 |       |
|   27 | Clojure         |    302,220 |    27 |       |
|------+-----------------+------------+-------+-------|
|   28 | Forth           |    199,730 |    28 |       |
|   29 | CoffeeScript    |    192,366 |    30 |     1 |
|------+-----------------+------------+-------+-------|
|   30 | Racket          |    115,880 |    29 |    -1 |
|------+-----------------+------------+-------+-------|

(1) combines Lisp, Common Lisp, Scheme, Clojure & Racket
(2) combines (S)ML & OCaml
(3) summed separate searches for standard ml, sml & ml

Written by Brian Adkins

May 20, 2014 at 8:31 pm

Programming Language Popularity – Part Seven

with 2 comments

I compiled some programming language popularity statistics in¬†April 2009,¬†October 2009,¬†October 2010,¬†September 2011,¬†August 2012¬†and Februrary 2013. Here’s an update for September 2013:

I made a number of Google searches of the forms below and summed the results:

"implemented in <language>"
"written in <language>"
"developed in <language>"
"programmed in <language>"

I’ve divided the table into sections based on large percentage drops from one language to the next.

|------+-----------------+------------+----------+-------|
| Rank | Language        | # Results  | Previous |  Rank |
|      |                 |            |     Rank | Delta |
|------+-----------------+------------+----------+-------|
|    1 | PHP             | 54,516,000 |        1 |       |
|------+-----------------+------------+----------+-------|
|    2 | C               | 31,536,000 |        2 |       |
|    3 | Python          | 24,700,000 |        4 |     1 |
|    4 | C++             | 22,697,000 |        3 |    -1 |
|    5 | C#              | 20,309,000 |        5 |       |
|------+-----------------+------------+----------+-------|
|    6 | Java            | 13,314,000 |        7 |     1 |
|    7 | Perl            | 11,588,000 |        6 |    -1 |
|------+-----------------+------------+----------+-------|
|    8 | JavaScript      |  6,389,000 |        8 |       |
|    9 | Ruby            |  4,710,000 |        9 |       |
|   10 | FORTRAN         |  4,167,000 |       11 |     1 |
|------+-----------------+------------+----------+-------|
|   11 | Lisp Family (1) |  2,444,860 |       10 |    -1 |
|   12 | ML Family (2)   |  1,787,586 |       16 |     4 |
|   13 | Lua             |  1,653,100 |       15 |     2 |
|   14 | Prolog          |  1,389,900 |       22 |     8 |
|   15 | Smalltalk       |  1,003,200 |       27 |    12 |
|   16 | R               |  1,000,700 |       13 |    -3 |
|   17 | COBOL           |    856,500 |       18 |     1 |
|   18 | Lisp            |    835,600 |       12 |    -6 |
|   19 | Erlang          |    808,400 |       17 |    -2 |
|   20 | Haskell         |    798,700 |       19 |    -1 |
|------+-----------------+------------+----------+-------|
|   21 | (S)ML (3)       |    559,186 |       23 |     2 |
|   22 | Common Lisp     |    548,100 |       20 |    -2 |
|   23 | Go              |    490,230 |       28 |     5 |
|   24 | Scheme          |    487,100 |       25 |     1 |
|   25 | Scala           |    481,100 |       24 |    -1 |
|   26 | OCaml           |    429,700 |       21 |    -5 |
|   27 | Clojure         |    352,000 |       30 |     3 |
|------+-----------------+------------+----------+-------|
|   28 | Forth           |    230,630 |       31 |     3 |
|   29 | Racket          |    222,060 |       33 |     4 |
|   30 | CoffeeScript    |    205,809 |       29 |    -1 |
|------+-----------------+------------+----------+-------|

(1) combines Lisp, Common Lisp, Scheme, Clojure & Racket
(2) combines Haskell, (S)ML & OCaml
(3) summed separate searches for standard ml, sml & ml

Written by Brian Adkins

September 12, 2013 at 2:30 am

Programming Language Popularity – Part Six

with 3 comments

I compiled some programming language popularity statistics in April 2009, October 2009, October 2010, September 2011 and August 2012 . Here’s an update for February 2013:

I made a number of Google searches of the forms below and summed the results:

"implemented in <language>"
  "written in <language>"

Naturally this is of very limited utility, and the numbers are only useful when comparing relatively within the same search since the number of results Google returns can vary greatly over time.

I’ve divided the table into sections based on large percentage drops from one language to the next.

|------+-----------------+------------+----------+-------+------------|
| Rank | Language        |    # Search| Previous |  Rank | Delta from |
|      |                 |     Results|     Rank | Delta |    Apr '09 |
|------+-----------------+------------+----------+-------+------------|
|    1 | PHP             |  52,699,000|        1 |       |          3 |
|    2 | C               |  39,330,000|        2 |       |         -1 |
|    3 | C++             |  26,490,000|        4 |     1 |            |
|    4 | Python          |  22,410,000|        3 |    -1 |          1 |
|    5 | C#              |  21,474,000|        5 |       |          2 |
|------+-----------------+------------+----------+-------+------------|
|    6 | Perl            |  11,013,000|        8 |     2 |            |
|    7 | Java            |  10,150,000|        6 |    -1 |         -5 |
|    8 | JavaScript      |   7,340,000|        9 |     1 |          1 |
|------+-----------------+------------+----------+-------+------------|
|    9 | Ruby            |   3,456,000|        7 |    -2 |          1 |
|   10 | Lisp Family (1) |   2,955,000|       10 |       |         -2 |
|   11 | FORTRAN         |   2,256,000|       11 |       |        N/A |
|   12 | Lisp            |   1,708,000|       17 |     5 |            |
|   13 | R               |   1,305,000|       21 |     8 |        N/A |
|   14 | Tcl             |   1,072,100|       13 |    -1 |         -1 |
|   15 | Lua             |   1,011,000|       19 |     4 |          5 |
|   16 | ML Family (2)   |     988,400|       16 |       |         -2 |
|   17 | Erlang          |     842,000|       18 |     1 |         -1 |
|   18 | COBOL           |     729,200|       23 |     5 |        N/A |
|   19 | Haskell         |     707,000|       12 |    -7 |         -4 |
|   20 | Common Lisp     |     557,000|       20 |       |         -2 |
|   21 | OCaml           |     528,000|       24 |     3 |         -4 |
|   22 | Prolog          |     521,000|       25 |     3 |         -3 |
|   23 | (S)ML (3)       |     496,800|       27 |     4 |          1 |
|   24 | Scala           |     426,100|       22 |    -2 |          1 |
|   25 | Scheme          |     347,000|       28 |     3 |        -14 |
|   26 | Groovy          |     320,000|       14 |   -12 |        N/A |
|------+-----------------+------------+----------+-------+------------|
|   27 | Smalltalk       |     201,400|       29 |     2 |         -6 |
|   28 | Go              |     201,200|       15 |   -13 |        N/A |
|   29 | CoffeeScript    |     182,800|       31 |     2 |        N/A |
|   30 | Clojure         |     173,100|       30 |       |         -2 |
|   31 | Forth           |     128,800|       26 |    -5 |         -8 |
|   32 | Caml            |     102,600|       34 |     2 |         -6 |
|   33 | Racket          |      93,500|       33 |       |        N/A |
|   34 | Arc             |      76,400|       32 |    -2 |        -12 |
|   35 | Io              |      60,200|       35 |       |         -8 |
|------+-----------------+------------+----------+-------+------------|

(1) combines Lisp, Scheme, Common Lisp, Racket, Arc & Clojure
(2) combines OCaml, (S)ML, Caml
(3) summed separate searches for standard ml, sml & ml

Written by Brian Adkins

February 23, 2013 at 2:59 pm

Programming Language Popularity ‚Äď Part Five

with 5 comments

I compiled some programming language popularity statistics in April 2009, October 2009, October 2010 and September 2011 . Here’s an update for August 2012:

I made a number of Google searches of the forms below and summed the results (some earlier posts averaged the results):

"implemented in <language>"
  "written in <language>"

Naturally this is of very limited utility, and the numbers are only useful when comparing relatively within the same search since the number of results Google returns can vary greatly over time.

While formatting the table, I noticed there was a fairly natural break into three sections. Languages more popular than FORTRAN, languages between FORTRAN and COBOL and languages less popular than COBOL, so I highlighted the three sections :). I’m curious to see if any languages jump into a higher or lower section next time.

I also switched from HTML to using Emacs org-mode to create a textual table since the latter is so much nicer to deal with.

Update 8/5/12: Someone on the TriFunc mailing list mentioned the omission of Groovy. I don’t feel like updating the table, but I’ll record the total number of results here to allow for a comparison next time. Groovy came in at 460,300 results which puts it above Go and in the middle section.

|----+-----------------+------------+----------+----------+------------|
|    | Language        |   # Search | Previous | Position | Delta from |
|    |                 |    Results | Position |    Delta |    Apr '09 |
|----+-----------------+------------+----------+----------+------------|
|  1 | PHP             | 21,120,000 |        2 |        1 |          3 |
|  2 | C               | 15,440,000 |        1 |       -1 |         -1 |
|  3 | Python          | 11,441,000 |        4 |        1 |          2 |
|  4 | C++             |  9,788,000 |        3 |       -1 |         -1 |
|  5 | C#              |  8,319,000 |        5 |        0 |          2 |
|  6 | Java            |  6,020,000 |        6 |        0 |         -4 |
|  7 | Ruby            |  4,784,000 |        9 |        2 |          3 |
|  8 | Perl            |  4,183,000 |        7 |       -1 |         -2 |
|  9 | JavaScript      |  3,117,000 |        8 |       -1 |          0 |
| 10 | Lisp Family (1) |    898,680 |       10 |        0 |         -2 |
|----+-----------------+------------+----------+----------+------------|
| 11 | FORTRAN         |    795,500 |       11 |        0 |        N/A |
|----+-----------------+------------+----------+----------+------------|
| 12 | Haskell         |    490,000 |       14 |        2 |          3 |
| 13 | Tcl             |    476,000 |       12 |       -1 |          0 |
| 14 | Go              |    391,100 |      N/A |      N/A |        N/A |
| 15 | ML Family (2)   |    375,780 |       17 |        2 |         -1 |
| 16 | Lisp            |    352,000 |       13 |       -3 |         -4 |
| 17 | Erlang          |    334,000 |       15 |       -2 |         -1 |
| 18 | Lua             |    304,000 |       16 |       -2 |          2 |
| 19 | Common Lisp     |    256,000 |       19 |        0 |         -1 |
| 20 | R               |    221,000 |      N/A |      N/A |        N/A |
| 21 | Scala           |    219,000 |       22 |        1 |          4 |
|----+-----------------+------------+----------+----------+------------|
| 22 | COBOL           |    218,600 |       18 |       -4 |        N/A |
|----+-----------------+------------+----------+----------+------------|
| 23 | OCaml           |    181,100 |       20 |       -3 |         -6 |
| 24 | Prolog          |    176,300 |       21 |       -3 |         -5 |
| 25 | Forth           |    168,700 |       27 |        2 |         -2 |
| 26 | (S)ML (3)       |    159,700 |       26 |        0 |         -2 |
| 27 | Scheme          |    135,500 |       23 |       -4 |        -16 |
| 28 | Smalltalk       |    114,500 |       24 |       -4 |         -7 |
| 29 | Clojure         |     74,500 |       25 |       -4 |          0 |
| 30 | CoffeeScript    |     68,660 |      N/A |      N/A |        N/A |
| 31 | Arc             |     40,990 |       30 |       -1 |         -9 |
| 32 | Racket          |     39,690 |      N/A |      N/A |        N/A |
| 33 | Caml            |     34,980 |       28 |       -5 |         -7 |
| 34 | Io              |     23,110 |       29 |       -5 |         -7 |
|----+-----------------+------------+----------+----------+------------|

(1) combines Lisp, Scheme, Common Lisp, Racket, Arc & Clojure
(2) combines OCaml, (S)ML, Caml
(3) summed separate searches for standard ml, sml & ml

Written by Brian Adkins

August 4, 2012 at 12:38 pm

Programming Language Popularity – Part Four

leave a comment »

See Part Five

I compiled some programming language popularity statistics in April 2009, October 2009 and October 2010 . Here’s an update for September 2011:

I made a number of Google searches of the forms below and summed the results (previous posts averaged the results):

"implemented in <language>"
  "written in <language>"

Naturally this is of very limited utility, and the numbers are only useful when comparing relatively within the same search since the number of results Google returns can vary greatly over time.

Language Total Prev. Position Position Delta
C 10,360,000 2 1
PHP 10,351,000 1 -1
C++ 6,495,000 3 0
Python 5,759,000 5 1
C# 5,335,000 4 -1
 
Java 4,890,000 8 2
Perl 3,702,000 6 -1
JavaScript 3,077,000 7 -1
Ruby 1,654,000 9 0
Lisp Family1 1,022,870 11 1
 
FORTRAN 975,600 10 -1
Tcl 594,500 12 0
Lisp 486,000 14 1
Haskell 450,500 16 2
Erlang 419,700 13 -2
 
Lua 367,100 18 2
ML Family2 348,400 17 0
COBOL 308,270 15 -3
Common Lisp 254,900 19 0
OCaml 240,300 21 1
 
Prolog 224,000 20 -1
Scala 203,400 23 1
Scheme 184,700 22 -1
Smalltalk 129,700 24 0
Clojure 84,600 27 2
 
(S)ML3 83,630 25 -1
Forth 69,980 26 -1
Caml 24,470 28 0
Io 17,700 30 1
Arc 12,670 29 -1

1 combines Lisp, Scheme, Common Lisp, Arc & Clojure
2 combines OCaml, (S)ML, Caml
3 summed separate searches for sml and ml

Written by Brian Adkins

September 22, 2011 at 10:37 am

Programming Language Popularity ‚Äď Part Three

with one comment

See Part Five

I compiled some programming language popularity statistics in April 2009 and October 2009 . Here’s an update for October 2010:

I made a number of Google searches of the forms below and averaged the results:

"implemented in <language>"
  "written in <language>"

Naturally this is of very limited utility, and the numbers are only useful when comparing relatively within one column since the number of results Google returns can vary greatly over time.

Language Apr 2009 Oct 2009 Oct 2010 Position Delta
PHP 680,000 5,083,500 14,096,000 +3
C 1,905,500 16,975,000 9,675,000 -1
C++ 699,000 6,270,000 6,510,000 -1
C# 349,700 2,125,000 5,132,000 +4
Python 396,000 3,407,000 5,114,500 +1
Perl 365,500 3,132,500 4,675,000 +1
JavaScript 102,700 1,163,000 2,120,000 +4
Java 850,000 5,118,000 1,495,500 -5
Ruby 99,650 227,000 1,426,000 +13
FORTRAN 1,621,000 770,850 0
Lisp Family1 176,507 3,489,650 399,685 -6
Tcl 44,800 382,000 313,400 +5
Erlang 22,285 161,700 188,800 +12
Lisp 61,900 486,500 174,050 +1
COBOL 247,300 166,435 +6
Haskell 22,550 280,500 157,150 +4
ML Family2 29,062 1,003,800 149,005 -5
Lua 13,065 131,800 128,150 +9
Common Lisp 20,600 554,500 112,750 -5
Prolog 17,750 390,500 100,000 -4
OCaml 22,000 343,500 99,050 -3
Scheme 86,450 2,100,000 82,650 -13
Scala 3,570 66,250 65,950 +6
Smalltalk 9,105 187,500 56,950 0
(S)ML3 5,173 590,700 42,130 -12
Forth 6,465 146,450 25,880 0
Clojure 782 62,200 23,525 +3
Caml 1,889 69,600 7,825 0
Arc 6,775 286,500 6,710 -10
Io 1,760 198,500 3,025 -7

1 combines Lisp, Scheme, Common Lisp, Arc & Clojure
2 combines OCaml, (S)ML, Caml
3 summed separate searches for sml and ml

Written by Brian Adkins

October 8, 2010 at 3:30 pm

Programming Language Popularity – Part Two

with one comment

See Part Five

I compiled some programming language popularity statistics in April and mentioned I’d update the results in 6 months, so here they are:

I made a number of Google searches of the forms below and averaged the results:

"implemented in <language>"
"written in <language>"

Language # Results
Apr 09
# Results
Oct 09
Position
Delta
C 1,905,500 16,975,000 0
C++ 699,000 6,270,000 +1
Java 850,000 5,118,000 -1
PHP 680,000 5,083,500 0
Lisp Family1 176,507 3,489,650 +3
Python 396,000 3,407,000 -1
Perl 365,500 3,132,500 -1
C# 349,700 2,125,000 -1
Scheme 86,450 2,100,000 +2
FORTRAN 1,621,000 N/A
JavaScript 102,700 1,163,000 -1
ML Family2 29,062 1,003,800 +3
(S)ML3 5,173 590,700 +12
Common Lisp 20,600 554,500 +5
Lisp 61,900 486,500 -2
Prolog 17,750 390,500 +4
Tcl 44,800 382,000 -3
OCaml 22,000 343,500 0
Arc 6,775 286,500 +4
Haskell 22,550 280,500 -4
COBOL 247,300 N/A
Ruby 99,650 227,000 -10
Io 1,760 198,500 +6
Smalltalk 9,105 187,500 -1
Erlang 22,285 161,700 -7
Forth 6,465 146,450 -1
Lua 13,065 131,800 -5
Caml 1,889 69,600 0
Scala 3,570 66,250 -2
Clojure 782 62,200 0

1 combines Lisp, Scheme, Common Lisp, Arc & Clojure
2 combines OCaml, (S)ML, Caml
3 summed separate searches for sml and ml

Written by Brian Adkins

October 24, 2009 at 10:23 am

Programming in Standard ML – Part 3

leave a comment »

Table of Contents

Chapter 6 – Case Analysis

Tuple types are homogeneous e.g. all values of type int*real are pairs containing an int and a real. Match failures occur at compile time. Types that have more than one form, such as int, are heterogeneous. Pattern matches fail at run time as a bind failure.

ML defines functions over heterogeneous types using clausal function expressions. For example:

fn pat1 => exp1
 | pat2 => exp2
 | ...
 | patn => expn

Each component pat => exp is called a clause, or a rule. The entire assembly of rules is a called a match. For example:

val recip : int -> int =
    fn 0 => 0 | n:int => 1 div n

The fun notation is generalized so we can be more concise:

fun recip 0 = 0
  | recip (n:int) = 1 div n

Case analysis on the values of a heterogeneous type is performed by application of a clausally-defined function. The notation:

case exp
  of pat1 => exp1
   | ...
   | patn => expn

is short for the application:

(fn pat1 => exp1
  | ...
  | patn => expn)
exp

Matches are subject to two forms of “sanity check” – exhaustiveness checking and redundancy checking.

Chapter 7 – Recursive Functions

For a function to be able to call itself, it needs a name. For example:

val rec factorial : int->int =
    fn 0 => 1 | n:int => n * factorial (n-1)

or using fun notation:

fun factorial 0 = 1
  | factorial (n:int) = n * factorial (n-1)

Iteration

If we define a helper function that accepts an accumulator we can reduce the storage needed:

fun helper (0,r:int) = r
  | helper (n:int,r:int) = helper (n-1,n*r)
fun factorial (n:int) = helper (n,1)

It’s better programming style to hide the helper function w/in a local declaration:

local
    fun helper (0,r:int) = r
      | helper (n:int,r:int) = helper (n-1,n*r)
in
    fun factorial (n:int) = helper (n,1)
end

Tail recursive functions are analogous to loops in imperative languages – they iterate the computation w/o needing auxiliary storage.

Mutual Recursion

Definitions which are mutually recursive can be joined together with the and keyword to indicate they are defined simultaneously by mutual recursion:

fun even 0 = true
  | even n = odd (n-1)
and odd 0 = false
  | odd n = even (n-1)

Chapter 8 – Type Inference and Polymorphism

Standard ML allows you to omit type information whenever it can be determined from context. Consider the following:

fn s:string => s ^ "n"

There is no need to declare the type of s since it can be inferred from the context, so we may write:

fn s => s ^ "n"

A type scheme is a type expression involving one or more type variables standing for an unknown, but arbitrary type expression. Type variables are written ‘a (pronounced alpha), ‘b (pronounced beta), etc. For example, the type scheme ‘a->’a has instances int->int, string->string, (int*int)->(int*int), and (‘b->’b)->(‘b->’b), etc. It does not have the type int->string.

We may bind an identity function to the variable I as follows:

val I : 'a->'a = fn x=>x

We may also write:

fun I(x:'a) : 'a = x

Standard ML eliminates the need to ascribe a type scheme to the variable:

val I = fn x=>x

or

fun I(x) = x

Chapter 9 – Programming with Lists

The values of type type list are the finite lists of values of type type:

1. nil is a value of type typ list.
2. if h is a value of type typ, and t is a value of type typ list,
   then h::t is a value of type typ list.
3. Nothing else is a value of type typ list.

The type expression typ list is a postfix notation for the application of the type constructor list to the type typ.

A value val of type typ list has the form:
val1 :: (val2 :: (… :: (valn :: nil) … ))

The :: operator is right-associative, so we may omit parentheses:
val1 :: val2 :: … :: valn :: nil

Or, we may use list notation:
[ val1, val2, …, valn ]

Computing With Lists

Some examples:

fun length nil = 0
  | length (_::t) = 1 + length t

Note we do not give a name to the head of the list, instead we use a wildcard _

fun append (nil, l) = l
  | append (h::t, l) = h :: append (t, l)

The latter is built into Standard ML and is written using infix as: exp1 @ exp2

fun rev nil = nil
  | rev (h::t) = rev t @ [h]

The running time of the latter is O(n2). The following definition makes use of an accumulator and has a running time of O(n):

local
    fun helper (nil, a) = a
      | helper (h::t, a) = helper (t, h::a)
in
    fun rev' l = helper (l, nil)
end

Chapter 10 – Concrete Data Types

Non-Recursive Datatypes

Example of nullary i.e. zero argument, constructors:

datatype suit = Spades | Hearts | Diamonds | Clubs

It is conventional to capitalize the names of value constructors, but this is not required by the language.

Datatypes may be parameterized by a type:

datatype 'a option = NONE | SOME of 'a

The values are NONE or Some val, where val is a value of type typ. The option type constructor is pre-defined in Standard ML.

Option types can also be used in aggregate data structures:

type entry = { name:string, spouse string option }

An entry for an unmarried person would have a spouse field with a value of NONE.

Recursive Datatypes

datatype 'a tree =
  Empty |
  Node of 'a tree * 'a * 'a tree

1. The empty tree Empty is a binary tree.
2. If tree_1 and tree_2 are binary trees, and val is a value of type type, then Node (tree_1, val, tree_2) is a binary tree.
3. Nothing else is a binary tree.
A function to compute the height of a binary tree, and one to compute the number of nodes:

fun height Empty = 0
  | height (Node (lft, _, rht)) = 1 + max (height lft, height rht)

fun size Empty = 0
  | size (Node (lft, _, rht)) = 1 + size lft + size rht

Heterogeneous Data Structures

The tree data type above requires that the type of the data items at the nodes must be the same for every node of the tree. To represent a heterogeneous tree, the data item must be labelled with enough info to determine the type at run-time.

datatype int_or_string =
  Int of int |
  String of string

type int_or_string =
  int_or_string tree

Datatype declarations and pattern matching can be useful for manipulating the abstract syntax of a language. Consider an example representing arithmetic expressions:

datatype expr =
  Numeral of int |
  Plus of expr * expr |
  Times of expr * expr

fun eval (Numeral n) = Numeral n
  | eval (Plus (e1, e2)) =
    let
        val Numeral n1 = eval e1
        val Numeral n2 = eval e2
    in
        Numeral (n1+n2)
    end
  | eval (Times (e1, e2)) =
    let
        val Numeral n1 = eval e1
        val Numeral n2 = eval e2
    in
        Numeral (n1*n2)
    end

If we extend the expr datatype as follows:

datatype expr =
  Numeral of int |
  Plus of expr * expr |
  Times of expr * expr
  Recip of expr

The compiler will complain about eval being incompatible with the new version of expr. Recompiling eval will produce an inexhaustive match warning since eval lacks a case for Recip. This is one of the benefits of static typing provided in Standard ML.

Written by Brian Adkins

August 15, 2009 at 2:43 pm

Posted in programming

Tagged with ,