/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 1554591587606.jpg (500x375, 54K)

Other urls found in this thread:

get.haskellstack.org/
pastebin.com/raw/GASE07wf
twitter.com/NSFWRedditGif

leetcode

nth for Nim!

The only purpose for using Haskell or Idris is because you are a contrarian and want to feel smug about yourself. Prove me wrong.

Protip: you can't

a winner right out of the gate

user just give it a try it is really fun. You could try ML or F# instead if you want to just start out.

>X has """"""""""native"""""""""" perfoemance
>X is """"""'"''as fast as C""""""""""
stop. nobody buys or cares about that shit at this point.

I tried Haskell, but gave up after I spent a day trying to get any of the hello world examples to even compile using ghc. It bitched about all sorts of things missing.

>install a compiler wrong
>wtf why isn't this working, this language is shit
love it.

If anything "as fast as C" is a red flag

This. C isn't fast.

Attached: 1534512304759.jpg (637x800, 75K)

Everyone knows C++ is the fastest language.

>What are you working on, Jow Forums?
trying not to be a total retard at programming

sweden?

>literally follow the haskell wiki step by step
>"you did it wrong"
I should have known better than expecting updated documentation from a community that literally consists of 150 people tops.

Of course

Attached: 1549638656431.jpg (715x1000, 143K)

haskell is Fun!

Norway, but yeah same timezone.

>needed a fucking wiki just install a compiler and run hello world
the absolute state of zoomers.

Reminder that all runtime logic errors in statically typed languages are due to the type system not being strong enough.

Attached: 1535334031354.jpg (1206x1890, 188K)

ghc literally breaks on homOS updates. this can only say so much about the language and its maintainers.

windows? havent tried haskell there. on linux just do
curl -sSL get.haskellstack.org/ | sh
stack new my-project
cd my-project
stack setup
stack build
stack exec my-project-exe

I got no idea what I wanna do after I finish my CS degree and I got no motivation to do any project
Should I try shrooms or lsd or something

>it's on the compiler devs to support every single OS out there
also is homOS supposed to be a joke?

I use it at work. Nice lang for stuff that's heavy on parsing. Using it at work to make a tool that merges a couple hex files and injects a checksum. Will be used to make images for some embedded devices that get flashed in the factory.

Is stack better than cabal? I tried cabal it was a clusterfuck.

Friendly reminder that Haskell fags are so delusional that they think a strong typing system makes programatically logical errors and algorithmic errors impossible.

Protip: static typing does not make you infallible programmers, except if the only program you ever made is a fizzbuzz.

I needed to refer to the documentation when the compiler didn't compile, yes.

Ubuntu

cute
i feel like the only place i'll ever get to speak to scandis is 4channel

Attached: b5d.png (601x353, 366K)

The point is programming becomes about designing good types instead of making it work correctly I think.

>you need to compile the compiler
The absolute state of haskell

yes, stack is the currently accepted haskell build tool

acid is fun, but you have to do it when you're in a good mood and with a friend to babysit.
both are fun to microdose

okay I will have to switch to that. In the meantime I need to focus on brushing up on C++ for job interviews.

you could download the binary but that wouldnt be very FOSS of you

...

@71084656
>[sufficiently stong] typing systems make logical errors and algorithmic errors impossible
This statement is provably true. Just think about it for a moment and even someone as stupid as you might see why that's the case.

Are you saying that the goal of Haskell is to remove focus from "making it work" to designing types, or are you saying that Haskell circlejerkers are so preoccupied with making types that they aren't making any actual useful programs?

I don't make a living on being FOSS

I tried that with apt install haskell-stack, but it didn't work. Hence why I referred to the wiki.

>provably true
proofs?

No I mean the goal is to make programming about designing types and functions that map those types to different types instead of about worrying whether a variable was set here and whether it got changed in that other procedure blah blah blah. It's not a bad goal in my opinion. Not sure that it will ever truly replace imperative though.

Left as an exercise. The proof actually trivially follows from the definitions and is a one-liner.

>This statement is provably true.
Prove it.

I agree that the goal is noble, but I'm unconvinced that they've actually achieved it.

>bla bla bla bla
proof?

>Access int in struct from a void function, print to file no problem, its all correct
>Access int in a struct from an int function, print to file, prints some massive fuck off number I can only assume is the address

Literally fucking why?
This makes no sense.

Attached: 1505321302619.png (657x720, 374K)

>Left as an exercise.
Nice try. You can't prove it, lol.

>making things more simple by making them more complicated
you use the term "worry" to describe picturing your own state as if that's a source of stress but the hoops you have to go through to write anything in Haskell aren't

see I'm not doing your homework for you. Try using your brain a little for a change.

how new r u? most ghc compiler devs use macos and so do the majority of haskellets. it is NOT fine to have the main implementation break on every minor OS update of the main supported OS.

How are we going to help you if you don't post code?

post code

I want to start leaning C. I used to do a bit of C# shit for a uni course that I dropped out of, so I'm not totally unfamiliar with programming.
What compiler should I use, and what guides do you recommend?

based

pastebin.com/raw/GASE07wf

vim, gdb, gcc. read the manpages and the quick rundown provided by gnu.

Eh it all depends. In theory though it is definitely cleaner to read a function like turn cucumber into pickles rather than give gregor a cucumber and he will give you a key and then you open a fridge with that key and now it has pickles in it.

I've gotten away with just doing random shit and looking at Stackoverflow questions for shit that I get stuck on.
Cppreference is also pretty good.

No, please explain it. I'm genuinely curious, and I know nothing about type theory, but you're just being rude, how am I supposed to learn anything?

Somebody please make me a logo for my game

Attached: screencast.webm (1600x900, 2.09M)

can someone recommend a good keyboard under 40 CAD?
Just looking for something that feels ok to use extensively and doesn't make much noise.

thats because you're describing two different operations, one more complex than the other

Real question Jow Forums -- is there any money to be made in developing apps for education?
I have an idea for an educational application that is so simple and useful that my mind is boggled at the fact no one has made it yet.

dumb frogposter

Maybe. I've never worked on a huge project that is written in Haskell. I have no idea if it is really easier in practice or not. But I would say that functional stuff is easier if used correctly with imperative for sure.

...

>compiler
GCC
>guide
if you want a book, K.N. King's C Programming: A Modern Approach. or K&R.
if you don't want a book, stackoverflow and fly by the seat of your pants.

>I've never worked on a huge project that is written in Haskell
The state of every Haskell programmer

How come clang still can't keep up with GCC's superior optimizations

I'm going to write myself something that will make me millions so that I can move to Chile and marry a Chilean girl. God I love them so much.

Attached: 1558471165609.jpg (715x1022, 245K)

I've only written a little Haskell. Mostly just following tutorials. I wouldn't say I'm a Haskell programmer...yet

I never took Python seriously but I fucking love it now. I tried back in the 2.7 days and it was kinda shitty. You can read more on my blog btw

I'm just being a dick. Don't mind me, user. Keep it up.

The basically fallacy here is that Haskell advocates pretend state is inherently bad and difficult to deal with. It CAN be bad if it abused, but you can abuse pure functions aswell, you can make a purely functional module that's terribly cumbersome to use and that's just as bad as a stateful module that has unpredictable behaviour based on what's happening behind the scenes

Don't worry, I like dicks.

>Python bad typing and slow
>Haskell good typing and fast

Attached: npc2.jpg (275x183, 6K)

Can somebody tell me about ML?
Is IO a pain to do in it?

just my weekly 2 lines of code to pretend I'm making some kind of progress
now I can do exceptions with python, it's something, maybe
I've made some game where you try and guess the random number the code comes up with

>how new r u? most ghc compiler devs use macos
nah, most haskell talks I see are people using linux with Vim.

Stop using Python

Attached: varg-b.jpg (640x962, 127K)

struct Thing1{
int x;
};

struct Thing2{
struct Thing1 xx;
};

struct Thing2 pp;

// (initialised in function so pp->xx.x = 1)


void f(struct Thing2 *tt){ // Called using f(&pp);
putInFile(tt->xx.x); // Puts 1 in the file
}

int ff(struct Thing2 *tt){ // Called using ff(&pp);
putInFile(tt->xx.x); // Puts address ?? into file
}

should be basically what I've done

I just finished a short C program that replicates the chinese iching.

Hey no I don't.

Show calls to f and ff, you're most likely pasing different things.

Show implementation of putInFile

>you can abuse pure functions aswell
What did she mean by this?

Attached: 1554050658439.gif (500x282, 539K)

I'm not even joking I literally copied the LOC that calls them and changed the function name, they pass the same thing in
putInFile just opens up a stream, fprintfs a string and an integer, closes stream

i'm not a fp dude but i envy you elm/haskell/*ML/idris fags. i wish i had a good type system.

Oh yeah I'm sure it's mathematically impossible to write a bad Haskell program

Attached: Screenshot_1.jpg (671x390, 43K)

Show the actual calls to f and ff. You're probably passing different things to those functions.

I'm just going to leave this here.

Prove it.

Prove it.

Attached: haskell.png (1328x1768, 237K)

then use them.

see

i dont feel like creating bindings for them so they are useless for me.

what languages do you use?

Python is a great lang for beginners.

Every Haskell program abuses arcane C UB under the hood, and since C is a bad language, every program compiled with GHC is a bad program.

>the parameter got changed by accident
It sure is fun being fucking autistic

Sorry for wasting your time user, but you did make me triple check over the code which I believe solved it

Attached: 1500732041890.jpg (600x600, 125K)

>Every Haskell program abuses arcane C UB under the hood
It doesn't compile to C

>Python is a great lang
Only for streetshitters. Not every beginner is one.