- 0 Posts
- 15 Comments
oessessnex@programming.devto
Ask Lemmy@lemmy.world•{Series and Serious} 1/56. What do you feel [Anger] about? Why?
3·2 years agoPeople saying something factually incorrect and insisting on it.
oessessnex@programming.devto
Functional Programming@programming.dev•How to convert imperative side-effectful program to functional (in Ocaml)?
1·2 years agoThe way you can think of it is that in OCaml everything is implicitly wrapped in an IO monad. In Haskell the IO monad is explicit, so if a function returns something in IO you know it can perform input and output, in OCaml there is no way to tell just from the types. That means that in Haskell the code naturally stratifies into a part that does input and output and a pure core. In OCaml you can do the same thing, however it needs to be a conscious design decision.
oessessnex@programming.devto
Technology@lemmy.world•How do people find good information on the internet these days?English
1·3 years agodeleted by creator
oessessnex@programming.devto
Programming@programming.dev•Opinions on how to deal with duplicate code.
61·3 years agoThe implementations mostly don’t matter. The only thing that you need to get right are the interfaces.
oessessnex@programming.devto
Linux@programming.dev•Vim Wayland users: how do you bind CAPSLOCK to Escape?
21·3 years agoXKB config files work under sway without XWayland.
oessessnex@programming.devto
Linux@lemmy.ml•Fuck it, give me your most OVERRATED Distros
4·3 years agoWell, most people installing Arch for the first time have no idea what a typical Linux install does under the hood. That makes it a worthwhile learning experience. The same commands you use during the setup you can later use to fix or change things. It basically forces you to become a somewhat proficient Linux user.
oessessnex@programming.devto
Unixporn@lemmy.ml•Hey, we should all really stop using racist slang to refer to customozation
1·3 years agodeleted by creator
oessessnex@programming.devto
Asklemmy@lemmy.ml•Is it worth to buy a used phone from ebay?
31·3 years agoOn a phone with spyware installed that wouldn’t do anything. There are probably ways to get rid of it, but how can you be sure?
Nope. Monads enable you to redefine how statements work.
Let’s say you have a program and use an Error[T] data type which can either be Ok {Value: T} or Error:
var a = new Ok {Value = 1}; var b = foo(); return new Ok {Value = (a + b)};Each statement has the following form:
var a = expr; restYou first evaluate the “expr” part and bind/store the result in variable a, and evaluate the “rest” of the program.
You could represent the same thing using an anonymous function you evaluate right away:
(a => rest)(expr);In a normal statement you just pass the result of “expr” to the function directly. The monad allows you to redefine that part.
You instead write:
bind((a => rest), expr);Here “bind” redefines how the result of expr is passed to the anonymous function.
If you implement bind as:
B bind(Func[A, B] f, A result_expr) { return f(result_expr); }Then you get normal statements.
If you implement bind as:
Error[B] bind(Func[A, Error[B]] f, Error[A] result_expr) { switch (result_expr) { case Ok { Value: var a}: return f(a); case Error: return Error; } }You get statements with error handling.
So in an above example if the result of foo() is Error, the result of the statement is Error and the rest of the program is not evaluated. Otherwise, if the result of foo() is Ok {Value = 3}, you pass 3 to the rest of the program and you get a final result Ok {Value = 4}.
So the whole idea is that you hide the if Error part by redefining how the statements are interpreted.
oessessnex@programming.devto
Asklemmy@lemmy.ml•Which proprietary software do you prefer over their open-source alternatives, and why?
1·3 years agoYou can probably replace it with ImageMagick.
oessessnex@programming.devto
Programming@programming.dev•Why do they keep making new languages
281·3 years agoSome people consider working on programming languages fun, so they create new ones.
oessessnex@programming.devto
Learn Programming@programming.dev•*Permanently Deleted*English
1·3 years agoIf you want to make games, start with a text based adventure game, something like Zork. Learn as you go, you will need console IO and data structures to represent game state, puzzles, levels. Then make a 2D game. After that you will probably be proficient enough to make anything you want.
oessessnex@programming.devto
Asklemmy@lemmy.ml•I'm being harassed by mosquitoes, how do i kill them all?
14·3 years agoI usually kill them with my phone with the screen turned on (the background needs to be blueish and the room needs to be completely dark). For some reason they don’t see it, they just sit there until they get squashed.
This doesn’t work for tiger mosquitoes.
I randomly generated mine using a Markov model. It’s just pronounceable nonsense.
oessessnex@programming.devto
Programmer Humor@programming.dev•JavaScript always know my truest of desires
3·3 years agoTurn JavaScript into Bash with these easy steps…
oessessnex@programming.devto
Ask Experienced Devs@programming.dev•How do you self-teach yourself more complex software dev skills>English
1·3 years agoFirst focus on working on projects instead of improving your skills. The concepts you learn are usually a solution to some problem. Things are easier if you first encounter the problem yourself and then learn the solution, than if you do it in reverse. It is ok to do things poorly when you are starting out.
For a while 1 wasn’t considered to be a number either http://aleph0.clarku.edu/~djoyce/elements/bookVII/defVII1.html