/dpt/ - Daily Programming Thread

Old thread: Lisp is the most powerful programming language.
What are you working on, Jow Forums?

Attached: lisp.png (2880x1800, 562K)

Other urls found in this thread:

arne-mertz.de/2016/11/trailing-return-types-everywhere/
chaiscript.com/
rust.godbolt.org/z/kuXQFy
github.com/git/git/blob/master/banned.h
twitter.com/SFWRedditGifs

Finally a dpt thread without an anime image.

i'll never understand what compels you mongs to go in the ocean and then complain about getting wet

First for RUST!

>no UTF-8

Wat do?
#include
#include

[[nodiscard]] auto main() -> int {
std::cout

I got mad at my employer recently and put a bug into production on purpose. Just woke up from a nightmare where my bug caused the entire system to crash costing the company millions in downtime.

Attached: 1497566914156.png (128x99, 21K)

auto main() -> int
What the fuck is the point of this syntax?
Why would I write that over just
int main()

I whole-heartedly agree.
Ergonomics is the key.

EWWW get that pre C++11 code away from me REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

sepples trying to emulate better languages and failing as usual

It's helpful when you are declaring template class and using the return type of the function

EXPLAIN TO ME WHAT IS THE PURPOSE. WHO THOUGHT THIS WAS OKAY WHEN ALL IT DID WAS ADD EXTRA KEYSTROKES!?!

You wouldn't do that in this case in any actual program unless you're autistic.

>guilt pains
>"heh, I'll get over it."
at this very moment, a coworker is noticing the bug and putting 2 and 2 together.
even if he doesn't report you right away, he'll never regard you as a professional again

template
auto foo(T x, T y) -> decltype(x + y)
{
return x + y;
}

arne-mertz.de/2016/11/trailing-return-types-everywhere/

It's an FP thing.
fun : type -> return type
or some langs let you do
fun : type (implicit return type
but ML based langs go from right to left, and C langs do the opposite. And since sepples can't break the original syntax, you now have redundant type declarations and syntax for the sake of """"""""""'modern""""""""" aesthetics

not him, but unless he's working at some startup full of autists, i doubt anyone would give a shit
most people i work with are the punch in, punch out type

can't you put the decltype thing in the normal return place?
genuine question, I've never used these things macros are comfier

left to right*

It relies on the argument values, so no, if you put it on the left side the x and y would be undeclared.

no because x and y aren't in scope. that's the point of trailing return types.
it doesn't literally rely on the values, don't give the wrong idea. also x and y needn't be the same type

>also x and y needn't be the same type
So it's for people who hate type safety and just want the compiler to decide?

no

I'm finishing up the sample problems in K&R C and then I'm going to write my own shell for shiggles while I apply for chemist and scientist jobs.

I'm currently writing a program that will delete all \t characters from a text stream and print the resulting text stream out to the console. I'm also trying to wrap my mind around encapsulating computations inside functions rather than writing lengthy spaghetti code. The former is quite difficult.

it takes practice like anything else
good luck user

Thanks user, my life sucks and I have no job. As it turns out, you still have to network, know the right people, and game ATS software even with an advanced degree.

at least you're not just sitting around
you'll get noticed eventually

>page 284/1399
please end me, I can't do this anymore

what book

Is gaming ATS software part of the screening process?

cpp primer

Basically, you need to write a custom resume and cover letter for every application. This can be as in depth or shallow as you think it needs to be. You have to be sure that you include likely keywords that the job posting lists. Let's say that I'm applying for a scientist I position and the posting says "X years experience in UV-Vis spectroscopy required". Well in one version of my resume, my summary just said "experienced in chemical analysis", but that encompasses many kinds of spectroscopy. That particular version of the resume would be rejected by ATS software. However, I spent several years doing UV-Vis and designing several of my own experiments using our Lambda 950 so I damn well know my UV-Vis spectroscopy. I'd need to specifically say that I have >= X years UV-Vis spec. experience or I'd be rejected by software before ever being seen by a human. I'd also likely specify what I did in detail (designing experiments to measure nanoparticle extinction coefficients in my case) in the cover letter.

If I'm looking at the right book, you're almost done with Part I: The Basics. I say you keep going.

yea, just a bunch of function nonsense for a bit and then finally the classes (the part I should've started at) and IO
don't think I'm gonna continue after that, I need to start writing some fucking code already

It was a joke but thank you for the explanation. I read every word.

Thanks, that makes me feel better.

Is LISP still used for AI, or is that mostly handled by Python, TensorFlow, and friends?

>Is LISP still used for AI
no

Go is actually a pretty good language and the fact that /dpt/ generally hates it is proof that most everyone here has never worked on a large software project with a team.

/dpt/ is actually a pretty good general and the fact you hate it is proof that you're a homosexual

there are some companies using clojure for AI

Is this much variance expected?

Attached: float.png (348x83, 13K)

There's at least one company using some obscure solution for an obscure problem, that doesn't mean shit.

>is X used
>yes
>no that company doesn't count
you retards are hilarious with this shit.

>%d
>float

I see you've yet to understand what a generalization is

based. i wonder what causes it to be a completely random variable with %d

Rolling

Attached: 1551587995540.png (3840x2160, 1.61M)

>number goes over 100
this shit really needs to get remade

it isn't random. assuming it's even the same size it's reinterpreting the float as an int, they have totally different bit patterns

>writing functions is hard
how did you get qualified for a chemist or scientist job?

only the shittiest jobs wind up on the internet. if you want to get serious you need to be out there talking to bosses and hiring managers face to face. think. you know at least one person with a job at a company you could work at. ask that person some questions.

Attached: done.jpg (3840x2160, 1.92M)

good job user

>no discard for the main function
fucking retard

>Yeah, I probably worded that poorly, this isn't a property unique to just Rust.
Ah, ok. This was my confusion.

>I imagine a similar mindset C++ programmer would have come to the same conclusion.
Yes, for example std::thread and std::unique_ptr are move-only types (they don't implement copy ctor). You can use std::move on them, which is default behaviour in Rust (and in some cases C++).

>Though from what I gather it looks like C++'s minmax implementation works on returning references? And I seem to remember C++ ownerships semantics are a bit weird right now?
I can't see the implementation atm and haven't ever used it. I'm guessing it doesn't implement any ownership semantics, as this was added to C++11. Not sure though.

I think what you are describing here ia basically C++ concepts. In C++, type can "accidentally" satisfy concept, where in Rust the type must explicitly satisfy trait AFAIK. This is good or bad, depends what you need.

Is arithmetic in the header of an openmp parallel for loop all done by the master thread?

>it's time for the wage cucks to go to work
>thread slows down to a crawl
really_makes_you_think.jpg

ah yes, where would /dpt/ be without a million "my job sucks" and "which language should i learn to find a job" posts

>it isn't random
but the values different each time? based on rounding errors or something?

fuck you i want a job

what do you get for sizeof(int) and sizeof(float)

Great space savings converting it to jpg

>rust is "blazingly fast" according to the website
>it has array bounds checking at runtime
explain this, rustfags.

-1904905064
-349490592
-349490592
-349490592

The size of balling as a d is 4
The size of balling as a d is 4
The size of balling as a d is 4
The size of balling as a d is 4
The size of balling as an f is 0.000000

blazingly fast, like a melting candle

OH NO RUST BROS WE GOT TOO COCKY

>rust
>cocky
excuse me but in the rust community you're supposed to follow the CoCk and call it a girlpenis

After a few days of trying and failing to get mruby working in a C++ app I'm thinking about embedding Ruby proper instead. Mruby's documentation is ridiculously bad and there are no tutorials or examples anywhere. I managed to Jerry rig a working REPL but once I start trying to define classes it gets fucky. So, moving to Real Ruby. Don't care if it's big. Speed is not a problem. Just something other than Lua...

why not lua ?

why not try this? chaiscript.com/

>Don't care if it's big. Speed is not a problem. Just something other than Lua...
H

Attached: 1562490837109.png (388x496, 199K)

>nightmare
fuck them they should treat you like a fucking person. Also fuck google.

>what is luajit

> Is LISP still used for AI
No, Lisp is the reason the first AI hype in the 80s died off.

>other than lua

Most bounds checks(i.e. during iteration) are optimized out. Also there are unsafe access methods without the checks.

>Most bounds checks(i.e. during iteration) are optimized out.
I'm all for bounds checks but that's a very misleading statement

Most of the time you won't be indexing arrays directly, you'll be using iterators, and they have no bounds checking.

var _ types.Numeric = (types.Integer)(0) returns
cannot use types.Integer(0) (type types.Integer) as type types.Numeric in assignment:
types.Integer does not implement types.Numeric (wrong type for Compare method)
have Compare(types.Integer) int32
want Compare(types.Comparable) int32

Comparable and Numeric are interfaces:
type Comparable interface {
Less(Comparable) bool // x.Less(y) ? x 1 : 0
Greater(Comparable) bool // x.Greater(y) ? x>y -> 1 : 0
Equal(Comparable) bool // x.Equal(y) ? x==y -> 1 : 0
Compare(Comparable) int32 // x.Compare(y) ? x -1 : x==y -> 0 : x>y -> 1
}

type Numeric interface {
Comparable
Float64() float64
}

while my Integer type is as follows:
func (lhs Integer) Compare(rhs Integer) int32
func (lhs Integer) Less(rhs Integer) bool
...

To make this "generic" type work, I have to use func (lhs Integer) Compare(rhs Comparable) int32 and so on, which may break compile-time type checking and will cause code to panic when type assertion fails.

don't worry i'm sure whatever language you're writing this in supports the generics you need to write it

Attached: dq13bN2.png (637x319, 530K)

>Most of the time you won't be indexing arrays directly, you'll be using iterators
Don't tell me how to program

Why? The compiler recognizes when the index can't be outside the bounds and don't use checks, even if you don't use iterators: rust.godbolt.org/z/kuXQFy . You can see sum2 can't be sure the index is in the bound so it checks it every time and then panics, while sum doesn't check anything which allows it to vectorize.

Because you're making a big assumption that most of your bound checking can be doing outside of an iteration, which may or not be true

What are some valid use cases for indexing outside of using iterators?

What kind of dumbass question is that
That's like asking "what's a valid use of function calls"
There's literally millions of answers

So give me one.

I have an array of vertices and I'm procedurally generating a shape and arbitrarily inserting points at random locations

You can just as easily select a random iterator in a range as you can a random index.

It might not use ranges

Sure, depending on the algorithm it may or may not be, but usually it is. If after all the optimizations, the cost is too much for you, and you're 100% sure your indices could never fall outside the bounds, just use get_unchecked.

github.com/git/git/blob/master/banned.h
What functions would you put there? I would put the entire C standard library and most of POSIX, the shit is just broken beyond repair.

is this C specific? if so, rand

Yeah, rand is a disaster.

Imagine having to ban code

I guess the only way to write non-trivial C project is to ban half of the language.

found the coding libtard
>n-no code should be FREE and people should program however they want
that's called shitcode

>I should program how my masters tell me to program

you should program how God tells you

God tells me not to use shitlangs where people have to write macros that ban the use of certain functions