Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Incredibly Strange Programming Languages - CodeMash 2017

Incredibly Strange Programming Languages - CodeMash 2017

If you’ve ever suspected that “all programming languages are pretty much the same; they just have different syntax,” well, you will never suspect that again! Covering languages from the unusually powerful (Idris) to the illuminated (قلب) to the profoundly limited (BlooP), and all points in between, these languages will help you think differently about approaches to software problems you face in your day job. Of course we’ll have a lot of fun, but these languages are no joke. The practical benefit of an impractical language is the power to find new approaches to common problems.

Craig Stuntz

January 13, 2017
Tweet

More Decks by Craig Stuntz

Other Decks in Programming

Transcript

  1. Incredibly Strange
    Programming Languages!
    Craig Stuntz
    https://speakerdeck.com/craigstuntz

    View full-size slide

  2. print *,"Hello world!"

    View full-size slide

  3. Console.WriteLine("Hello, World!");

    View full-size slide

  4. S3
    S1 S2 S3
    c a t
    var aaa = new Regex("cat");
    https://en.wikipedia.org/wiki/Van_cat#/media/File:Turkish_Van_Cat.jpg

    View full-size slide

  5. S3
    S1 S2 S3
    c a t
    var aaa = new Regex("cat");
    https://en.wikipedia.org/wiki/Van_cat#/media/File:Turkish_Van_Cat.jpg

    View full-size slide

  6. https://upload.wikimedia.org/wikipedia/commons/0/06/Human_computers_-_Dryden.jpg

    View full-size slide


  7. • Today, many languages look mostly the same
    • “Mainstream” languages will change
    • There are specific reasons why they change
    • Just learning about certain languages can help you
    learn how to write interesting code

    View full-size slide

  8. http://jsforcats.com/

    View full-size slide

  9. https://www.flickr.com/photos/lenore-m/2514975647/

    View full-size slide

  10. https://commons.wikimedia.org/wiki/File:Kitchen-knife-santoku-form.jpg

    View full-size slide

  11. https://www.flickr.com/photos/40726522@N02/9385054093/

    View full-size slide

  12. https://www.flickr.com/photos/40726522@N02/9385054093/

    View full-size slide

  13. var query = from total in Enumerable.Range(0,100).Reverse()
    select (total > 0)
    ? string.Format("{0} bottles of beer on the wall\n{0} bottles of beer\nTake one down,
    around", total)
    : string.Format("{0} bottles left", total);
    foreach (var item in query)
    {
    Console.WriteLine(item);
    }
    http://rosettacode.org/wiki/99_Bottles_of_Beer

    View full-size slide

  14. plural = 's'
    99.downto(1) do |i|
    puts "#{i} bottle#{plural} of beer on the wall,"
    puts "#{i} bottle#{plural} of beer"
    puts "Take one down, pass it around!"
    plural = '' if i - 1 == 1
    if i > 1
    puts "#{i-1} bottle#{plural} of beer on the wall!"
    puts
    else
    puts "No more bottles of beer on the wall!"
    end
    end
    http://rosettacode.org/wiki/99_Bottles_of_Beer

    View full-size slide

  15. var beer = 99;
    while (beer > 0) {
    var verse = [
    beer + " bottles of beer on the wall,",
    beer + " bottles of beer!",
    "Take one down, pass it around",
    (beer - 1) + " bottles of beer on the wall!"
    ].join("\n");
    console.log(verse);
    beer--;
    }
    http://rosettacode.org/wiki/99_Bottles_of_Beer

    View full-size slide

  16. "#>,_
    "#Beer Song>,_
    #include
    using namespace std;
    int main(){ for( int
    b=-1; b<99; cout $%
    '\n') for ( int w=0;
    w<3; cout $% ".\n"){
    if (w==2) cout $% ((
    b--) ?"Take one dow"
    "n and pass it arou"
    "nd":"Go to the sto"
    "re and buy some mo"
    "re"); if (b<0) b=99
    ; do{ if (w) cout $%
    ", "; if (b) cout $%
    b; else cout $% (
    (w) ? 'n' : 'N') $%
    "o more"; cout $%
    " bottle" ; if
    (b&'1) cout $%
    's' ; cout $%
    " of beer";
    if (w&'1)
    cout $%
    " on th"
    "e wall"
    ;} while
    (!w++);}
    return
    0
    ;
    }
    "#
    "# by barrym 2011-05-01
    "# no bottles were harmed in the
    "# making of this program!!!
    http://rosettacode.org/wiki/99_Bottles_of_Beer

    View full-size slide

  17. def sing(b, end):
    print(b or 'No more','bottle'+('s' if b-1 else ''), end)
    for i in range(99, 0, -1):
    sing(i, 'of beer on the wall,')
    sing(i, 'of beer,')
    print('Take one down, pass it around,')
    sing(i-1, 'of beer on the wall.\n')
    http://rosettacode.org/wiki/99_Bottles_of_Beer

    View full-size slide

  18. https://www.quora.com/Are-all-programming-languages-based-on-C

    View full-size slide

  19. https://www.quora.com/Are-all-programming-languages-based-on-C

    View full-size slide

  20. Lineage
    1960 1970 1980
    ALGOL
    LISP
    APL
    ML
    Prolog
    ALGOL BCPL C C++
    1990 2000
    C#
    Java
    JavaScript
    Ruby
    ML OCaml F#
    2010
    Swift
    LISP Scheme Clojure
    APL J
    SASL SASL Miranda Haskell
    Prolog Erlang Elixir
    PHP

    View full-size slide

  21. Lineage
    1960 1970 1980
    ALGOL
    LISP
    APL
    ML
    Prolog
    ALGOL BCPL C C++
    1990 2000
    C#
    Java
    JavaScript
    Ruby
    ML OCaml F#
    2010
    Swift
    LISP Scheme Clojure
    APL J
    SASL SASL Miranda Haskell
    Prolog Erlang Elixir
    PHP

    View full-size slide

  22. Lineage
    1960 1970 1980
    ALGOL
    LISP
    APL
    ML
    Prolog
    ALGOL BCPL C C++
    1990 2000
    C#
    Java
    JavaScript
    Ruby
    ML OCaml F#
    2010
    Swift
    LISP Scheme Clojure
    APL J
    SASL SASL Miranda Haskell
    Prolog Erlang Elixir
    PHP

    View full-size slide

  23. Lineage
    1960 1970 1980
    ALGOL
    LISP
    APL
    ML
    Prolog
    ALGOL BCPL C C++
    1990 2000
    C#
    Java
    JavaScript
    Ruby
    ML OCaml F#
    2010
    Swift
    LISP Scheme Clojure
    APL J
    SASL SASL Miranda Haskell
    Prolog Erlang Elixir
    PHP

    View full-size slide

  24. Lineage
    1960 1970 1980
    ALGOL
    LISP
    APL
    ML
    Prolog
    ALGOL BCPL C C++
    1990 2000
    C#
    Java
    JavaScript
    Ruby
    ML OCaml F#
    2010
    Swift
    LISP Scheme Clojure
    APL J
    SASL SASL Miranda Haskell
    Prolog Erlang Elixir
    PHP

    View full-size slide

  25. Mainstream Programming
    Paradigm Shifts
    1950s
    “Beats machine code”
    (Assembler)
    1960s - mid-1970s
    “Beats assembler”
    (FORTRAN, COBOL)
    mid-1970s - mid-1990s
    “The Great Leap Backwards”
    (C, C++)
    mid-1990s - today?
    “Safer, Web”
    (Java, JavaScript)

    View full-size slide

  26. Change is coming
    • Hardware: GPU / FPGA / Quantum computing
    • Distributed systems
    • End of Moore’s Law - Storage faster than CPU
    • Safety and privacy

    View full-size slide

  27. Is This Some Kind of
    Joke?
    HAI 1.2
    CAN HAS STDIO?
    VISIBLE "HAI WORLD!!!1!"
    KTHXBYE
    http://lolcode.org/

    View full-size slide

  28. – Harold Abelson and Gerald Jay Sussman
    with Julie Sussman
    Structure and Interpretation of Computer Programs
    “Establishing new languages is a powerful
    strategy for controlling complexity in
    engineering design; we can often enhance our
    ability to deal with a complex problem by
    adopting a new language that enables us to
    describe (and hence to think about) the problem
    in a different way…”

    View full-size slide

  29. What’s
    In a
    Name?

    View full-size slide

  30. Console.WriteLine("Hello, World!");

    View full-size slide

  31. Console.WriteLine("你好世界");

    View full-size slide

  32. var hello = "Hello, World!".Substring(0, 5);

    View full-size slide


  33. http://www.unicode.org/reports/tr51/index.html#Emoji_ZWJ_Sequences

    View full-size slide


  34. http://www.unicode.org/reports/tr51/index.html#Emoji_ZWJ_Sequences
    " = U+1F1E8 REGIONAL INDICATOR SYMBOL LETTER C
    U+1F1E6 REGIONAL INDICATOR SYMBOL LETTER A

    View full-size slide

  35. بلق
    http://nas.sr/%D9%82%D9%84%D8%A8/

    View full-size slide

  36. http://nas.sr/%D9%82%D9%84%D8%A8/
    “The Arabs have a rich
    tradition of calligraphy
    and poetry attached to
    the text of their
    language. Computer
    scientists have a
    strangely similar
    relationship with the text
    that they write as well,
    and that overlap was
    something I became
    fascinated with.”
    -Ramsey Nasser

    View full-size slide

  37. http://nas.sr/بلق/

    View full-size slide

  38. Is
    Turing Completeness
    a Good Idea?

    View full-size slide

  39. “You theorized a
    machine that
    could solve any
    problem. It
    didn’t just do
    one thing; it did
    everything.”

    (fictional) Joan
    Clarke

    to (fictional) Alan
    Turing

    The Imitation
    Game (2014)
    http://theimitationgamemovie.com/#blog/104786411214
    A Misunderstanding

    View full-size slide

  40. BlooP
    FlooP
    GlooP

    View full-size slide

  41. BlooP
    DEFINE PROCEDURE “PRIME?” [N]:
    BLOCK 0: BEGIN
    IF N = 0 THEN:
    QUIT BLOCK O;
    CELL(0) (() 2;
    LOOP AT MOST MINUS [N,2] TIMES:
    BLOCK 1: BEGIN
    IF REMAINDER [N,CELL(0)] = 0, THEN:
    QUIT BLOCK 0;
    CELL(0) (() CELL(0) + 1;
    BLOCK 1: END;
    OUTPUT (() YES;
    BLOCK 0: END.

    View full-size slide

  42. FlooP
    MU-LOOP:
    BLOCK n: BEGIN
    .
    .
    .
    BLOCK n: END.

    View full-size slide

  43. Client
    Server
    Data Cyphertext
    Result Cyphertext
    Computation
    Data Plaintext
    Result Plaintext

    View full-size slide

  44. Does
    Order of Operation
    Matter?

    View full-size slide

  45. https://www.flickr.com/photos/lusoldi/3018045218/

    View full-size slide

  46. C#
    if (true *+ LaunchMissiles()) {
    !" do stuff

    View full-size slide

  47. C#
    IEnumerable stuff =
    from i in new[] { 1, 2, 3 }
    select i * i; !" Line A
    DoStuff(); !" Line B
    DoStuffWithStuff(stuff); !" Line C

    View full-size slide

  48. “Now I'm a pretty lazy
    person and am prepared
    to work quite hard in
    order to avoid work.”
    Martin Fowler
    Refactoring
    https://www.flickr.com/photos/adewale_oshineye/2933030620/

    View full-size slide

  49. f x = x + 1
    g x = x + 3
    composed = f . g

    View full-size slide

  50. f x = x + 1
    g x = x + 3
    composed = f . g

    View full-size slide

  51. f x = x + 1
    g x = x + 3
    composed = f . g

    View full-size slide

  52. f x = x + 1
    g x = x + 3
    composed = f . g

    View full-size slide

  53. minimum :: Ord a &. [a] "→ a
    minimum = head . sort

    View full-size slide

  54. minimum :: Ord a &. [a] "→ a
    minimum = head . sort
    minimum [3, 2, 1]
    = head . sort $ [3, 2, 1]

    View full-size slide

  55. https://www.schoolofhaskell.com/

    View full-size slide

  56. If What
    Order Wrong
    Happen Things?

    View full-size slide

  57. System A
    System B

    View full-size slide

  58. System A
    System B
    Possible Network Partition

    View full-size slide

  59. System A
    System B
    Possible Network Partition
    THEOREM Spec ⇒ ☐NobodyGetsEaten

    View full-size slide

  60. System A
    System B
    Possible Network Partition
    THEOREM Spec ⇒ ☐NobodyGetsEaten

    View full-size slide

  61. https://lorinhochstein.wordpress.com/2014/06/04/crossing-the-river-with-tla/

    View full-size slide

  62. http://research.microsoft.com/en-us/um/people/lamport/tla/formal-methods-amazon.pdf

    View full-size slide

  63. http://research.microsoft.com/en-us/um/people/lamport/tla/formal-methods-amazon.pdf

    View full-size slide

  64. http://research.microsoft.com/en-us/um/people/lamport/tla/hyperbook.html

    View full-size slide

  65. https://github.com/p-org/PSharp/

    View full-size slide

  66. https://github.com/p-org/PSharp/

    View full-size slide

  67. https://github.com/p-org/PSharp/

    View full-size slide

  68. http://p-org.github.io/PSharp/

    View full-size slide

  69. http://research.microsoft.com/pubs/260939/paper.pdf

    View full-size slide

  70. Is Real
    Privacy
    Even Possible?

    View full-size slide

  71. https://github.com/jeanqasaur/jeeves/blob/master/demo/jcal/tests.py

    View full-size slide

  72. https://github.com/jeanqasaur/jeeves/blob/master/demo/jcal/jcal/models.py

    View full-size slide

  73. https://github.com/jeanqasaur/jeeves/blob/master/demo/jcal/jcal/models.py

    View full-size slide

  74. https://github.com/jeanqasaur/jeeves/blob/master/demo/jcal/jcal/models.py

    View full-size slide

  75. https://github.com/jeanqasaur/jeeves/blob/master/demo/jcal/tests.py

    View full-size slide

  76. http://arxiv.org/pdf/1507.03513v5.pdf

    View full-size slide

  77. http://jeeveslang.org/

    View full-size slide

  78. What Is the
    Fundamental
    Data Type?

    View full-size slide

  79. C Bag of bits
    C#
    , Java Object (ref. types)
    Value types
    Lisp Atom
    List
    Haskell Algebraic data types
    Julia, MATLAB Vector, Matrix
    APL, J Array
    Idris Theorem

    View full-size slide

  80. https://www.manning.com/books/type-driven-development-with-idris

    View full-size slide

  81. https://github.com/munificent/vigil

    View full-size slide

  82. What If Future
    Computers
    Aren’t Silicon?

    View full-size slide

  83. Weird Machines

    View full-size slide

  84. LIQUi|〉
    let circUa = CompileUa N a qs "# Compile 1 Shor step
    let count = circUa.GateCount() ∗ n∗2
    let hits, misses = "# Get total gate count
    Gate.CacheStats() "# Get gate caching stats
    let gp = GrowPars(30, 2, false) "# Params for growing
    let circUa = circUa.GrowGates(k, gp ) "# Grow the circuit
    circUa.Dump() "# Dump circuit to file
    ShorRun circUa rslt n a qs "# Run Shor
    let m = Array.m api "# Accumulate all the
    ( fun i bit "→ bit <<< i ) rslt "# ..phase estim ation bits
    |> Array.sum "# ..m = quantum result
    let permG, permS, permN = k.Perms "# Get permutation stats
    http://stationq.github.io/Liquid/

    View full-size slide

  85. http://stationq.github.io/Liquid/

    View full-size slide

  86. Kappa
    %agent: A(b,c)
    %agent: B(a,c)
    %agent: C(b,a)
    ##
    %var: ’V’ 1
    %var: ’k1’ INF
    %var: ’k2’ 1.0E-4/’V’
    %var: ’k_off’ 0.1
    ##
    ’a.b’ A(b),B(a) "→ A(b!1),B(a!1) @ ’k2’ (’k1’)
    ’a.c’ A(c),C(a) "→ A(c!1),C(a!1) @ ’k2’ (’k1’)
    ’b.c’ B(c),C(b) "→ B(c!1),C(b!1) @ ’k2’ (’k1’)
    ##
    ’a..b’ A(b!a.B) "→ A(b) @ ’k_off’
    ’a..c’ A(c!a.C) "→ A(c) @ ’k_off’
    ’b..c’ B(c!b.C) "→ B(c) @ ’k_off’
    ##
    %var: ’n’ 1000
    ##
    %init: ’n’ A(),B(),C()
    %mod: [E] > 10000 do \$STOP
    %def: "dotSnapshots" "true"

    View full-size slide

  87. www.kappalanguage.org

    View full-size slide

  88. This
    Begs the Question:

    View full-size slide

  89. Why Don’t We Make a
    Lazy, Dependently Typed,
    Domain-Specific, Secure,
    Quantum Biological,
    Failsafe Language
    in Arabic?

    View full-size slide

  90. Craig Stuntz
    @craigstuntz
    [email protected]
    http://www.craigstuntz.com
    http://www.meetup.com/Papers-We-Love-Columbus/
    https://speakerdeck.com/craigstuntz

    View full-size slide