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

Incredibly Strange Programming Languages - Code...

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. 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
  2. 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
  3. <spoilers> • 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
  4. 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
  5. 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
  6. 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
  7. "#>,_ "#Beer Song>,_ #include <iostream> 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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)
  15. Change is coming • Hardware: GPU / FPGA / Quantum

    computing • Distributed systems • End of Moore’s Law - Storage faster than CPU • Safety and privacy
  16. Is This Some Kind of Joke? HAI 1.2 CAN HAS

    STDIO? VISIBLE "HAI WORLD!!!1!" KTHXBYE http://lolcode.org/
  17. – 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…”
  18. 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
  19. “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
  20. 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.
  21. C# IEnumerable<int> stuff = from i in new[] { 1,

    2, 3 } select i * i; !" Line A DoStuff(); !" Line B DoStuffWithStuff(stuff); !" Line C
  22. “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/
  23. f x = x + 1 g x = x

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

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

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

    + 3 composed = f . g
  27. minimum :: Ord a &. [a] "→ a minimum =

    head . sort minimum [3, 2, 1] = head . sort $ [3, 2, 1]
  28. 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
  29. 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/
  30. 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"
  31. Why Don’t We Make a Lazy, Dependently Typed, Domain-Specific, Secure,

    Quantum Biological, Failsafe Language in Arabic?