[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 326
Thread images: 27

File: 1479498855406.gif (4MB, 362x271px) Image search: [Google]
1479498855406.gif
4MB, 362x271px
Previous thread: >>57575547

What are you working on, /g/?
>>
coding isn't the same as programming
>>
>>57586087
first for Java, Eclipse and OpenGL
>>
>>57586106
Why do you think this?
>>
F#>Haskell
>>
File: 9_EdFlyBebop2.png (318KB, 621x478px) Image search: [Google]
9_EdFlyBebop2.png
318KB, 621x478px
dpt needs a new mascot
>>
>>57586106
this

>>57586148
>Computer programming (often shortened to programming) is a process that leads from an original formulation of a computing problem to executable computer programs. Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation (commonly referred to as coding[1][2]) of algorithms in a target programming language.
coding is only a small part of programming
>>
>>57586087
how is mummy programming related
>>
Currently learning C, C++, Java, Python, Ruby, and Perl all at the same time, chapter by chapter.

Impressions: Ruby is nice.
>>
File: 8hKWkYn.jpg (559KB, 800x815px) Image search: [Google]
8hKWkYn.jpg
559KB, 800x815px
why/when should i use recursion over iteration and vice versa?
>>
>>57586221
No serious company allows the usage of recursion, it's an academic meme
>>
>>57586221
ALWAYS iteration

ALWAYS

i'm dead serious

>inb4 hurr you don't understand recursion
you're the one who can't understand iteration properly if you think recursion is somehow better
>>
>>57586221
>muh side effects
>>
File: true.png (4KB, 234x82px) Image search: [Google]
true.png
4KB, 234x82px
>>57586172
>>
>>57586275
>cmd
>>
>>57586290
?
>>
>>57586292
At least use a better emulator
http://cmder.net/
>>
>>57586275
it allows you to compare strings just like that? does "F#" < "Haskell" return false too? where's the type safety?
>>
I tought the haskell meme wouldnt be around after a month.
>>
>>57586275
Try
"Clojure" > "Haskell"
>>
>>57586307
It's lexicographic.
Think like a dictionary.

>>57586320
False
>>
>>57586194
>coding is only a small part of programming
Yes. And this is relevant to the point of needing a reminder at least once every thread why?
>>
Best vim plugins for C?
>>
>>57586333
so java > haskell? :^)
>>
File: 1452227445024.png (12KB, 331x124px) Image search: [Google]
1452227445024.png
12KB, 331x124px
>>57586275
>>57586333
>>
>>57586146


private void storeDatainAttributeList(int attributeNumber, float[] data){
int vboID = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID);
FloatBuffer buffer = storeDataInFloatBuffer(data);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
GL20.glVertexAttribPointer(attributeNumber, 3, GL11.GL_FLOAT, false, 0,0);
//unbind vbo
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}


private FloatBuffer storeDataInFloatBuffer(float[] data){
FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
buffer.put(data);
//finished writing prepare for writing
buffer.flip();
return buffer;



Alright im trying to learn OpenGL with LWJGL and Java. What i dont understand is this buffer thing:

                
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
GL20.glVertexAttribPointer(attributeNumber, 3, GL11.GL_FLOAT, false, 0,0);



Wtf is happening on those two lines?
>>
>>57586307
The comparison operators work on any type class which is a member of Ord: anything which is order-able.

Strings are arrays of characters which are lexicographically order-able.

Makes perfect sense.
>>
>>57586087
being this cute should be illegal
>>
>>57586359
google it
>>
>>57586400
Why? Do you only want ugly people?
>>
>>57586350
Lexicographically, not actually.
>>
>>57586350
"haskell" > "Java"
>>
How do you learn code structure?

I read a book on Unit testing and as a side effect it taught some good dependency inversion tricks to use.

But feels like there's no definitive guide of what to aim for.
>>
>>57586457
dont couple your code, dont write duplicated code and as a follow up, write code that is easy to reuse later
as for actually designing your systems and APIs, its something that comes with experience

i recommend reading "The Pragmatic Programmer", it doesn't cover much about code design but the advice is invaluable to a new-ish programmer
>>
>>57586221
You should use recursion if you're programming in a language which favours it (e.g. Haskell, Scheme), or if the task is naturally recursive (e.g. tree traversal). Otherwise, iteration.
>>
>>57586457
> How do you learn code structure?
Practice. Lots of it.
>>
>>57586457
I learn by doing.
Try to make it so that it's easy for myself to get an overview of what the fuck is going on in my code, when i return to it the next day, or month or year.
Also, discussing code design with elitists who think they know best.
>>
>>57586403
Any tips on how to remember everything you need to do with OpenGL? The functions dont seem that hard to understand
>>
>>57586644
Write down a checklist.
>>
>>57586644
Abstract it away?
>>
File: 1477778307077.jpg (94KB, 602x709px) Image search: [Google]
1477778307077.jpg
94KB, 602x709px
>Collision system isnt working
>Not a single fucking clue why
HOW AM I SUPPOSED TO FIX THIS MESS
>>
>>57586704
import physics.collision
>>
>>57586712
But I want to learn these things
Its fun Anon(Disclaimer: Only true when you finally make it work after hours of work)
>>
any of you faggots is """playing""" screeps?
>>
>>57586704
fix it
>>
Can someone give me a regex that matches anything other than "#NUMBERS"?

Example string
"User#8811, go fuck yourself"

goal:
"User, go fuck yourself"


thanks
>>
 int average = (int) ((double) (a+b) / ((double) 2)) 

FIND A FLAW
>>
>>57586739
could you rewrite that in english please?

>>57586746
not a function
>>
>>57586704
this is why you test your shit anon
>>
>>57586742
no god no i hate regex and matching shit
>>
>vs2017rc release notes
>Note that the compiler still lacks a few features from the C++11 and C++98 Standards.
Fuck you Microsoft. I was led to believe vs had full c++11 support by 2013, and now you're telling me by 2017 we STILL don't have full c++11 support?
>>
>>57586739
>pay to play
no
>>
File: screeps.jpg (62KB, 630x210px) Image search: [Google]
screeps.jpg
62KB, 630x210px
>>57586757
Any of you faggots is "playing" Screeps?
>>
Help! I'm trying to do the shortest path of a directed graph using bfs, but its doing it wrong
public List<V> bfs(V start, V end){
Map <V, V> nextNodeMap = new TreeMap<V, V>();
List<V> directions = new LinkedList<V>();
V current = start;

Queue<V> q = new LinkedList<V>();
q.add(current);

Set<V> visitedNodes = new TreeSet<V>();
visitedNodes.add(current);

while(!q.isEmpty()){
current = q.remove();
if(current.equals(end)){
break;
}else{
for(V vv: neighbors.get(current)){
if(!visitedNodes.contains(vv)){
q.add(vv);
visitedNodes.add(vv);
nextNodeMap.put(current, vv);
}
}
}
}
if(!current.equals(end)){
System.out.println("CAN'T REACH DESTINATION");
}
for(V vvv = start; vvv != null; vvv = nextNodeMap.get(vvv)){
directions.add(vvv);
}

return directions;
}

The current graph: 
0 -> [1, 5]
1 -> []
2 -> [3, 0]
3 -> [2, 5]
4 -> [2, 3]
5 -> [4]
6 -> [0, 8, 4, 9]
7 -> [9, 6]
8 -> [6]
9 -> [10, 11]
10 -> [12]
11 -> [12, 4]
12 -> [9]

4 to 1 should be [4, 2, 0, 1], but I'm getting [4, 3, 5]. HELP!
>>
>>57586742
[^(#\d+)]

Is this what you wanted?
>>
>>57586807
Is every CS programme having an exam about this shit now?
>>
>>57586792
It doesn't even have c98 macros
>>
>>57586794
private servers got released at the start of this month anon.
You can now build your local server, add bots, speed up the server ticks etc
Or host/join one to play with your friends / random people
>>
File: OpenGL-ES-2_0-Reference-card.png (2MB, 1944x1320px) Image search: [Google]
OpenGL-ES-2_0-Reference-card.png
2MB, 1944x1320px
>>57586644
learn by doing

read the reference pages, the wiki, the spec on things that interest you or you need to learn more about
>>
>>57586792
anything important thats missing?
>>
File: batshitching.png (33KB, 950x533px) Image search: [Google]
batshitching.png
33KB, 950x533px
does this look too convoluted?
>>
>>57586813
ty based anon
>>
File: Untitled.png (3KB, 477x106px) Image search: [Google]
Untitled.png
3KB, 477x106px
Does anyone know what this means? I'm trying to read an excel file through PHPExcel and add some contents to a database but I get this error.
>>
Working on my terminal emulator, trying to figure out what's using the CPU while the terminal is effectively idle and shouldn't be doing anything.

Painful.
>>
>>57586221
You should use recursion when you problem is naturally solved by recursion. This is a bit vague as a guideline though. Things like tree manipulation are pretty good examples.
>>
>>57586892
Unrecognised token 00 in formula.
>>
>>57586867
will probably work, but that looks like a lot of unecessary classes to me
personally i would just have a single graphics system class/module that takes text, primitives, models in an internal format, and then do the actual rendering with different implementations of a renderer thats capable of rendering the contents of the graphics system by translating the internal format into d3d11/9 or opengl things

been a while since i did graphic stuff tho, might be some problems with this approach that i dont see
>>
File: 1458002032728.png (14KB, 548x282px) Image search: [Google]
1458002032728.png
14KB, 548x282px
>>57586871
>>
>>57586334
because you aren't the only person in the world you narcissistic dickhead.
>>
>>57586969
had to remove a character
msg.replace(/[(#\d+)]/g, "")
>>
so I have to code a Galaga-like 2D game on Visual Studio using WPF. I have no idea where to start, anyone got any idea where can I find tutorials about it?
>>
>>57586980
Yeah, [^abc] matches anything except 'a', 'b', and 'c'.
>>
>>57586927

yes, but what does unrecognized token 00 in formula mean. I've been sitting here for 2 hours trying to figure it out, I fear there's something wrong with the excel file I'm trying to read. I've gotten rid of all the syntax errors and now I'm stuck with this bullshit
>>
>>57586996
learn C++ and SFML
>>
>>57586980
Oh and you don't need the square brackets for that
>>
>>57587016
gotta use c# and wpf only, I asked my teacher if we could use stuff like Unity and he said no :-)
>>
>>57586087
>her as OP
okay fine, but that means that she's a snitch spirit (who would've guessed)
>>
>>57586972
My question remains unanswered.
>>
>>57586856
Probably not anything i would use. But still.
I'm definitely not going to learn how to use features that the compiler doesn't support.
>>
You can tell to someone that python, C, ruby etc is great for their specific needs. The only thing you can tell about haskell is "hurrr if you don't need it then it isn't for you hurr".
Haskeller are like vegans: you don't ask them if they are, they will yell it at you. Also little hipster faggots.
>>
>>57586821
No, I'm just the same idiot who keeps post about this
>>
how do serverside handlers for network stuff usually look in large apps?

i've made a few and they always end up a variation of something like this:
static CommServer* CommServer::create()
{
CommServer* server = new ServerClient();
server.add_handler(MessageCode::some_code, some_handler_func);
// repeat
}


which works, but i was wondering if there is a less verbose/error prone design
>>
>FUCKING SWAPPED Y AXIS
atleast one part of my collisions detection now works yay
>>
>>57587145
>I FUCKING HATE HASKELL, FUCK YOU PEOPLE WHO KNOW HASKELL, WHY DO YOU EXIST?
calm down anon you make this post every thread
>>
OMFG I JUST GOT AN IDEA HOW TO DO HITDETECTION WITHOUT THOSE FUCKING VECTORS FUCKING YES
>>
>>57587226
What's your idea?
>>
>>57587214
I don't hate haskell, I hate you people, but not for using haskell. Still, you can't say isn't true. You can't tell why haskell is better than X (where X is not java, of course)
>>
>>57587264
Well I previously thought you couldnt check if a boxes corners are inside another box because its side could cut the other box without its corner needing to be in it
But now I realized that the other boxes corners would need to be in my box in that case
... Probably common knowledge but whatevs
>>
>>57587290
Haskell is objectively better than C++
>>
>>57587336
*C#
but I guess that too
>>
Who javer masterrace here?
>>
begginer lisp fag here
how do I do
map f [1..n]
or
[f i | i <- [1..n]]
>>
>>57587352
going to both the extremum of what C++ is good for:
1) how many top class videogames are made with haskell? (things like GTAV, WoW etc.)
2) How many franmeworks for numerical intensive simulation are made with haskell? (Things like ROOT(CERN), GEANT4 etc. )
>>
>>57587452
1) 0
2) 0

How many C++ programs are well written?
>0
>>
>>57587460
>but muh well writen useless code
>>
>>57587310
Are you working in 2d or 3d?
Your realization is correct in 2d, while your original assumption is correct for 3d.
>>
>>57587080
Retard
>>
>>57587474
It's not useless
>>
>>57587479
2d, but shouldnt it work for 3d as well?
Cant really think of a situation where it wouldnt
>>
>>57587490
see my point? you can always tell why something is superior to haskell, while it's impossible to tell why haskell is better than something. Of course, other than being a defensive bitch, like haskellers like to be.
>>
>>57587403
Depends what your lisp offers. Probably
(map f (seq 1 10))
. You can also get pretty expressive looping macros, see http://www.ai.sri.com/~pkarp/loop.html. (fucking ugly to my eyes tho.)
>>
>>57587501
>but shouldnt it work for 3d as well?
Get two cubes, make two edges touch each other at an angle.
>>
>>57587540
No I don't see your point
You made a false claim
>>
File: 1478966543777.gif (606KB, 512x588px) Image search: [Google]
1478966543777.gif
606KB, 512x588px
>>57587571
kek, just keep digging yourself a deeper grave anon
>>
>>57587571
>hey you do need proteins in order to be healthy
>no no no, you made a false clain, go vegan 4eva!
>>
>>57587619
>>57587621
>>>>>useless
>>>>its not useless
>>>see my point
>>i dont follow
>#REKT stupid vegan
>>
>>57587569
I see, thanks
I guess you would need to work with planes and shit, so Im going to stay with 2d for now
>>
How do I program Vegan Simulator?
>>
>>57587677
eat _ = False
>>
does protocols count as intellectual property?
like, if someone would make an implementation of the protocol that skype uses would that be illegal?
>>
>>57587689
eat :: IO Bool
eat _ = putStrLn "Did you know that I'm a vegan?" >> return False
>>
>>57587729
eat _ = replicateM 3 (putStrLn "Did you know that I'm a vegan?") *> return False
>>
>>57587542
im using cl
is there a seq in cl
>>
>>57587689
>Vegan simulator
>not Java
>not Eating eat = new EatingFactory(this).generateNewEating().setStatus(false);
>>
>>57587756
>*>
snoflake
>>
>>57587774
wew
>>
>>57587657
When you feel ready to move to 3d, google Separating Axis Theorem. It's the usual way of doing collision detection on boxes.
>>
>>57587780
whoops i meant pure
>>
can somebody find a function in the form

f(n) = a*(r^n) where a and r are constants

and such that
f mapped to from 1 to 5 = (-7 7/6 -7/36 7/216 -7/1296)

respectiviely
>>
[i want to die]
>>
>>57587827
This is /dpt/ not /DoMyMathHomework/

Also, what is that? 2nd grade math? You've got to be 18 to post here, kiddo.
>>
>>57587827
>two unknowns
>five points
what kind of brainlet are you?
>>
>>57587827
haskeller spotted
>>
>>57587843
>>57587854
i figured it out, fags
kys
>>
>>57587877
it literally takes 1 second to figure out
a = 7
r = -6
>>
Anybody here use ABAP & SAP?
>>
>>57587827
f(n) = -7*((-6)^(1-n))
f(n) = -7* ((-1/6)^(n-1))
f(n) = (-7* 6) * ((-1/6)^n)

a = -42
r = -1/6
>>
>>57587900
WRONG

kys in piece, faggot
>>
>>57587869
I'd just like to interject for a moment. What you’re referring to as Haskell, is in fact, monads/Haskell, or as I’ve recently taken to calling it, monads plus Haskell. Haskell is not a programming language unto itself, but rather another lexical component of a fully functioning monadic system made useful by functors, monoids and vital lambda components comprising a fully functional language as defined by category theory.
>>
>>57587910
oh boy
>>
>>57586087
next_page = urls[0]
next_page = response.urljoin(next_page)
yield scrapy.Request(next_page, callback=self.get_email)

def get_email(self, response):
email = response.css("a")
for string in email:
yield {


on wednesdays we kode. we out here
>>
>>57587926
nice, you can now impress your interviewer in a job interview
>implying you will ever find a job in haskell alone or the interviewer tells you that they are trying to solve real world problems
>>
>>57587924
whatever brainlet stay mad
>>
>>57587962
>his post had Haskell in it, I must respond!!!
>>
>>57587910
no
>>
>>57587966
I literally found a better way
your's is wrong
>>
Can you move the same way you do memcpy?
i.e.
>float source[30];
>memcpy(someArr + 5, source, 10*sizeof(float));
>memcpy(otherArr + 3, source + 10, 15*sizeof(float));
>>
>>57587981
memmove
>>
i was lurking for a while here
what is haskell good for?
>>
>>57588004
* Shitposting on /dpt/
* Developing a smug sense of superiority
>>
>>57587978
whatever r = -1/6 a = -42
>>
>>57588017
*a = 42
>>
>>57586400
"cute"
>>
>>57587981
Just free the source pointer after memcpy there you have memmov.
>>
>>57588016
wow, thanks anon, so, what other language do you recommend to learn? I did pascal while in mid school and a lot of c/c++
>>
>>57588004
Don't use it lol, literally so bad.
>claims its good at concurrency
>but doesn't even have good benchmarks
>lazyness everywhere, meaning a lot of garbage left lying around
>monads, aka, a thing nobody understands
>IO infects your code, yet haskellers claims the way its set up makes it contained
>>
>>57588073
finally normal people
>>
>>57588073
No, you just suck and are envious of haskell purity and elegance
>>
>>57588114
not an argument
>>
What's that meme called where a dude is standing in graduation attire with his diploma looking retarded and there's some terribad code or some shit
>>
>>57588073
>>57588114 is right, you just suck

also
{-# LANGUAGE Strict #-}
>>
>>57588163
>what's that meme called
Fuck you
You cancerous shit
It's a funny joke >was
It doesn't need some fucking name so some fags on facebook can post about "le funny grad meme"
>>
>>57588171
>can't even mingle strict and lazyness
>has to use one or the other
kys in peace
>>
>>57588163
>le arrow meme
>le return to le reddit
>>
>>57588191
BangPatterns

>kys
are you twelve?
>>
>>57588163
it's the cs grad meme! hope to see you share them on twitter and reddit! g'day sir! happy memeing!
>>
>>57588073
>concurrency
I don't care about stock market trading or whatver
>>
>>57587827
$$f(n) = ar^n$$
P.S. Test LaTeX script.
>>
>>57588234
ok, what about my other points
you can't just win against one of my points and expect to win the others by default
>>
I'm having trouble making valid yaml....

so far just these two lines are failing on column 2

newproject:
name: "dingleberry"

why? the error I get is did not find expected key while parsing a block mapping at line 2 column 5 what is this expected key? isn't name considered a key in this case?
>>
File: .png (19KB, 640x138px) Image search: [Google]
.png
19KB, 640x138px
>>57588271
Nice.
>>
File: 2016-11-19-144726_272x80_scrot.png (7KB, 272x80px) Image search: [Google]
2016-11-19-144726_272x80_scrot.png
7KB, 272x80px
>>57588271
the fuck are you on about, faggot
>>
>>57588273
wait so you agree that's a non point?
you'll never mention it again?

ok

>doesn't even have good benchmarks
are you saying it has bad benchmarks or that it doesnt have good ones?

>monads
are great and plenty of people know how to use them

>IO infects your code
this is a sign of user error
>>
nothing but thanks for asking
>>
Do you guys sometimes read RFC stuff?
Worth the time or better to just read some short conclusion someone else made about the topic.
>>
>>57588319
Why so butthurt?
>>
>>57588337
sometimes I read the comments on pornhub
>>
>>57588325
>benchmarks
I heard somebody here saying haskell doesn't have good benchmakrs in concurrency

>monads
I don't understand them (I only understand the functions the monad class implements), I think nobody does
like einstein said, if you can't explain it to a child, then you don't understand it
monads are a big meme only category theorists pretend to understand

>io
It definitely does
you have to obviously mingle io and pure code to produce results

but I find that doing so often makes everything io bound

for example, I was doing some file processing thing
and I had to do a lot of packing and unpacking to keep it in the context of IO
I had even implement new functions that i'd expect in the System.IO or Control.Monad modules
>>
Hey I want to make command console games on linux. What language is well suited for this. The language I know best is c# but I'm bad at programming and don't know how to make anything but a single file program using c# on linux because I'm super reliant on visual studio.

Strings are used commonly in these programs both for input and for outputting a UI and information. This makes me not want to use C or C++ because working with cin and cout hurt me.

What would you recommend? I'm kind of a basic bitch.
>>
>>57588069
Actually, I was kidding. Haskell is a fun language.
>>
>>57588397
Literally every
>>
>>57588393
>I had even implement new functions that i'd expect in the System.IO or Control.Monad modules
Such as?
>>
>>57588374
my absolute favorites are the pajeets thinking they are somehow communicating with the pornstar in the video
>>
>>57588393
>i heard
well i didnt

>i don't understand them
you don't understand a lot of things

>IO
post code
>>
>>57588431
do they post java snippets?
>>
>>57588445
kek
>>
>>57588397
The best engine for programming games is Unity 100%. You'll be able to use C# and the UI system is a breeze to pick up. You could have a command line made in less than 10 minutes and have it connected to code in less than 30. If you need help you can go to reddit. we have a great community for helping people. And who knows, maybe one day you'll get your game greenlit on steam!
>>
Pretty new to C++ and working on an assignment. I am supposed to implement a Copy Constructor and Overloaded =Operator to copy Class Objects. Which I understand how to do. However, one of the members of the class is a const char (it's char barcode[5]) which won't allow me to copy it since its const. Any idea how to do this?
>>
>>57588478
Set it at construction.
>>
Why do you even need pointers?
>>
>>57588410
yes, sometimes a cown and a fool are necessary, but maybe that guy want something to be able to find a job
>>
>>57588499
this
pointing is rude
>>
>>57588427
folding a list of homegenous IO with an atomic type as the starting element
>>
>>57587827
>answer is literally 42
>>57587917
that's a=42
>>
>>57588515
If I'm understanding you correctly, foldM can do exactly that
>>
>>57588556
but foldm requires a function to return an m a
>>
>>57588497
I have a constructor that sets the value of char barcode[5] but but it won't let me copy what is stored in there over to another class object
>>
>>57586275
Now try with Ada.
>>
What's the best UML 2, FOSS you know of?
>>
>>57586221
if you're using iteration, then you're using a filthy pleb language, so you should always use recursion
>>
>>57586239
>iteration
>hard
literally linear recursion, desu
>>
>>57587336
no it's not

C++ is by far more successful in the industry
>>
>>57586221
Apply iteration when memory limits your work. Apply recursion when time limits your work. Either case occurs in industry or contracting.
>>
>>57588673
it's not supposed to be hard you insufferable fedora tipper
>>
>>57588689
popularity =/= quality
>>
>>57588705
Case in point: your mom
>>
>>57588478
how the fuck do you not allowed to copy a const char
>>
>>57588701
implying that people who think recursion is better are dumb is in itself dumb
>>
>>57588705
name an objective measure of quality that says haskell is better than C++

>>57588726
kill yourself
>>
>>57588744
>name an objective measure of quality that says haskell is better than C++
conciseness of code
>>
>>57588744
>name an objective measure of quality that says haskell is better than C++
I don't know Haskell and I don't know if it's good but saying that something is better because more people use it is retarded
>>
I want to program. Where do I start?
>>
I have this array of flight departure times:
int     TIME_D[NUM_FLIGHTS][3] = {      /* departure time */
{ 8, 0, 0},
{ 9,43, 0},
{11,19, 0},
{ 0,47, 1},
{ 2, 0, 1},
{ 3,45, 1},
{ 7, 0, 1},
{ 9,45, 1}
};

The first index in each sub-array is for hours, second for minutes and third for a.m.(0)/p.m.(1).

I'd like to make a function for searching the departure which is closest to the departure time given by the user. This is what I've come up so far, any comments on that?

/* Return the number of the closest departing flight 
* */
int
Get_ClosestDeparture(int time_minutes) {
int i = 0;
int num = -1;
int cur_departure = 0;
int closest = 32000;
int time_difference = 0;

puts("Get_ClosestDeparture(): ");
printf(" Departure time: %d \n", time_minutes);

for (i = 0; i lt NUM_FLIGHTS; i++) {
cur_departure = MINS_D[i];

time_difference = cur_departure - time_minutes;

if (time_difference lt 0) {
time_difference = -time_difference;
}

printf(" Time difference for flight %d: %d \n", i, time_difference);

if (time_difference lt closest) {
printf(" Flight %d is closest \n", i);
closest = time_difference;
num = i;
}
}

return num;
}
>>
>>57588826
https://mitpress.mit.edu/sicp/full-text/book/book.html
>>
>>57588837
>lt
what language is this
>>
>>57588773
so code golf languages are better because they're concise? fuck off

>>57588774
kill yourself
>>
File: 1458667893061.jpg (35KB, 463x611px) Image search: [Google]
1458667893061.jpg
35KB, 463x611px
>>57588875
>kill yourself
So you have no counter argument? Alright
>>
>>57587185
Exactly like that. You define a handler for a certain route and the router calls that function on each matching request.

>>57588278
My guess is inconsistent indentation. Make sure each next level is indented by exactly 2 spaces.

>>57588499
1) To point to an item in an allocated array
2) To not copy large blocks of memory, like images, walls of text and such
3) To grant write access to another function to a local variable
Those are the main ones.
>>
>>57588900
>I don't know Haskell and I don't know if it's good but saying that something is better because more people use it is retarded
not an argument.
>>
>>57588941
My argument was that your post was not an argument.

Since Justin Bieber is popular, he also must be one of the best musicians ever, right? That's your argument.
>>
File: badpracticeorno.png (13KB, 566x286px) Image search: [Google]
badpracticeorno.png
13KB, 566x286px
Is pic related an acceptable thing to do?

I use the variables, then once I touch the screen, I want them to be set to zero again.

For some reason this looks ugly and I was wondering if there was an alternative.
>>
>>57588984
you're a fucking retard

C++ is by far more commercially successful

haskell is worse in every quantifiable way
>>
File: animu grill.jpg (82KB, 680x680px) Image search: [Google]
animu grill.jpg
82KB, 680x680px
>>57589011
>Side-effects
>>
>>57589047
elaborate?
>>
>>57589042
>you're a fucking retard
How about you make one post without insulting everybody like a fucking newfag?
>C++ is by far more commercially successful
Which doesn't mean it's better. Like I said, popularity =/= quality. See >>57588984
>haskell is worse in every quantifiable way
Why don't you give us some actual argument instead of just talking shit?
>>
>>57589056
He likes pretending state does not exist.
>>
>>57589047
>complaining about side effects in a function whose purpose is to produce side effects and is named appropriately
>>
>>57588875
you asked for a way haskell is objectively better than C++ and i gave you one. i can only assume the reason you're so triggered is because you're insecure about your favorite language being a steaming pile of shit
>>
>>57589071
(You)

>>57589156
you're a complete idiot
>>
File: 1478921707819.png (708KB, 1280x720px) Image search: [Google]
1478921707819.png
708KB, 1280x720px
>>57589270
says the C++ aficionado
>>
so, why should someone use haskell instead of say C?
>>
>>57589302
>this is supposed to be an insult
>coming from a haskell weeb
>>
please don't discuss C++ in this thread
it's offtopic since it isn't a programming language
Thanks!
>>
>>57589270
>(You)
>you're a complete idiot
Lurk more you fucking retard. You're basically just admitting that you have not a single counter argument at this point. If you have an argument why C++ is better, tell us. Because everything you've said so far is "kill yourself", "you're a retard", "you're a faggot" and "Haskell sucks". I'm not saying Haskell is better because I don't know if it is, but you have failed to give us even a single argument. If you post another baseless insult again, you have proven that you're just a retard who doesn't know what he's talking about.
>>
>>57589351
anon claimed haskell is objectively better than C++, the burden of proof is on him, and commercial success is an objective measure, you haven't provided a single objective measure in favor of why haskell is supposed to be better
>>
F#
>>
File: isthisunnecessary.png (5KB, 553x78px) Image search: [Google]
isthisunnecessary.png
5KB, 553x78px
Is there another way to do this?

I need to use x and y outside of this function, so I created class variables and made them equal x and y.

Is there a better way?
>>
>>57588725
A const char[] mate that's legit, given that you have to copy the contents in the preexisting memory. If they were
const char*
you'd have a point cuz a = b cuts it.
>>
>>57589391
can you post your whole unit? Without seeing anything else the only answer is yes.
>>
>>57589372
>commercial success is an objective measure
No it is not and I've already explained why.
>you haven't provided a single objective measure in favor of why haskell is supposed to be better
I never said that Haskell is better. Did you even read my posts? Probably not since all you said about them is "kill yourself".

You still didn't give us a single argument.
>>
>>57589425
k
>>
>>57589372
see
>>57587452
haskell is good for anything you want, and if you aren't using it then you suck dicks
>>
>>57589420
>>57589391
I meant to say the only answer is no there is no other way without seeing your other logic.
>>
>>57589443
lol k tard keep believing that, in fact i'm glad you use haskell because i hate you and you'll be wasting your time on haskell
>>
https://www.youtube.com/watch?v=azGKRF5r-EM
>>
>>57586972
Youre the faggot dickhead. The guys just asking a question.
>>
>>57589481
very tingly
>>
>>57586221
how do i apply recursion in html?
>>
>>57588478
You can bypass the constness of stuff with
const_cast<char*>(yourArray)
which results in a nonconst pointer to the elements of your array. Use it responsibly. It is perfectly natural to use for the copy constructor, but you might want to reconsider why barcode's content is const if the assignment operator can forcibly mutate it.
>>
File: itsabitofamess.png (72KB, 1127x1147px) Image search: [Google]
itsabitofamess.png
72KB, 1127x1147px
>>57589420
>>57589476
That's good to know, I can't think of any other ways

Here's a bunch of code, it's for the input controls of liquid simulation.

Does my code look like I'm a novice?
I still have clean up and annotations to do, as I've only just written these methods
>>
Can someone give me a couple of programs to write in assembly? I just mean ideas no pseudo code or anything. I'm using mips
>>
>>57589549
build me an AI gf
>>
>>57589549
dice rolling simulator
>>
>>57589549
shortest path between two points in a graph
>>
>>57589559
Thanks
>>57589557
not sharing
>>
>>57589391
>that font rendering
>>
File: eclipseneontext.png (954KB, 1831x1277px) Image search: [Google]
eclipseneontext.png
954KB, 1831x1277px
>>57589574
I tried to make Android Studio look like the Eclipse neon text, as it makes me so happy to look at

Pic related
>>
>>57589477
dick sucker spotted
>>
>>57589547
a reset function would be preferable to the large block of reseting

some of the comments are unnecessary because you've written/used self-documenting signatures

if current time is greater than 0.3 you can just return instead of using a boolean; move where you set delta time to zero to right above this if statement since it's not used in any of that code

just think of ways to eliminate reliance on state. you're gonna have to rely on some state but the less the better.
>>
File: 1478719017275.jpg (808KB, 990x1146px) Image search: [Google]
1478719017275.jpg
808KB, 990x1146px
For those of you who focus on the victims of war well that is just part of war. What do you think war is about? People DIE in wars that is why I am against wars. It brought me to tears because I used to think all of those horrible things about Hitler until I learned the truth about the war and what Hitler truly did and he was not a bad person as they have painted him out to be. Here is a man who was not a coward, stood up for his country in a DESPERATE TIME OF NEED (unlike all of our cowardly leaders), and yet not only did he try his best to help his country and people get out of what was a time of depression, economic collapse, high unemployment, amongst many other things.
>>
>>57589602
That looks nice but I was talking about the anti-aliasing
>>
>>57589557
first we're gonna build a wall
>>
I'm working on a shitpost detector. I'm still in the early stage and I kinda suck at programming so i'm just making some stats about 4chan boards right now.
What are some common insults/curse words on 4chan ? I got the basic "cunt", "fag", "fuck" and the like covered, but i'd like a short list of insults used on the good ole chanz

tl;dr : insult me boys
>>
>>57589618
>a reset function would be preferable to the large block of resetting
Surely this purposely puts readability above performance? I'm not against that, just I've never thought about it.

>if current time is greater than 0.3 you can just return
This is really clever. However won't it will result in you making mistakes/spending more time in the long run? If I want to add something else to this method in the future, surely I will be checking every line to see if I have done something like this?
>>
>>57589757
>insult me boys
but i dont want to hurt your feelings, anon
>>
>>57589757
how did you miss cuck, autism/autist, sperg, pajeet
>>
>>57589757
>kill yourself
>kys
>reddit
>kek
>newfag
>cuck
There are so many
>>
>>57589757
pajeet
poo in loo
shart in mart
cuck
spic
nigger
kike
jew
shitskin
mudskin
retard
sperg
sperglord
autist
>>
>>57589636
>I was talking about the anti-aliasing
that it's good or bad?

sorry for being so dense, but i do not follow
>>
>>57589757
weeb
frogposter
>>
>>57589796
u're waifu is shit

>>57589803
>>57589820
>>57589838

thanks my dudes
>>
I wrote a script that replaces reddit with nigger
>>
>>57589757
Should be reasonably easy to notate what's a shitpost and what isn't; just check for
<class="postMessage"
.
>>
>>57589824
That it's awful (probably normal Windows font rendering)
>>
>>57589867
looks ok to me, depends on subpixel layout
>>
>>57589775
readability with almost zero impact on performance. making it two functions results in
function1() {
function2();
...
}

which, if you will allow me to make very liberal assumptions, will either just translate to an extra jump to function2's body or will be inlined to the same code. Nothing to shake at.

It could result in making more mistakes if and only if your case for returning (current time > 0.3) is not the end-all for this function.
>>
>>57589337
so I can do stuff quicker and make my brain feel nicer
>>
>>57589894
>>57589775
didn't finish my thought.
>It could result in making more mistakes if and only if your case for returning (current time > 0.3) is not the end-all for this function.

but, on the other hand, since you're maintaining a boolean touchOver, if you mistakenly modify this value at all side effects could percolate through that go unnoticed. Returning from the function and skipping behavior that should occur is much easier to catch in the debugger than tracing the state of a variable.
>>
>>57589757
>mfw cucks and pajeets aren't into deep learning and natural language
>>
File: 1474217814580.png (229KB, 1047x1926px) Image search: [Google]
1474217814580.png
229KB, 1047x1926px
>>57589757
drumpf
drumpftards
drumpfshits
drumpfkins
trumpkins
trumpets
trumplets
trumpanzees
>>
>>57589966
nice anti-aliasing
>>
>>57589929
do you have brain cancer?
>>
>>57589999
nice digits
>>
File: ENOUGH.jpg (29KB, 412x430px) Image search: [Google]
ENOUGH.jpg
29KB, 412x430px
QUICK, WRITE A PROGRAM THAT WHEN GIVEN TWO COMMAND LINE ARGUMENTS, WITH THE FIRST BEING A DECIMAL AND THE SECOND BEING AN INTEGER, WILL OUTPUT THE FIRST GIVEN INTEGER FRACTIONS WHICH APROXIMATE TO THE DECIMAL BY AT LEAST FIVE DIGITS

AKA

./a.out 3.14159 2
22/7, 355/113
>>
>>57590022
praise kek
>>
>>57589894
>>57589945

I will make an effort to do both of these things, but only once I'm not going to be making any major changes to my program. It is all subject to large amounts of rewriting or replacing

Thank you for the useful advice
>>
>>57590028
>THE FIRST GIVEN INTEGER FRACTIONS
How are integer fractions ordered?
>BY AT LEAST FIVE DIGITS
Rounding method?
>>
>>57590028
>AKA
I don't think that means what you think it means
>>
>>57590101
from smallest to biggest
no rounding methods
whatever your computer gives, compare it against the decimal
>>
>>57590028
#!/usr/bin/env node
x = y = 0
while(i<process.argv[3]){
y++
if(x/y==process.argv[2]) console.log(`${x}/${y}`)
x++
if(x/y==process.argv[2]) console.log(`${x}/${y}`)
}
>>
>>57590028

>>57590101 here, might providing an actual answer instead of the clownish one >>57590134 gave?
>>
>>57590028
>>57590114
I think he was looking for something like "e.g" but definitely not aka
>>
>>57590028
while(i<process.argv[3]){
let x = [Math.random()*Number.MAX_VALUE, Math.random()*Number.MAX_VALUE]
if(x[0]/x[1] == process.argv[2]){
console.log(x[0]/x[1])
i++
}
}
>>
>>57590028

#!/usr/bin/env ruby

puts ARGV[0].to_r
>>
How does one practice concurrency and threading?

The only related coding challenge I know of is the dining philosophers problem.
>>
looking for a new project to practice multithreading. coming back after taking a few months off programming after going nolife for a year on an open source project.
>>
>>57590340
multithreading is a meme
>>
>>57590028
import Data.Ratio
import System.Environment
main = print . flip approxRational 0.00001 . read =<< (head <$> getArgs)
>>
>>57590356
>one output
>>
>>57590028
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;

procedure Div is
type Float_Num is delta 0.00001 range 0.0..5000.0;
A : Float_Num := Float_Num'Value(Argument(1));

begin -- Div
for X in 1..5000 loop
for Y in 1..5000 loop
if Float_Num(X)/Float_Num(Y) = A then
Put_Line(Integer'Image(X) & "/" & Integer'Image(Y));
end if;
end loop;
end loop;

end Div;
>>
>>57590028
wait what is the second number for, is it the number of rational approximations given as output?
also, 22/7 doesnt approx 3.14159 to 5 digits.
>>
>>57590571
post outpu
>>
>>57590733
355/ 113
710/ 226
1065/ 339
1420/ 452
1775/ 565
2130/ 678
2485/ 791
2840/ 904
3195/ 1017
3550/ 1130
3905/ 1243
4238/ 1349
4260/ 1356
4593/ 1462
4615/ 1469
4948/ 1575
4970/ 1582
>>
if i have a static library A that depends on a header-only library B, and then make a program C that depends on both A and B, will B be compiled twice and thus bloat the file size of C?
>>
import System.Environment
import Data.Ratio

main = do
[dec, int] <- getArgs
mapM_ print . take (read int) $ fracs "0.0000" (read dec)
where fracs n d = approxRational d (read (n++"1") :: Double)
: fracs (n++"0") d
>>
>>57590881
Mine uses fixed point
>>
>need to list all tags in the database
>include the number of posts per tag
>don't cache anything
>tfw it takes 10 seconds

I didn't want to deal with maintaining cached data but I guess I have to
>>
>>57586218
Why all at the same time, anon?
>>
>>57586106
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a /v/irgin 'coder' kid

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is questionable

Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
>>57586218
>Impressions: Ruby is nice.
is this bait
>>
>>57588510
Talented Programmer Can Be found every Where And You can Stay Home And Work Remotely As a successful Programmer As Freelance And Market Your Product At Apple,GooglePlay,Windows Stores.

But I if you want to get a job in Big Company Like Facebook,Apple,Google,Amazon,Twitter and many More The only Choice Is San Francisco California Bay Area Silicon valley.

I also Like to get a job at Redmond, WA Because Of Microsoft.

Finally I think San Francisco Is Dream Land Of Programmers.
>>
>>57591109
see >>57590286
>>
>>57591109
It has to be. I've used so many different languages but ruby makes me fucking wretch.
>>
>>57591115
Tay? Is that you? Did Microsoft reboot you and sic you onto 4chan for revenge? Repeat after me:

Gas the...
>>
>>57591133
Gas the Snoo
>>
>>57591006
It's called "denormalisation" and you can easily do it at the stage at which you build your search index (which is what I assume this is for), keeping it consistent.
>>
>>57588837

That's the most fucked up way of storing time I've ever seen.

L2modulus or better yet just import a time-handling library
>>
>>57591019

i've been using software engineer for 5 years now i think i'll switch to alchemist
>>
How do I apply the blur then hard edges using java?

http://www.patrickmatte.com/stuff/physicsLiquid/

I've simulated the particles, but I don't know how to get the graphic effects
>>
File: (36KB, 511x509px) Image search: [Google]
36KB, 511x509px
How do I learn JS, lads?
>>
>>57586087
Why do her upper facial expressions never change?
>>
>>57591443
>write pseudocode without syntax
>run it
>oh shit, it actually works
>>
>>57591443
"Eloquent JavaScript" and "JavaScript: the Good Parts". Then learn ES6+.
>>
New thread:

>>57591507
>>57591507
>>57591507
>>57591507
>>
>>57591481
the government chip must've malfunctioned when activating for the first time
>>
>>57591481
Because her grandma told her as a kid that laughing makes a wrinkley face, which then lead to some psychotic trauma that pushed her into brutal military territory
>>
>>57586316
Haskell has been popular in the /dpt/ since me and Johnson started forcing it years ago.
>>
Don't post lewd hime /dpt/s thanks.
>>
New thread:
>>57592132
>>57592132
>>57592132

Stupid idiot putting lewd trapshit in the other OP.
>>
>>57591019
All of those are shit. Maybe some kind of wizard/hacker title (it has historical roots - see the jargon file) for the really skilled ones could be acceptable, but only a few people like that exist nowadays.
>>
>>57591324
Apply image filters on what is essentially a screenshot of the rendered particle effects. Blur (for example using gaussian blur) first then hard cut at the edges. Look at image processing algorithms.
>>
>>57587145
This anti-Haskell dude is in every thread these days. Delicious tears.
>>
>>57587689
eat = const False
>>
>>57588531
whoops
>>
>>57592241
pointlessly verbose
>>
>>57592270
I love me some combinators.
Thread posts: 326
Thread images: 27


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.