topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 8:36 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Experimenting with Other Programming Languages  (Read 30685 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Experimenting with Other Programming Languages
« on: November 13, 2014, 01:15 AM »
I've spent most of my life coding C++, and dabbling in other languages (most recently Python).

But the list of programming languages that I've never written a line of code in is starting to get big, and I think it's time I put an end to that.

So I've decided I'm going to try to do a little experimenting with other programming languages, and wanted other coders here to join me, and post your updates here.



For my first stop on the tour, I spent today coding in Go.

I was inspired to write a program to solve a homework assignment given to the daughter of one of our fellow DC members.

The assignment is as follows:
"Given a set of numbers, and a target value, find an expression using + - * / and which uses each of the numbers exactly once, which reaches the target."

For example, given the numbers [2, 3, 6, 15] find a mathematical expression that uses all of the numbers and reaches the target value of 7.
Answer: 2+(15/(6-3))



Note that there may be multiple expressions that reach a given target value.  Rather than find a specific solution to a specific problem -- I was more interested in writing a program that would find ALL possible expressions given a set of n numbers, and then looking for particular targets which have few possible solutions, reasoning that these would be nice and hard puzzles to solve.



I started out by trying to calculate a formula for the # of possible expressions of n numbers.  That turned out to be a very fun mathematical journey, and I encourage the mathematically inclined among you to give it a try.  I'll share my formula later so as not to spoil the problem.



Anyway, so today I coded this program in Go.  Looks like about 400 lines of code, and definitely a non-trivial and interesting project.
Speed and memory seemed quite reasonable, no complaints there.  Error messages were reasonable.
I'll post the source code soon after I give anyone else a chance to have some fun.
However, I can't say I really enjoy Go after my day with it.  Some parts of it are ugly and unpleasant, and I don't approve of many of the language design decisions.
In fairness, this wasn't really something that made use of the real strengths of Go, so perhaps it wasn't the fairest of tests.



Here's a test for you if you decide to try coding this program.  I will give out a prize of a free DC mug for anyone who can solve this by writing their own version of this program before I post my source code at the end of the month.
Given the numbers [2 3 4 5 6 7 8], find TWO good, and fundamentally different, solutions that yield the target value of "2741"



Go source code for eqsolver attached.
« Last Edit: April 15, 2018, 02:46 AM by mouser »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #1 on: November 13, 2014, 01:39 AM »
Wel, there is a section in this forum called Programming School...  :tellme: ;D :Thmbsup:

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #2 on: November 13, 2014, 02:08 AM »

Hehe well as long as Mouser is doing wild "non-trivial" things in random languages, I'll remark that while I had fun on my recent LD cruise, I wasn't as captivated as that puzzle-game from the last bunch, Undermined. I was saying there was enough there for a stats class essay paper there!

Meanwhile, assuming you're skipping the silly ones like Malbolge, what about VB.net?




Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,466
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #3 on: November 13, 2014, 04:30 AM »
Why not LISP?

I'm beginning to experiment with C#, just to see how it has evolved during the past few years. I wonder if it would make sense to reimplement "my" C++ applications.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #4 on: November 19, 2014, 06:46 PM »
Up next is Java programming for Android..

I highly recommend this set of tutorials, which I thoroughly enjoyed:
http://www.i-program...-android-studio.html
« Last Edit: November 22, 2014, 02:20 AM by mouser »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #5 on: November 28, 2014, 08:22 AM »
Finally making some good progress on Android coding..

One day I love it, the next I hate it.  Rinse and repeat.

For better or worse, it seems to me that mobile/tablet coding is mostly user interface coding.. Which I'd really like to get away from, and go back to my roots of academic/simulation coding where the UI plays a minor role.

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #6 on: November 28, 2014, 08:30 AM »
The main reason I never made an Android app is because of my profound dislike for Java (which I know is absurd). I've investigated alternatives (e.g. Scala), but they all seem to be more than sub-optimal (especially for novices of the platform).

I'm planning to check out one of the cross-platform solutions one day though.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #7 on: November 28, 2014, 08:48 AM »
Finally making some good progress on Android coding..
IF you are working on an Android version of PBOL, then please let me know, so I can stop pondering on whether I should start the project, because it is really short for my NANY to get it finished, and I really didn't start it yet :-[ (too much other stuff at hand :()

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #8 on: November 28, 2014, 08:59 AM »
Ath:

I am working on a basic code framework that is perfectly suited for making PBOL android.  Whether I get to it in time for NANY 2015 is still unknown, but yeah I think PBOL android is one of the test apps I will make.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #9 on: November 29, 2014, 12:00 AM »
I am working on a basic code framework that is perfectly suited for making PBOL android.  Whether I get to it in time for NANY 2015 is still unknown, but yeah I think PBOL android is one of the test apps I will make.
Never mind that, it's time for Find And(roid) Run Robot!

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #10 on: December 02, 2014, 09:54 PM »
Why not LISP?

I've started working my way through Clojure for the Brave and True.  Pretty nice so far.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #11 on: December 07, 2014, 07:44 PM »
Phew, 16 days later and I have released my first Android/Java app.  Details here: https://www.donation...ndex.php?topic=39626

Two languages down and now I have to take a break and concentrate on updating my "real" programs and working a bit more on NANY 2015.  Will resume the programming language experiment in 2015.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #12 on: December 11, 2014, 06:21 AM »
From my experience with Android, I just want to make a plug for the IntelliJ IDE for android development.  I can't really compare it to Eclipse, the giant multi-language more well known IDE for Android, except to say that the last time I used eclipse I found it quite overwhelming.  IntelliJ is still a monster of an IDE feature-wise, but it seems more manageable to me.

IntelliJ is a commercial product, but there is a free community edition, and if you are actively involved in an open-source project you can apply for a free open-source full license.  IntelliJ was also repackaged as Android Studio which looks to be a great free solution for new Android developers.

When I'm coding in a plain vanilla language (like C++), an IDE is not all that important -- but for something like android, the autocomplete features of the IDE are indispensable, and IntelliJ does a very nice job with such things, and just in general makes it much less stressful learning about android project structure organization and building.  There is a *lot* of confusing overhead involved in building android projects that has nothing to do with programming and everything to do with build management and file structures, etc., so I welcome any help I can get.

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,857
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #13 on: December 11, 2014, 09:44 AM »
Why not LISP?

I've started working my way through Clojure for the Brave and True.  Pretty nice so far.

That one looks very interesting. I think I'm going to give it a whirl. :Thmbsup:

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #14 on: December 11, 2014, 09:46 AM »
I'll not bite in the IDE-wars (again) ;)


The last couple of days I had to dive into perl, as one of our Jira required plug-ins (Jira Commit Acceptance) is no longer supported on the latest Jira version (6.3) that we want to migrate to, and 'only' a perl script is available as an alternative.
The script was, ofcourse, 80% right for what we need, but that last 20% had to be added as well (multiple issue-numbers in a commit-message all must apply to the set rules, the issue must exist and not have a 'Resolution' set).

It's been a pleasant surprise on the ease of getting into some (to me) trickery stuff/features of the language (and Google is my friend :P), as perl combines a lot of features from Java/C-like languages, bash shell scripts and the basic-ish language I've come to like in AutoIt3.
Ofcourse I'm not (yet) creating (or planning) full-fledged applications in perl any time soon, but it is been really easy to use. :Thmbsup:

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #15 on: December 11, 2014, 05:24 PM »
I've been using Perl (5 series) lately too -- recalling that use strict and use warnings are my friends :)

On Windows, I've had some good success using a portable version of Strawberry Perl.

Packaging up results for distribution for Windows is something I'm still sorting out -- some things tried include: CitrusPerl and PAR::Packer.



On a side note, have you given Padre a try?

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #16 on: December 11, 2014, 05:27 PM »
That one looks very interesting. I think I'm going to give it a whirl. :Thmbsup:

Interested to hear how that goes for you.

The creator of Clojure has some interesting things to say too.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #17 on: December 11, 2014, 09:47 PM »
Why not LISP?

I've started working my way through Clojure for the Brave and True.  Pretty nice so far.

If you're working in Clojure, you might want to take a look at Light Table.  Pretty impressive!  And if you're on Windows, installing it with Chocolatey is really easy.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #18 on: December 12, 2014, 12:43 AM »
Indeed, Light Table is quite something.



On a side note, the talk that inspired the creator had some nifty things too!

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #19 on: December 12, 2014, 06:55 AM »
On a side note, have you given Padre a try?
The amount of work I expected to be doing on this script didn't leave (much) time of looking for an IDE, but this is good to know, thanks. :up:
And that Padre-author seems 'quite knowledgeable' in perl :Thmbsup: (to make the understatement of the day :tellme:)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #20 on: December 12, 2014, 07:19 AM »
One of the features that caught my eye was the debugger -- I didn't quite get it to work on my *nix installation though.  Of course there's the official debugger, but I was looking for something a bit more flashy.

In the mean time I'm using Devel::REPL for some interactive development -- which is better than nothing, but it leaves me feeling that it needs some love and attention...

In any case, good luck with your Perl-ing!

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #21 on: December 14, 2014, 02:41 PM »
I'd like to branch out from my current language of choice (Rexx, which I've been using for the last 25 years). Coincidentally I have a need for a small routine written in Lua. Should I just hit lua.org and go through the live demo? I know I ought to buy the book and support the project, but I just wanted something fairly basic to play with at the beginning. Does anyone have some suggestions on the various online resources? Some tutorials can be better than others...
vi vi vi - editor of the beast

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #22 on: December 14, 2014, 05:51 PM »
Haven't done much recently with Lua, but I remember the lua-users site to be helpful and specifically the Learning Lua wiki page to be a relevant starting point for learning lua.

I understand it's used for extension in a number of projects -- e.g. VLC, wireshark, etc, -- and this presents one potentially nice approach for learning the language: identify a project (preferably one you have interest in) that's using it for plugins/extensions and start studying the existing plugins/extensions, including modifying them and writing one's own.
« Last Edit: December 15, 2014, 06:27 AM by ewemoa »

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #23 on: December 15, 2014, 01:22 AM »
The first edition of Programming in Lua is available free online, and is still a good resource when learning the language.

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Experimenting with Other Programming Languages
« Reply #24 on: December 15, 2014, 05:20 AM »
Thanks for the hints folks, I'll start playing around with it this week lwatcdr.
vi vi vi - editor of the beast