/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

en.wikipedia.org/wiki/Halting_problem
github.com/Guad/batt
dlang.org/comparison.html
dlang.org/phobos/index.html
code.dlang.org
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
wiki.dlang.org/Books
twitter.com/SFWRedditGifs

haskell!

proc multiplyAtv(v: [?Dv], Atv: [?DAtv]) {
forall i in DAtv do
Atv[i] = + reduce (for j in Dv do A[j,i] * v[j]);
}

Jesus fucking Christ

nth for python is shit

As an Australian, what is the best language for me?

Whats this?

sql.

>OY, MATE; SELECT * FROM BEER; -- WOULD YA, YA CUNT?

generic function in chapel.

So called "programming" is for the simple-minded.

Prototype function to summon Satan

Any second opinions? Is D really the language for me?

Please tell us how a superior mind operates, smug anime girl.
(I think it's a Touhou character, but I don't know her name)

I'm starting to learn the MEAN stack ^-^ also just got tasks in my new work today ;_;

Are you a gypsy?

>The MEAN stack is MongoDB, Express.js, AngularJS (or Angular), and Node.js
kill yourself my man

Just wasted fucking hours and hours trying to figure out how strings and encoding are working in C++.

After spending literally hours wondering why the fuck I could iterate over a string and print a meaningful result ONLY IF the string's length was below a certain value I finally realized that the first element of a string must be a pointer and that, for whatever reason, it points to the next element in the string if the length is below a certain number and to somewhere else in memory if it's above a certain number.

To explain better,

std::string sampstr1 = "DDDDDDDDDDDDDDDD";
std::cout

>Please tell us how a superior mind operates
That would be too hard to comprehend for someone such as yourself.

>smug anime girl
>I think it's a Touhou character
Exhibit A.

how qt is my lang and how can I make it qtier
proc repeat
over println
1 -
dup 0 > @repeat if
end

"Hello world!" 100 repeat

>end
>@
the syntax sucks.

incomprehensible to mere mortals such as myself

what'd you use instead?

Also I guess I should note I'm using VS2010 to experiment here. I can imagine this behavior is compiler/settings dependent and not necessarily a language feature of C++.

I want to setup a cmake cross compile build environment for android and ios on arch.
This is far beyond my capabilities. Pls gib 1 command script.

Make it so that non-terminating programs are treated as a compile-time error.
He would probably use some plebeian garbage so I wouldn't listen to him.

A little confusing, do you have any documentation on it or anything? why is there an if at the and and what does the `1 -` mean?

I like the syntax though.

i'm following a guy's (pythonprogramming.net)'s tutorial for tensorflow and i actually feel like i'm learning because he leaves bugs in the code (unintentionally, i suspect) and i have to fix them

en.wikipedia.org/wiki/Halting_problem

i-it's good money in my country

It's based on reverse polish notation, so basically everything is on a stack. 1 - would subtract 1 from whatever was on top of the stack. In this case it's a counter.
If takes quote from the stack (@repeat) and only executes it if whatever on top of the stack is not zero. In this case that would be the result of the > operation

Is this like, stack-based?

The only Australian among my university's faculty is a fan of Haskell and Prolog.

No.

> Make it so that non-terminating programs are treated as a compile-time error.
So indefinitely running services like Web servers would be impossible?

what country?

That's right, the way std::string works under the hood is dependent on your standard library.
Typically your string implementation owns a char* to the heap, a size variable and a capacity variable.
An effective optimization would then be to use a union to treat the char* and capacity as a char[] if the size of the string is small enough to fit in that space.

How is that in any way related to my post?
Indefinitely running isn't the same as non-terminating.

The solution to this is to make your language not turing complete. This is, of course, undesirable behavior, especially given that non-terminating programs are very often considered desirable.

>The solution to this is to make your language not turing complete
Blatantly retarded and wrong.

How to shuffle the bits of an int based on the input of another int in a fast way?
More generally how to shuffle bits based on an input in a way that's fast.

Philippines, lots of companies outsource their sites and startup ideas to us

The halting problem applies to all turing machines. Therefore, either the language is not turing complete, or the compiler cannot tell if a given program halts.

Have you released the source for this language?

>or the compiler cannot tell if a given program halts
The compiler can't decide halting for all programs. Nobody mentioned all programs.

...

Yeah, I wrote an interpreter in C
github.com/Guad/batt

gotcha. Hope your doing well after the ISIS scare a few days ago. MEAN is considered a meme here, most things are done in relational databases and statically typed languages. Angular is on its way out I think.

...

You guys are always being fucked by other, more important countries, so I would go with a language that accurately sums up "I like taking it up the ass for no reason." Probably C.

The claim was that non-terminating programs should be treated as a compiler error. This is the same as saying that the compiler should test each and every program for non-termination, and fail those that can't terminate. Plenty of good programs are unable to terminate unless forced to by a user (i.e. via sigint, sigkill, etc...), such as a daemon.

not making the language Turing complete to fix the problem is stupid.
There can be no general procedure to decide if a self-contained program will eventually halt, so detecting on compile time is stupid.

>such as a daemon.
Can be written in total languages.

>not making the language Turing complete to fix the problem is stupid.
Do you have problems with reading comprehension?
>There can be no general procedure to decide if a self-contained program will eventually halt
Nobody claimed this is untrue.

I was agreeing with the first statement.

If it is true, how do suggest a complier to detect if a program is non-terminating?

any people with experience with tensorflow here? this guy's tutorial tests accuracy by loading the entire test set into memory and running that, and i don't know how to do it one by one. code segment in question

correct = tf.equal(tf.argmax(prediction, 1), tf.argmax(y, 1))

accuracy = tf.reduce_mean(tf.cast(correct, 'float'))
print('Accuracy:',accuracy.eval({x:mnist.test.images, y:mnist.test.labels}))


i can't even look at the structure of mnist.test.images
>>> import tensorflow as tf
>>> from tensorflow.examples.tutorials.mnist import input_data
>>> mnist.test.images
Traceback (most recent call last):
File "", line 1, in
NameError: name 'mnist' is not defined
>>>

>how do suggest a complier to detect if a program is non-terminating?
By doing termination analysis. Obviously you won't be able to decide halting for every program, but that's not really needed.

>generic
What's a "Generic"?

>code
I think you mean "program".

It's not really worth it when you're going to end up getting a 'maybe' most of the time when dealing with more complex programs, having a compiler not compile a program if it's very obvious that the program will not terminate is sort of useless and not something that would be of help to the user as most of the time it would be intentional anyway, as the compiler wouldn't be able to determine it if the user couldn't.

machine learning isn't programming, though

>It's not really worth it
It's pretty interesting to implement for your own language, which is what this was initially about.
>when you're going to end up getting a 'maybe' most of the time when dealing with more complex programs
That's not really the case though.
>as the compiler wouldn't be able to determine it if the user couldn't
Indeed. If only there was a way to signal your intent to the compiler in some easy way.

Sure do it for fun but it's not something that would be terribly useful and a valued aspect of this compiler above others.

I wouldn't touch a compiler which doesn't do some form of termination checking.

Aww thankoo for your kindness~~ I'm away from the south where the muzzies are racking up some terror ;_; and tbf MEAN is a meme, but I think it won't hurt to play around with it hehe. Relational databases and those statically typed languages are still my forte, though

Working on the eternal roguelike game project made with C.

Will try to keep this as my project for some years while learning C.

Trying to make clever comments on the code so i don't need the SDL2 documentation soon.

Pic related.

Even if you could detect an infinite loop, I don't think a compiler should bother wasting time on doing so. Sometimes this is desirable behavior:

#include

int main(void)
{
while(1) { fork(); }
return 0;
}

Particularly if the desire of the programmer is to harm the machine the program is being run on.

Fact: any language, which doesn't have a turing-complete type system, is garbage.

Which compiles just fine.

Type systems are useless.

t. php/javascript dev

Can you stop with the retarded spacing?

Never understood the hate for those languages. They're easy to adapt to if you're not retarded.

>human
>not retarded

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!

>Features
dlang.org/comparison.html
>Standard library
dlang.org/phobos/index.html
>Package manager
code.dlang.org
>GC
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Books
wiki.dlang.org/Books

just moved to the philippines. Nice convergence.

Literally the exact opposite

I have no idea what you're trying to say.

>Starting a new project before finishing the
kek, first time I notice the joke here

Superior minds run on category theory.

when are you going to write a bot to post this?

Hello Andrei. Please stop spamming this shit in every thread.

>not knowing what a generic is
Holy fuck. There needs to be some way to filter out the fucking summerfags better. Generics exist in several languages.

Would you prefer the two lines be flush against the block of code? Because that would look like garbage.

It's a recurring shitposter.

>straight to Java for the example.

t. Pajeet

Do you live in Scotland ?

Java Generics are the worst example of generics, basically just a macro for producing casts.
C# and C++ are much better examples.

how does this compare to rust ? currently learning rust and having a blast

Fact: any language for which the halting problem isn't trivially decidable is garbage.

It was the example because I did not want to put forth any more effort than a wikipedia definition. They exist in several languages, like I said if you were literate enough to read.

t. Summerfag

Nope. I live in the Pacific Northwest.

What is a "Generics" though?

>summerfag calling anyone summerfags over the What is "thing`` shitposter

What can I say? Hook shit is tasty.

does anyone have that comic mocking java where they're showing how would you use java to fly a kite and it looks overly complicated

...

What are some interesting open problems to work on?

cheers

What a retarded comic

Proof of P = NP

Is the number 1 equal to 0.999... ?
Is the sum of all positive integers equal to -1/12 ?

How about the halting problem.