[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/ - Delicious 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: 353
Thread images: 43

What are you cooking up, /g/?
>>
C
>>
D is dead
D will never not have a GC
D will never replace C++
D will never have a gf
D will never be a good language
>>
>>59852377
.. is the source of all security exploits.
>>
>>59852405
How can languages have "lives"? I like fan fictions.
>>
>>59852407
Reminder that no language can yet replace C. C will be the language of FFI interfaces and ABIs for a long, long time.
>>
>>59852405
I thought I told you to stop peddling your awful meme
>>
>>59852405
Rust doesn't have these problems
>>
>>59852452
This is why C is a tumor to the software industry.
>>
>>59852454
Rust also doesn't have HKTs

>>59852453
Still here, claims-not-to-be-Andrei's-buttboy?
>>
>>59852371
> it's popularity is falling more than any other languages in the market.
>C is dying and it should die ASAP.

half a century later, still top language for sys
>>
>>59852485
Yes
>>
>>59852485
HKTs are for brainlets.
>>
>>59852485
Rust doesn't need HKTs to appease to one autist who uses them for toy programs.
>>
>>59852407
except the ones caused by javascript
>>
File: umaru!!!.png (472KB, 791x753px) Image search: [Google]
umaru!!!.png
472KB, 791x753px
>>59852366
Python is like buying a box of premade cupcakes
C++ is baking cupcakes from a boxed cupcake mix
C is baking cupcakes from scratch
ASM is baking cupcake from scratch and grinding all your own ingredients
>>
>>59852518
Have fun writing the same code over and over again without them. I hope your boss fires you for wasting time like that.

>>59852519
Then Rust will be yet another waste of countless hours of work. Another language stillborn.
>>
>>59852542
Nah, I'm good at metaprogramming
>>
Explain HKTs to me without using a Haskell type signature
Or link me a good article explaining them
>>
>>59852542
>same code over and over again
t. someone who has never used a language with a macro system
>>
>>59852554
>>59852582
Heavy use of metaprogramming is a sure sign that a language possesses many deficiencies.
>>
What's even the reason for not having them in Rust in the first place? It's not like they will scare away retards who wouldn't have touched the language either way.
>>
lol @ babbies dissing C, probably don't even understand pointer arithmetic and memory management

Have fun declaring 64 bit integers for your loop counters

t. systems guy
>>
>>59852590
Not using metaprogramming to your advantage is a sure sign of a retarded programmer who doesn't obey the rule of never rewriting code more than once.
>>
>>59852576
Do your own homework, scrub.

>>59852594
Haven't you heard? If you design a crippled language, you can call it "pragmatic" and/or "practical", and idiots will flock to it.
>>
File: anime-girls.png (1MB, 1200x1800px) Image search: [Google]
anime-girls.png
1MB, 1200x1800px
>>59852426
>>
>>59852604
I guess so.
>>
Currently learning C++ from a book called "Accelerated C++" by Andrew Koening and Barbara Moo and compiling and editing the example code using Xcode

I'm on chapter four where they introduce partitioning a program into several files. They say to name my header files as "header_name.h", but Xcode initializes header files as "header_name.hpp". Either one compiles on my computer.

Which is the proper way? .h or .hpp?
>>
>>59852601
Why resort to metaprogramming if the language allows you to write generic, reusable code directly? Metaprogramming introduces unnecessary complexity and maintainability headaches.
>>
"metaprogramming" is just regular programming in any non-shit language.
>>
>>59852630
i guess they call it hpp because hpp is to h as cpp is to c. never heard of it before
>>
>>59852630
C++ is retarded, and couldn't even decide on a single standard file extension.
Also, use .hpp. .h is for C header files, and people who use that for C++ can go fuck themselves.
>>
>>59852655
Stop using header files altogether, they just pollute the function namespace.
>>
>>59852485
What language do you use?
>>
>>59852604
Butthurt
>>
Husklelshitters are out in full force tonight
>>
>>59852667
I don't touch anything without dependent types and a totality checker.
>>
>>59852631
>Why resort to metaprogramming if the language allows you to write generic, reusable code directly?
I can write generic reusable code in Rust directly

>Metaprogramming introduces unnecessary complexity and maintainability headaches.

Are you a toddler? It doesn't introduce complexities at all and maintaining it is as simple as maintaining a normal function. You clearly have never used a langauge with a macro system

>>59852639
And then we have this idiot who doesn't understand the use of metaprogramming.


You are the same kind of people who will argue that Emacs is a bad editor simply because it lets you customize it as much as you please.
>>
>>59852609
All I can picture is the Python girl being tugged in different directions by the 2 snakes
>>
>>59852694
Haskellshitters are out in full force everynight crying on /g/ because their language is so shit that they can't do anything relevant with it aside from their toy programs.
>>
File: 1458383683649.png (450KB, 812x720px) Image search: [Google]
1458383683649.png
450KB, 812x720px
>>59852700
Why would you need a totality checker if the language isn't crippled and is total in the first place?
>>
>>59852694
What's the matter, failed your Haskell class in college?

>>59852679
Just stating facts.

>>59852702
>I can write generic reusable code in Rust directly
No, you can't. This follows directly from its lack of HKTs.
>>
Math autists shouldn't be programming.
>>
>>59852700
I should have guessed
>>
>>59852719
Sometimes I must descend from the clouds and interact with mortals, regrettably.
>>
>>59852723
>Math autists shouldn't be writing proofs.
That's what math autists do.
>>
>>59852736
programs aren't proofs, they have effects
>>
>>59852723
Non-math people shouldn't be in programming. Y'all are the reason software doesn't work.
>>
>>59852722
Yes I can. Consider reading the Rust site if you have any further questions about the Rust language since you don't seem to know anything about it.
>>
>>59852747
Equivalence isn't identity.
>>
>>59852753
I don't need to read the Rust site. Rust lacks HKTs and it is therefore impossible to write generic, reusable code in it directly.
>>
Why do Haskell programmers try to assert themselves everywhere? I'm so glad the Common Lisp community is much more tame and keeps to themselves.
>>
File: 1460303555163.png (425KB, 589x564px) Image search: [Google]
1460303555163.png
425KB, 589x564px
>>59852748
>Non-math people
>people
>>
>>59852722
>Haskell class in college
Be pretty shameful for a school to have a class even more useless than gender studies 101
>>
>>59852762
i bet you think this was really deep and meaningful
>>
>>59852777
Because they're fucking autistic and this is their whole life.
When you insult haskell, you're insulting the very foundations of their life.
>>
>>59852786
So your college didn't even try to teach you Haskell? I sure hope you got a scholarship, because otherwise you wasted your money.
>>
>>59852790
It's self-evident and anyone should be able to understand it, assuming they aren't a retard like you.
>>
>>59852770
>I'm ignorant of your language but i'm going to make a false statement anyway because I'm a haskellfag with nothing to do in my life since my toyprograms are worthless, no one will let me in their OSS projects since I'm an elitist retarded, and I have no intentions of learning anything but what my god and savior haskell tells me
>>
>>59852723
Hope this isn't in response to the Husklelshitter. All they can do is pseudo-math.
>>
>>59852807
Who are you quoting though?
>>
>there has still been nothing of importance written in Haskell
>>
>>59852777
>>59852791
I don't even like Haskell much. It's just better than most languages.

>>59852807
>A implies B, A, therefore B
>noooooo you need to read the rust site
>>
>>59852748

Software bugs come from a wide variety of sources, and it's not always from having a poor understanding of the math.
>>
>>59852806
>outright say programs are proofs
>this is demonstrably false
>"Equivalence isn't identity."
woah, neurons in overdrive
>>
File: haskell scala autists.png (260KB, 600x800px) Image search: [Google]
haskell scala autists.png
260KB, 600x800px
>>
>>59852801
So MIT and Stanford are a waste?
>>
>>59852821
It must be liberating, in a way, to be aware of so little in the world.
>>
>>59852821
>>59852823
Who are you quoting?

>>59852835
programs <=> proofs. This is proven.
And who said the first two quotes?
>>
>>59852842
>MIT
>even dropped Scheme and began using Python instead
Utter trash.
>>
>>59852854
Right, some of the brightest minds in CS are utter trash because they weren't forced to pay for a class that could be learned online in less time.
>>
>>59852853
programs aren't proofs though, is what i'm saying and you fail to understand. proofs do not do anything. they are entirely useless, on a fundamental level. programs, on a fundamental level, are useful. do you understand what i'm saying? proofs do not cause an effect
>>
>>59852874
Reread my post. You seem to be utterly retarded and incapable of reading basic sentences.
>>
>>59852872
MIT is trash. Its students wasted their money (unless they got scholarships).

l2reading comprehension
>>
>>59852883
you're just plugging your ears at this point
>>
>>59852874
Programs are not useful, on a fundamental level. They're only an AST (or worse, text).
>>
>>59852889
One of the highest ranking schools in the nation is trash because they don't offer your languages anymore and you are too incapable of learning them without a professor wasting his time teaching you petty shit?

This is exactly why you are on the internet shilling haskell and doing nothing with your life.
>>
>>59852366
Trying to learn how to use templates in sepples.
>>
>>59852899
I am stating something which is known to be true beyond any doubt. This is literally proven. Programs are equivalent to proofs.
You're not even arguing with me here, if you have some information which shows that this is incorrect I'm sure a lot of people would like to know that.
>>
>>59852904
so butthurt you had to reply twice?
>>
>>59852874
>>59852904
>useless
>useful
>>>/t/umblr
>>
>>59852916
>Programs are equivalent to proofs.
show me a proof that can edit text documents. you can't, because proofs are not imperative and cannot perform. go back to sci
>>
>>59852907
It being trash is not about specific languages. It's about the philosophy that informed its decision to switch from Scheme to Python.
>>
>>59852609
Here's a page with some descriptions of the anime personifications of programming languages:
http://next.rikunabi.com/tech/docs/ct_s03600.jsp?p=002412
It's in Japanese, but more or less understandable after you run it through google translate.
>>
>>59852931
Of course anon, you know much better than them and their program even tho you probably never even went anywhere past HS let alone near MIT
>>
>>59852928
>you can't
Nor do I need to. The truth of that statement is independent of what I do.
>>
How do I set up graphical output with C++ on osx?
>>
>>59852931
"Programs should be readable" - Philosophy that informed MIT's decision to switch from Scheme to Python
>>
>>59852958
What do you mean by "graphical output"?
>>
>>59852961
Scheme is far more readable than Python.

>>59852949
>you know much better than them and their program
Yes, I do.
>>
>>59852953
it's not about whether you can do it or not. you can't write a proof that returns 1. because proofs don't return. proofs don't do ANYTHING. that's the big thing you don't understand. math doesn't do anything at all
>>
Stop giving this guy (You)s
>>
>>59852982
Programs are proofs, and vice versa.

A program that returns 1 is a proof.
>>
>>59852991
copy and paste the definition of declarative, and then do the same for imperative, post that, and then don't post anything else
>>
>>59852982
A proof can prove that the result a program returns is correct

These things are complementary, why are you trying to pit them against one another
>>
>>59852991
>A program that returns 1 is a proof.
It is a coincidence, not a proof.
>>
>>59853004
because he falsely equated programs to proofs here >>59852736 in "who are you quoting" tier greentext
>>
>>59852984
Which guy
>>
>>59853007
All programs are proofs, no matter how much you wish they weren't. This is an inescapable truth.
>>
>>59852982
My ability or inability to write a proof which """""""""returns""""""""" 1 is entirely irrelevant.
These two things have already been proven to be equivalent.
>>59853014
Where did I ever write this?
"programs = proofs"
>>
>>59853034
>These two things have already been proven to be equivalent.
prove it then, proof man :)
>>
>>59853041
https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence
>>
>>59853029
The observable behavior of a program does not constitute a proof.
>>
>>59853041
I'm not smart enough to do so, but I don't need to, since it has already been done. >>59853047
>>
>>59853017
This guy >>59852984
>>
>>59853047
why not just link that 30 minutes ago instead of leading me along to get a cool internet fight out of it? doesn't change the point that proofs are declarative and not imperative so they're not actually the same thing as programs, unless you take action based on the result of the proof
>>
File: 1478056675472.jpg (256KB, 1155x703px) Image search: [Google]
1478056675472.jpg
256KB, 1155x703px
Is it true that crossdressing makes you a better programmer?

I need to know before I buy this.
>>
File: 1480467632292.jpg (48KB, 500x300px) Image search: [Google]
1480467632292.jpg
48KB, 500x300px
>>59853147
>>
>>59853123
>so they're not actually the same thing as programs
No. A program is a proof. A proof is a program. That's proven, don't argue. Reality is often stranger than fiction.
>>
>>59853147
>$80 to be a faggot
>>
File: trap-programming-2.png (2MB, 1058x1600px) Image search: [Google]
trap-programming-2.png
2MB, 1058x1600px
>>59853147
Yes. Though you should consider starting out with striped thigh-highs.
>>
>>59852366
>What are you cooking up, /g/?
working on a cross-platform app for mindless consumers
>>
What do people think about having full or almost full type inference where annotations are basically just checked comments?
>>
>>59853147
I've tried crossdressing a few times and here are some of the positive reasons why I recommend it:
>comfy
>increased creativity (~76% of the time)
>gives fresh perspective on problems
>motivates you (varies from person to person)
The dildo in your ass is just a bonus
>>
>>59853214
>full type inference
That's a sure sign of a type system being deficient.
>>
>>59853241
Almost full. For example, you don't really ever need to specify the return type of a function. Depending on how the language works it could be inferred most of the time, and you can write functions like so:
foo (f : (x : A) -> B x) (a : A) = f a

Instead of like so:
foo : ((x : A) -> B x) -> (a : A) -> B a
foo f a = f a


And whenever possible the parameter types could be inferred too.
>>
https://www.youtube.com/watch?v=R4hNmWvFcxo
>tfw no chad bf to code with
>>
Someone explain this fallacy that if you criticize something, you don't understand it.
>>
>>59853296
https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
>>
>>59853296
That's literally the dumbest question I've ever heard.
>>
>>59853285
can't stand this so-called youtuber
more than 13 minutes just to say:
"According to my research, these are the programming languages you should be focusing in 2017:
- JavaScript
- Python
- Elixir
- Rust
- Swift"
>>
>>59853296
>if you criticize something, you don't understand it.
Claiming this is itself a fallacy.
>>
>>59853310
But anon, this was a request, not a question!
>>
>>59852970
>Scheme is far more readable than Python.
No it's not
>>
>>59853170
>A program is a proof.
But it's not
>>
>>59853430
They can be proofs. Unfortunately if they aren't proven to terminate then you are effectively saying "if this terminates, then X" which of course is in general absurd. But imagine a universe where, somehow, the halting problem doesn't hold. Then it would be a proof of a type expressible in that universe.
>>
File: youthink.png (287KB, 1010x1718px) Image search: [Google]
youthink.png
287KB, 1010x1718px
hmmmm
>>
>>59853458
I mean I wouldn't disagree that the results of running a program could prove something, but to say that the program itself in the abstract, without running it, constitutes a proof of anything, I wouldn't be so sure..
>>
File: test (4).png (532KB, 602x699px) Image search: [Google]
test (4).png
532KB, 602x699px
How do you guys numerically define pi? I do 4 * atan(1).
>>
>>59853495
int pi = 3; //Optimized
>>
>>59853310
Why?

Ignore this...>>59852600
>>
>>59853492
Why not? Take a function. A function type interpreted as a proposition is an implication. A -> B means A implies B. If you can prove A, B follows. The function itself is the proof, an algorithm that turns a value (proof) of A into a value (proof) of B.
>>
>>59853205
sauce?
>>
>>59853430
Provide a formal proof of the Curry-Howard correspondence being incorrect. Unless you can somehow accomplish this your post is worthless.
>>59853492
>I wouldn't be so sure..
I'm glad the truth isn't predicated on your feelings.
>>
>>59853217
So what you are saying is that if people leave you alone, you get stuff done.
Makes sense.
But is it worth it?
You have to spend your life in solitude because the only ones who want to deal with you are faggots.
>>
>>59853525
saucenao
>>
I feel spoiled using MATLAB for array shit
>>
>>59853524
Okay lets take a very simple program and we'll see if you can tell me what it proves:
1 = 2
>>
>>59853549
It's a definition that 1 and 2 are identical in your universe.
>>
>>59853555
But 1 and 2 are not identical, and further, when executed in python you get "SyntaxError: can't assign to literal". And in other languages you'll get all sorts of different errors.
>>
>>59853568
>But 1 and 2 are not identical
They are by definition identical, here is a proof of that being the case in whatever logic system this was written in >>59853549
>>
File: yuzuko_gelfand.png (3MB, 1366x2300px) Image search: [Google]
yuzuko_gelfand.png
3MB, 1366x2300px
>>59853533
>So what you are saying is that if people leave you alone, you get stuff done.
Not at all.
>You have to spend your life in solitude because the only ones who want to deal with you are faggots.
Not at all.
Don't criticize something just because you don't understand it anon.
>>
>>59853578
>They are by definition identical, here is a proof of that being the case in whatever logic system this was written in >>59853549(You)
But you're assuming we're interpreting it as a proof in a logic system. It's actually a statement in a programming language.
>>
>>59853568
With all of our current knowledge presumed, no, that would be an error as you cannot redefine 1 or 2.

Besides, Python and many other languages are unsound.
>>
>>59853481
Kek, what happened here?
>>
>>59853481
Why are you using threads when your design is inherently sequential thanks to a 1 slot buffer? I'd also bet your Ada program isn't locking the Buffer which accounts for some time.
>>
>>59853589
>proof
>program
Yes, I am assuming that since that is indeed the case.
What you wrote is identical to
1 := 2
Which is "1 is defined to be 2".

>>59853590
Why not? He didn't define 1 and 2 to have any prior meaning.
>>
Anyone else dislike Elixir after working with it for a bit?
>>
>>59853605
>Why not? He didn't define 1 and 2 to have any prior meaning.
If so then why would doing that be a problem?
>>
>>59853605
>Which is "1 is defined to be 2".
Which is fine in logic, but in programming it is not.
How then do the two interpretations of the statement coincide?
>>
>>59853612
It wouldn't be. It's as meaningless as x := y since nothing here has been defined yet.
>>59853621
You are assuming that "1" and "2" are the integers 1 and 2, they are not (since you haven't stated that in your system).
>>
>>59853633
>It wouldn't be. It's as meaningless as x := y since nothing here has been defined yet.
So? You wrote a meaningless program and you got a meaningless proof.
>>
>>59853604
Which is a positive for the Ada version
>>
>>59852366
Has anyone completed the harvard CS50 intro to programming course?
Its free, should I follow through with it or is there a better place to be learning?

Its teaching C
>>
>>59853642
Indeed. Your point being? Not every proof/program has "meaning".
>>
>>59853648
That there's nothing wrong with proofs being equivalent to programs.
>>
>>59853651
Where did I ever imply that there was?
>>
>>59852590
retardedly wrong, one of the commonly agreed failing points of lisp dialects is that they lack expressive macros.
>>
>>59853657
>>59853492
>>
>>59853660
That wasn't me.
>>
>>59853217
how does one fix the issue of being too tall to crossdress?
>>
can we all just agree to let /dpt/ be computer science and /sci/ be for mathematicians?
>>
>>59853679
You don't have to be a mathematician to accept basic truths.
>>
File: sorting-algorithms.webm (214KB, 900x456px) Image search: [Google]
sorting-algorithms.webm
214KB, 900x456px
>>59852366
Given binary search tree T, how do I find the first node who's key is greater than N?
>>
File: 20df4ca0.jpg (153KB, 900x1200px) Image search: [Google]
20df4ca0.jpg
153KB, 900x1200px
>>59853677
Just bee yourself.
>>
File: kid.jpg (38KB, 362x346px) Image search: [Google]
kid.jpg
38KB, 362x346px
How exactly do you do big programs in functional languages like Erlang or Haskell? For example lets say you're doing a simulation of missile trajectory through space. Over time it's going to at the very least update it's position, rotation, etc, but how do you update that information in a language that only allows for immutable data? Are you having to recreate a copy of that Object every time it updates one small thing about it?

What if there are 1000s of them and we have them in some list, everytime one gets updated I have to update my list which means remaking the list? This just seems like a nightmare.
>>
>>59853709
b-but i won't look cute enough to be a good programmer
>>
>>59853711
>Erlang, Haskell
>language that only allows for immutable data
This is just blatantly false.
>>
>>59853723
Am I missing something here? Aren't both of them 'purely' functional languages?

Is there like some secret command that allows you to ignore everything and do unsafe modifications?
>>
>>59853739
Purely functional doesn't mean no mutation.
>>
>>59853739
Mutable data doesn't have to break "purity".
Also
>everytime one gets updated I have to update my list which means remaking the list
Don't know about E*lang, but that's definitely not the case in H*skell. You wouldn't have to recalculate the whole list.
>>
>>59853689
>You don't have to be a mathematician to accept basic truths.
>basic truths
Yes like the fact that logic, and indeed reason, are not sufficient means to derive knowledge
>>
>>59853748
>>59853743
Oh. Well how exactly do I reassign a variable then in either of those languages? I never saw it mentioned in any of the books I read.
>>
>>59853771
https://en.wikibooks.org/wiki/Haskell/do_notation
>>
>>59853770
That sounds like something a leftist retard would say, in which case I can't say I'm surprised.
>>
>>59853786
That's incorrect.
>>
Doing SICP Exercises. Quick question, is there a difference between the two multiplication algorithms below?

//attempt at recursion
(defun multiply(a b)
(cond ((= b 0) 0)
((isEven b) (multiply (double a) (/ b 2)))
(T (+ a (multiply a (- b 1))))))

and
//attempt at iteration
(defun fast-mult-iter(a counter product)
(cond ((= counter 0) product)
((isEven counter) (fast-mult-iter (double a) (/ counter 2) product))
(T (fast-mult-iter a (- counter 1) (+ product a)))))



Because they seem to both be O(log N) and do pretty much the exact same thing. Are they different?
>>
File: 1428469460313.jpg (82KB, 500x603px) Image search: [Google]
1428469460313.jpg
82KB, 500x603px
Why are there like a dozen malloc implementations and why does the standard implement the slowest one?
>>
>>59853790
>>>/pol/
But seriously all knowledge is derived from logical examination of evidence. Without either you can't have knowledge.
>>
>>59853677
Have you tried not being a faggot?
>>
>>59853844
Why are you sending me to a leftist board? My post clearly states I despise your kind.
>>
File: 5ef657c308b51e58408cbff0c7596953.jpg (107KB, 1280x813px) Image search: [Google]
5ef657c308b51e58408cbff0c7596953.jpg
107KB, 1280x813px
>>59853713
I told you to wear thigh-highs and short-shorts last night, anon. Why aren't you doing it?
>>
>>59853854
How has what I've said in any way indicated to you leftism?
>>
>>59853867
I was trained to detect your kind pretty well.
It's extremely unlikely, but I'll ask, was I somehow wrong this time?
>>
>>59853846
In fact, I did. A while back. It didn't make me feel any more at peace with myself, so trying something else now.
>>
>>59853894
I think you should get a refund for your '''training''' :')
>>
>>59853913
I can't get a refund for something that was neither voluntary, nor for money.
You didn't answer the question.
>>
Box<Any>


this should be a sin
>>
>>59853495
tau / 2. My language defines tau, but not pi.
>>
>>59853921
You must have literally a sub-80IQ if you couldn't see the answer in my post.
>>
>>59854045
All I saw was an attempt to dodge a simple question. Even if we assume I am just stupid and can't see it, could you please state it in a more obvious form?
>>
>>59853959
>
<>

This should be a sin.
>>
so I started reading this "haskell from first principles book" and it seems alright, but my brain sort of shuts down when I read a lot of mathematical notation

is there some better resource to learn about functional programming for a person who does not like so much notation?
>>
>You will never program a legal ~ATH compiler
>>
>>59853865
good question
>>
>>59854119

What's wrong with parametric polymorphism, Anon?
>>
>>59854147
The syntax. The bloat.
>>
>>59854087
You're wrong
Why would I dodge your question on an anonymous mongolian basket weaving forum such as this
>>
>>59854165
Let's not tell lies. Or are you really being serious here? If so, could you prove it somehow?
>>
>>59854154

Isn't it more bloated to have to write a different vector class for each type you want to make a vector of? Generics are helpful.
>>
>>59854175
I mean I can try if you like
Minimum wage is a fucktarded idea because will only result in either reduced employment or an increase in prices generally, and a proportionate bump in wages for non-minimum wage earners ensuring that those at the bottom stay both at the bottom and as poor as they were prior. Also for welfare in general basically the same thing applies.
>>
>>59854249
Also, historically the only things that have really increased the standard of living on average have been tied to an increase in productivity either through technological development or refining the production & distribution process to be less wasteful. Fiddling around with dollar values makes no difference in the long run as markets adjust to equilibrium.
>>
>>59854249
>>59854271
It seems like I was wrong indeed. This is the first time in hundreds of encounters with them.
>>
File: Untitled.png (1MB, 1920x1080px) Image search: [Google]
Untitled.png
1MB, 1920x1080px
>>59852366
Trying to make some image management program since my image folder looks as though a tornado went through it
>>
>>59852405
I thought about it, and the problem is, that there simply is no reason to switch to D, if some platform (e.g. Android) would make its API in it, it could really shine
>>
>>59854319
>>>/g/wdg
Good luck though.
>>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp8
{
class Program
{
static void Main(string[] args)
{
Double CoinNum;

Console.WriteLine("How many coins are you flipping?");
CoinNum = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Out of {0} coin flips, the chances of getting at least 1 heads/Tails is {1} \nOut of {2} outcomes, {3} of them contain atleast 1 Head/Tails.",CoinNum, 1 -Math.Pow(.50, CoinNum), Math.Pow(2.0, CoinNum), Math.Pow(2.0, CoinNum) - 1);
Console.ReadLine();
}
}
}



Simple program. any way to make it even more efficient or are we done here?
>>
>>59854404
Just using HTML as a front end since I want it to be cross platform and Qt5 installation is a pain in the ass on windows.

Frankly speaking I hate GUI programming since they are damn near impossible to debug and design is so damn subjective.
>>
>>59854442
What's your backend programmed in?
>>
>>59854648
ML.
>>
>>59852472
Poor analogy. You can surgically remove tumours generally but it's difficult to catch them all. What you want to say is that it's a poor foundation of a building or something.
>>
File: Untitled.png (484KB, 1920x1080px) Image search: [Google]
Untitled.png
484KB, 1920x1080px
>>59854648
python
>>
File: compiling.gif (3MB, 460x306px) Image search: [Google]
compiling.gif
3MB, 460x306px
>>59853708
Anybody??
>>
In SICP, they tell you you can pass functions as parameters to other functions, which makes it easier to evaluate certain functions.

However, I'm having a bit of trouble implementing one of the examples (summation of the cubes from 1 to 10)

When I compile the following with clisp,
(defun sum(term a next b)
(if (> a b) 0
(+ (term a)
(sum term (next a) next b))))
(defun inc(x) (+ x 1))
(defun cube(x) (* x x x))

(print (sum cube a inc b))


I get the following error:
*** - EVAL: variable CUBE has no value


Why is this happening?
(Also, apparently, when I put parentheses around (cube) in the last line of the code, it recognizes cube is a function, but requires one argument... any thoughts?)
>>
>>59853708
Well since it is a binary search tree then you can just go ahead and do a simple preorder dfs and get the first value that exceeds N. Use something like a stack to store whatever that has just been traversed or just store the latest element in a single variable.
>>
>>59854703
In CL functions and data have different slots. You can have a variable with the same name as your function. To refer to a function as data, you must prepend it with #' (sharpquote).

I suggest you try out scheme for SICP, CL is too shitty imho.
>>
>>59854882
>Scheme over CL

I thought Clisp used Scheme?
To be honest, the only reason I'm using CLisp as opposed to the interpreter is that it makes it a lot easier for me to edit code when I inevitably screw up

(To my knowledge, the only way to get a program to run is to type type scheme in bash, which brings you to the scheme MIT/GNU Scheme program, and from there just type out all your
(define ) 
statements, but I'm probably wrong... I didn't really see any good tutorials on setting up a development environment for scheme, so I've just been sort of winging it for now... I heard Racket's something that might help, would you happen to know how true this is?)
>>
File: 2017-04-12-031443_602x138.png (11KB, 602x138px) Image search: [Google]
2017-04-12-031443_602x138.png
11KB, 602x138px
>>59854713
This is what I have right now. I'm pretty sure it's wrong.
>>59854927
You might have better luck using racket in scheme mode: https://stackoverflow.com/questions/19546115/which-lang-packet-is-proper-for-sicp-in-dr-racket
>>
File: 38493333.png (29KB, 657x527px) Image search: [Google]
38493333.png
29KB, 657x527px
>>59852538
>Too stupid to bake premix cupcake mix
>>
>>59854945
>>59854713
sorry, no, I made a nasty typo.
>>
>>59854945
I've never seen this kind of DFS I'll tell you that...
>>
File: 2017-04-12-032012_644x106.png (11KB, 644x106px) Image search: [Google]
2017-04-12-032012_644x106.png
11KB, 644x106px
>>59854987
Fuck, pressed space and it posted.
>>
File: trash dove gas.gif (41KB, 239x239px) Image search: [Google]
trash dove gas.gif
41KB, 239x239px
>>59854992
Yeah I'm retarded sorry. No clue what it should look like exactly.
>>
>>59854945
alright... Installing Racket (downloading sicp package)... I'll probably continue in the morning
>>
File: sicp-madoka.png (673KB, 1280x720px) Image search: [Google]
sicp-madoka.png
673KB, 1280x720px
>>59855016
Best of luck. I think you'll find it a bit easier to use especially if you're new to programming, and wish to read SICP.
>>
>>59855001
Node* dfs(val, curr_node)
if curr_node == null
return null
if val == curr_node->val
return curr_node
return val > curr_node->val ? dfs(val, curr_node->left) : dfs(val, curr_node->right)


may not be entirely correct
>>
File: perfect.png (10KB, 327x173px) Image search: [Google]
perfect.png
10KB, 327x173px
>>59855019
Holy fuck you're a god among men.
desu I don't know how I got this far without DrRacket.
>>
File: who.jpg (19KB, 424x293px) Image search: [Google]
who.jpg
19KB, 424x293px
person me()
{
//feels this is better
}


identify yourselves!
who is sloppy and who is right?
>>
>>59855090
whatever is the norm in the language or project I work in
>>
>>59855090

Do whatever you want and use an auto-formatter to keep with project spec.
>>
File: 1457893150514.png (278KB, 706x412px) Image search: [Google]
1457893150514.png
278KB, 706x412px
What is the most anime-like programming language?
>>
>>59855090
The right is right and the others are not right and therefore wrong

>>59855203
Haskell
>>
File: 1488159995163.jpg (193KB, 1300x1244px) Image search: [Google]
1488159995163.jpg
193KB, 1300x1244px
>>59855203
lisp
>>
File: wisdom_of_the_ancients-1.png (27KB, 485x270px) Image search: [Google]
wisdom_of_the_ancients-1.png
27KB, 485x270px
every fucking time i go to stack overflow
>>
File: 1485289147366.gif (611KB, 500x281px) Image search: [Google]
1485289147366.gif
611KB, 500x281px
>>59855210
>>59855214
Both of them are unsound, and therefore not anime.
>>
>>59853495
Math.Pi()
captcha: violet pepe
>>
File: 1480962683457.png (595KB, 871x1103px) Image search: [Google]
1480962683457.png
595KB, 871x1103px
>>59855203
Racket
>>
File: 1471736062317.jpg (20KB, 704x400px) Image search: [Google]
1471736062317.jpg
20KB, 704x400px
>>59855417
see >>59855329
>>
File: common-lisp-buncha-parens.png (72KB, 252x479px) Image search: [Google]
common-lisp-buncha-parens.png
72KB, 252x479px
>>59855421
>>
>>59853495
#define pi 3
#define e 3
>>
What's the easiest way to dump all the int elements in an ArrayList of arrays onto another array?

I got:
int[] tmp = new tmp[N];
for ( int[] intArr : buckets ) {
for (int bucket : intArr) {
tmp[bucket]++;
}
}


Is that even right? Idk. Help? Java
>>
>>59855571
*int[] tmp = new int[N];
>>
>>59851152
5 bucks for 4 red led 8x8 32x32mm dot matrix displays including MAX7219 chips to drive them.
Just randomly bought it on aliexpress. I always buy tons of things that look like I could do something interesting with them when I'm on there.
>>
>>59855571
>Java
>>>/r/abbit
>>
>>59855134
This is the only acceptable answer
>>
>>59855834
No, it isn't.
>>
I'm following a Java implementation of an adjacency-list representation of an undirected graph.

In the implementation, the instructor uses bags at each index of the array. It seems like this is a native data structure within Java, and that they're supposedly implemented with linked-lists under the hood. (Is that right?)

I'm implementing my version in Javascript, which doesn't have a native Bag data structure. Can I just use linked-lists at each index of the array? I think it'll do the same thing in the context of the data structure overall, especially considering that I think bags are implemented with linked lists themselves.
>>
>>59855910

There are existing array-backed unordered collections in JS. Why not use one of those?
>>
>>59855935

And by existing, I mean people have developed them, not that JS has them in the standard library.
>>
>>59855942
i thought by existing you meant "in existence or operation at the current time."
>>
>>59855935
You mean like the native array?

I'm trying to stay as true to the implementation outlined in the course as possible, because I'm using them as an exercise to learn and understand the structures, but also to ensure that I'm adhering to performance guarantees associated with the structures I'm implementing -- dynamically resizing arrays in JS will have amortized insertion cost which would make the structure I'm using them to implement no longer have the guaranteed performance it should have.
>>
File: 2017-04-12-054541_479x257.png (27KB, 479x257px) Image search: [Google]
2017-04-12-054541_479x257.png
27KB, 479x257px
>>59855052
This is what I came up with. Appears to work.
>>
File: 2017-04-12-054728_506x272.png (31KB, 506x272px) Image search: [Google]
2017-04-12-054728_506x272.png
31KB, 506x272px
>>59856057
>>59855052
Fuck, wrong screenshot.
>>
File: krautbbs_05b.webm (2MB, 832x1056px) Image search: [Google]
krautbbs_05b.webm
2MB, 832x1056px
Still working on my BBS-simulator for a certain german imageboard.
Got a reply function for /b/ working. WebM related.
>>
>>59855955

Bepis

>>59855960

I think it'd be truer to the implementation to use a bag where a bag is called for, but it's up to you.
>>
>>59856068
redo it in English
>>
>>59856155
>redo it for an english board
>when all of them require a captcha
>>
>>59856281
What's the problem? You can retrieve the catpcha and render it to the terminal just fine.
>>
>>59856068
Looks nice, hate the krautchan design. Plan on releasing it?
>>
>>59856304
proofs
>>
>>59856281
>English board
no, redo it inEnglish
>>
>>59856335
What makes you think that what I'm saying is not true?
When you make a request to the legacy captcha you will get an URL https://www.google.com/recaptcha/api/image? after which you append the challenge ID, which is just a JPEG image, then you can use w3m to display the picture in the terminal (or if you do not want to integrate it, simply make a popout with the the image, say download it to /tmp and call display/feh on it).
>>
>>59856374
>breaking terminal immersions by displaying an image
gross
>>
>>59856384
Render it as ASCII then you nerd.
>>
what is the quickest way to dump into memory the contents of an opengl window or a screen region in linux in image form?
>>
>>59856374
>>59856068 here.
Actually, a "fork" for 4chan is planned, but I have not yet found a good solution for the captcha issue. Will take your suggestion into consideration though. Thanks.

>>59856308
You can get it right now https://pastebin.com/pukiMD9x
>>
>>59856501
https://linux.die.net/man/3/xgetimage
>>
File: 1490407178853.jpg (35KB, 344x550px) Image search: [Google]
1490407178853.jpg
35KB, 344x550px
>>59856068
>deutsche imageboards
Purer Krebs
>>
>>59856539
I don't like blacks either but this is /g/ not /pol/, so either fuck off or go to the correct board.
>>
>>59856597
Das stand ja gar nicht zur Debatte.
>>
>>59856620
>I don't like blacks either
You have probably read and agreed with their posts. Which is why I asked the question in the first place.
>go to the correct board
Sure, to the CIA headquarters.
>>
>>59856656
If I had agreed with a post made by a black person then it's likely that they're among the small group of black people that I wouldn't have a problem with.

But again, >>>/pol/
>>
>>59856674
That's highly unlikely considering how they tend to be.
>But again, >>>/pol/
Why would I be visiting the CIA headquarters?
>>
>>59852405

Someone seems worried about the spread of D.

Go away, Java Pajeet shill!
>>
Currently writing a compiler for a language I've invented called 'Haskell++' (AKA 'Haskell with Classes').
>>
>>59856809
>Haskell with Classes
Maybe you should call it Haskell--
>>
in c++, is it a good idea to always make all getters inline and const?
>>
>tfw I dreamed I was spending time with a cute tsundere anime girl in a supernatural setting
>tfw we were flying around on a broomstick at night, looking for her house, which had disappeared
>tfw I woke up and realised I'm alone and have a Java programming assignment to do
>>
>>59856957
>java
sounds like a nightmare
>>
I want to write a game like Super Mario Sunshine in C or C++.

Wat do?
>>
>>59857027
buy the rights to Mario
>>
>>59857027
>get a cup of coffee
>start writing
what exactly are you asking?
>>
>tfw at the point where I'd rather just program own projects than do boring university coursework most of which are trivial but require a shit ton of boilerplate commenting, testing and writing for stuff I can do with my eyes closed
>>
>>59857060
I'd like you to write it for me.
>>
>>59856957
You best believe in a Java-dominated reality, anon. You're in one.
>>
>>59856884
As long as said getter isn't mindboggingly long, yes, why not? Code that doesn't do so isn't necessarily bad though, remember that early optimisation is evil.
>>
>>59857072
well, make these "trivial" tasks nontrivial yourself mr. smartpants
>prof: "just like draw a line"
>...
>you: "here is my lowlevel library with every possible algorithm included optimized in asm"
>>
>>59857103
that's not what I meant with trivial : ^ )
>>
File: gnu-head.png (5KB, 276x261px) Image search: [Google]
gnu-head.png
5KB, 276x261px
>>59852770
Sorry kiddo, but duck typing is the best in terms of reusability.
>>
>>59855090
bracket wars are a useless topic of conversation
>>
File: 1457983333895.png (48KB, 1920x1080px) Image search: [Google]
1457983333895.png
48KB, 1920x1080px
>>59857249
I agree. Let's talk Python!
>>
>>59856884
>inline
Compilers ignore this keyword. There's usually force inline for your compiler but they're compiler specific. Compilers usually knows best about this sort of thing. It's not something you put in there before profiling. Using the inline keyword might indicate some kind of intent but do you really expect yourself or others to read into the keyword like that?
>const
I don't find it would ever catch bugs for me but it doesn't hurt to put it there really.
>>
File: Capture.png (13KB, 430x420px) Image search: [Google]
Capture.png
13KB, 430x420px
Im working on wangblows right click editor
>>
https://pastebin.com/erv2Rjq8
>took me around 10 minutes
>>
Yeah, rustfags really are the cancer of programming world.
>>
>>59857454
jesus christ
>>
>>59854927
https://repl.it/languages/scheme
>>
Trying to follow windows build instructions from here:
http://mongoc.org/libmongoc/current/installing.html#building-on-windows

But I don't know how to run the cmake command. PowerShell doesn't recognize it and google is being no help. Can I run it in VS?
>>
>>59857602
Your PATH isnt set.
>>
In Java, what's the best way to retrieve the list of fields that a class had but only with its class name?
For example, I have "be.pattex.scheduler.tasks.RefreshDashBoardsTask" as a String. And I want (with this String) to retrieve all the fields (or methods or anything) that this class has?
>>
>>59857458
but anon
SPEED
AND
unsafe SAFETY
>>
>>59857602
have you tried installing cmake senpai?
>>
>>59857454
PORT = 80

def main():
from time import time
from multiprocessing import cpu_count
from queue import Queue
from threading import Thread
from ipaddress import IPv4Address
import socket

start = time()
cores = cpu_count()

queue = Queue(2 ** 32)
for n in range(0, (2 ** 32 - 1)):
queue.put_nowait(n)

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.4)

class Consumer(Thread):
def __init__(self):
super(Consumer, self).__init__()
print('Consumer started.')

def run(self):
while not queue.empty():
self.test_addr(queue.get())

def test_addr(self, addr):
try:
sock.connect((addr, PORT, ))
print('Found open port on host {}.'.format(IPv4Address(addr)))
except Exception:
pass

for _ in range(cores):
Consumer().start()

queue.join()
print('Took {} seconds.'.format(time() - start))

if __name__ == '__main__':
main()
>>
>>59857628
You're looking for a java reflection system.
https://docs.oracle.com/javase/tutorial/reflect/
The classes lesson seems to cover exactly what you wanted.
>>
>>59857673
Yeah I read earlier about reflection but from what I saw it works only with an instance of the class you want informations. In my case, I only have the class name, not an instance of it.
>>
>>59857628
>what's the best way
WTF is going on with all the "what's the best way to do X?" ITT? Why can't you just ask "How to do X?" like everyone else.
As for doing this kind of shit, I guess break the string into pieces and lookup the package, then the class in it, then the field metadata in it. Or alternatively use cn.bestjavalibsonearth.AbstractReusableMethodLookuper or some shit. Our move on to a better language. (It's easy as ABC in snek btw) In short, google "java reflexivity" up and fuck off.
>>
>>59857701
I haven't read this stuff. I'm not a java dev I just skimmed it.

>but from what I saw it works only with an instance of the class you want informations
It's not a reflection system if it deals with instanced objects.
>>
>>59857027
if writing the game is more interesting to you than writing low level engine stuff: use something like unity. trust me. otherwise you'll give up way before you even started coding anything interesting.
>>
>>59857628
>>59857701
Class.forName ("be.pattex.scheduler.tasks.RefreshD")
lrn2read
https://docs.oracle.com/javase/tutorial/reflect/class/classNew.html took me 10 seconds with no prior knowledge of Java (TM)
>>
>>59857762
Anon could we instead just be rude to people who don't even want to help themselves? Eventually they will leave if nobody talks to them or they only get bad responses.
>>
>>59852366
It's coming alone nicely I think...
>>
>>59852790
>4 is equivalent to 1 modulo 3
>Therefore 4=3
>>
>>59857983
equivalence [modulo 3] is not equivalent to equivalence
>>
Dynamic typing, yeah or nah?
>>
>>59857997
>Dynamic typing
Such a thing is by definition impossible.
>>
>>59857997
nah
>>
>>59857997
Not by default, but should be available.
>>
>>59858002
fuck off autist
>>
>>59858032
>>59858033
How were you able to answer his question? Or did you just pick at random?
>>
>>59857997
For scripting languages, yes.
For more serious languages, no.
>>
>>59858036
What are you getting at?
>>59858050
see >>59858038
>>
>>59858002
You mean it's contradictory?
>>
>>59857997
fooNaN
>>
>>59858058
Yes.
>>
>>59858038
>>59858052
Is this some new form of guaranteed-replies shitpost?
>>
>>59858063
Or rather the existence of such a thing would be impossible by the definition of "typing", I don't know if that is equivalent to a contradiction in the true sense.
>>59858073
What exactly in my post got you to make this kind of reply?
>>
>>59858059
That's weak typing
>>
>>59858002
>>59858038
>>59858052
Dynamic typing is generally understood as describing languages where type checking and determination is done at runtime.

Being pedantic does not make you seem smart.
>>
>>59858103
>Dynamic typing is generally understood as ...
Which is a wrong and impossible definition.
You mean "dynamic type checking" here, "dynamic typing" just doesn't make sense in English.
>Being pedantic does not make you seem smart.
No wonder someone who can't understand basic words would think that someone who is capable of doing so would consider himself "smart".
>>
>>59858139
Autism - The Postâ„¢

Here's another (You), now be on your way, pedant.
>>
>>59858153
You're not the sharpest tool in the shed, are you?
>>
>>59856809
How does that look like?
>>
so the xor logical op is basically like a "not and" op
>>
>>59858251
no, that's nand
>>
>>59854419
is there any way to make this more efficient?
>>
>>59858251
No. xor is true in 2 cases, "not and" only in one.
>>
>When you decide to give Haskell a chance and realize that "monads" are just objects by another name
>Hasklelfags are literally shitting on OOP while using it and being too dumb to realize
I'm fucking LMAOing IRL. What the fuck.
>>
>>59858305
Who are you quoting?
>>
>>59858289
>>59854419
Why would you have a double storing the number of flips?

This should be an integer. You're not going to do half of a coin flip.

Why are you even worrying about optimization for something so trivial?

Not efficiency, but you could utilize
int.TryParse
with a loop or exception to ensure the program doesn't break if the user types "cat".
>>
>>59858305
I've been saying this for months.

OOP and FP are basically the same thing if you distill them both sufficiently.
>>
>>59858319
>You're not going to do half of a coin flip.
Why not though?
>>
>>59858305
b8
>>
>>59858305
>>59858326
>>
>>59858316
That should be 'whom', not 'who'; the person being quoted is the object, not the subject, of the sentence.
>>
@59858326
How can they be the same thing when one is a subset of the other while the reverse isn't true?
>>
New thread:
>>59858387
>>59858387
>>59858387
>>
>>59858349
I reject your dialect of English, sorry.
>>
>>59858319
power works with ints? Thats the only reason I'm using double.

also thank you for int parse.

I wan't it to be efficient even if its super trivial to keep myself from building bad habbits.
if there's a way to do something better I should get in th ehabbit of doing it in every program, even the small ones.
>>
>>59858420
>power works with ints?
Are you old enough to use this website?
>>
>>59858420
>I wan't it to be efficient even if its super trivial to keep myself from building bad habbits.
This is literally a bad habit.

There are some common sense decisions you need to make all the time, such as buffering output and then calling I/O, but microoptimizing everything you do is stupid.
>>
>>59857832
Very nice, anon.
>>
>>59857993
It's an equivalence class, you Philistine
>>
>>59854442
>Qt5 installation is a pain in the ass on windows.
Qt4 through msys2 is actualy decent. (Not good, but decent)
Thread posts: 353
Thread images: 43


[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.