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 Slide

  2. print *,"Hello world!"

    View Slide

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

    View 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 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 Slide

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

    View 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 Slide

  8. View Slide

  9. View Slide

  10. http://jsforcats.com/

    View Slide

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

    View Slide

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

    View Slide

  13. View Slide

  14. https://www.flickr.com/photos/[email protected]/9385054093/

    View Slide

  15. https://www.flickr.com/photos/[email protected]/9385054093/

    View Slide

  16. View Slide

  17. View Slide

  18. 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 Slide

  19. 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 Slide

  20. 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 Slide

  21. "#>,_
    "#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 Slide

  22. 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 Slide

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

    View Slide

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

    View Slide

  25. 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 Slide

  26. 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 Slide

  27. 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 Slide

  28. 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 Slide

  29. 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 Slide

  30. 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 Slide

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

    View Slide

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

    View Slide

  33. – 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 Slide

  34. What’s
    In a
    Name?

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide


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

    View Slide


  39. 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 Slide

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

    View Slide

  41. View Slide

  42. View Slide

  43. View Slide

  44. 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 Slide

  45. View Slide

  46. View Slide

  47. View Slide

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

    View Slide

  49. Is
    Turing Completeness
    a Good Idea?

    View Slide

  50. “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 Slide

  51. BlooP
    FlooP
    GlooP

    View Slide

  52. View Slide

  53. 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 Slide

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

    View Slide

  55. GlooP

    View Slide

  56. View Slide

  57. View Slide

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

    View Slide

  59. View Slide

  60. Does
    Order of Operation
    Matter?

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  64. “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 Slide

  65. View Slide

  66. View Slide

  67. View Slide

  68. View Slide

  69. View Slide

  70. View Slide

  71. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  76. View Slide

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

    View Slide

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

    View Slide

  79. https://www.schoolofhaskell.com/

    View Slide

  80. If What
    Order Wrong
    Happen Things?

    View Slide

  81. View Slide

  82. System A
    System B

    View Slide

  83. System A
    System B
    Possible Network Partition

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  87. View Slide

  88. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  95. View Slide

  96. View Slide

  97. View Slide

  98. View Slide

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

    View Slide

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

    View Slide

  101. Is Real
    Privacy
    Even Possible?

    View Slide

  102. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  109. http://jeeveslang.org/

    View Slide

  110. What Is the
    Fundamental
    Data Type?

    View Slide

  111. View Slide

  112. 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 Slide

  113. View Slide

  114. View Slide

  115. View Slide

  116. View Slide

  117. View Slide

  118. View Slide

  119. View Slide

  120. View Slide

  121. View Slide

  122. View Slide

  123. View Slide

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

    View Slide

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

    View Slide

  126. View Slide

  127. View Slide

  128. View Slide

  129. View Slide

  130. View Slide

  131. View Slide

  132. View Slide

  133. View Slide

  134. View Slide

  135. View Slide

  136. What If Future
    Computers
    Aren’t Silicon?

    View Slide

  137. Weird Machines

    View Slide

  138. 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 Slide

  139. View Slide

  140. View Slide

  141. View Slide

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

    View Slide

  143. 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 Slide

  144. View Slide

  145. View Slide

  146. www.kappalanguage.org

    View Slide

  147. This
    Begs the Question:

    View Slide

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

    View Slide

  149. View Slide

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

    View Slide