There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

HatFunction , in D or d come on

This is completely unrelated to the meme at hand, but the title just reminded me that for a while, Merriam-Webster mistakenly included the word “Dord” to mean density - because an editor misread the entry for “D or d” as an abbreviation of density.

Wikipedia

FreshLight ,

This is as stupid as it is funny. I love it <3

FlyingSquid ,
@FlyingSquid@lemmy.world avatar

I am regularly disappointed that the word games I play on my phone don’t accept ‘dord.’ They should, damn it! One of them accepts Jedi, ffs!

ArmokGoB , in It’s a game for kids!

Towers of Hanoi? I don’t think so.

breadsmasher , in Steal What Is Stolen
@breadsmasher@lemmy.world avatar

does this meme really need to be reposted every day?

starman ,
@starman@programming.dev avatar

Man, I stole your meme

It’s not my meme

unreachable ,
@unreachable@lemmy.world avatar

humor achieved

Jakylla ,
@Jakylla@sh.itjust.works avatar
SpeakinTelnet ,
@SpeakinTelnet@sh.itjust.works avatar

Especially considering all the fuss in programming about copyright laws.

PapstJL4U , in It’s a game for kids!
@PapstJL4U@lemmy.world avatar

Before studying CS, I recognized it as ‘the bioware puzzle’. They were probably copying their own scribbles fron back then.

Haskell was the hardest, but it looked the most beautiful.

lugal ,

Haskell was the hardest, but it looked the most beautiful.

That pretty much sums that language up

DarkenLM ,

Strange. I find the language hideous, most likely because it resembles math, or maybe because I'm already used to the C-like syntax.

lugal ,

Haskell is beautiful because it resembles math

xigoi ,
@xigoi@lemmy.sdf.org avatar

It’s also beautiful because it doesn’t have C-like syntax.

mindbleach ,

Functional programming flips your brain around backwards, but shader programming will turn it inside-out.

manpacket ,

For more brain flipping try looking into hardware description languages (Verilog) or proof assistants (Coq).

TheBananaKing ,

In order to write a haskell program, you must first write the corresponding haskell program.

lugal ,

And in order to do that, you have to imagine sisyphus happy

Knusper ,

<span style="font-weight:bold;color:#795da3;">hanoi </span><span style="font-weight:bold;color:#a71d5d;">:: Integer -> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> [(a, a)]
</span><span style="color:#323232;">hanoi 0 _ _ _ </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">[]
</span><span style="color:#323232;">hanoi n a b c </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) a c b </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> [(a, b)] </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) c b a
</span>

From here: www.rosettacode.org/wiki/Towers_of_Hanoi#Haskell

DumbAceDragon , (edited )
@DumbAceDragon@sh.itjust.works avatar

https://media.tenor.com/1bIptSWki_kAAAAd/unintelligible.gif

Edit: I understand it now. That first line is just a really weird way to define a function.

Knusper ,

Welp, imma try myself at an explanation. Mostly cause I haven’t written Haskell in a while either.

So, that first line:


<span style="font-weight:bold;color:#795da3;">hanoi </span><span style="font-weight:bold;color:#a71d5d;">:: Integer -> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> [(a, a)]
</span>

…actually only declares the function’s type.

In this case, it’s a function that takes an Integer and three values of a generic type a and then returns a list of tuples of those same as.
So, those as are just any types representing the towers. Could be strings, integers, custom data types, whatever. The returned tuples represent movements between towers.

Following that are actually two definitions of the function.

The first definition:


<span style="color:#323232;">hanoi </span><span style="color:#0086b3;">0</span><span style="color:#323232;"> _ _ _ </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">[]
</span>

…is the recursion base case. Function definitions are applied, whenever they match, being evaluated top-to-bottom.

This line specifies that it only matches, if that first Integer is 0. It does not care what the remaining parameters are, so matches them with a wildcard _.
Well, and to the right side of the equals sign, you’ve got the return value for the base case, an empty list.

Then comes the more interesting line, the recursion step:


<span style="color:#323232;">hanoi n a b c </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) a c b </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> [(a, b)] </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) c b a
</span>

This line matches for any remaining case. Those small letter names are again wildcards, but the matched value is placed into a variable with the provided name.

And then, well, it recursively calls itself, and those ++ are list concations. This line’s only real complexity is the usual Tower Of Hanoi algorithm.

nothacking , in It’s a game for kids!

Oh but we don’t play it, we put lighting into rocks and trick them into doing it.

ram , in D or d come on

There are two Linux paradigms that I consider stupid. One is the use of centralized software repositories managed by the distro instead of individual developer maintained installers. The other one is file system case sensibility. They already admitted defeat on the first one with the rise of containerised applications. I wonder how much longer they’ll keep the charade on the second one.

charlotte ,

Sorry, but you’re plain wrong on your first issue. Getting all your packages from one source is one of the biggest upsides of Linux.

onlinepersona ,

Pretty hilarious for mac users, of all people, to complain about centralisation. Like, don’t you live in a walled garden?

EddoWagt ,

Indeed, but I’m sure we can agree that it’s pretty stupid for every distro to maintain its own repo. That’s a lot of duplicate work, which could be spend on more useful things. Luckily flatpak is well on its way to change that

charlotte ,

Hm… But different distros have different philosophies (not just) about updates. That’s part of why people choose a specific distro.

Theres still plenty speaking against flatpak (larger sizes, problems with GTK/qt themes, and it’s only meant for GUI applications - you still need a separate system for the kernel and lower-level/cli tools. And frankly, that makes flatpak unusable to me, because the purpose of a centralized package management system is not having duplicate systems).

So in short: y’all are gonna pry pacman from my cold, dead hand.

tslnox ,

The same goes for me, but with Portage, brother.

EddoWagt ,

I’m not against distros as a whole, some extra work will be inevitable because people have different preferences, but it feels like a waste having a Firefox package for arch, ubuntu, fedora and Debian while essentially all being identical. Indeed flatpak isn’t perfect yet, but it works great for me and it’s steadily improving

MJBrune ,

I have a third one for you. Not being able to pick where things install. Everything installs to the os disk. Terrible idea.

sbv , in Close to the next unlock in the speedtest app

maybe it will be fast this time

ThiefUserPermissions OP ,

Unlocks an extra megabit for you

sbv ,

worth

blargerer , in They Need To Stop Doing This
bleistift2 ,

Piped Link: The Expert (Short Comedy Sketch) aka “7 Red Lines”

GrayBackgroundMusic ,

The Expert!

This lives in my head. Any time I talk to/about sales or customers. ajklsdhflkasjdgfloaui

uniqueid198x , in Steal What Is Stolen

I see this meh-meh come up occasionally, and I’m always amused because designers are constantly looking at the competition and adjusting to suit. Why do you think all sebtites look the same?

Anticorp , in Steal What Is Stolen

“I stole your code”

“Well, I’m fucking honored, mate. Have at it”

Samsy , in They Need To Stop Doing This

Hah, yes, I was a few times between these two sides. My role was to understand both and doing something you could call “translating.”

brygphilomena ,

Well–well look. I already told you: I deal with the god damn customers so the engineers don’t have to. I have people skills; I am good at dealing with people. Can’t you understand that? What the hell is wrong with you people?

BioDriver , in They Need To Stop Doing This
@BioDriver@beehaw.org avatar

You forgot sales

Sh1nyM3t4l4ss , in D or d come on

Use a shell with decent auto-completion. I have not been irritated by this in years.

nogooduser ,

Won’t autocomplete fail if you do “cd d” and then try the autocomplete?

Or is that what you mean by “decent” auto-completion?

bdonvr ,

No, it will probably go to “Documents”, and if you hit tab again it should go to “Downloads”. (Assuming you have the normal default folders)

rasensprenger ,

bash’s autocomplete fails (at least with default settings), but e.g. zsh can figure out what you mean

newIdentity ,

Not with a decent autocomplete. It will look for a folder starting with a small d and if it doesn’t exist it looks at a folder with a large D.

pgp ,

The choice of the letter d was brilliant, that’s for sure. Now I’m imagining a folder with a large D.

newIdentity ,

I don’t get what you mean. It doesn’t matter if you write a uppercase or lowercase d

pgp ,
Skimmer ,

What shell would you recommend? 🤔

Sh1nyM3t4l4ss ,

I use fish which is quite nice OOTB, although if you want a posix compliant shell, zsh with some plugins is also great.

ayaya ,
@ayaya@lemdro.id avatar

If you need to run a set of commands or a script with fish you can just toss them in a file and run bash file.sh. I have been daily driving fish for years and I don’t even have think about it.

stevehobbes ,
yum13241 ,

Is fucking irrelevant. Just use your package manager.

stevehobbes ,

Get some anger management help.

yum13241 ,

Maybe stop trying to be a smartass.

Swedneck ,
@Swedneck@discuss.tchncs.de avatar

I personally like xonsh despite the minor amount of wonkiness it has, it’s so nice to have python available directly in your shell, it takes the “i don’t care about the quality of my code i just want this shit to work with minimal effort”-ness of bash and turns it up to 13.

wviana ,

Zsh.

Omg looks like people think omz is a shell.

Zaphod ,

Oh my zsh?

wviana ,

No. Zsh. It’s pretty easy to have a nice auto compl. No need for omz. After knowing poweline10k I just use it and syntax highlight plugin, manually installed. There is no need to add entire omz.

lightnsfw ,

I just don’t use caps when naming directories

stingpie , in It’s a game for kids!

Did you guys find this hard? There are only four possible ways to move a ring, two of which are disallowed by the rules. Out of the remaining two, one of them is simply undoing what you just did.

Voli , in Steal What Is Stolen

Hey! we designers have mastered the imposter syndrome.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines