Here's another freebie!! I signed up for a programming problem of the day. I got my first one today, rated "easy".

Here's the description of the problem.

git.qoto.org/Absinthe/sum-of-n

My code to solve it, though not clean and delicious, is in that same repo, but certainly give it a crack before peeking. :)

@Absinthe this one was actually "easy", just translated the description and mercury solved it for me (no squinting required), so I decided to throw in some input handling and that was the painful part as usual.
git.sr.ht/~namark/mercury_stuf

But of course the real challenge is doing it in one pass... in a language that might not have a concept of a pass...

#toyprogrammingchallenge #mercurylang

@namark I really do wish I could run the code :(

I usually try not to involve I/O in the problems as that can just add an unnecessary layer of complexity to most things.

So, let me ask, the line that says
A + B = K ... does that generate a whole bunch of things like (1 + K-1) (2 + K-2) (3 + K-3) and so on?

If that is the case, what does it feel like if your list of numbers are large? Like 1,234,567,890?

@Absinthe It wasn't really that hard to install, just downloaded the 14.0.1(i think) source release from the website, and
./configure
make
make install
It only needs gcc and gnu make.
The only slightly tricky part was adding the bin directory from the installation to the system PATH.
It took a few hours to build on my super old desktop.

Follow

@namark maybe i will try it from sources this weekend.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.