/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?


Previous Thread:

For for C++ is for idiots.

>Cirno is perfect
>C(irno)

>therefore, C++ cannot be an improvement of C

qed

low-level C++ is high-level comfy

when will zen+ be available for purchase?

unfortunately it doesn't work though
it's crashing on this RETF here, that should be valid.

How can it be comfy if it doesn't work?

I'm sure my code works, the stupid rom code I'm calling doesn't.

Does anyone here seriously still use Turing complete shitlangs?

So, it doesn't work

I only write software with no I/O. Who else /patrician/ here?

Please answer the question.

I'm thinking of using procedural-oriented C++ more and more until I reach true enlightenment.

>my typechecker is finally working perfectly

I'm pretty sure it's not.
This or the equivalent of this most likely typchecks in your language.
5 + fix (x -> x)

Trying to set up a stack for our next project. Back end dev wants some RESTful asp.net thing and i (being the front end dev) want to try out npm with some of these _buzzword_ javascript libraries.

Started looking into renting a VPS - they all come with Linux. Which is fine by me since npm is very Linux friendly and i personally like working with CLI.

But mr back end is all asp.net and microshill so how do we make this work? (Note: I'm completely new to REST)

Two different servers? One building the front end single page application, sending out only index.html and scripts.js to the client; and the other one being a RESTful asp.net server.

Follow up quesiton on this: If we want user authentication (login), what's a proper way to approach this? Send credentials with each API request?

What about encryption; Can you establish a TLS connection with the back-end only? Credentials wouldn't touching the front end server in this case.

Im drowning in questions and I feel stupid. Should i just put npm + asp.net on the same server and deal with porting asp.net to linux?

I don't see why that shouldn't typecheck, assuming you're giving fix the standard type ((a -> a) -> a)

In any case, my project language doesn't have fixpoints

>overusing const for non-constants is just increasing meaningless visual noise
>returning bool and passing the real parameter out in a pointer is worse than raising an exception and using it for flow control
prove me wrong
protip: it's impossible because what I've said is 100% right

>I don't see why that shouldn't typecheck
Because (+) doesn't have type (forall a : a -> a -> a) and because it's retarded.
>In any case, my project language doesn't have fixpoints
Any loop is pretty much the same from this standpoint.

solution to #1 is purity
solution to #2 is monads

inst (a = Int)

>having non-constants in your language

but fix (x -> x) has type (forall a.a) so you should be able to infer that the second argument be given type Int

and the language I'm writing is total so it doesn't have loops

>Send credentials with each API request?
Look up OAuth or any other variation of token based authentication

show me a gui application written in haskell that isn't absolutely garbage

Would removing all looping from my language make it non-Turing complete?

show me a gui application that isn't absolutely garbage

Where did he say anything about H*skell?

Fixed it now.
I had to make a "short" far call with an m16:16 fword ptr. it was doing a long one with m16:32, then the retf from 16-bit rom code tried to pop an m16:16 pointer and failed.
I couldn't figure out the right syntax to do that in gcc asm, so I just inserted an opcode-size prefix:
".byte 0x66;"
"call fword ptr cs:[0];"
If anyone here knows the right syntax to do that, that would be cool.

dude just make stuff lmao

Also REST web services are all about interoperability, you should be able to interact with a REST webservice with basically any language and technology more often than not

Its basically a glorified XML that lists all the available methods you can call on the server along with their parameters and the type of return you recieve, several languages have a way to translate that file into classes you can call locally in your code

If you remove mutually recursive calls too yeah

Isn't a program a series of mutually recursive calls though?

Looks pretty neat, but how is this RESTful? Isn't the auth provider issuing a session?

Maybe I'm missing the point here about REST.

So I take it your advice is to keep front end and back end on two different servers, yeah? It would probably simplify the development process too, eliminating some unnecessary conflicts.

Not necessarily recursive. But to be a computer program you need it to be Turing complete.

>But to be a computer program you need it to be Turing complete.
So according to you this is somehow not a computer program?
(\x : Bool . x) True

C = INT_MAX
C++

I can't offer proper informed advice since i don't know what you guys are trying to do, there's a very big difference between just displaying content and handling on the fly realtime thermodynamics calculations, just giving you a heads up about what REST is all about so you aren't too spooked about it

We were talking about the language. Turing completeness is not a property of a program

What the fuck does that spaghetti code do?

It's written in a non-Turing complete language and it is a computer program. Which means what you said was incorrect.

I wish I was as smart as you think you are.

You literally said "But to be a computer program you need it to be Turing complete." And I have shown you a program which is written in a non-Turing complete language.
Only some kind of retard would think this is """"smart""""

Absolute madman

It sets up an interface to call the graphics card's bios directly.

Has anyone been able to correctly write a function in C that takes two numbers from the user and returns the sum? Or is C still a proven garbage?

You mean the average of two ints?

>C
No one cares. And no, you can't do it in C properly.

const char* avg(int a, int b) {
if (a == 0 && b == 0) return "0"
else return "an error occurred"

Does it work with 100M + (-9999999999999999.000000000000000001)? Show proof pls

but the second var isn't a int, you asked for sum of ints

>you asked for sum of ints
>ints
Point to me where

So where's the addition part?

GNU nano 2.7.5 File: sum.c

#include

double
sum(double a, double b){
double c = (a + b);
return c;
}

int main(){
double a, b, out;
printf("Enter num 1:");
scanf("%lf", &a);
printf("Enter num 2:");
scanf("%lf", &b);
out = sum(a, b);
printf("The sum is: %lf\n", out);
}

//now fuck off with your shitty meme

It's in the pointer.

>returns double
So 4.9 +.1 returns a double, not int? Why?

So numbers will decimal points can be added and summed accurately.

4.9 is from the set of doubles
so is .1
Why the hell would it return an int?

Because the type of 4.9+.1 is an int. not a double. Are you dense?

5.0 is by definition not an integer.

5.0 is definitely an integer

Let's teach you a basic thing:
4.9+0.1 = 5
5 is a whole number
5 does not have any floating point precession, the .0 is meaningless.
The zeros in 0005 are meaningless.
4.9 = 49/10
.1= 1/10
(1+49)/10 = 50/10 = 5

I hope it guides in your infancy

Does a C toddler know what an integer means?

5 is, 5.0 isn't.
Didn't even read this post.
what is a C toddler?

What's the difference between 5 and 5.0 again? kek

5 = 5.0

What's the difference between 5.0 and 5.00000000?

0

>what is a C toddler?
A C toddler is an overgrown baby with no literacy

There is no difference

auto n = 5.0;
auto n2 = 5;
static if(!is(n == n2)) {writeln("wew lad"); }

wew lad

hmm

For the retards replying to this, the difference is that you KNOW 5.00 is precise to two decimal places but 5 you don't. They are different numbers.

You might want to check out the binary representation of them both.

One is either an integer or a natural number and the other is a double.

Not until you apply some kind of operator which maps ints to doubles.

That's situational. Nobody mentioned anything about precision or measurement.

What's that got to do with anything?

Both are integers

>5 and 5.00 are different numbers
No
Good, so why would you return a double if the sum forms a whole number?

Coming from a physics background, mb if it's not the case in a computer.

>What's that got to do with anything?
Pretty much everything as demonstrated in

The notation IS the indication of precision, that's why you get F's when you use the wrong significant digits.

To highlight how wrong you are, when someone says 1 + 2 = 3, do you correct them and say
"1 + 2 is between 2 and 4"?

Nobody cares about your shitty programming language.
5 = 5.0

If there's no kind of expectation of accuracy or anything, and we are dealing with the number 5, it is equivalent to 5.0. 5.0 is another way of writing 5.
In Physics or Chemistry, yes you would use the .0 to emphasise accuracy.

That's situational.

An integer is a number with no fractional part. 5.0 clearly has a fractional part and is therefore not an integer.

>No
How can something be the same if it has different types?
You can turn 5.0 into 5 by using some function which converts doubles to integers, but until then they are different numbers.
>Good, so why would you return a double if the sum forms a whole number?
I'm guessing he is some sort of retard.

I see, so 4.53 is also an integer.

there is no better language then c++
that is a fact, deal with it
stop with those meme languages you dirty autists

It's never situational. A data type that can hold a '5' cannot necessarily hold a '5.0', there's more metadata in floats.

Why are you pointlessly giving me this "precession" abstraction?
Do you also write 5 as 0005.00*10^0 +0i ?

You're fighting a losing battle man, just accept it and move on.

Are you the 1/0 = 1 guy?

>4.53 is also an integer.
Do C toddlers know what an integer means?

>5.0 clearly has a fractional part and is therefore not an integer.
5.0 does not have a fractional part.

4.53 is not an integer. 5.00 is an integer.

Using .00 for precision is situational

None of you faggots have obviously got the point, so here is what my example meant

If 5.0 is an indication of precision, then how do you indicate 1 SF, or 0 DP? With "5".
So now we know that WHENEVER SOMEONE REFERS TO AN INTEGER, they actually mean a numer that rounds to an integer! So integers don't even exist!

Or rather, the notion of precision is situational.
Obviously I was being sarcastic about the 5 thing, but that is how ridiculous you're being.
Your logic would actually have me believe that when you say you're over 18 for the Sup Forums verification, you actually mean you're over 17.5

Notation carries meaning, your data type must be able to carry that meaning. If you chop that meaning off you have changed the data

10/5 is an integer.

10/5 is an expression of two integers.

>1 + 2 = 3
This is correct assuming plus is defined as something which takes two integers or nats and returns the same type.
>5 = f (5.0) where f : Double -> Integer
Fixed that for you.

>5.0 does not have a fractional part.
You just wrote it. .0 is a fractional part. It being easily removed without any loss of information doesn't somehow mean it doesn't exist.
>4.53 is not an integer.
So you can indeed distinguish them. Anything with a dot after it is by definition not an integer.

auto n = 5.0;
auto n2 = 5;
writeln(n.sizeof,"|", n2.sizeof);


8|4

A lot of my cute professors say that it's important to keep the discourse of the universe in mind when working with computer systems and programming. It's not all theoretic. :)

You guys get trolled so easily.

Ok let's see .
./a.out
Enter num 1:1
Enter num 2:2
The sum is: 3.000000

> 3.000000
FUCK OFF C TODDLER

in C you have to know what type you are returning, what sense would it make to dynamically return an int if it could be a double depending on user input as well?

Yeah but then you have the C people who genuinely believe this shit. That's why you can't have nice C things.

Still generating primes under 2mil