/dpt/ - Daily Programming Thread

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

Attached: 75933779_p0.jpg (764x1087, 443K)

Other urls found in this thread:

godbolt.org/z/I7uwzg
pastebin.com/HF9H0WZt
twitter.com/NSFWRedditVideo

C++!

Attached: 1545621660568.jpg (532x800, 308K)

I've never finished ANY project.

Bioinformatics with python, R and some matlab.

how do I read faster, I don't wanna spend hours on mere 20 pages like I do now

Attached: 1564988972369.gif (498x427, 2.72M)

Learning rust. I want to call a mutable method of a mutable object in parallel multiple times.
I know for sure that it is safe because the calls will mutate different fields. Yet rust doesn't allow multiple mutable borrows.
Is there a way around?

The only thing you can do is get separate mutable references to those fields.

>It's a science degree but the major is computer science.

Attached: 'computer' 'science'.gif (320x240, 2.42M)

yes, not using rust.

Implementing an ASCII image loader for a rougelike I am working on because I'd rather see artwork i cant produce in my game now than producing actual game play.

If it's a technical book they should have the decency to say the gist of the chapter in the first paragraph, so you can read that then look at the code if you're in a hurry. If it's a normal book just read them on mass and eventually you'll read faster.

Any of you niggers has any idea about
the performance of numsharp with respect
to normal for loops?

I-is that one of t-those buttplug t-tails?

you're the one doing the reading. if you're distracted, fix that. if you go off on tangents, note them so that you can back to them later. if you spend too much time working on examples--why? look into that. if you're reading at a normal speed and this is how much time it takes you, just keep doing it. read more pages instead of wasting time asking about how to read faster.

>numsharp
this is neat.
>performance
numpy makes use of opencv iirc but it seems numsharp uses System.Numerics, System.Drawing, and unsafe code.
perhaps it balances out with numpy targeting CPython.

Jow Forums what's the best way to get into programming, without any schools and only learning by yourself?

time and motivation.

literally pick something to write and write it.

Any recommendations what to start with?

Is there something specific you want to do, or just something generic?

C++ i dont fucking know

write an x86 simulator

C# might be more beginner friendly.

C# belongs in the garbage bin

I have many game concepts that I'd like to try out in a simple 2d top-down version, where certain mechanics are tried out.
Is PyGame the thing to use for Python?

I'm desperate enough to consider Unity as I just want to try things out.

I'm learning Scala in order to play around with Apache Spark.
It's been a while since I've used the JVM, and frankly I haven't missed it.

dont use python its slow as shit

lua + love2d is the simplest and fastest and most lightweight you will get for simple 2d prototypes

C# or Python. Perhaps JavaScript if you want to make website frontend (yuck)

Make a calculator. That’s usually a good first project when starting out from scratch

what do I skip?

Attached: SumatraPDF_2019-08-16_11-47-48.jpg (314x879, 101K)

Read Part1 and do some basic stuff: the above mentioned calculator, maybe do a hangman game, basic things like that. then you can move on to OO (part 2 and 3 ) and maybe do a simple chess game where the pieces are objects. Templates are useful but they can be a rabbit hole. For now you can live without Part 4.

I don't need speed for testing out concepts in a prototype.

thank you. I'll look into this.

use unicode_segmentation::UnicodeSegmentation;

pub fn rev(s: &'static str) -> String {
s.graphemes(true).rev().flat_map(|g| g.chars()).collect()
}


fn main() {
let word = "mañana mañana";
println!("{}", word);
println!("{}", rev(word));
}


mañana mañana
anañam anañam

python is fine as long as you use libs who just call stuff written in C like numpy, Tensorflow and such.

Just don't write too much of anything in pure Python and you'll be fine, I learned that the hard way when I tried to make a Fire Emblem clone for a uni project

Move on with your life already it's been three days now.

if it's hard and new, then that's not too slow

>collect()
yikes

I'm only fishing for ctards for fun atm

enjoy your vacation then.

what's so bad about that?

Thank you all, for your help! Greatly appreciate it!

Electromagnetic.

Attached: 7.png (121x200, 9K)

I WANT TO MARRY NENECCHI!!!

Kindly wait for your turn.

Attached: 24.png (169x202, 12K)

dunno, the fact it exists or the fact that it is needed

Anime, faggotry, homosexuality and pedophilia are correlated. These are the signs of a beta male.

in python3 is there any way to pass a variable to the key option in sorted()? specifically I'm trying to do this without success so far:
sort_method = lambda x: (self.copies[x], self.cards[x])
...
def sort(self):
sorted_indexes = sorted(range(len(self.copies)), key = self.sort_method, reverse=True)

It's needed because of the laziness

It's needed because of the lack of HKTs.

Academic wankery is not useful.

>wankery is not useful
>.into_iter().collect().into_iter().collect()

nobody cares
retard

>a-a-academic wankery is not useful
.unwrap().collect().iter().unwrap().collect()

>wouldn't have to write .collect
>could have a mutable in-place version
>useless academic wankery

No one writes that
>unwrap()
is a bad way of ignoring possible errors, don't do that
>collect and then iter
ok normally you don't write that, you just iter
>unwrap
see above
>collect
makes sense to collect at the end of the statement.

Also, you are a degenerate anime watching pedo. Go to jail.

>mutable in-place
You also have mutable iterators but the BC imposes problems later down the road.

Trying to learn more about c++ template programming by playing with the assignments here.

Could someone look at my explode function from ?
What do you think about this? It's good at folding itself (assembly is basically printer call), but it looks quite messy:
godbolt.org/z/I7uwzg

Thank you

none of those would be needed if rust had a decent type system
in fact what is rust but a failed attempt at academic wankery

anime website
why don't you fuck off to reddit with your room temperature IQ
it's always the fucking redditfags who pollute ruin these threads with their completely retarded bullshit

Attached: 1548583523131.jpg (600x456, 29K)

pollute & ruin

Attached: 1549506261079.gif (500x281, 97K)

nice

personally i wouldn't choose anything with static typing as a first language. just another concept you need to get your head around before you can be productive. people shit on python but if nothing else it's a decent beginner language. wouldn't recommend anything beginning with C. javascript maybe.
personally i started with basic when i was like 12.

basic had static typing

Shouldn't this work if you make the sort_method part of the class instead of a free variable?

really? Thank you!

the variant i used was dynamic iirc.

depends on the school of thought... some people think it's important to understand basic concepts like pointers, types etc. before working on something. others think it's best to just get the student to write something. i personally believe it depends on the student - if you have a short attention span and are the kind of person that plays a game without reading the manual first, go with python. if you're a bit more diligent and thorough, go with C.

i also started learning with basic, then C++, then Java. didn't learn python until like 5 years ago.

you have to put $ to denote string types

i think with ranges it'd look less messy, that's mostly just because of C++ iterator stuff desu

it is part of the class

Yes but is it defined in the class the same way you posted in your original post?

at least for me the important part was learning how to program in the conceptual sense, the method of problem solving that is required. once i got that down the basic concepts were fairly easy. of course you're right that it depends on the person.

you win

>just another concept you need to get your head around before you can be productive.
types make you more productive, might as well not learn anything if everything is just another concept you need to get your head around before you can be productive

>types make you more productive
citation needed

>Could someone look at my explode function from ?
Completely useless, the args of explode and implode should only be known at the runtime.

Re-added ability to freely code shaders.

After I added the visual shader, there was no way to use code, which is gay.

Also, optimized the shit out of the default render pipeline.

Attached: code.webm (1280x720, 2.93M)

they literally write code for you
besides catching a whole family of bugs you'll never have to debug

types can arguably make a skilled programmer more productive. for a beginner it's just steepening the learning curve in my opinion. they can be brought in later once the student understands the abstract concepts like control flow etc etc.

>they literally write code for you
other way around
you have to write more code to give variables types

google did research. untyped languages are more productive at first, but after a year or two, they slow down considerably because of how hard it is to maintain them. that's why google developed golang as a python replacement, which they see as an easy to learn, simple, fast lang with types.

Why are you idiots talking like there are untyped languages apart from assembly?

once the student is at the top of the dunning-kruger curve like this user you mean?

you're a dumbass who has no idea what he's talking about
stop misleading people

that means types are more productive for big programs

no types or just one type, not much of a difference

Attached: 1563274649011.gif (450x450, 102K)

Most statically typed languages don't have type inference and you have to write them out

It's not needed at all or am I missing something?

use unicode_segmentation::UnicodeSegmentation;

pub fn rev(s: &'static str) -> impl Iterator {
s.graphemes(true).rev().flat_map(|g| g.chars())
}


fn main() {
let word = "mañana mañana";
println!("{}", word);
println!("{}", rev(word).collect::());
}

>-> impl Iterator
jesus christ

not sure who the dunning-kruger remark was directed at. i'm mostly i believe in using what's appropriate for a task. not a teacher or anything, just relaying my own experience.

rust was a mistake

I am on showing images, Jow Forums identifies me as a robot when accessing images, so I actually got them on some networks only, I will leave my source once again, view code click on the src img and verity

Attached: 4581.jpg (1200x630, 156K)

sorry about that, my OP was pretty poor at presenting my case, I didn't want to post something too involved
pastebin.com/HF9H0WZt
I had tried to define sort_method in the class variables

???
I can't tell if I'm retarded or you are. "impl " is just a shorthand for actually having to write out the concrete type. Which is useful since the type is cannot be written since each closure has a unique anonymous type.

Anyone else membering his first language?
I remember using the first blitz basic port to windows around 2000. Someone accidentally left a book about it in the kid section of the library. The librarian allowed me to use it on one of the library computers. Good times

i still use blitz basic today

Do you think I will be able to finish all of these until the end of the year?
>Tic-Tac-Toe (TUI, C++)
>Text-to-Speech (TUI, C++, GStreamer)
>Music visualizer (Xlib, pulseaudio)
>markdown to html converter (=library)
>html renderer (C, Xlib)
>pdf reader (C, Poppler)
>weather report (C, ncurses)
>client for one website (Python, ncurses)
>WM (C, Xlib)
>terminal emulator (C++, Xlib)
>file manager (C++, ncurses)
>image viewer (C, Xlib and maybe some other stuff too)
>compiler for a simple language i will invent (C)
>tetris (C++, SFML)
>simple calculator (multiple ASM)
>mail client (Python, ncurses)
I have good experience with all of these programming languages and even with most of the tools and libraries but not with creating any of the specific software mentioned above.

>syntax vomit is "shorthand"
that's enough rust for today

lmao
are you an aspie? like the real deal?
fascinating! do you also seethe when someone touches you like in the movies?

Attached: 1557366542190.jpg (1204x1339, 206K)

How would you write this out in your preferred language of choice?

perl5
nothing passionate

not if you're a beginner

big meaning larger than 1 file, yes

Care to post en.json as well? Also are you sure you want to reference card_data and not card_lib in the sort callback?

fn rev(s : String)-> String