/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1561379416333.png (1447x2047, 2.57M)

Other urls found in this thread:

youtu.be/lC5UWG5N8oY
en.wikipedia.org/wiki/Simple_DirectMedia_Layer
lazyfoo.net/tutorials/OpenGL/index.php
twitter.com/NSFWRedditGif

nth for spending way too long implementing, what should be a basic feature

you too huh?

Scheme!

nth for python and c++

My psychiatrist is a CS grad and is giving me a bunch of good resources.

Pretty cool.

Attached: 1563324280851.jpg (810x1158, 241K)

me three

Yuno is such a good girl

Challenge: Write a function "press" that takes in a String containing a sequence of mostly digits but sometimes symbols "pressed" and yields the corresponding text.
press("2") => "a"
press("22") => "b"
press("2222") => "2"
press("22222") => "a"
press("4#666") => "g.o"
press("33") => "e"
press("303") => "dd"
press("3003") => "d d"
press("1") => "1"
press("11") => "1"
press("66670044477770042999") => "op is gay"


pic related
key 0 and 1 are special, look at examples to see how to handle them
you can ignore the * key which causes capitalization of the next item, but bonus points to whoever includes that behavior

Attached: 2019-07-19-013032_412x262_scrot.png (412x262, 12K)

>psychiatrist
cringe

>has insect fever
checks out

I'd yuno Yuno's yunos, if yuno what I mean

(´・ω・`)

do your own work, Nokia.

get rid of the >s and this is valid haskell code defining a function that passes all the tests

This is easy
std::string_view press(std::string_view) {
return "Buy a smartphone you fucking luddite";
}

fuck you lol

Feels so fucking good to back to programming C/Java after dabbling in Lisp for a while. Fuck Lisp honestly that was painful.

How do I actually learn Haskell for practical purposes? I worked through Learn You A Haskell at some point a year or so ago but it felt more like mathematics than programming. I'm not sure how to take these things and actually apply them to making a program that does something useful.

which one?

Scheme to learn then Racket to actually do something. After I regain my sanity I'll probably try Haskell.

It was made to be a research platform. The code is very concise, which is perfect for journal articles. People should learn it so they can read them. But is it suitable for industrial usage? I wonder.

If you want to try a lisp that doesn't have decades of anachronistic baggage then try Clojure -- unless your main complaint was dynamic typing. In that case, head in Haskell's direction.

But I might add that you should study Haskell either way.

neat.
examples?

Anyone with experience writing dapps on ETH?

Does anyone seriously believe normies are going to download an eth wallet and PAY MONEY just to sign up, submit data, etc.?

I'd love to believe in a glorious decentralised future for the internet, but as it stands, only gambling and finance dapps seem to stand a chance at getting an initial userbase...

It wasn't the lack of static typing that was the problem. For me the problem was a highly subjective one... Let me explain.

I've dabbled with tons of languages. Usually I read the docs, solve a few simple problems like Project Euler, then try and build something useful or contribute to a project on GitHub to see how it works in practice.

I have NEVER "hated" a language, because it's usually pretty fun trying to solve problems with a new tool, even if that tool is difficult at first. But when it came to Lisp, the problem I had to solve wasn't the problem at hand, but the tool itself. Like why am I spending half my time trying to read what appears to be write-only Lisp code when in other languages it's much more intuitive? Why am I sitting there trying to figure out what's going on in this highly implicit line when the explicit equivalent would have taken 30 seconds to understand?

Maybe I'm just not used to functional programming and need a bit more time until it sinks in but I doubt this is the case because I am actually an avid user of functional style in other languages (where possible) but the Lisp syntax with all it's brackets and lambdas and prefix syntax gives me a headache when I'm trying to follow the logic of a large program.

I'd be interested to hear how your Haskell experience compares after you've tried it.

This fellow seems to think it has a lot of potential.
youtu.be/lC5UWG5N8oY
Arguably he's just looking at features of haskell that are good not the language as a whole. But it's an excellent presentation on where haskell fits in in terms of performance.
It's also very obvious he's a professor since everything is so clear.

This post >, heads up Jow Forums NSO is making the NSA happy again.

I'm not working on a project yet, I just came here to ask what is your personal best graphics api/lib/whatever to use in C? I looked up opengl but it's a bit confusing because most is about C++ and I haven't found a documentation that explains the process of adding opengl in a program

I think SDL is popular.
en.wikipedia.org/wiki/Simple_DirectMedia_Layer

>what to use
There's OpenGL, vulkan and directx
Vulkan and dx12 are giving you very low level access and aren't all that good for exploring graphics programming. It's a lot of busy work.
OpenGL and dx11 are the higher level graphics api you can be dealing with. Opengl is plagued by having had its core developed long ago but it's not that bad.
Dx11 is plagued by Microsoft (I haven't used it)
I'd go with opengl just so I could work on Linux.
>tutorials
lazyfoo.net/tutorials/OpenGL/index.php
I believe this is a C tutorial but I don't remember. It'll start with 2.1 and move to 3.0. It's slightly roundabout but I can see the educational benefits.
I think C tutorials can be hard to come by now. But most C++ tutorials that don't use glm or something like that are trivially translated to C.

I misunderstood the question. You should use something other than just opengl. SDL is fine.

no, you didn't misunderstand, that link you posted seems to be what I needed, thank you!

I'll also look at SDL, thanks!

Why the FUCK is the windows command processor terminal so FUCKING SHIT

because people use PowerShell or Bash instead

I’m at work doing work stuff. Just learned about MBIM so I’m gonna be implementing support for that in my little modem project.
Also I’m trying to help the people who are working on Serenity. It’s nice to have so many contributors lately, makes me feel less bad about not being able to work on it all day long myself :)

Lisps are generally multi-paradigm languages, where did this meme of them being exclusively functional come from?

Because it's dead, slow, operates on lists, and is a meme.

I hate memes.

Attached: Screen Shot 2019-06-16 at 10.34.45 pm.png (432x144, 26K)

No that's awfully generous.
It's because Microsoft doesn't care. It's virtually unchanged since XP and there weren't good options.

>if it has lists it's functional
really nigga?

>all that bloat just to reverse a string

It ain't even a string.

a fucking list then
don't be pedantic you nerd.

funny, but newer lisps have finally recognized THE POWER OF MAPS

Attached: data structures.jpg (728x546, 77K)

Maybe in 50 years they'll rediscover Lua

magit is so fucking slow on windows holy shit it's utter garbage
what's some neat git frontend for windows
>inb4 use svn

use the one in VSCode

I don't use vscode
I guess I could use the one in VStudio, but on non c++ projects it's kind of a pain to boot it just for VCS

brainlet here, what's the best language for a brainlet for server/backend tasks? go? python? php?

It isn't even a list of characters.

haskell

lol

I have switched from C++ to Rust.

>I have switched from C++ to Rust.
Have you switched from m to f?

C# or simply python scripts.

If you're not programming in C++ you're not programming.

good

Were the guys who wrote the first C++ compiler "programming" when they wrote it?

i too fell for the lisp meme

python can do everything lisp can do with as much elegance

wrong

No, of course not.
They were programming when they used the new compiler though.

prove it

Elegance doesn't exist in Python.

Lisp is the most powerful programming language.

python's arbitrary distinction between statements and expressions is terrible for writing elegant code
it becomes especially bad when you try to make a lambda

Implement a read macro in Python.

give me a concise solution to a problem written in lisp which exemplifies lisps elegance and i'll show you it can be done in a non-lisp language with as much elegance

I can't because Lisp is not an elegant language and nothing should ever be written in it.
This also applies to Python.

do you literally like anything?

I only like programming languages, so obviously not Lisp or Python.

I don't know Lisp, but I can't imagine an elaborate (But contrived) AST meta-generation example would be very elegant in Python

CUNNY!

I can only imagine the person behind this post is an overweight, nasally teenager who hasn't showered in a week.

Truer words were never spoken.

is there a lowlevel enough way to actually see your whole virtual memory and where are your program's variables actually saved?
why do programming languages do this automatically for us?

git CLI, you pussy.
Go was designed for making brainlets useful.

>who hasn't showered in a week.
Wrong, retard. I haven't showered in 3 weeks.

Hex dumps.

Because the tedium complexity has insane scaling once you get out of toy programs.
why would you want to do this?

Feel so cold having to use java. Lisp is the comfiest language of all time

>he can't do it because he's too much of a retard to handle the complexity

It's not about being a retard.
It's purely about time management.

>Hex dumps.
will need to read about those thanks
im just curious about how this is done
how does program/language chooses where is the memory that he can use which is,i assume, given by the OS
i mean it cant that whole memory is available right? i imagine it as being a continous block given to partcular piece of running software

Go is good. Arguably the best scripting language. Definetly the fastest.

this is wrong. go is obviously shit tier.

You should read about kernel memory allocation routines, paging, etc.

>scripting language
the meme is becoming trending

haha he's mad at a programming language

programming in general is not elegant. it's brute and primitive. real elegance is in abstract mathematical solutions. computer science is the bronze age tools of problem solving.

>programming language
He's clearly talking about Lisp.

>t. brainlet

Name a better scripting language.

Your operating system gives a program a virtual address space. It's exactly as specified in the binary image (that's why it's called an image) but more pages can be mapped in at runtime.

sure, you can always invent a new language, but people use lisps to avoid that.

are you going to get upset at my choice of words? you sound like it

you say that, but then i have a strong feeling you also have issues with functional programming.
But i also have a stronger feeling, you're just shitposting.

>grug program computer
>grug use lisp mean grug is big brain

People invent new languages to avoid Lisp.