/dpt/ - Daily Programming Thread

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

Attached: lisp_.png (165x256, 30K)

Other urls found in this thread:

baroness.bandcamp.com/album/yellow-green
youtube.com/watch?v=f5ddAAYasgM
twitter.com/SFWRedditImages

Turns out SFML and Haskell don't play nicely after all

Interview question for a hedge fund: what's the complexity of this program?

for i in range(1,1000):
for j in range(i+1,1000):
for z in range(j+1,1000):
if(i**2+j**2==z**2):
if(i+j+z==1000):
return

Nothing desu!

O(1)

Code is real. Code gives friend.

first for Erlang

Attached: 1553379856488.png (771x723, 680K)

>play
hasklel is no game

based

thats the program from previous thread, not sure why would the recruiter from hedge fund ask about this program

Polynomial?

fuck this thread

O(3n)

First for having a good time

Attached: 714F5GrOpdL._SY717_.jpg (477x717, 98K)

for fuck in fucks:
fuck(you)

How do you have an array of functions?

nice monster, man

O(n)^3?

h

get better error messages

>first
>5th

Seems like your posting system took quite a long time to restart there buddy.

what's n?

that's not how that works user

its getting faster

This is hard. Is it O(logn^x) or something?

many languages will let you do this like it's perfectly normal

Found the brainlet.

how the fuck is everyone getting this wrong?

It's running on BEAM.


It's a joke, Erlangers.

>languages aren't first class in his brainlet language

Attached: walkinggarbage.jpg (520x600, 97K)

Please unbrainlettify me

He isn't a brainlet if he can program in C. He just needs to expand his horizons.

*functions aren't derp

All real positive numbers if I remember correctly.

Attached: 1557543065813.jpg (645x1000, 92K)

one language to rule them all

Assuming the if statements don't do anything fucky I don't see how this is at all logarithmic.

C can have an array of functions you nitwit.

Oh. It's a first-class thing. Functions shouldn't be first-class. They are dirty and smell bad. They should be third-class where they belong, eating the remains of unwanted food.

>hur durr
you don't even know the answer retard

Ms Obama get down!

Attached: 1514694727315.png (645x729, 82K)

The space covered by z decreases on each iteration of j, which also decreases by each iteration of i. I didn't think too deeply about it, but it seems like that's what the "trick" could be.

Are there actually any languages left that don't have first class functions?

O(1)

If you plot all ordered pairs (i, j, z) it creates a sort of pyramid and its volume probably proportional to the cube of some number. So probably O(n^3)

He means, which variable in the code changes to make it take longer or shorter. As written all the variables are fixed so it's constant. I assume the implication is that '1000' would change to other values.

What's everyone listening to while totally programming and not just shitposting in this thread?
baroness.bandcamp.com/album/yellow-green

explain why

>vocals
IDM, Jazz, or bust.

Because no input parameters change the runtime of the function, are you dumb?

both are fine with me
youtube.com/watch?v=f5ddAAYasgM

2sleepy, but still good

What about
for i in range(1,n):
for j in range(i+1,n):
for z in range(j+1,n):
if(i**2+j**2==z**2):
if(i+j+z==n):
return

n^2

>programming language with programming languages as first class objects

Attached: jpeg.jpg (1056x978, 94K)

Is there no better alternative to HTML? It looks so bloated. If you didn't had closing tags for example, you could easily shave 5% off of a file's size. If it had a context-free grammar parsing would be faster too.

O(11)

Depends on what you need, problem with HTML is that it tries to do everything.

Haml

>early cbl
>too sleepy
okay got recommendations?

>Hydroponic
heh just reminded me of Hoover(phonic) and trip hop.

O(n^3)

Elm is the best alternative.
Though diet templates from vibe.d are the least bloat, but compile times for those are still terrible.

Java will never be a cheetah.

Attached: 27976C18-F873-4C8C-BCEC-A0005A82DFD7.jpg (920x299, 37K)

but the inner loops are starting at i+1 and j+1

Degine a "programming language" in the context of objects.

What's the right answer?
O(nnn)?
O(1)?
Calculating the answer once and hard coding it?
BTW, it stops when i=200, j=375, z=425.

big-O is upper-bound, little details like that get hand-waived

O(1)

C

It’s like a penis but with more code y’know

doesn't matter

I'm just trying to get people to be nice.

smalltalk

sh

Attached: tan.jpg (960x1440, 333K)

cpp.compile()

You know how big O notation works right? It's asymptotically, as n approaches infinity. It's easy to see why it's not precisely n^3 but O(n^3) means it is bounded asymptotically. I think you could find a formula for the precise number of iterations tho, based on the graphical intuition it creates a pyramid of ordered pairs (i, j, z)

for i to n
for j to i
this is O(nlogn)
dont know how
for i to n
for j to i
for z to j
can be O(n^3)

>Python
>not a lamia

What the fuck is O(nnn)? Do you mean O(n)?

it can't be n^3
what are you even talking about

>for z to j
what

O(n^3)

>this is O(nlogn)

Attached: dauhhhhhhh.jpg (442x500, 8K)

probably O(n^3)

I'm gonna say it

O(x^3)

How is this not O(1) ? It doesn't even depends on an external variable, time will be the same each time. Did you assumed we are analyzing time complexity when we use other values than 1000?
Anyway it would be more efficient to take z = 1000 - i - j for each i and j.

Please do elaborate.
That's just stupid.

did you even go to uni?

fugg you're right

I know I'm right
I'm never fucking wrong

what is it, then

O(n^2)

>it doesn't even depend on an external variable
good point

O(1) is right. The program will always terminate after the same number of instructions. Any procedure which doesn't loop based on the input is the same, this one doesn't even take input.

>It doesn't even depends on an external variable
What does this mean?

for i to n
for j to i
this is nlogn
how is this so hard to understand

this depends on a external variable
def foo(n):
for i in range(1,n):
for j in range(i+1,n):
for z in range(j+1,n):
if(i**2+j**2==z**2):
if(i+j+z==1000):
return


this doesn't depend on a external variable
def foo():
for i in range(1,1000):
for j in range(i+1,1000):
for z in range(j+1,1000):
if(i**2+j**2==z**2):
if(i+j+z==1000):
return