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.

Smallwater , in No common rube

My wife’s standing at her company’s IT dept skyrocketed during COVID lockdowns.

Why? Because we were both working from home, and aside from helping her with basic troubleshooting, I also helped her formulate her tickets better.

Turns out, tech support folks like it when a ticket has concise info, instead of “screen broke”.

Entropywins ,

My God the amount of times I have to pull the frickin issue out of people…

Iheartcheese ,
@Iheartcheese@lemmy.world avatar

It doesn’t work.

laranis ,

I find this a fascinating phenomenon. Some of it is ignorance of the technology. Which I get because you can’t expect everyone to be experts (but if you don’t know the difference between a browser and your desktop just fuck off back to the bronze age).

The other is a true lack of empathy in the context of communication. Being able to communicate effectively with an equal onus on both parties to understand and adapt the dialog until the information has effectively been transferred is not hard, really, but some people just don’t care enough about the person on the other end of the line to be bothered.

That is infuriating when you’re trying to be helpful.

disgrunty ,

As a former IT help desk person, I can confirm that we do in fact love it when people give us good info. People who write screen broke shouldn’t be working with technology more advanced than a shovel

DokPsy ,

“please call so and so, they’re having issues with their browser”

Call the user, they are out for the day. Leave message to call back

Either never hear back or the issue was not browser related

Either way, tell the original ticket creator to have the person having the issue call us if they want prompt service

rottingleaf ,

People who write screen broke shouldn’t be working with technology more advanced than a shovel

Shovel gay, pen have, paper end, rock good.

Ookami38 ,

It’s the same as going to a mechanic and saying “my car doesn’t work!” No shit? That’s usually why people come here. Wanna be more specific?

MrSpArkle , in Stop use docker

Docker exists because most programming languages don’t give a shit about producing easily executable outputs.

Nobody cares about your stupid python egg or ruby gem. How do I run it on my local?

alexdeathway ,
@alexdeathway@programming.dev avatar

How do I run it on my local?

spin a dock…

dan ,
@dan@upvote.au avatar

Docker is still useful even for apps that compile to a single executable, as the app may still depend on a particular environment setup, particular libraries being available, etc.

MonkderDritte ,

Pack it with the interpreter in an executable.

parpol , in std::underflow_error

You start out with negative knowledge in C++, then as you just hear the name for the first time, you get your balls stepped on, jizz, and then get post-nut clarity.

onlinepersona , in we love open source!!1!

While coding on a Mac.

Anti Commercial-AI license

haui_lemmy ,

I might just visit your post and comment history instead of curating my own feed by now. :) best takes

onlinepersona ,

😄 thanks dude. Don’t put me on a pedestal though, wouldn’t be able to live up to that 😉

Anti Commercial-AI license

haui_lemmy ,

So far you‘re doing pretty well in my book. Most comments I read with spot on takes happen to have your name on it.

Nobody’s perfect though. I get it. :)

i struggle to understand the downvotes though. Maybe I worded it strange?

onlinepersona ,

i struggle to understand the downvotes though. Maybe I worded it strange?

I dunno, it was obviously a joke and I laughed 🙂

Anti Commercial-AI license

haui_lemmy ,

Thanks. Good to hear one person gets it. Maybe its because I have answered so many of your comments that you were able to see the joke and others thought I was trying to nag at you for some perceived behavioral code violation or whatever. In any case. Please go on being awesome. Love reading your comments.

onlinepersona ,

💖 thanks dude. Have a good day!

Anti Commercial-AI license

haui_lemmy ,

You too! :))

Fades , (edited )

Actually the mac OS is built in part with freeBSD. Open source nix has always had a place at Apple, but Apple greedy and bad right?

en.wikipedia.org/wiki/BSD

Darwin, the system on which Apple’s Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD

Here’s a good breakdown: stackoverflow.com/a/3449195

The Wikipedia BSD article is good (and accords with my own understanding, for what that’s worth). It says that Darwin, the system on which Apple’s Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD, and notes that 4.4BSD is the last release that Berkeley was involved with.

So, Darwin is as BSD as you can get (just like all the other BSDs!). OS X refers to those parts of the distribution which aren’t open-source, principally the GUI, but including a variety of frameworks, and anything which relies on these won’t be portable.

OS X as a whole is a UNIX 03 system. That’s equivalent to being a truly POSIX-compliant system (as opposed to being POSIX-like).

As other answers have noted, the userland parts of the OS are unsurprising to anyone with much unix experience, and I’ve rarely had any difficulty building portable-unix software on OS X.

In contrast, the non-userland parts of the OS are pretty different. Apple seems to be willing to innovate in those areas fairly cheerfully. I think (but I’m not positive) that these changes are formally part of Darwin. One of the most obvious differences is that launchd has replaced cron, at, inetd, and much of the startup infrastructure.

….But go ahead and tell us how mac and open source is antithetical

Edit: for the downvoters, yes Apple has had their hands in open source from the start and never stopped. Doesn’t mean they’re the goddamn FOSS Jesus

Open source software is at the heart of Apple platforms and developer tools. Apple manages the following projects and encourages your contribution.

opensource.apple.com/projects/

msage ,

OS X refers to those parts of the distribution which aren’t open-source

From your own quote

Fades , (edited )

OSX is not simply the non open source pieces, I get reading comprehension is hard for you but come on. People will upvote anything if it confirms their emotional biases lol

msage ,

The entire internet is built on open-source technologies, as you probably know. That doesn’t make the internet as a whole an open-source thing. Transport technologies are open, a lot of hardware and software around it is not, and that’s still talking about the infrastructure, not what is actually running on top of all that.

It’s like saying Windows is open-source because they use curl. And Microsoft is as open to open-source code as long as they can train their LLM on it and sell it to you. Sure they provide money and developers to some projects, but Windows, Office, Azure will most likely never be actually open to code investigations, forget free.

ricdeh ,
@ricdeh@lemmy.world avatar

Incorporating parts from a free and open-source Unix-like operating system does not make your OS FOSS. Apple would be the last company to contribute their MacOS source code.

Fades , (edited )

You missed the point of my comment which was open source is not antithetical to Apple and it’s not absurd to use a mac to work on open source software.

To imply it is absurd to believe in open source and use a mac as part of development is fucking ridiculous. As I said in my comment open source has always had a place at Apple both historically and currently.

I used the FreeBSD connection to illustrate how open source is at the core of Apple sw. We don’t have to use that as an example though:

Open source software is at the heart of Apple platforms and developer tools. Apple manages the following projects and encourages your contribution.

opensource.apple.com/projects/

As I said in my original comment, it is not antithetical to use a mac to dev FOSS. I’m not saying Apple is the goddamn FOSS Jesus

Corbin ,

You’re cheering for exploitation of a commons.

Fades ,

No im not cheering about anything, my entire fucking point is Apple is not antithetical to open source.

It’s that goddamn simple, it your making some sort of fan boy anti Apple war out of this and it’s honestly pathetic.

Corbin ,

As a hardware hacker, I’ve experienced Apple’s anti-FLOSS behavior. I was there when Apple was trying to discourage iPodLinux. In contrast, when we wanted to upstream support for the Didj, LeapFrog gave us documentation and their kernel hackers joined our IRC channel. It’s the same reason that people prefer ATI/AMD to nVidia, literally anybody to Broadcom, etc.

Your “entire fucking point” is obvious from the top-level comment you replied to; you’ve taken offense to somebody pointing out that writing FLOSS on Apple hardware is oxymoronic. And it’s a bad point, given that such a FLOSS hacker is going to use Homebrew or Nix in order to get a decent userland that hasn’t been nerfed repeatedly by an owner with a GPLv3 allergy and a fetish for controlling filesystem layouts. Darwin is a weird exception, not one of the easy-to-handle BSDs.

Also, what, are you not anti-Apple? Do you really think that a fashion company is going to reward you for being fake-angry on Lemmy?

Skullgrid ,
@Skullgrid@lemmy.world avatar

You missed the point of my comment which was open source is not antithetical to Apple and it’s not absurd to use a mac to work on open source software.

so your argument is that apple doesn’t actively oppress your ability to program? And that it supports open source because it leeched off free bsd?

are you actually stupid, or are you on the apple payroll?

Supporting open source involves contributing to the amount of software available by open sourcing your own work.

Leeching off open source software is not support

ZILtoid1991 ,

Windows is a free and open source software, it incorporates open source components.

Fades , (edited )

Nowhere did I say that mac os is open source, all I said is mac and open source are not antithetical.

Furthermore

Open source software is at the heart of Apple platforms and developer tools. Apple manages the following projects and encourages your contribution.

opensource.apple.com/projects/

jnk ,

The fuck are you high? Even microsoft, google, and meta support or have their own OSS projects. Apple just used someone else’s work as a base and doesn’t contribute to anything, what are you defending here?

Fades ,

I’m “defending” the fact that development on a mac is not some bastardized union, FOSS has had its place in the Mac world since forever and to say that using a mac to work on FOSS makes you a hypocrite or a joke is fucking dumb.

Furthermore

Open source software is at the heart of Apple platforms and developer tools. Apple manages the following projects and encourages your contribution.

opensource.apple.com/projects/

ICastFist ,
@ICastFist@programming.dev avatar

I mean, you’re using hardware from a company that is very blatantly anti consumer rights - thou shall not repair, thou shall not upgrade, thou shall not use third party anything, thou shall use Metal, for we despise OpenGL; not to mention that you have even less control on the mobile devices unless you pay a developer fee.

The fact that MacOS has some FOSS under the hood is completely irrelevant.

catch22 ,

Apple greedy and bad right?

Yes.

Fades , (edited )

So brave for hating a brand because they price up.

Can’t be using anything that costs money when you believe and/or work in open source right? Because that’s the joke my comment is responding to

gaylord_fartmaster ,

Yes, Apple, like many other corporations, uses FOSS components in their closed source software because it saves them money from free labor. There are also parts that make sense for them to distribute under a free license because they need developers to implement them in their software to work with their OS or browser.

That doesn’t mean they’re actually benefitting the FOSS community in any way, it just means the FOSS community is benefitting their closed source software for free.

Skullgrid ,
@Skullgrid@lemmy.world avatar

Is osx / iOS itself open source?

Fades ,

How exactly does that show that open source is antithetical to Apple? Is that whole ass list I provided at the end of my comment just a 2 bullet point of osx, iOS???

No it’s not, so please actually read what you are emotionally reacting to first.

Skullgrid ,
@Skullgrid@lemmy.world avatar
mexicancartel ,

They, fuckin’, use, FOSS. But they use it by wrapping their proprietaty stuff they need. Just taking the free labour from foss devs

Fades ,

That’s not true for all of their projects, that whole ass list is absolutely not just stuff that use FOSS. They openly welcome contributions but you don’t know that because you didn’t actually look at what I provided.

My entire goddamn point is that it is NOT antithetical to use a Mac to write foss. How does your response relate to that AT ALL??

mexicancartel ,

Its about Mac OS itself being proprietary, even though it certain part is foss. Apple do manage foss projects but you know, google, facebook and microsoft does that too. They defenitely need foss and do promote in some ways. And all theese are stupid dramas like “Microsoft<3Linux”

AtariDump ,
onlinepersona ,
AtariDump , (edited )

lemmy.ml/post/15152684/10769248

Edit: “I DO NOT GRANT PERMISSION TO LAW ENFORCEMENT TO READ THIS COMMENT. ANY USE OF THIS COMMENT BY LAW ENFORCEMENT FOR ANY REASON IS ILLEGAL. THIS COMMENT CANNOT BE USED AS EVIDENCE AGAINST ANY NON-LAW ENFORCEMENT PERSONS IN RELATION TO ANY CRIME.”

onlinepersona ,

🙄

onlinepersona ,

dunno why I bothered. blocking people like you wastes less of my time

Anti Commercial-AI license

AtariDump ,

Bothered with what? I thought we were having a nice discussion about your signature line.

I’ve added more to mine after reading that post you linked - thanks! 😊

What is the Anti Commercial-Al license and why do people keep adding it to their comments?

“I DO NOT GRANT PERMISSION TO LAW ENFORCEMENT TO READ THIS COMMENT. ANY USE OF THIS COMMENT BY LAW ENFORCEMENT FOR ANY REASON IS ILLEGAL. THIS COMMENT CANNOT BE USED AS EVIDENCE AGAINST ANY NON-LAW ENFORCEMENT PERSONS IN RELATION TO ANY CRIME.”

Swedneck ,
@Swedneck@discuss.tchncs.de avatar

it’s honestly just magical thinking, like sovereign citizens saying they’re “just travelling, not driving” to magically get around traffic laws, or people in the past murmuring prayers of protection against wolves.

might as well pour a line of salt around your house to protect against the robot invasion!

AtariDump ,

Wait, it’s salt now for the robots‽ I’ve been using cinnamon.

BRB, going to buy salt.

Andromxda ,
@Andromxda@lemmy.dbzer0.com avatar

OS is a personal choice, a messaging platform is not. You have to use the platform that the community is on, but you can choose your own OS.

tiredofsametab , in Saw 37 the software Dev

People should be able to do this, at least for simple programs. We used to do it all the time.

NatoBoram ,

Everyone should be able to do a hello world without IDE

masterspace , in Not really sure whether S-expressions or Python indentation-based scoping get more hate...

Go home OP, you’re drunk.

And give us your keys, you’ve had too much minimalism to drive.

SpicyLizards , in What it's like to be a developer in 2024

This thing in quotes?
Searching for not that! Did you mean that? Okay, here’s nothing.

morbidcactus , in What it's like to be a developer in 2024

Interestingly, bing of all things turns up better results than Google with the same search terms, first 3 blocks are “popular results”, first is tutorial sites, second is w3 schools and third takes you to the current docs for functions and operators.

If you ignore those, the fourth result takes you to the current docs for comparison functions and operators. I’d prefer it taking you right to the official docs on the first result, but comparatively acceptable. It was memed to death but I’ve seriously found it more useful than Google these days, comparable to ddg’s results.

brisk ,

DuckDuckGo uses Bing’s results

morbidcactus ,

Did not know that, for some reason I thought it was (or at one time was) based on Google’s

victorz ,
jnk ,

If you’re going through that route, SearX beats everything and it’s not even close. It’s self hosted and takes search results from any engine you check in a config, different config for search categories, … Rn I’m mostly getting results from brave, qwant, and duckduck. Gotta acknowledge the bing copilot tho, it’s pretty decent, but requires to use edge or bing app in android, so i only use it when I’m lazy or I’m searching for something too obscure for searx.

Vilian ,

SearX

i hate that name lol

ObsidianNebula ,

I’ve used Bing for a few years for the free rewards points and purchase rebates, and it has worked very well for me when it comes to normal searches including searches for software development. I very rarely have to turn to Google when trying to look something up, and as you mentioned, sometimes Google honestly gives me worse results. I will say however that I have found the image and video search on Bing to be significantly worse than Google’s (which I already have some issues with). Not sure about the other search types like shopping or news since I never use them.

morbidcactus ,

I have a half thought that maybe bing works well for technical searches because it’s the default search engine for edge and depending on the company, you may or may not be able to use a different browser and I’ll be real, I tend to leave my work laptop setting as default as possible unless particularly awful.

Vilian ,

i read something a few years ago, that it was better, because bing don’t have many users, so they couldn’t rely on AI, and because everyone was using google, sites didn’t optimize for bing SEO, not sure how much time it has, with microsoft obsession with AI

armchair_progamer , (edited ) in A real chicken-and-egg situation

C++’s mascot is an obese sick rat with a missing foot*, because it has 1000+ line compiler errors (the stress makes you overeat and damages your immune system) and footguns.

EDIT: Source (I didn’t make up the C++ part)

https://i.imgur.com/RkD4juc.png

https://media3.locals.com/images/posts/2024-01-10/102127/102127_99yfyumtxc53rd4_custom.jpeg

Ephera , in Let's do micro service

One of our customers recently had tasked us with building a microservices thing. And I already thought that was kind of bullshit, because they had only vague plans for actually scaling it, but you know, let’s just start the project, figure out what the requirements really are and then recommend a more fitting architecture.

Well, that was 3 months ago. We were working on it with 2 people. Then at the end of last month, they suddenly asked us to “pause” work, because their budget situation was dire (I assume, they had to re-allocate budget to other things).

And like, fair enough, they’re free to waste their money as they want. But just why would you start a microservice project, if you can’t even secure funding for it for more than a few months?

Potatos_are_not_friends ,

Because some marketing asshole told them that they better be prepared to scale to a bazillion users.

Ephera ,

In this case, the colleague who had talked to the customers told me, they wanted microservices, because they’d have different target systems which would need differing behavior in places.

So, I’m guessing, what they really needed is:

  • a configuration file,
  • maybe a plugin mechanism, and
  • a software engineer to look at it and tell them the behavior is actually quite similar.
JCreazy , in Any Volunteers

As a person that has a lot of ideas and no coding or art knowledge, it sucks because I know I can’t expect someone else to do it for me and I don’t have the time or mental capacity to learn. I guess I can just have AI do it for me now /s

CaptDust , (edited )

I envy you in some ways, recognizing your limits is something I wish I would have done. I came from a coding background, spent like 2 years learning unity, then eventually realized much of the cool stuff for games happen on the art side. So I learned blender… the whole pipeline- modeling, sculpting, materials, animations, each piece had it’s own challenges and quirks.

It’s been like 15 years since I started, I still haven’t released a game… but I do have a collection of neat prototypes that no one has played. I often wonder if I’ve wasted my time with the whole thing. If I could go back, I’d choose one niche, specialize in it and find a team to collaborate with, but there are trade offs with that too like giving up a lot of creative control.

Asafum ,

I think it’s probably better to have taken action as you’ve learned a lot, people like the person you replied to and myself “know” our limitations but then we don’t do anything so you’re 15 years more advanced in your knowledge and I’m 15 years stagnant no better than I was from the start.

CaptDust ,

Yes this is what I tell myself to keep from going insane, I learned a lot. Unfortunately the majority of these skills I’ve acquired are not applicable to “pay the bills” work. By trade, I’m still building web forms and streamlining internal business processes - what would it look like I spent those years on perfecting that craft instead? What if I didn’t block out my evenings and sacrifice time with friends and family? Life is always a series of trade-offs, I suppose.

Sotuanduso ,

Hey buddy, your value is not what capitalists are willing to pay for your time.

MonkeMischief ,

FACTS.

Some days it’s harder to remind yourself of this than others. Thank you.

CancerMancer ,

In an ideal world we’d all be encouraged to take on creative pursuits and have the ability to do so, rather than feel guilty for them. Maybe someday, right?

JokeDeity ,

Do you have the prototypes hosted anywhere?

CaptDust ,

Nah, call it a mental block or creative fear or whatever, but publishing is an open invitation for criticism and negative feedback. If I’m crossing into that, I feel a need for it to at least be a complete package I’m presenting. This is just my experience, most devs will advise you to get your work in front of an audience as soon as possible and iterate quickly.

pearsaltchocolatebar ,

If you enjoyed the process, you didn’t waste your time.

A hobby doesn’t have to produce a commercial product.

CancerMancer ,

Stopped myself before I got in as far as you but realized my roadblock is art. I can’t solve this one: I lack the creativity and patience to do the art, and naturally nobody will ever work for free, nor should they.

I wasn’t really sure how to proceed so I started studying for various tech and cloud certs instead. Might as well put my skills to use somewhere.

CaptDust ,

Heh I can relate, a proper artist - someone with a creative mind and vision - will still run circles around me. I often rely on references and “copying” previous work. I also never learned to draw, instead jumping straight into 3d modeling. Drawing is basically the quickest way to experiment with concepts and designs and that knowledge gap has become a glaring issue over time. There’s no “fix”, just 10,000 more hours of practice…

ramble81 ,

You can have someone else do it for you. You just need the money. Give yourself Executive Producer credits, tell them your vision and pay them to make it happen.

Hazzia ,

Wait people actually have money? i thought that was a myth

MonkeMischief ,

And that’s how we (eventually) got Kingdom of Amalur!

<a href="">https://en.m.wikipedia.org/wiki/38_Studios</a>

Sure would’ve gone a lot smoother if moneybags knew jack about making games though, that’s for sure.

I believe I read this story in detail in “Blood, Sweat, and a Pixels” and it was exceedingly painful.

notapantsday ,

Same here, I have one idea for a simple 2D game that I would like to make just so it exists. I even got myself Unity (before they stopped being cool) and tried to do some tutorials, but I just don’t have what it takes.

dat_fast_boi ,

If you still want to make the game despite that, I’d recommend watching some of Pirate Software’s youtube shorts for motivation. He’s got some great gamedev advice.

This one that he uploaded today feels relevant: youtube.com/shorts/TBxhiw-Hpxc

I’ll hold myself back from sharing more for now, in case you don’t care. And also because it’s 3 am.

steersman2484 , in Added Bugs to Keep my job

Squash me later

Assman ,
@Assman@sh.itjust.works avatar

My commit messages have gotten extremely lazy since I start squashing all my commits down to one. I just describe the PR on the first commit message and write nonsense in all the others.

grrgyle ,

I’ve been adding the commit shas + messages to the final description, if anyone wants to see my exploratory work.

xmunk ,

I know that if you are on the local repository where the commits were originally created they’ll remain accessible through recovery methods but AFAIK orphaned commits aren’t synced to other machines.

grrgyle ,

That’s correct. This is for work, which uses GitHub. The dangling commits remain accessible via their sha through the web ui, so I can link them in the PR description. I don’t put them in the actual commit message.

I think these are garbage collected eventually, but no idea on cadence. It’s long, anyway.

feedmecontent , in I realised this today

Nobody can see this -> some people can see this -> anybody can see this

miridius OP ,

Perfectly described!

krewjew , in Some of my iterations are delightfully recursive

I’ve been learning Haskell, and now I won’t shut up about Haskell

affiliate ,

what’s the appeal of haskell? (this is a genuine question.) i’ve been a bit curious about it for a while but haven’t really found the motivation to take a closer look at it.

pkill , (edited )

purely functional paradigm (immutable data structures and no shared state, which is great for e.g. concurrency) and advanced type system (for example you could have linear types that can be only used once). Lisps build on the premise that everything is data, leaving little room for bloated data structures or tight coupling with call chains that are hard to maintain or test. In Haskell on the other hand, everything is a computation, hence why writing it feels more like writing mathematical equations than computer programs somehow. It might, along Scala be good for data-driven applications.
Also the purely functional syntax means that on average, functional programming languages will arrive at the same solution in approx. 4 times less LOC than procedural/OO according to some research. Just look at solutions to competetive programming problems.
And even though I’m not a big fan of opinionated frameworks, compare some Phoenix codebase to a Symfony or even a Rails one to see how much cleaner the code is.

But if you’re new to FP you should rather pick Scheme, Elixir or Clojure since the paradigm itself can be a little bit hard enough to wrap your head around at first (though Elixir and is a bit imperative, depends on how deep are you ready to dive in), not to mention having to learn about ADTs and category theory.

krewjew ,

My favorite feature is how currying is applied literally everywhere. You can take any function that accepts 2 args, pass in a single arg and return a new function that accepts one arg and produces the result. In Haskell, this is handled automatically. Once you wrap your head around using partially applied and fully saturated functions you can really start to see the power behind languages like Haskell

CanadaPlus ,

It’s been noted that functional code accumulates less bugs, because there’s no way to accidentally change something important somewhere else, and Haskell is the standard for functional languages. Also, it might just be me, but the type system also feels perfect when I use it. Like, my math intuition says there’s no better way to describe a function; it’s showing the logic to me directly.

Where Haskell is weak is when interactivity - either with the real world or with other components - comes up. You can do it, but it really feels like you’re writing normal imperative code, and then just squirreling it away in a monad. It’s also slower than the mid-level languages. That being said, if I need to quickly generate some data, Haskell is my no-questions go to. Usually I can do it in one or two lines.

victorz ,

Out of curiosity, what kind of data do you generate with Haskell? And would be willing to show an example of a one or two liner that generates the data? 🙏

CanadaPlus , (edited )

Uh, let’s look at my GHCi history…

It looks like I was last searching for 12-member sets of permutations of 7 which come close to generating every possible permutation of seven elements, as well as meeting a few other criteria, for an electronics project. It ended up being more like 10 lines plus comments, though, plus a big table generated by GAP, which I formatted into a Haskell list using probably a line of Haskell plus file loading.

Unfortunately for providing code, me playing with the finished algorithm has eaten up my whole 100 lines of history. So, here’s a two-liner I posted on Lemmy before, that implements a feed-forward neural net. It’s not exactly what you asked for, but it gives you an idea.


<span style="color:#323232;">layer layerInput layerWeights = map relu $ map sum $ map (zipWith (*) layerInput) layerWeights
</span><span style="color:#323232;">
</span><span style="color:#323232;">foldl layer modelInput modelWeights
</span>

In practice, you might also need to define relu in another line:

relu x = if x > 0 then x else 0

Edit: No wait, I think that was a different problem related to the same project. There’s another module attached that generates all permutations of n items. After breaking it up so it’s a bit less write-only:


<span style="color:#323232;">allPermutations :: Int -> [[Int]]
</span><span style="color:#323232;">allPermutations 1 = [[0]]
</span><span style="color:#323232;">allPermutations n = concat $ map (addItem $ allPermutations (n-1) ) [0..(n-1)]
</span><span style="color:#323232;">
</span><span style="color:#323232;">addItem :: [[Int]]  -> Int -> [[Int]]
</span><span style="color:#323232;">addItem old new = map (y -> new : map (fitAround new) y) old
</span><span style="color:#323232;">
</span><span style="color:#323232;">fitAround :: Int -> Int -> Int
</span><span style="color:#323232;">fitAround n y
</span><span style="color:#323232;">	| y >= n	= y+1
</span><span style="color:#323232;">	| otherwise	= y
</span>
victorz ,

Cool! Thank you for sharing!

I just recently read the man page for GNU Parallel, and that seems like a pretty nifty tool to generate permutations of data as well. It’s command-line so great for scripts, utilizes many cores, quick to do without mind-bending Haskell project setup, etc…, for anyone interested. 🙂👍

CanadaPlus ,

I’ll look into it, although this probably wasn’t directed at me. GHC can compile multi-threaded, and “setup” here was just opening GHCi and starting, and then moving it into files once it got large enough I didn’t want to repeat the work, so I’m happy.

victorz ,

I still haven’t been able to learn project setup with Haskell and know exactly what I’m doing lol. But I’m glad you have a working setup! But yeah, do look into parallel if you want, maybe it can prove useful, or not. It was directed at you, considering your use case of generating permutations. :-)

Take care!

victorz ,

BTW: I think you need to put the “```” on separate lines.

test


<span style="color:#323232;">test
</span>

Edit: huh, nope, that had no difference in effect for me. Wonder why your code doesn’t render for me…

CanadaPlus ,

Which frontend are you on? I’m using lemmy-ui (the default webapp) and it renders fine, not sure how to find which version.

victorz ,

I was using Sync for Lemmy when your comment didn’t render properly. No idea why. Especially since my own comments were rendering fine. 🤷‍♂️

CanadaPlus ,

I’d guess it has to do with the specific symbols I was using, and there’s a bug in rendering of markdown in Sync.

victorz ,

Maybe so!

victorz ,

I learned some Haskell. Did some problems on Advent of Code and such. But since then I’ve heard about OCaml, which seems super interesting. Hopefully the tooling is simpler, but I’ve not had time to try anything yet.

Does anybody have any experience with it?

owsei ,

Im pretty sure tsoding has some videos with it

victorz ,

I’ll check it out, thank you very much! I approximate it a lot. 🙂🙏👍

BassaForte , in You wouldn’t get it
@BassaForte@lemmy.world avatar

public Joke Joke { private get; set; }

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