re: 5 Powerful Programming Languages to Stretch Your Brain VIEW POST

FULL DISCUSSION
 

While I like most languages on your list I'm not sure they are particularly brain-stretching, except for Haskell and maybe Elixir if you haven't seen vanilla Erlang before. Rust gets some points for its ownership model and the zero-cost abstractions, though I find them more interesting from the compiler implementation perspective than as an application developer.

Here are some languages I consider genuinely mind-stretching:

  • J: think "Ascii APL". Always good to explore a non-von Neumann programming language. For example here's a solution I wrote for Project Euler problem 3, summing all the multiples of 3 and 5 below 1000 (it may look cryptic but makes sense when you used the language for a bit):
+/ ~. ,0 ([: I. =) (3 5|/i.1000)`
  • Prolog: Programming in facts and rules was a really mind-boggling experience for me. Here's the quicksort example off Wikipedia:
partition([], _, [], []).
partition([X|Xs], Pivot, Smalls, Bigs) :-
    (   X @< Pivot ->
        Smalls = [X|Rest],
        partition(Xs, Pivot, Rest, Bigs)
    ;   Bigs = [X|Rest],
        partition(Xs, Pivot, Smalls, Rest)
    ).

quicksort([])     --> [].
quicksort([X|Xs]) -->
    { partition(Xs, X, Smaller, Bigger) },
    quicksort(Smaller), [X], quicksort(Bigger).
  • Clojure and or Racket: a Lisp never hurts, and my loyalties lie with the Lisp-1 family. Clojure is a great modern functional Lisp and Racket's approach to language-oriented programming is fairly unique. Here's some code I wrote for work in 2010, which parses an EC2 usage report and nicely plots the results with Incater:
(def usage (read-dataset "./report.csv" :header true))

(def instance-types
     (set (filter #(re-find #"BoxUsage" %) ($ :UsageType usage))))

(with-data (->> ($rollup :sum :UsageValue :UsageType usage)
                ($where {:UsageType {:$in instance-types}}))
  (view (bar-chart :UsageType :UsageValue
                   :title "EC2 Instance Usage"
                   :x-label "Instance Types"
                   :y-label "Usage Value")))
  • Forth, especially a modern variant like Factor or RETRO: stack-based programming is fun and it's also really interesting to see how Forth systems are built from very few primitives (similar to Lisps). I highly recommend building a little throwaway mini-Forth for yourself, it's a fun exercise. Here's a factor snippet that extracts the href attribute of all a tags on the Factor website and prints them:
USING: io kernel sequences
http.client xml xml.data xml.traversal ;

"http://factorcode.org" http-get nip string>xml
"a" deep-tags-named
[ "href" attr ] map
[ print ] each

 

To be fair, how much it stretches your brain is subjective (and the article is tagged for beginners).

However, those are great additions and I'm going to look into Clojure. 👍

 

how much it stretches your brain is subjective

I find the stretching asymptotically approaches zero if one doesn't venture further than the Algol and ML families ¯\(ツ)

and the article is tagged for beginners

Beginner's minds are generally more flexible and less set in their ways. Even seasoned developers should adapt this mindset when approaching some of the languages I listed here :-)

code of conduct - report abuse