/dpt/ - Daily Programming Thread

Previous Thread: What are you working on, Sup Forums?

also mathematics is not a science

Other urls found in this thread:

en.wikipedia.org/wiki/Formal_science
tiobe.com/tiobe-index/
pypl.github.io/PYPL.html
youtube.com/watch?v=02a723LsoFA
twitter.com/AnonBabble

>mathematics is not a science
t. SJW liberal arts major who couldn't handle any math classes

You cant study deep space and black holes without math
checkm8 agnostics

>there are people here who are writing obscure scripts and tools instead of writing apps for mobile devices
You realize you could get a job making $20/hour sitting on your fat NEET ass, right?

>t. SJW liberal arts major who couldn't handle any math classes
Nobody who did more maths than the "mathematics for computer scientists" module in first year CS would say that mathematics is empirical

It doesn't really matter what you think; it's a fact that mathematics is a science.
en.wikipedia.org/wiki/Formal_science
Pathetic and retarded losers who don't agree with well-defined nomenclature that is widely-used by experts who are exponentially more intelligent than them (or indeed anyone with half a brain) need not apply (and need not reply to me).

>$20/hour
is that your idea of good money?

It's a respectable amount compared to being unemployed and tinkering with Linux

i'm on to you, kitsune

There are two rocks on a beach.
The human race has been wiped out in a nuclear war.
Are there still two rocks if there are no minds around to perceive them?
Twoness exists independently of consciousness. QED.

>All sciences are empirical
See Math is a different type of science, in that it is primarily deductive instead of empiracle, but it's still a science

Come at me faggot.

holy shit there is not a single on-topic non-shitpost post in this entire thread

shitposting is an science

How would you construct data types or something like them in Prolog?

> Each exchange operation on line 5 of HEAP-INCREASE-KEY typically requires three assignments. Show how to use the idea of the inner loop of INSERTIONSORT to reduce the three assignments down to just one assignment

anyone know what this is talking about?

heap_increase_key(A,i,key)
if key < A[i]: error
A[i] = key
while i > 1 and A[parent(i)] < A[i]:
swap A[i] with A[parent(i)
i = parent(i)

Anime is shit

>haskell cant do this
int hasklet = 5 + -2;

in Haskell this is just
hasklet = 5 - 2

I'm working on some javascript for my bff, RMS

>bff
Boyfriend forever?

big fat friend

Threadly reminder that dlang-chan is not dead, and she's super duper cute and fast! Say something nice about her, /dpt/!

Whats the point of this?
To shitpost d?
Or reverse people into looking it up and using it?
either way its gonna get filtered.

still trying to compile gcc 7 on windows. autotools is the worst build system ever.

I wish

Don't filter her, friend. I actually use D unlike the other shitposters.

I do too, i just hate autists who spam their pastas like its some gift to us all.

Are you a ghost?

I do it because maybe some user might actually try D. Is it likely? No, but if one person does do it, I'll be happy.

Thats literally the worst way.
"Say something nice ___" shitposts makes me want to do the opposite.

Stop giving D more shitpost fuel and just let people find it on their own.

if i < len(d[c]):
if d[c][i + 1] == d[c][i] + 1:


why am I getting a "list index out of range" on the second condition ? there has to be a
d[c][i + 1]
since
i < len(d[c]

There's another reason for me posting it, but I can't reveal why.

rate my prime number checker


def main():
num1 = int(input('Enter a number: '))
while num1 != 0:
print(is_prime(num1))
num1 = int(input('\nEnter a number: '))

def is_prime(num1):
for i in range(2,num1):
if (num1 % i) == 0:
prime = False
print('divisible evenly by',i)
break
else:
prime = True
return prime
main()

Are there any functions other than socket() and socketpair() that can create sockets?

syscall

>def
0/10 see me after class

What you mean :-/

he's just shitposting as most people here do.
ignore him.

Learn a real language or you'll fail

I'm a 2nd year IT student, I got an offer for an internship at Sabre. I'm pretty nervous about what to expect and where I might have gaps in knowledge. I've only done academic projects and feel comfortable writing code ant that level but not sure what to expect and what is expected of me. I thought exam for internship would provide some clues but that was mostly questions about "will this code compile and why not".
Anyone got any tips or things I should know?

Also, I didn't have a course about design patterns yet, is there a book you recommend for self-study? Internship is for Java but that seems like something that can be learned in any language.

Why the fuck is my bash script not working? Bad part:

if [ "$stuScore" = "$profScore" ]
then
echo "$stuScore / $profScore Great! Continuing..."
else
echo "$stuScore / $profScore Incorrect. Exiting..."
exit
fi


When I run it:

1000 / 1000 Incorrect. Exiting...

What the fuck?

idk bash but do you know what " does?

Defend this, Java users.

String[] strings = new String[10];
Object[] objects = strings;
objects[0] = new Integer(7);

No

no one uses java so no one will defend this

Lots of jobs in Python these days.

Even more jobs in HTML

tiobe.com/tiobe-index/

>1 1 Java 15.568%

pypl.github.io/PYPL.html

>1 Java 22.6 %

So learn Python and HTML, and you're set.

I don't think you get what I meant

You're right. You need to throw in CSS and JS too these days, preferably with a few frameworks.

How can I get something to help me refactor code in Python? I want something like IntelliJ for Java.

nice meta posts faggots

>checks i = num
>checks all 1 < i < num
Someone put this on the CS grad meme.

You wouldn't need to check i

Retard detected.

>calls others retarded
>doesn't know factors always come in pairs
>his code checks both of them
>his code also checks if num1 % num1 == 0
>yfw 7 isn't a prime according to his fucking code
Please tell me you're just fucking pretending.

>yfw 7 isn't a prime according to his fucking code
7 is a prime according to his code.

protip: you only need to check divisibility of numbers up to the square root of num1.

If a number n isn't prime, it has factors a and b such that n = a * b. At least one of a and b has to be less than sqrt(n), because otherwise their product would be larger than n.

Autism.

C """programmers""" were a mistake
have you ever looked at any old unix software lately?
everything is so fucking full of spaghetti code it's not even funny

B-B-BUT THE SOURCE CODE IS THE DOCUMENTATION user
THAT'S WHY WE DON'T NEED TO WRITE USER MANUALS

of course it's spaghetti, it's C

pls no bulli C

Unix programming is a quick and dirty form of CSP with pipes as channels and the kernel as the garbage collector. Threads with shared memory were a mistake.

youtube.com/watch?v=02a723LsoFA

This is pretty much every post in /dpt/ in a nutshell

might want to learn. it usually means strings. so you're comparing the word xxxx to the word yyyy

Idris > Haskell > Scala > OCaml > F# > Rust > C++ > C > C# > Java > CL = Scheme = Clojure > Forth > Perl = PHP = Python = Ruby = JS > Go

...

Scala and F# should be somewhere near Perl

Fortran > *

>Rust better than sepples
nice shit taste

Why is Lisp so low?

Would a new language for the web have to be able to compile to Javascript, or do you think it would be possible to introduce a brand new language this far into the evolution of the web?

that's not true. if i < len(d[c]) then the last entry of d[c] is d[c][i], and i+1 is out of range. this is because python arrays are zero indexed (like most languages), so for example an array of length 3 has indices 0, 1, 2. when i = 2, i + 1 = 3 and is out of range

Make it compile to WASM

Maybe it would be better to go the other way around and have the language be able to implement a fully featured Javascript implementation inside itself.

an array of Object references can hold references to any object type, because Object is the base class of all object types

object-oriented type hierarchies are bullshit but this is an incredibly straightforward example of them, it will work in many languages

The web should be able to implement other languages, really...

>rust is better than c++
>scala is better than anything

Post an example of where this happens. Your example lacks the values of both variables. It works fine if you assign them both to 1000.

Shell has but 1 type: string. Expansion of variables happens within double quotes, the double quotes are everywhere in bash because without them the value undergoes word splitting(e.g. 'foo bar' -> 'foo' 'bar'). You even have nested double quotes:

"$(cmd "${var}")"

Anyway they aren't the problem.

Caution! The poster you are replying to has been infected by the "strong static typing" virus. It rots the brain, leaving the victim in a state of catatonia. The only form of communication they now possess is through grunts and phrases like "muh types." They will forever be unemployable, and will likely end up in a nursing home.

I have to admit, it's easier to make mistakes on non-static typing languages.

Does it matter? dynamic FTW!

I know
but
#0 0x000055555556c800 in bind@plt ()
#1 0x00005555556fb9c5 in isc__socket_bind (sock0=0x7ffff7f98010, sockaddr=0x55555598c040 , options=) at socket.c:5484
#2 0x000055555557cc1e in send_udp (query=0x7ffff7f96018) at dighost.c:2923
#3 0x0000555555580753 in onrun_callback (task=, event=) at dighost.c:4146
#4 0x00005555556ea753 in dispatch (manager=0x7ffff7f88010) at task.c:1130
#5 run (uap=0x7ffff7f88010) at task.c:1302
#6 0x00007ffff69f9494 in start_thread (arg=0x7ffff2cf5700) at pthread_create.c:333
#7 0x00007ffff638193f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

apparently calls bind() and connect() on a file descriptor that isn't created with a call to socket() beforehand

>it would be possible to introduce a brand new language
Imagine one of the browser vendors suddenly coming up with it, that'd be a shitshow

Dynamic only if it's a Lisp.

Here's an example of what word splitting is and why quotes are needed.

~ $ ls -ld /tmp
drwxrwxrwt 9 root root 180 May 3 21:46 /tmp
~ $ args="-ld /tmp"
~ $ ls ${args}
drwxrwxrwt 9 root root 180 May 3 21:46 /tmp
~ $ ls "${args}"
ls: invalid option -- ' '
Try 'ls --help' for more information.

In the first case, they are expanded to ("-ld" "tmp"), in the second case it's equivalent to:

ls "-ld /tmp"

You should really look into WebAssembly.

Rust Scriptâ„¢ soon :^)

Legit thanks for the education, Sup Forums. I forgot this.

>arrays can hold any lisp object
Can't imagine how slow lisp must be.
This is why dynamic programming sucks.

>dynamic programming
That is something completely different.

That's now how it works you idiot.

Around 2-11 times slower than C++.

Is wasm really gonna be a huge deal, a game changer?

I'm a complete newfag to programming- business student learning python for fun over the summer. I'm working through that waterloo university intro to python and i need help on a really simple question, pic related. I can't figure out how to start- what's the input? i don't understand what input i'm basing the program off of.

Maybe.

Look up how to receive input in python.

You are completely hopeless.
x = input("input some shit yo:")
write that and your input will be assigned to x. then you can use ord and chr and shit with x as if it were what is typed in

learn a real language instead

NONE OF THE FOLLOWING
>python
>java
>ruby
>go
>javascript

recommended (all a different type of language):
>C
>Rust
>Haskell
>Prolog
>Scratch