/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

0.0.0.0:8000
a.4cdn.org/b/catalog.json.
chrismorgan.info/blog/rust-fizzbuzz.html
twitter.com/SFWRedditVideos

Programming sans I/O.

>the communication between an information processing system, such as a computer, and another information processing system
yes, that is i/o you fucking retard
I'll repeat: compiling in itself is i/o

truly this.
>the communication between an information processing system, such as a computer, and another information processing system
Yes, the computer itself performs I/O. This doesn't mean that the language has any notion of I/O.
>compiling in itself is i/o
No, you retard. A compiler is simply something which maps source code to a program, there is literally nothing here which requires I/O.
If most implementations of compilers use I/O it does not somehow mean that a compiler is inherently tied to I/O.

A program without I/O could be used for testing hardware stability. I/O doesn't matter. All you need to know if your computer crashes or not.

Programs sans I/O are also the ultimate proof that you're programming recreationally, just for the the aesthetic qualities of source code.

Recreational programming with I/O is basically for poseurs.

A program without I/O could be used for exactly nothing useful

>addition cannot be used for anything useful

>Yes, the computer itself performs I/O
this is what I was arguing. I mistakenly implied I was talking about the language. you all should be saying "a programming language sans I/O" not "programming sans I/O" then

This is by definition false. Unless you want to argue that the following is false of course (heads up: it's true)
"Something which has a use is useful."

Let's stop this now. The retard posting about I/O just wants a syntax for input into a static analyzer. It's not a programming language since it doesn't program anything. Stop giving taking about it.

There's a distinction between a language and how programs written in it are interpreted.

see
A program without I/O can be used for hardware Q/A.

>>addition cannot be used for anything useful
It is if you can't see the result.

what's wrong with testing hardware stability with i/o?

Programming something in a language is programming [with or without I/O].
Programming something in a language with no I/O is programming with no I/O.

Is webpy the way to go if I want to make a simple web interface for a python program?
What would be the best way to make one if not?

>Programming something in a language with no I/O is programming with no I/O.
>Yes, the computer itself performs I/O.
hmmm

Does this program do I/O?

data Console a where
PutStrLn :: String -> Console ()
GetStrLn :: Console String

putStrLn :: String -> Free (Coyoneda Console) ()
putStrLn s = liftF (liftCoyoneda (PutStrLn s))

getStrLn :: Free (Coyoneda Console) String
getStrLn = liftF (liftCoyoneda GetStrLn)

program :: Free (Coyoneda Console) ()
program = do
putStrLn "Please enter your name:"
name

>It's not a programming language since it doesn't program anything.
Are you retarded? How is programming in a Turing complete programming language somehow not programming something?

"Programming with no I/O" implies that you are programming something while not making use of I/O, you could do it in any language which has even a single non-I/O function. Unless you are a retarded ESL you should be able to understand this.

Fuck off.

>Does this program do I/O
>>program = do
>> putStrLn

"no", the "computer that executes the program does I/O"

>"Programming with no I/O" implies that you are programming something while not making use of I/O
how does it do this if computer itself performs I/O?

>Turing complete programming languages aren't I/O
You're fucking brain dead

to elaborate on user's post

all you are doing is describing an effectful program, the language itself merely allows for pure transformations and reductions to take place

effectively, you end up describing a program as a value within the module

this is different to something like an imperative language, because the "effects" are actually just a part of the value. you can discard the effects, modify them, repeat them, etc.

the compiler then searches the Main module for a "main" value, that describes a program, and then compiles it to an actual program.

so in , program IS just a pure value (and assuming it was just IO) that the compiler will convert into the actual program

>Reddit spacing
I didn't even bother to read your post, because I already know it's fucking stupid. Piss off.

"Writing a program with no I/O" is by definition the same as "programming with no I/O". This sentence doesn't say anything about the machine executing the program. A non-ESL should get this.

What are you even on about? When did I/O become a fucking requirement for being Turing complete?

A language being Turing-complete does not imply that it can do I/O, and vice versa.

The lambda calculus is Turing-complete and cannot do I/O.

The following language can do I/O, but is not Turing-complete:

Expr ::= Expr + Expr
| Expr * Expr
| Print Expr
| Expr; Expr

Oops, forgot the base case:

Expr ::= Int i
| Expr + Expr
| Expr * Expr
| Print Expr
| Expr; Expr

>"Writing a program with no I/O" is by definition the same as "programming with no I/O"
wrong

Sup Forums can't even average 2 ints dans une langue sans Entrée/Restitution

Exactly, you could also define a language which can't do basic control flow but can still do I/O.
Right.

>reddit spacing
I hate this reddit meme

>Turing complete
Oh lord
Without dynamic I/O, you've got nothing. Both in the real world and mathematically. The Turing machine really is quite limited in functionality. If a computation happens and no one can use it, does it really compute? Never underestimate the importance of dynamic I/O. It's what makes everything possible. The entire idea of a Turing machine will steer you in the wrong direction.

What are some quirky languages :3?

Only valid response to this hyper autism semantic argument, tbqh

Odd how none of the "no I/O" babies have replied to

apl

>Without dynamic I/O, you've got nothing.
There is so much wrong with this statement that I won't even address it as something valid.
>Both in the real world and mathematically.
Are you implying that mathematics exist in some kind of "fake"(?) world?
>The Turing machine really is quite limited in functionality.
Why does it matter?
>Never underestimate the importance of dynamic I/O.
It's fucking garbage.

Read the previous thread. There's a response to something very similar.

>It's fucking garbage.
There is so much wrong with this statement that I won't even address it as something valid.
Mind pointing it out to me?

Just read the thread, it's where some stupid person decided to claim that you can't see the result of evaluation therefore you don't know the result.

How do you know the result then?

Daily reminder that hardcoding values into the source code is I/O.

Daily reminder that hardcoding instructions into the source code is I/O.

How do you know the result of writing "1 + 1" on a piece of paper?
It is (usually) done through the use of OS (an editor) I/O but it isn't I/O itself.

>inputting something
>not input
>writing something on paper
>not output
lol

How did you write down 1 + 1 without in input of your hand and a pen?

Daily reminder that according to /dpt/, pure code does I/O otherwise it is useless

By reading it with my eyeballs.

Where did I claim that?
Why would you be writing it down without input? That simply isn't possible by definition, nor did I claim that it is possible.
But how do you know the answer? The expression itself can be evaluated provided you know the language it's written in. You don't need to write "2" to know the answer to "1 + 1"

purepill me on coyoneda

>You don't need to write "2" to know the answer to "1 + 1"
Sure but it will take a long time for a human to just read code to get an answer. That's the whole point of running code on hardware.

Depends on the human, obviously someone who is so retarded as to think that a string is somehow I/O will have a hard time.

me too

Hey mates. Trying to make Sup Forums API works with axiosjs. But I'm getting the following errors:

> [Error] Refused to set unsafe header "Origin"
> [Error] Refused to set unsafe header "Referer"
> [Error] Failed to load resource: Origin 0.0.0.0:8000 is not allowed by Access-Control-Allow-Origin. (catalog.json, line 0)
> [Error] XMLHttpRequest cannot load a.4cdn.org/b/catalog.json. Origin 0.0.0.0:8000 is not allowed by Access-Control-Allow-Origin.

I know that this has to do with CORS and the Headers I'm passing. But I don't know how to fix it properly :/

>the communication between an information processing system...and another information processing system...is i/o
Is calling a function i/o?

>wasting server space with this shitty ""debate""

If it's outside of the program

Crashing can't be detected if it doesn't generate i/o.

The "A" part of Q/A cannot exist without I/O. What's the point of testing hardware if you're unable to tell if the hardware passes the test or not?

>tfw /wdg/ is deader than usual
c-can I talk about javascript here

>Does this program do I/O?
It depends on what software you use to execute it.

So a function ceases to be an ``information processing system" if it's part of a program?

>what is lazy evaluation

doing tetris in x64 assembly (with I/O)

Sure, that seems like that statement needs definitions attached to it, but I don't honestly care.

Hey Sup Forums
I'm learning C and I've written a game of life implementation, but my code looks like shit. This is mainly because I can't understand how to pass a multidimensional array between functions.

Is there an easy solution to this or is it simply a bitch to do?

pass its pointer

C doesn't natively accept arrays being passed between functions. It will just give you a pointer.

I suggest using a linked list instead.

Why is my layout looking like this? I want each button to have equal height...


...and another 11 Buttons below

So last thread I wrote about a java NcR implementation with the Pascal's Triangle, so I decided to actually do it. It's my first attempt at doing memoization as well.

Aside from me not using BigInteger (cases larger than n=35 start overflowing Integer) how did I do?

package fastChoose;
import java.util.*;

public class NChooseK {
TreeMap tri;

public NChooseK(){
//creates the reference map
tri=new TreeMap();
Integer[] first={1};
Integer[] zero={0};
Integer[] two={1,1};
tri.put(0,zero);
tri.put(1,first);
tri.put(2,two);
}

public Integer[] makePascal(Integer num){
//generates rows of the pascals triangle up to num and stores them in tri and returns the row
if(tri.containsKey(num)){
return tri.get(num);
}else{
int n=(int)tri.lastKey();
for (int i=n;i

Rustfags will defend this:

chrismorgan.info/blog/rust-fizzbuzz.html

[spoiler]Use malloc.[/spoiler]

>Recursive Pascal's Triangle
Wew

>Rust
literally who?

like dis?

typedef struct matrix {
int *data;
int n, m;
} matrix;

int fillMatrix( matrix *a )
{
int n = a->n, m->n;

a->data = calloc(sizeof(int), m * n);

for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
a->data[i * n + j] = 0;
}

int main( void )
{
matrix m;

m.data = 0;
m.m = 5, m.n = 4;

free(m.data);

return 0;
}

I dont recall putting in recursion. It's memoized so if I call it multiple times it wont have to remake the entire triangle.

Which helps how? You're still stuck with just one pointer to the start of the memory chunk. Doesn't help with a 2d array at all.

Trying to reverse some VC++ malware that apparently makes use of the entire boost library. Help?

Fucking finally found it.
I was missing this from each button:
android:layout_rowWeight="1"

elaborate

No

>Make basic function to find the highest common factor of two arguments
>No bugs - great
>Doesn't fucking work; it just skips to the return b statement, I assume.

What's wrong with it Sup Forums, other than it being on Xcode?

Maybe

>a = b
>b = a
now sit down and think

Thanks for not using an animuh im-

>linked list for a 2D grid
>items aren't being removed or added
kys

lol

Your swap algorithm in the first block of HCF() is faulty. It copies B to A, then copies the NEW value of A to be. You need to be storing the temporary value somewhere.

>if (a < b) {
> a = b;
> b = a; // a was already equal to b, so you're doing b = b, clever.
> }

a ^= b;
b ^= a;
a ^= b;

Idiot.

if (a < b) {
int tmp = a;
a = b;
b = tmp;
}

Ransomware written in C++ for Windows. It's a whole megabyte and I can see some debugging symbols. I'm using radare2 but as far as I can tell there isn't a way to automatically link the debug symbols to their respective functions. Pic related.

yeah, bitwise xor is exactly what we need here

Thanks, I also did it in the second block which is why.

thats a hacker as fuck UI you got there

Is that i3 ?

definitely not helping you with a rice like that

Blackarch i3 config
It used to be blue but I bought this laptop back when I was an autist so it's a red gaming laptop. My OCD therefore requires a red theme.

Does anyone know of any good forums or boards that are actually pretty active for people that didn't start programming yesterday?