Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Recommendations for fun programming languages ?

by rnaeye (Friar)
on Feb 27, 2022 at 14:59 UTC ( [id://11141676]=perlquestion: print w/replies, xml ) Need Help??

rnaeye has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I start learning programming for the first-time using awk and Perl. I am not a professional programmer or have any official computer science education. I consider my skill level as “early-intermediate” level Perl programmer. When I read documentation, I understand most if not all without asking anyone. I have similar level of competence in Python and R, and beginner level knowledge of C language (still working on it). I can use Perl, Python and R in my job; I am a biologist and do mostly my own data analysis. I can write >=95% of scripts I would need myself without asking any help. In other words, programming is a hobby for me, and I have a lot of fun when I write in Perl. However, I do not have as much fun when I write in other programming languages I mentioned above (C comes second so far). I am not sure why? Maybe Perl is more expressive for me.

Since programming is a hobby for me and forces me to think problems differently, I would like to learn additional programming languages, but I want them to be as fun as Perl. I was wondering if there are other languages there that might be as much fun as Perl. I would appreciate recommendations, especially it complements my Perl knowledge. I hope that my question is reasonable enough to get some suggestions. Much appreciated.

  • Comment on Recommendations for fun programming languages ?

Replies are listed 'Best First'.
Re: Recommendations for fun programming languages ?
by LanX (Saint) on Feb 27, 2022 at 15:19 UTC
    hmm ... I think you should rather think in terms of programming paradigms to broaden your horizon than "fun languages".

    Fun languages are a matter of fashion and hypes, but paradigms prevail.

    Perl is a multi paradigm language, which I enjoy a lot (and frustrates others)

    Larry created a kind of "Frankenstein's Monster" (tongue in cheek) by sewing together elements of C, bash, awk, sed and Lisp, among others, this led to quick success because ppl coming from those languages quickly felt comfortable.

    You can try using Perl from these different angles to approach other languages.

    For Functional programming: Higher Order Perl comes to mind. From there you can have a look at LISP (or Scheme to be more specific)

    If you don't like Lisp's syntax, you might wanna have a look at Haskell.

    Of course there are more languages which are outside the paradigms covered by Perl, like Forth, Erlang or Prolog.

    edit

    The book Seven languages in seven weeks may also be of interest for you, tho I would switch Io with JS.

    update

    The books covers most of what I've already mentioned, here my 2022 take on them

    • Ruby:

      basically a redesign of Perl ideas with a powerful standard OO system, but included out-of-the box. Plus a sexy syntax, facilitating the design of DSLs, (IMHO Perl6 should have taken this direction, but without breaking backwards compatibility)

    • Io:

      The unknown sister of JS in using prototype based OO.

    • Prolog:

      List processing, classic approach to AI. There are CPAN modules for doing this inside Perl

    • Scala:

      use the JVM with a lot of DWIM. Resource heavy in production, really bad for global warming. (This niche is targeted by Kotlin nowadays with much less processor heating - hype alert :)

    • Erlang:

      High Availability for TelCos

    • Clojure:

      Lisp for the JVM, better readable syntax tho

    • Haskell:

      the dream of computer scientists, but maybe too intelligent for the rest. (The volume of the WWW nearly doubled with blogs trying to explain what a Monad is ;)

    update

    DISCLAIMER: I'm not proficient in most mentioned languages, my short characterizations are far from being complete.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      It's a shame (Concurrent) Clean did not catch up instead of Haskel. Its uniqueness typing is a concept much easier to grasp than all that monad mumbo jumbo.

      Jenda
      1984 was supposed to be a warning,
      not a manual!

      Thank you!

Re: Recommendations for fun programming languages ?
by duelafn (Parson) on Feb 28, 2022 at 12:43 UTC

    I second LanX's suggestion to work through Higher Order Perl. It is an excellent level-up.

    I'll add Rust to the list. The book is a great guide (and there are many other resources). I'd programmed C and C++ in college and several projects through the years, but never loved writing at that level until learning Rust. My big complaint is cargo and the way modules are handled, but once you get past that, the language itself is great. Interestingly, the "Maybe" monad example in linked by LanX is written in Rust.

    Good Day,
        Dean

Re: Recommendations for fun programming languages ?
by dbuckhal (Chaplain) on Feb 27, 2022 at 21:49 UTC

    If you were one that might have wanted to explore Java and found you had to type so much to do so little, a "fun" alternative to explore (if only for a couple of days...) might be the Groovy Language

    You can review PLEAC - Programming Language Examples Alike Cookbook for a quick reference to how it relates to the famous Perl Cookbook.

    NOTE: Fun factor is left to the subjective opinion of the user.

Re: Recommendations for fun programming languages ?
by etj (Deacon) on Feb 27, 2022 at 20:03 UTC
    Following on from LanX's thought on different paradigms, "array programming" is a very powerful way of dealing with bulk information with no more for-loops. MATLAB (or its free GNU clone, Octave) is a good way to experiment with that. Obviously, I will also recommend PDL which is both Perl and array programming, and you may find reading PDL::MATLAB illuminating about both MATLAB and PDL.
Re: Recommendations for fun programming languages ?
by tybalt89 (Monsignor) on Mar 02, 2022 at 23:24 UTC

    Another place to look for inspiration is https://rosettacode.org which for a designated problem show solutions in many languages.

Re: Recommendations for fun programming languages ?
by harangzsolt33 (Chaplain) on Mar 01, 2022 at 04:13 UTC

    I would recommend you to learn JavaScript. It is a language that CAN BE very similar to Perl. I have written in JavaScript using Perlish style. Lol And Perl translates into JavaScript with minimal effort. Some features are left out of JavaScript. For example, since JS is designed to run inside a web browser when you visit a website, it cannot access the file system. If it could, it would mean that you visit a random website, and the website's designer could simply copy your hard drive while you're innocently browsing his site. LOL So, there is no direct access to files. You cannot open a file and save it or read it. However, you can do it if the JS program is designed to run offline on your local Windows computer. (Example) I have JS scripts on my computer that do various things such as change Windows settings. (Example) Yes, did I mention that you can actually modify the Windows registry from a JS script? You can do anything. In fact, when someone sends you viruses in emails, it's usually a JS file that looks like Your_Package_Could_Not_Be_Delivered.DOCX.js LOL Malware creators use JS a lot. In Windows 7, you could pin a clock gadget or weather gadget or various gadgets onto the desktop. These gadgets were all written in JavaScript. Then they were zipped and the zip extension was changed to .gadget and now all of a sudden it could be installed as a little app on your desktop. Unfortunately, Windows 7 is the only OS that supports the gadgets. For some reason, they removed them from latter versions. Windows XP had an active desktop which meant that you could use a webpage or JavaScript program as your desktop background, which could run a clock or do various things. But it was quite slow. It wasn't perfected until Windows 7 came out. Windows also allows you to write .HTA applications since Windows 98. This is a really cool feature. You write your program's GUI in HTML and then you add JavaScript to it. It can be a single file with .hta extension or multiple files. Either way, a HTA program can run JavaScript. (Example) It can access the file system and do basically everything. If you tried to change the HTA extension to HTML and upload the program to the internet, it would probably still look like an app, but the logic wouldn't work exactly as designed, because now your script wouldn't be able to access the file system. Whenever you try to access the file system in JavaScript, you enclose it in a try-catch structure, so in case the file system access is turned off, your program can be made aware of that...

    JavaScript is great because when you write a little app, it can run on almost any device. You don't have to install anything to run JavaScript. It's embedded into every web browser. Even my earliest smartphone could run JavaScript. Some refrigerators now come with a web browser. And they are even in cars and airplanes. I mean JavaScript is a universal language that can run on every device. All you have to do is share a web link, and another person can click on it and open it in a web browser and run your program without having to install anything or download anything or type any kind of stuff into a terminal. Developing JavaScript programs is very simple.

    JavaScript supports Unicode characters, and it's completely behind the scenes. You don't even realize you're working with those special characters, because support is builtin. You don't have to type "use utf8" or whatever. It's supported by default. If you have a file name that contains weird Chinese characters, you can simply open it, save it, rename it. Whatever you want to do. And it doesn't take any effort at all. What's a little weird is you can even use some weird characters in your variable names. I have written a little JavaScript obfuscator that converts all variable names and everything to a bunch of binary characters, so the source code looks like a compiled executable. All you can see is a bunch of weird characters with a few semicolons scattered here and there. :D

    I have been playing with JavaScript since I was 18, and I am 40 now. I learned it on my own by looking at the HTML code of web pages like www.yahoo.com, and I tried to copy the code from their site to mine and see what happens if I change some things... Another thing I like about JavaScript is that it is designed to be very "friendly." Let's say you forget to place a semicolon at the end of a statement. What happens? Nothing. Your program still runs without an error! Or let's say you forget to declare a variable. Your program still runs! It might have unwanted consequences which you'll figure out later, but it's not a nitpicking language such as Java or C++ where you must cross every t and put a dot on top of every i. This is what I love about JavaScript. You can sit down and write a program and just focus on your program rather than waste time by typing a ton of redundant crap such as public class int main() #include <blah blah> return 0; In this sense, it's comparable to BASIC programming. I remember, when I was writing BASIC programs, the reason I liked that language so much is because I was able to think about the program flow in my head, and I didn't have to think about syntax or anything else. I was able to focus all my attention to the problem. There weren't any distractions.

    JavaScript also has disadvantages. For example, if you want to work with files on your local computer, you'll need Windows. JS files won't run on Linux. HTA applications don't run on Linux. And if you're writing a script which is to be run inside a web browser, the only way to make your program sleep is you have to cut your program into half. There's no sleep() function available if you're in a browser. So, if you want your program to sleep for 1000 ms, then you can setup a timeout that will call another function when the delay time is up. So, you can't just insert a sleep() instruction into your web app. Whatever would come after the sleep has to be placed into a separate function and it has to be called with a timeout. It CAN be done, but it's unnecessarily complicated. Another thing I really-really miss from JavaScript is the ability to overwrite parts of a string. In Perl, you can easily do something like this: substr($STRING, 1, 3) = 'ABC'; But in order to do that in JavaScript, you have to use the substr() or slice() method to slice the string and then use the + sign to join the string again with the new 'ABC' slice in the middle. It's designed to be unnecessarily complicated! Lately, JavaScript frameworks and libraries have really become popular, which slows down computers. I mean you look at the source HTML page of some modern website, and they include a ton of JavaScript frameworks, many of which they don't use at all. Half of the stuff is used to load ads and to check if you are able to see those ads. The other half is to check your screen resolution and orientation, so if you're holding a tablet and you flip the screen from landscape to portrait, the JavaScript program suddenly redraws your website to fit the new screen width and height. Some websites are nefarious, and they use your processing power to mine bitcoins for themselves while you're visiting their site...

    When you visit a random website, a JavaScript program can run in the background without asking for your permission. In fact, before the page even loads, it will know what kind of browser you're using, your screen resolution, color depth, the speed of your device, your connection speed, type of device or computer you're using, whether it's a 64-bit architecture or 32-bit, your language, timezone, what kind of cookies you have saved, if you have the username and password saved, if you're logged in or not, how many times you have visited before, when was your last visit, a JavaScript snippet from Google may already know your advertising ID, from that it will know your interests, etc. The JavaScript also knows where you move the mouse on the screen and when you scroll up or down. It knows when you tilt the screen or when you are looking at another tab. Some websites record all that, and then they can play it back for the website admin to see what the visitors are doing and what they are clicking on. The amount of data you can get from visitors is pretty amazing. Most websites don't actually record all that, but it is possible.

    JavaScript allows you to modify the HTML content of a page. It allows you to simulate a page flip (when in reality your entire website loads in one piece). It allows you to draw directly to the screen using a canvas feature. It allows you to communicate with the back-end server script which might be a Perl script. It allows you to launch a WebAssembly code which runs inside the web browser. It allows you to play midi sounds, mp3 music, animations, and do all sorts of things to "entertain" the visitor. Microsoft has ported its entire Office suite to JavaScript. Office 365 is an online web app written entirely in JavaScript. I've also seen a free photo editor written entirely in JavaScript. There's also a 8086 processor emulator written entirely in JavaScript. You can find other processor emulators online as well. So, you can run an old DOS program inside your web browser. I've read somewhere that every program you can think of will be ported to JavaScript at some point. It's going to happen, because JavaScript has become such a popular language.

Re: Recommendations for fun programming languages ?
by hv (Prior) on Mar 02, 2022 at 17:28 UTC

    For the purpose of fun, one place well worth a look is the Esoteric Languages wiki. You might also want to try some of the tasks on programming challenge websites such as Sphere Online Judge in several of the supported languages, to get a better feel for what you enjoy. That particular site supports a wide variety of languages, including some esoteric ones, and even has specific challenges that require an esoteric language such as brainfuck - or at least it did; I haven't been there in a few years, and I can't right now see how to search for challenges with particular types of requirement.

    Another direction to go that might tie in with the day job would be SNOBOL, which was the first language to introduce 'pattern matching' as a first-class concept.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11141676]
Approved by johngg
Front-paged by LanX
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-24 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found