/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

blog.jle.im/entry/streaming-huffman-compression-in-haskell-part-1-trees
en.cppreference.com/w/cpp/language/copy_initialization
youtu.be/q9jB9lHjHc0
twitter.com/NSFWRedditVideo

Cirst for F.

Second for Python is a kino language!

Cecond for S

Rewriting the Apple EULA in Rust for great social justice!

Reminder that the movements of a Rubik's cube forms a group
Reminder that probability distributions form a monad

>muh "moan ads"

Movements of a Rubik's cube is isomorphic to the symmetry group of N = 3 lattice (Z_N)^3 and probability distributions form a sigma algebra.

the monad as interpreted by functional programmers is the ultimate embedding of imperative programming within functional programming and represents the pinnacle of 20th century programming innovation, uniting imperative programming, type theory, category theory, first class functions, custom data types, procedural and imperative concepts along with continuations and the lambda calculus to perfect the concept of the pure typed programming language. it is the cherry on top of the proof within the pudding that functional programming is strictly superior to imperative programming.

philistine memesters need not reply

I wanna create a program that can predict the price of a stock with 99.9999...% accuracy. How can I achieve this?

>monads.png
>muh "moan ads"

>the lambda calculus
>muh "lamb duhs"

Predict historical stocks but be wrong .......0001% of the time

When (move) returning an object from a method, is it better to return a rvalue reference, or return by value? i.e.:

Thing get() {
return std::move(thing);
}

...

Thing thing = foo.get();


VS

Thing &&get() {
return thing;
}

...

Thing thing = foo.get();


I'm aware that the first one would use RTO (or not?), but what is really the difference between the two? should I be using the first or the second?

write a true ai. trivial

We are making a web browser! You are welcome to join!

>philistine memesters need not reply

By value. Rval refs are meant for soon-to-be-expiring values, not for returning from functions.

>it is the cherry on top of the proof within the pudding that functional programming is strictly superior to imperative programming.
all this and yet functional programming STILL cannot go fast

a true ai would be shit at this task
"so what is the stock price"
"daddy i'm bored can we play chess"

What I'm worried about is extraneous moves, though.
The first one looks like it moves thing twice.

Step 1:
>learn martingale theory
>learn theory of StDEs
>develop a stock model with infinite degrees of freedom that covers all possibilities
Step 2:
>learn quantum computing
>learn condensed matter
>create protected qubits
>invent quantum computing language
>implement the above stock model in a quantum neural network
>the quantum algorithm learns from stock history and weights all probabilities accordingly
>wait
Step 3:
>become slave to robot overlords

>i need C++ performance for video games!
This is an 18+ website

>probability distributions form a monad
R needs an overhaul
Where's Q, language for statistical computing, also without the dumb RAM issues R has, and also severing compatibility with S and R for a clean beginning

Do NOT call std::move when returning by value unless your compiler's retarded (*cough* VC++), because that inhibits RVO. As for &&, it is primarily meant for expiring parameters, using them to return references is pointless.

OK, i don't know how to program. Where to i start.

std::move does not mean "move this thing".
It means "treat this thing as movable".
Only one move occurs.

Try working in lossless compression with any functional language.

Start by killing yourself.

I saw a numberphile or computerphile episode on random numbers. They generated a truly random number by somehow using measuring hits of an electron shot out of something. Would it be possible to make these "hits" public so that everyone could use them, I mean instead of using UNIX time as the seed, use these electron hits.

blog.jle.im/entry/streaming-huffman-compression-in-haskell-part-1-trees

std::move and std::forward are just casts, they don't really move anything. std::move casts to rvalue unconditionally, std::forward may or may not perform the cast.

>he has not written a kernel
>he does not write software for his kernel he has written
This is an 18+ website

google "how to program", learn to be resourceful, self-sufficient, motivated and disciplined (ie. once you pick a learning resource, stick to it)

But I'm returning a member variable, not a value created in the get function. So RVO wouldn't be applicable here wouldn't it?

I know that, but the function returns by value, so it looks like it moves thing into the return value, and then the return value is moved into the new thing at the call site.
Two moves.

>the only reason to want speed and performance is games
Hello brainlet.

Is that image written in freaking Chinese or something? What the heck.

>it's not about games dude xD *goes back to playing 2humst'd've*

>2humst'd've*
Lmao bish whet

much easier and faster to calculate UNIX time I'd imagine, unless computers start shipping with some kind of device capable of accurate and precise electron measurement like you're describing (just speculating, I'm out of my element)

not him but
>2humst'd've
what the fuck is this supposed to be

...

>But I'm returning a member variable, not a value created in the get function. So RVO wouldn't be applicable here wouldn't it?

This is why posting your full code listing is important.

Anyway, if you want to really understand the rules of C++ initialization, you have your work cut out for you:

en.cppreference.com/w/cpp/language/copy_initialization

Anyone here worked with critical systems?

I was thinking of something similar to operating systems referencing a time server, which references atoms cycles, or something like that. So what could happen is that in some building there is a device that captures data milliseconds at a time, and that data is uploaded to a server which other computers can reference as a seed.

oh for fuck sake
it's called toe hoe you literal trash

also:
>even fucking plays toe hoe
literally get out

Nobody here has ever worked on anything important

>>i need C++ performance for video games!
the current state of freetards

I can't see how that would be "better" than calculating UNIX time, especially since now you've involved an outside connection

So, I made a small class to keep server info in strings, such as name, address, site.

Trying to put that information into an object and save each object in a list.

Anyone one of you fine Sup Forumsentlemen know how to extract letsay, the name of a specific item from an object which is in a list?

Its starting to irritate me now.

Server s;
List serverList1;

in function:

s = new Server(servName, address, site);
serverList1 = new List();

Object value = serverList1[0];
var names = value.???????????????


Ya, Im shit at code...

No, it's taw haw in Queen's English

Because the method I've suggested is truly random since it uses quantum states of electrons, something that is totally unpredictable!

it's pronounced tou hou (teoh hoh)

Use a List instead of a plain Object.
Let value be of the type Server instead of the type Object. That way you know it contains whichever variable you're trying to obtain from it.

I could possibly agree with you if you were proposing computers come with a device which did this measurement locally, otherwise I foresee problems

Thank you based user.

>those who seek to misle others will themselves become misled

It's pronounced とうほう you fucking retards.

.cxx > .cpp > .c++ > .cc

Oh buzz off, you beanhead. I say what I want and I don't give a darn. If you don't like it, you can take a hike, pal.

Practicality aside:
What if the server receives requests from 2 programs simultaneously?
What if the server gives 2 or more programs the same RNG data?
How would you implement uniform distributions? Every electron has their own wavefunctions and these wafefunctions are never uniform due to constant functions not being L^\infty.
If the same setup is used over and over again in the server (i.e. the same electron wavefunction keeps being sampled) then there will be patterns in the distribution of the distributions of the RNs given out by the server. If this happens then the electron's Schrodinger's equation can be created such that the RNG would become just another quantum sim.

>/maJ'zəl/ - to mislead

If it receives two requests at the same time, which would be rare then the computers would be placed in a queue. This would likely only result in a negligible delay.

>he spent time on this

You might think is joking but really he's not.

circuits: math without the drudgery of thinking
machine language: circuits without the drudgery of manually building and reconfiguring them
assembly: machine language without the drudgery of punching a lot of holes and/or unplugging and replugging pipes
c: assembly without the drudgery of manually managing registers, memory reads and writes, and the stack
c++: c without the drudgery of frequently casting things and manually keeping track of types in data structures
java: c++ without the drudgery of manually managing memory allocation and deallocation
everything else: java without the drudgery of always organizing everything into classes

import god

print(god.answer('What is the meaning of life'))


What would it output?

haskell!

lol

"error: missing question mark inserted at line 3."

This is truly a step I wish I hadn't missed

I never get what the cross is about.

>java: c++ without the drudgery of manually managing memory allocation and deallocation
You're a fucking idiot.

Error: There is as yet insufficient data for a meaningful answer.

It's supposed to be the reticle of a distant firearm.

>math
Math is clearly the most high level thing.
Why did you out that at the bottom?
>the test of the post
Oh. You're retarded.

I've never seen that on firearms, thanks.

Does anyone else listen to classical music whilst programming?

I only listen to the hardest of metal
youtu.be/q9jB9lHjHc0

i listen to synthpop

In addition to optimizing my algorithms, I would like to optimize my brain's performance. Aside from getting at least 8 hours of sleep, eating a balanced diet, and using a stimulant (caffeine, etc.), what else can I do?

Exercise, scheduled down-time (no coding, no thinking about anything related to development)

Does meditation work?

Stimulants are not good for you, you should not be using them if you're getting a good amount of sleep.

Ballmer peak

Cx

i don't really listen to it
i write it during downtime to pass the time

Does anyone here have any experience in building ATS/Postiats for Cygwin? Their website says it's compatible, but it won't link, even when compiling with -D_ATS_NGC
Plus AFAIK alloca isn't implemented in Cygwin

cygwin is a special hell i would wish on noone

Forgot pic
At least it has some support for fcntl(), unlike MinGW

New to programming here, should I start with C first? If so, any recommendations for books etc?

Start with something more abstract so you don't get frustrated with programming. Then use C.

No, C is actually a good first language.

Wrong. C++ is a great first language. So is Javascript.

Don't use caffeine consistently. It gives, but it also takes in roughly equal measure. See the avenues your mind goes down without it.

I recommend cocoa beans, or a high quality chocolate bar. As well as phenibut or kava. Ethanol can also be useful, and not even in a Ballmer peak kind of way. My programming is just as solid while drunk, until apathy or laying on the floor spinning and eventually puking, overtakes me. Drink a clean alcohol like vodka. Not beer or whisky, which are full of other psychoactive compounds like hordenine.

> C++
> Great first language

wut

> Javascript

>when a book is 1200 pages long and has maybe a solid 10 pages worth of actual information in it

...

C is a good way to start. Then learn OCaml or Rust as your second language.

C++ is not a great language of anything. Stop pushing that abomination that killed programming.

Start with C++. You'll learn some aspects of C simultaneously as you view projects written in both, deal with null terminated strings, functions like memcpy, etc. Learn C more fully if you decide it's worth it.

A scripting language might be good to learn first as well, as long as you're not a moron that thinks things are happening magically and therefore mindlessly writes inefficient junk. The first "language" I learned was batch, and I came to write very complex scripts and optimize the hell out of them because despite not knowing the implementation details of the interpreter and supplmentary programs, I still thought about it mechanically. Always consider the means.

Also, read about how computer memory and cpu caches work. Possibly the single most important thing you'll ever learn. If anyone remembers the name of that guide, I'd appreciate it as well.