[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: 330
Thread images: 38

What are you working on, /g/?

Old thread: >>58642671
>>
good thread
>>
>>58647320
Your thread was created later, though
>>
>>58647282
So, what's a good OOP language, considering C++ is shit?

And don't give me the "OOP is bad" shit since it's impossible to work on the industry these days without having to use OOP.
>>
>>58647336
C#
>>
>>58647336
C++ is the best language for OOP, period.
>>
>>58647346
Depends on what you're doing.
>>
>>58647336
Python is good, I tgink, in terms of OOP, since it treats everything as objects.
>>
>>58647359
>>58647363
There isn't a language as feature-rich and mature as C++ to do OOP.
It's not really a debate.
>>
>>58647363
Isn't Pascal dead?
>>
>>58647336
Smalltalk duh.
>>
>>58647338
It's an anime site. Go to Reddit.
>>
>>58647338
Fuck off, this one was poster before the other.
>>
>>58647384
C++ seems to be a multiparadigm language lately.
>>
>>58647346
>C++ is the best language

You could have stopped the sentence there
>>
>>58647384
OOP is just a set of tools to help you arrange your program.

C++ has strengths in specific places (speed), but it is not objectively the best language that facilitates OOP.
>>
File: 202260-161952-slither.jpg (106KB, 400x397px) Image search: [Google]
202260-161952-slither.jpg
106KB, 400x397px
>>58647282
Python
>>
>>58647418
"No"
>>
>>58647384
Not everyone wants bloated languages. Not everyone wants OOP.

Its really debatable.
>>
>>58647399
As it should be.
>>58647402
Never said that, and I don't even use C++ anymore.
>>58647410
D's already pretty much there, once we get rid of GC, it'll surpass it.
>>
I'm getting major deja vu right now.

>>58647426
The original question was specifically for OOP languages, though.

>>58647336
C#
>>
>>58647434
What's good in D, Andrei?
>>
>>58647336
Definitely C#
Industry corporate enterprise edition
>>
>>58647445
native modules.
no header bullshit.
no bloated STL
MUCH MUCH MUCH better templates.
more powerful range and slice tools.
limited class inheritance.
no preprocessor nonsense.
more flexible constructors.
more powerful and common sense struct tools
the list goes on
>>
>>58647341
>>58647438
>>58647468
How can I make C# to get conpiled into native code?
Under Linux, please.
>>
>>58647486
>Industry corporate enterprise edition
>Linux

Choose one.
>>
>>58647492
I dunno, man, I tuned a web server under Linux in a big company.
>>
>>58647504
If you're developing an application, it's under Windows.
>>
>>58647520
OK, what if I don't want C# Industry corporate enterprise edition?
>>
>>58647547
http://www.mono-project.com/docs/about-mono/languages/csharp/
Try this?
>>
>>58647547
Don't use it.
It's just the current meme.
>>
>>58647480
Does the language still only offer convenience for those who use the GC?
>>
File: not_programming.jpg (514KB, 797x1000px) Image search: [Google]
not_programming.jpg
514KB, 797x1000px
>>58647363
>>58647385
Pascal-posters confirmed anti-anime?
>>
>no functional programmers late threads
Did they die out?
>>
I'm learning Java through Codecademy and I'm finding that I waste a lot of time wondering about the true purpose of all these new concepts being thrown at me. Is this normal or brain problems? Do I just continue anyway hoping that it'll come together on its own?
>>
>>58647583
They finally realized that functional programming is a useful tool to have but awful to actually write entire non-trivial software in. They then chose to end their lives out of shame.
>>
>>58647572
It's not GC favor'd if that's what you're implying, just a big mistake they're fixing.
>>
>>58647282
Why is assembly the most disgusting of the 3 in that image?
>>
>>58647608
Sad.
I was legitimately amused by "In Haskell, it's just X" posts.
>>
>>58647613
Anon I'm saying that I want to do MMM and doing auto newString=myString[0..$-1] implies GC afaik. I can't tell it to use my memory management system in some way right? Because if I can't then I can't use this nice syntax anymore. And I drop down to something far more similar to C or C++.
>>
>>58647642
To be clear I'm not pooping on D. It's just that it's not as nice as I'd like it to be I think.
>>58647620
Go back to spamming?
>>
File: MMM_logo.png (177KB, 300x200px) Image search: [Google]
MMM_logo.png
177KB, 300x200px
>>58647642
>MMM
Manual memory management?
>>
>>58647620
Assembly is the most pure language of all time hence why it's portrayed by 2D.
>>
>>58647661
Yes. It's fairly obvious from context.
>>
>>58647596
What concepts are you talking about? It take a while and some experience to understand why people came up with these features and concepts.
>>
>>58647667
>2D
>pure
HAHAHAHAHAHAHAHAHAHA
>>
>>58647596
It's normal because they're not intuitively useful at the smaller scales.
I'm not an object oriented programming proponent so I'm bias against it but examine it with a critical eye at least.
>>
>>58647667
>Assembly is the most strongest language of all time
FTFY
>>
I''m having some trouble creating a generator from two other generators in scala. I''m trying to make a monoidal generator, as monoids have this sort of functionality built in but am 'having trouble with the syntax. Any ideas?

<code>
class GenMonoid[M >: Monoid[M]] extends Monoid[Gen[M]] {
override def zero: Gen[M] = Gen.const[M](zero)
override def append(f1: Gen[M], f2: => Gen[M]): Gen[M] =
for (
m1 <- f1;
m2 <- f2
) yield M.append(m1, m2)
}
</code>
>>
>>58647693
2D females are far more pure than any 3DPD. Even 2D traps are more pure than modern sluts.
>>
>>58647560
I'll look through it, though I thought Microsoft gave more freedom with .NET lstely.
>>
Fixed syntax, sorry.

I'm having some trouble creating a generator from two other generators in scala. I''m trying to make a monoidal generator, as monoids have this sort of functionality built in but am 'having trouble with the syntax. Any ideas?

class GenMonoid[M >: Monoid[M]] extends Monoid[Gen[M]] {
override def zero: Gen[M] = Gen.const[M](zero)
override def append(f1: Gen[M], f2: => Gen[M]): Gen[M] =
for (
m1 <- f1;
m2 <- f2
) yield M.append(m1, m2)
}
>>
>>58647715
Or do I want a Monad here?
>>
>>58647642
auto str = "hello";
auto string2 = str.dup[0..$-1];


No new allocation according to -vgc
>>
>>58647486
You can use Mono or .NET Core

>>58647520
>>58647492
C# works on Linux.
>>
File: u1qlp.jpg (16KB, 480x318px) Image search: [Google]
u1qlp.jpg
16KB, 480x318px
>>58647707
Please tell me more about how good your imaginary cartoons are
>>
>>58647686
>>58647697
Realized that I forgot to mention I'm a complete newbie. My issue applies to all programming taught at Codecademy. Wondering if I should also try Pajeet video tutorials and/or books on the subject
>>
>>58647520
>If you're developing an application, it's under Windows.
>he doesn't know that RHEL is actively supporting and pushing .NET on Linux servers

redhatloves.net
>>
>>58647793
I don't know what your issue is really. A more concrete example would help.
See I think you're asking things like 'why do I ever need an abstract class?' and wonder if it's normal to have these questions.
>>
>60mb binary
hha hahha hhahahahah
>>
>>58647755
>C# works on Linux.
I don't know if Mono is stable enough and can be trusted in terms of running legit C# code.
Does Mono run .NET applications, compiled with MS tools?
>>
>>58647336
Common Lisp CLOS is god-tier.
>>
>>58647844
>Does Mono run .NET applications, compiled with MS tools?
Yes.

Your only issues are going to be some of the newer stuff in ASP.NET if you're doing webdev, IIRC.
>>
>>58647842
>needing to compile against 10 different OSes and distributions
>>
File: 1474998741813.png (597KB, 480x854px) Image search: [Google]
1474998741813.png
597KB, 480x854px
>>58647861
Don't you say I can run Paint.NET under Linux
>>
>>58647336
>>58647341
>>58647438
>>58647468
Forgot to mention, no Microshit. I won't go that low.
>>
>>58647912
>le microshit x---DDDD
*tips*
>>
who /VsVim/ here?
>>
File: 1485232929453.jpg (84KB, 469x292px) Image search: [Google]
1485232929453.jpg
84KB, 469x292px
>>58647941
>>
>>58647582
Mods got trigger happy lmao.
>>
Java ran even on dumbphones, what makes people claim that it's shit?
I think if I wanted my program to spread as much platforms as possible, I'd go with Java.
>>
>>58648143
There is nothing wrong with the Java language.

The problem is the overabundance of shitty Java programmers turning everything into giant bloated object oriented crapware.
>>
>>58648188
>>58648143

Pajeets do this:

https://sourcemaking.com/antipatterns
>>
File: Untitled.jpg (155KB, 900x872px) Image search: [Google]
Untitled.jpg
155KB, 900x872px
What the FUCK does lexicographically larger mean?
Google doesn't help.
>>
#!/usr/bin/perl                                    
use v5.14;
use strict;

my $ayy;
$ayy = "LMAO";
say $ayy;
for (split (//, $ayy=~s/^.(.*)$/$1/)) {
say $_;
}

I still hope there is a way to change LMAO string into MAO string with a regular expression
>>
>>58647873
no senpai, its just that the runtime is included too
>>
>>58648306
sorted alphabetically.

Example:
> 1,2,3,5,5,6
is greater than
> 1,2,3,3,5,6

So you get rewarded for getting a large point earlier. This means that if you are going up against a very even opponent, you get rewarded for getting a big point in early.
>>
>>58648306
https://en.wikipedia.org/wiki/Lexicographical_order
>>
got a design question for you lads, ive got a chessboard style pitch that my agents are gonna occupy, should i put the ball on a seperate square to the agent, or should it be on the same square?
>>
>>58648306
It means it treats them like they were strings, even if it's a number.
>>
>>58648306
Do a barrel roll.
>>
>>58648395
>>>/tg/
>>
>>58648593
its a programming question. in my grid representation, should i have the agent having a ball attribute, or should the ball occupy its own square on the pitch?
>>
>>58648615
type Grid = [[Square]]
type Square = [Entity]
data Entity = Ball { ... } | Agent { ... }

sq :: Square
sq = [ Ball { ... }, Agent { ... } ]
>>
>>58647336
>So, what's a good OOP language, considering C++ is shit?
C++
>>
>>58648748
but why?
>>
>>58648771
you've hardly described anything and that's the most flexible
>>
>>58647282
I'm trying to come up with a palette for a fictional graphics device(i'm just thinking about stealing the default vga palette).
>>
>>58648785
basically ive got a football sim on a pitch shaped chessboard, should the ball entity be a property of the agent posessing it, or should the ball be its own entity on the pitch that a player affects if within range of it?
>>
>>58648791
indexed colors, duh
>>
>>58648791
red, green, blue 1-vit values
>>
>>58648809
type Located a = ((Int, Int), a)
type Team = [Located Agent]
type Board = (Team, Team, Located Ball)
>>
>>58648834
how about you just give me your general approach in english as opposed to some code in an irrelevant syntax?
>>
>>58648874
this is the daily programming thread
>>
>>58648885
yeah, and im writing in prolog
>>
>>58648903
not my problem
>>
>>58648308
#include <stdio.h>

int main (void) {
char *str = "LMAO";
while(*str && str) puts(str++);
return 0;
}
>>
Is model-view-presenter an acceptable pattern for a turn-based game?
>>
>>58648815
i'm trying to come up with the colors themselves, not with how to index them.
>>
File: trash.png (160KB, 373x503px) Image search: [Google]
trash.png
160KB, 373x503px
>>58648912
i see
>>
>>58648914
import std.stdio;

void main()
{
string str = "lmao";
writeln(str[1..$]);
}
>>
Should I learn programming to get a job/at least freelance (in Russia (kek) by the way)? If yes, what should I learn first?
>>
>>58649026
void main() {
import std.stdio : writeln;
"lmao"[1..$].writeln;
}
>>
>>58649026
>>58649103
whats the output of those progerams?
>>
>>58649103
looks like shit, but yeah, I really should start following local import practice.
>>58649128
mao
>>
>>58649103
>>58649026
>>58648914
he wants to do it with a regex
>>
File: stock-photo-angry-man-172757603.jpg (31KB, 450x332px) Image search: [Google]
stock-photo-angry-man-172757603.jpg
31KB, 450x332px
How come these/this threads/board is so full of redditors and consumer fags that are trying to learn programming but in the meanwhile are larping programming wizards?
This is counter productive you imbeciles.
I know this is chan and it's funny to larp but could you keep it out of /dpt/ threads at least?

What I mean by saying this is that:
>X lang is better than Y lang
etc. is pure garbage and low tier shitpost that everyone can see through.

At least make a smart shitpost/bait if you're gonna do it...

Programming is about concepts.
If you want to be a good programmer you need to know the following things:
>how to find information/ask questions
>how computers work
>at least one language (really understand it from the bottom up: compilers, OS)
and the most important of all the things to know:
>anime is for little kids and adults who haven't realised that they will never be a successful human being

tl;dr:
anime is cancer
>>
>>58649128
First should be:
LMAO
MAO
AO
O
>>
>>58649143
like this?
$ echo "LMAO" | sed 's/^.//'
>>
>>58647336
C# or Python.
Considering your aversion to C# that leaves you with Python.
https://docs.python.org/3/tutorial/
Happy Coding!
>>
>>58649162
99% of those posts are made by functional programming/lisp fans
>>
>>58649128
both output "mao"
>>
File: 1485140223581.png (795KB, 761x720px) Image search: [Google]
1485140223581.png
795KB, 761x720px
>>58649194
*lisp programmers

#not all functional
>>
>>58647282
c++, c#, javacript (compiled from typescript), Lua, Php, asm, even powershell .. whatever is good for project and make fastest coding.

I need work to be done, don't care how is it written done :)
>>
>>58649162
Are you still mad?
>>
File: nice_meme.png (122KB, 452x391px) Image search: [Google]
nice_meme.png
122KB, 452x391px
>>58649217
>coding
>>
>>58648914
>>58649026
>>58649103
The original version was:
#!/usr/bin/perl

use v5.14;
use strict;

my $ayy;
$ayy = "LMAO";
say $ayy;
for (split (//, substr($ayy, 1))) {
say $_;
}


I don't know how to make substr($ayy, 1) with a regex.
>>
File: enraged.jpg (12KB, 288x362px) Image search: [Google]
enraged.jpg
12KB, 288x362px
>>58649222
I AM ENRAGED NIGGER
>>
>>58649278
regex is a meme
>>
File: 1463019188644.jpg (25KB, 355x369px) Image search: [Google]
1463019188644.jpg
25KB, 355x369px
>>58649162
>larping
>typical pseudointellectual bullshit fountain of "BUT U NEED TO LEARN ASSEMBLY BEFORE ANYTHING OR ELSE YOU WILL NEVER UNDERSTAND COMPUTER TRUST ME AM GENIUS GRACING 4CHAIN WITH MY PRESENCE"
>waaaaah animoooooooooooooooooooo
lmaoing at ur life
>>
>>58649316
Yes, and memeing successfully is art.
>>
>>58649162
>>58649297
>call others redditors
>post reddit tier images
Pure cancer.
>>
>>58649172
import Data.List (tails)

go = mapM_ putStrLn . tails
main = go "lmao"
>>
>>58649278
oh i see what its for now
i dont know either how do a substring(n) using regex but i made the same functionality in c because autism

#include <stdio.h>

int main(int argc, char *argv[]) {
puts(argv[1]++);
while(argv[1] && *argv[1]) printf("%c\n", *argv[1]++);
return 0;
}
>>
>>58649051
Хoчeшь cтpaнички нa фpилaнce pиcoвaть, тo этo в /wdg/.
A тaк, нaвepнo, лyчшe вceгo Явy yчить.
Oбязaтeльнo yчи SQL.
>>
if i were to do some of those programming challenges that is sometimes posted, what would be a generally good language to do them? python?
>>
>>58649356
Regex mastering requires deeper levels of autism.
>>
File: 650908063115668.jpg (14KB, 246x229px) Image search: [Google]
650908063115668.jpg
14KB, 246x229px
>>58649375
>python
>>
>>58649375
>a generally good language
Doesn't exist or PL/1, but that is a bad language.
You don't nail with screwdrivers, you don't screw with hammers, etc.
The purpose of programming challenges is mastering the language of choice, so you don't just solve challenges for the sake to be them solved.
It must be noted, that a part of those challenges are implemented in various standard libraries.
>>
>>58649450
>You don't nail with screwdrivers, you don't screw with hammers,
stop saying this
it is literally just you and one other guy that thinks this
stop making excuses for your shitty language
>>
File: 1478239742125.gif (1001KB, 640x480px) Image search: [Google]
1478239742125.gif
1001KB, 640x480px
>>58647282
>Mr. Anon, we need you to build a new ERP system for our enterprise
>Right on, I'll do it in ASSEMBLY
>>
>>58649483
>for your shitty language
So, any language you don't like? :^)
>>
>>58649501
>Right on, I'll do it in ASSEMBLY
Said no one ever.
>>
>>58649543
but assembly is teh most hardcore
>>
>>58649501
who are you quoting?
>>
>>58649531
Wow, I guess all criticism is invalid!
Every language is perfect in its own way!
Just be yourself, progrmaming language!
You can't do anything wrong!
There are no bad decisions!
>>
>>58649556
And the most tiresome.
>>
>>58649375
Whatever language you're trying to learn. If you know a language then you ideally should be able to solve all in that language of them without any problems.
>>
File: 840215394299764.jpg (240KB, 1440x810px) Image search: [Google]
840215394299764.jpg
240KB, 1440x810px
>>58649556
>he doesn't program in binary
>>
>>58649592
>all those 4/10s

My animes lied to me.
>>
>>58649627
>4/10s
There's no need to be this generous
>>
why aren't you rich
if you're such a good programmer?
>>
File: 1479321954293.png (7KB, 377x330px) Image search: [Google]
1479321954293.png
7KB, 377x330px
>>58649571
I can pick any language and you'll critique it if you don't like it. Why bother? Remember Stroustrup's words.

Still, you won't write a firmware on JS.
>>
>>58649643
programmers are not rich
>>
>>58649571
No, every language is good for something, but no language is good for everything. All languages are shit.
>>
>>58649643
Working on it. Already making more than most people in the US, but I'm only a year into my career.
>>
>>58649375
>what would be a generally good language to do them?
Ideally, a language + framework that has implementations of everything so that you can just call a method for each challenge and the requirements are satisfied.
>>
File: 1462666392038.jpg (57KB, 415x440px) Image search: [Google]
1462666392038.jpg
57KB, 415x440px
>>58649686
>every language is good for something
>>
>>58649678
the top 1% are
judging from /g/'s ego, most should be in the top 1% here
>>
>Tfw I'll never be as terse as haskell-senpai
>>
>>58649704
Name some examples of languages good for nothing.
>>
>>58649698
>framework

Frameworks are cancer. Composable libraries are what we need more of.
>>
>>58649734
Rust
Go
D
>>
>>58649741
it was fast
>>
>>58649704
Technically true, depending on how it's spun.

Brainfuck is useful for creating programs that can be written using 8 types of characters.
>>
File: 1453831600096.png (138KB, 547x609px) Image search: [Google]
1453831600096.png
138KB, 547x609px
http://www.openwall.com/lists/oss-security/2017/01/24/4

>Systemd
>pwn3d like it is 99
>>
>>58649737
What's a framework?
>>
>>58649749
People said you can't have big all-in-one systems without issues.
>>
>>58649741
>talking shit about vibe.d
nigga please
>>
>>58649748
Brainfuck is useful as a Turing machine model, though.
>>
>>58649754
https://www.youtube.com/watch?v=D_MO9vIRBcA

Next time use google.
>>
>>58649734
Your favourite ones
>>
>>58649785
I wanted to know what you think a framework is, in your words.
>>
>>58649798
Video covers it pretty well. I don't see much to fault with the video.
>>
>>58649825
Videos are worse than plain text generally.
>>
>>58649741
>Go
Good for writing servers at a decent complexity/performance ratio.
>Rust, D
Currently experimental languages without much practical adoption that are a good testing ground for new ideas and studying their practical implementations.
>>
>>58649832
Yep, but that's what I gave you, so fuck off.
>>
>>58649842
I'm not him, but fuck you too.
>>
>>58649851
Not him, but you're a fucking retard.
>>
>>58649851
get in line
>>
>>58649767
But big all in one systems are good for forcing users into sucking corporate cock at a price.
>>
>>58649873
Not him, but you're a faggot.
>>
>>58649888
I'm you and fuck me.
>>
>>58649897
Gross.

>>58649825
Sounds like a copout.

Why do you think frameworks are inherently bad?

I'm just trying to get you to explain your opinion.
>>
>>58649910
Because they tend to not be composible and are tend to be heavily opinionated. That should be inferred from my original post.
>>
File: pyqt5wtf.jpg (114KB, 440x866px) Image search: [Google]
pyqt5wtf.jpg
114KB, 440x866px
when I install PyQt5 the modules all come as .pyd bytecode and I cant import them?

wtf ??????????????? why is this happening.

how do I import bytecode
>>
If you were going to learn two programming languages that were fairly different to keep yourself interested, but also had high chances of landing a job, which would you pick?
>>
>>58650142
>fairly different
>high chances of landing a job

I don't understand what you mean by this.

Fairly different from what language?
>>
>>58650142
C# and haskell
>>
File: 1479958812243.jpg (19KB, 250x250px) Image search: [Google]
1479958812243.jpg
19KB, 250x250px
>>58650172
excellent choice
>>
>>58650169
from each other, dummy
>>
What's up with all the Java hate? I landed my first job with Java and to be honest I don't mind it at all and it seems like the job opportunities are good. Should I keep getting better at it or prepare for a switch to a language that won't want to make me kill myself down the line?
>>
>>58650181
The only language that's really an oddball and has many jobs is Python.

Java has the most jobs. C# is next. C, C++, and Python all have about the same after that.

Obviously Javascript and SQL are up there as far as languages, but they're not exactly comparable to the aforementioned 5 languages.
>>
File: anal beads.png (46KB, 677x881px) Image search: [Google]
anal beads.png
46KB, 677x881px
>>58650172
This sounds like maximum comfy.

C# + Haskell is like a mullet. Business in the front, party in the back.

Pic somewhat related, I guess.
>>
File: 979838884967093999.jpg (52KB, 640x480px) Image search: [Google]
979838884967093999.jpg
52KB, 640x480px
>>58650181
>tfw java is so garbage that java fags' only argument is "muhhh jobs'
>>
>>58650239
>still no HKTs in .NET
>still no polymorphic recursion
>still no GADTs in .NET
>>
>>58650296
karen pls
>>
i'm learning python as my first ever language in my spare time. what am i in for? should i just pick another language?
>>
>>58648934
For pretty much any game you are still going to be drawing graphics in real time, so you can have a main loop that constantly runs and use a state machine that works with delimited continuations or coroutines to do the turn-based logic.
>>
>>58650365
Yes, pick another language
>>
>>58650365
>what am i in for?
An easy language to learn that is not very similar to other major languages, primarily due to the typing system.

>should i just pick another language?
Yeah, probably. C# is just as easy to learn, but translates much better to something like C++ or Java if you choose to go that route later.

C++ and Java would also be good options for your first language, whereas C++ is a bit more difficult to learn, and Java is less pleasant to work with.
>>
>>58650365
>>58650407
basically, don't pick Python or Java
>>
>>58650407
>>58650449
alright i will pick another language. thank you.
>>
OpenGL - SDL - C++

I have two textures generated using SDL_TTF.
This text will be changing fairly often throughout the program so I'm constantly recreating the texture in OpenGL.

As soon as I call glTexImage2D it replaces BOTH textures with the new texture. I can't seem to get it to only replace the 2nd texture.

I'm binding the correct VAO's and correct textures. Any ideas?
>>
>>58650552
Also, do I need to call glActiveTexture when calling glTexImage2D?
>>
Fucking Haskell.
I'm trying to write a function that takes in a list and returns the same list but with 10 added to each element. It has to be done recursively but I'm too retarded to figure it out.

add10_list_rec :: [Integer] -> [Integer]
>>
File: Anti depressants.jpg (35KB, 640x459px) Image search: [Google]
Anti depressants.jpg
35KB, 640x459px
>tfw your Python script runs for several hours
>>
>>58650574
add10ListRec [] = ?
add10ListRec (x:xs) = ?
-- x is the first element
-- xs is the rest of the elements
>>
>>58650576
$5 says that some simple changes would improve the performance tenfold.
>>
>>58650596

probably, since I am using linear search
i only need this script once anyways
>>
>>58650574
>>58650588
if you need more hints

add10ListRec :: [Integer] -> [Integer]

add10ListRec [] = []
-- if the input is an empty list, so is the output

add10ListRec (x:xs) = ? : add10ListRec xs
-- if the input is element x followed by list xs
-- give back ? followed by (add10ListRec xs)

-- todo, ?
>>
>>58650588
>>58650604
Yeah I've had this already
add10_list_rec :: [Integer] -> [Integer]
add10_list_rec [] = []
add10_list_rec (x:xs) =


Just had to come up with the rest. I can probably work it out from this.
>>
>>58650603

>i only need this script once anyways

You sound like practically every scientist using Python.
>>
>>58650552
>>58650563
glActiveTexture changes the active texture unit. glBindTexture binds a texture to the active texture unit. glTexImage2D works on a texture bound to the active texture unit. It shouldn't be able to affect multiple textures at once, though, so there is something else going on here.
>>
File: Untitled.png (49KB, 838x620px) Image search: [Google]
Untitled.png
49KB, 838x620px
Can anyone explain to my dumbass why his won't reverse properly
>>
>>58650643
If i comment out glTexImage2d for the 2nd texture the 1st texture displays fine, but of course no 2nd texture. If i uncomment glTexImage2D for the 2nd texture, then both textures change :(
>>
>>58650664
How many times do you actually want to reverse the array?
>>
>>58650664
Fire up a debugger and step through the function. It'll be much more clear than our explanations.
>>
I'm currently getting a masters in English at Virginia Tech. I have a full tuition waiver and also a technical writing internship. I'm currently working on an Atlassian Confluence wiki for the school's network infrastructure and security.

I'm thinking of teaching myself to program. I have an understanding now that the most important thing to have is a portfolio of projects.

So where would I start. If I really wanted to learn to program with the specific aim of making money through it, what do I want to do?
>>
>>58650674
Post the loading and drawing code. I think you've got a binding issue.
>>
>>58650685
I want to reverse that array of numbers one single time, that is it
>>
>>58650664
Can't you just use the built-in reverse method for arrays?

Why reinvent the wheel?
>>
>>58650705
Well I can tell you you're reversing it more than once, dataSet.length times in fact
>>
>>58650664

Reverse the array once. You're calling your ReverseArray function each time you iterate through the dataset.

Your outer for loop is doing:
j=0
reverse
print
j=1
reverse
print

and so on
>>
>>58650697
>If I really wanted to learn to program with the specific aim of making money through it, what do I want to do?

Pick one of the languages here: >>58650218

Learn the basics of the language and then get an official certification for whatever one you learn after you make some simple projects that interest you.
>>
>>58650738
Except Java or Python.
Almost anything except Java or Python is fine.
>>
>>58650732
THANK YOU! YOU BEAUTIFUL MOTHERFUCKER, I hope your day goes well because you just made mine
>>
>>58650763
Java is fine if you don't care about hating what you do and just want a job.
>>
>>58650775

No problem. Having a whiteboard or paper handy and step through each part of your program in these situations. Or use a debugger.
>>
>>58650704
Ok I realized I'm using 5 textures total (3 are static). My original glGenTextures(3, textures) (textures is an array of 5) was unchanged. I changed the 3 to a 5 in glGenTextures and now my first texture is gone but the 2nd is there. hahah jesus christ

should i put all my vao's into an array and create everything in a loop instead of doing everything individually?
>>
>>58650784
Java is not fine, 90% of people who start with java and get far into it end up as shitty people
>>
>>58650817
VAOs don't have anything to do with textures. They store vertex attribute bindings, that's it.
>>
>>58650826
Java is fine if you don't care about hating what you do and just want a job.
>>
How do you manage your customer relations?
Are there any decent, free CRM solutions?
>>
>>58650839
Java ruins you for life
some people learn Java and then actually like it or think parts of it are good programming style
you cant fix those people
they're broken
>>
>>58650848
suck them off once in a while
>>
Haskell is fun!
>>
>>58650865
None of what you said has anything to do with the price of rice in China as long as that person just wants a job.
>>
>>58647282
noob here.
Why the fuck i cant compile luatweetnacl on Cygwin? It works well on a real nix but not fucking here.
output: https://hastebin.com/oziwodijon.coffeescript

i the include files are in their place. Just like on my linux machine. Somebody pls save my sanity
>>
>>58650865
This is actually true.
I once explained to a Java evangelist the benefits of operator overloading, but he considers it unnecessary complex.
>>
>>58650405
That was my idea of why that pattern would be great. The game loop would just be repeatedly calling draw on the view, and any actions could be triggered by the view raising an event and the presenter handling it in a thread. I've seen loads of people saying that you should just never use MVP for games though, and I'm trying to figure out if there's a reason why.
>>
>>58650939
Well I don't see what benefit the pattern itself brings to the table. You don't need a separate thread or events or anything like that, and in fact that's going to just make things much harder.
>>
>>58650938
I don't do Java, but I'm still not really in favour of operator overloading.
Y'know, the old argument of "you can't be sure if it's a normal addition or overloaded one".
>>
>>58650953
How can you be sure that any operation matches its name?
>>
>>58650934
install a real nix
>>
>>58650953
Operator overloading results in a much cleaner API. Look at this monstrosity for example: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html.
>>
File: 1400380655998.png (127KB, 257x250px) Image search: [Google]
1400380655998.png
127KB, 257x250px
>Java doesn't have operator overloading because they're afraid people will abuse it
>Java itself abuses it by using + for string concatenation
>>
>>58650989
I have a real nix but i need luatweetnacl on windows so i can support it as a platform.
In fact i only installad win10 in a vm so i can finally have a windows version but looks like its not gonna happen
>>
>>58651006
Scala
>>
>>58651009
What about the "Windows Subsystem for Linux" or however it's called? I'd try using that.
>>
File: anal beads.png (17KB, 935x235px) Image search: [Google]
anal beads.png
17KB, 935x235px
>>58651006
>Java doesn't have operator overloading
Wait, what? That's lame.

I like abusing operator overloading.
>>
>>58650994
I'm not negging that; used properly, operator overloading is a very nice thing.
>>58650973
You can't, obviously. But when you're looking at misbehaving code, function calls are obvious and you can immediately inspect them. When operator overloading is introduced into the mix, you first have to ensure whether all the + - * / and other stuff are actually arithmetic or do they do fuck knows what.

I'm not saying operator overloading is bad per se. It's very useful and very powerful. I've just seen too many projects where language features were horribly abused, and operator overloading is quite easy to abuse.
>>
File: oop p2.png (57KB, 682x473px) Image search: [Google]
oop p2.png
57KB, 682x473px
>>58651043
>sumfactory
>>
>>58651043
Wait, is that visual studio running java?
>>
>>58651069
That's (sadly) not how Java looks like. It's C#.
>>
File: Payne.gif (3KB, 118x118px) Image search: [Google]
Payne.gif
3KB, 118x118px
>software engineering class
>got into our groups
>only 2/5 of the people in our group know C++
>the rest are java
>i'm probably going to have to make some fucking "App" for this class if we decide to settle on Java
>class introduced themselves
>all my team members only excel in java and make fucking minecraft mods
>>
>>58647282
Patching msvbvm60.dll to ignore the OS version check.

This way VB6 programs can at least halfway work under NT 3.51, rather than just complaining about the OS version and quitting.
>>
>>58651047
>you first have to ensure whether all the + - * / and other stuff are actually arithmetic or do they do fuck knows what.
All you need to do is look at the types of the operands. Same as telling the difference between x.foo() and y.foo().

What you should be able to depend on is e.g. + being commutative, associative, a no-op if one of the operands is zero, etc. All you have to do is document this and say that it's undefined behaviour if you fuck any of these properties up (assuming you don't have a type system where you can require these properties to be proved). But of course, most of the languages that do support operator overloading don't require any such restrictions and aren't consistent in the standard library about it.

This should be the case for reusing function/method names in general, really, but again, most languages don't have principled overloading to begin with that makes this easier to communicate about or even enforce.
>>
>>58650643
>glActiveTexture changes the active texture unit

What does this mean exactly? What is a texture unit?
>>
>>58651136
A texture unit in OpenGL stores a set of bindings (one for each type of texture) and associated samplers. Kind of like VAOs with vertex attributes except that there's a fixed number of texture units.
>>
>>58651125
Yep. Agreed.
We just differ in approach. You say "do it and remember not to fuck it up", I say "uhh, I'd rather we don't do it unless we're 100% sure we won't fuck it up".
>>
>>58651174
You're as opposed to common overloading or even using the same method name in different classes, then?
>>
File: .gif (2MB, 202x360px) Image search: [Google]
.gif
2MB, 202x360px
>>58651006
>Java claims to have generics
>can't create and return objects of generic type
Honestly, it amazes me how gimped Java actually is.
>>
>>58651197
>opposed to using the same method name in different classes
that would be retarded.
>>
>>58647282
Solved dailyprogrammer problem #293 easy (Defusing the bomb) purely at compile time with:

macro_rules! next_wire {
( $lhs:ty => $( $rhs:ty ),* ) => {
$(
impl std::ops::Shr<$rhs> for $lhs {
type Output = $rhs;

fn shr(self, r: $rhs) -> $rhs { r }
}
)*
};
}

struct White;
struct Red;
struct Black;
struct Orange;
struct Green;
struct Purple;

next_wire!(White => Red, Orange, Green, Purple);
next_wire!(Red => Green);
next_wire!(Black => Red, Black, Purple);
next_wire!(Orange => Red, Black);
next_wire!(Green => Orange, White);
next_wire!(Purple => Red, Black);


, so that

fn main() {
White >> Red >> Green >> White;
}


compiles fine, while

fn main() {
White >> Orange >> Green >> White;
}


errors with

Code $ rustc defuse_bomb.rs 
error[E0277]: the trait bound `Orange: std::ops::Shr<Green>` is not satisfied
--> defuse_bomb.rs:28:2
|
28 | White >> Orange >> Green >> White;
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Shr<Green>` is not implemented for `Orange`
|
= help: the following implementations were found:
= help: <Orange as std::ops::Shr<Red>>
= help: <Orange as std::ops::Shr<Black>>

error: aborting due to previous error
>>
File: defusal.png (277KB, 2780x860px) Image search: [Google]
defusal.png
277KB, 2780x860px
>>58651238
nice
>>
https://e.xtendo.org/monad

third eye ACTIVATED
>>
>>58651250
Yea, that was my inspiration actually
>>
>>58651236
It's just as "bad" as operator overloading or any other overloading for that matter.
>>
>>58651238
Now do it using lifetimes.
>>
>>58651301
Why? I'm not working with references so I don't need explicit lifetimes.
>>
File: oy vey.webm (723KB, 960x540px) Image search: [Google]
oy vey.webm
723KB, 960x540px
>>
There has to be a more efficient way to do this
I feel like K & R are screaming at me
int choice_selection(char * input) {

if (strcmp(input,"1") == 0 || strcmp(input,"l") == 0) { return 1; } //Do Function 1 or something
else if (strcmp(input,"2") == 0 || strcmp(input,"s") == 0) {} //Do Function 1 or something
else if (strcmp(input,"3") == 0 || strcmp(input,"i") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"4") == 0 || strcmp(input,"n") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"5") == 0 || strcmp(input,"d") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"6") == 0 || strcmp(input,"e") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"7") == 0 || strcmp(input,"s") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"8") == 0 || strcmp(input,"r") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"9") == 0 || strcmp(input,"p") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"10") == 0 || strcmp(input,"h") == 0 ) {} //Do Function 1 or something
else if (strcmp(input,"11") == 0 || strcmp(input,"x") == 0 ) {} //Do Function 1 or something

else { return NULL; }

return 1;

}
>>
File: south korean banter.png (11KB, 743x294px) Image search: [Google]
south korean banter.png
11KB, 743x294px
>>58651257
the absolute state of javascript
>>
>>58651319
what does this do? generate random paired parenthesis or strip of lisp file of everything but parenthesis?
>>
>>58651154
I changed 3 to 5 in glGenTextures(3, textures) since my textures array is 5 in size and i'm using 5 textures total right now

I have the code commented out that deals with the 2nd texture

No my 1st texture disappeared when i changed the 3 to 5 wtf!
>>
File: 1461084208644.png (138KB, 368x379px) Image search: [Google]
1461084208644.png
138KB, 368x379px
>>58651257
>>58651331
>>
File: cpointers.jpg (65KB, 450x600px) Image search: [Google]
cpointers.jpg
65KB, 450x600px
>How do I get good at pointer wizardry?

I mean I understand the dereferencing and address-of unary operators and the concept of pointers but I don't really understand what they're used for and I'm somewhat apprehensive about using them because of blowing something up with ~undefined behaviour~

Any good books or resources for me to git gud? Is this worth reading?
>>
>>58651250
puzzle oriented
>>
>>58651301
That doesn't make any sense.
>>
File: .png (3KB, 241x72px) Image search: [Google]
.png
3KB, 241x72px
>>58651331
But why.
>>
>>58651374
I have no idea
>>
>>58651331
Holy kek, you can't make this shit up.
>>
>>58651350
a simple explaination: used for indirection. do you want to make copies of everything? or do you want to point to that one that already exists?
>>
>>58651334
latter
>>
>>58651338
Ok i was missing a call to glActiveTexture in my init function

God my head hurts
>>
>>58651250
import Data.List

data Color = White | Black | Purple | Red | Green | Orange
deriving (Eq, Enum)

colors = [White .. Orange]

-- Left xs == colors you cant cut
-- Right xs == colors you can only cut

cut White = Left [White, Black]
cut Red = Right [Green]
cut Black = Left [White, Green, Orange]
cut Orange = Right [Red, Black]
cut Green = Right [White, Orange]
cut Purple = Left [Purple, Green, Orange, White]

boom :: [Color] -> Bool
boom = boom' colors
where boom' _ [] = False
boom' allowed (c:cables)
| elem c allowed = boom' allowed' cables
| otherwise = True

where allowed' = case (cut c) of
Left cs -> colors \\ cs
Right cs -> cs

much better version
>>
>>58651423
>runtime
>>
>>58651374
parseInt takes three arguments, the second being the base of the number
why javascript doesn't complain about omitting arguments i do not know. 10 days and all that and its now expected behaviour which would be breaking
>>
>>58651309
https://github.com/Gankro/thesis/raw/master/thesis.pdf

>>58651369
See above.
>>
>>58651345
This stupid /brit/ meme is everywhere.
>>
>>58651423
The point is both >>58651238 and >>58651250 are done at compiletime.
>>
>>58651452
>do it with lifetimes
>that doesn't make sense
>you are stupid, read this paper about what lifetimes are
>>
>>58651427
>compile time
what if i need to input something
you want me to change the source code and not just apply a function?
>>
>>58651467
Do it in GHCI
>>
>>58651377
>>58651376
>>58651374
['10','10','10'].map(n => parseInt(n));
// or
['10','10','10'].map(function(n) { return paseInt(n); });
// or
var r = function(e) { return parseInt(e, 10); };
['10','10','10'].map(r);


>parseInt(string, radix);
parseInt takes 2 arguments, but the 2nd one is generally implied.

and map takes 3 arguments, so you're passing a 2 argument function to one that expects 3 with a single value. basically partial application (technically currying here).
its turned into
>10 -> 10,index -> 10,index,this

but expecting people to RTFM is futile. (shitters using a shitty language = shitty results)
>>
>>58651466
More like a paper where the abuse lifetimes for other behavior. See Section 6
>>
>>58651462
that's stupid, what are the applications of compilte time jewing
>>
>>58651472
Then where does it get the string to parse from?
>>
>>58651480
Do you use a dynamically typed language?
>>
>>58651329
just check the first character and use a switch statement
>>
>>58651480
it's impossible to create invalid programs
>>
>>58651485
yes, I find it easier to do stuff
plus, its been proven strong static typing doesn't help prevent bugs

also, the strong typing meme hinders you
for exmaple, in haskell, the IO Monad shit is a pain in the ass and creeps into your code
this is why lisp is better, since it can be as pure as it can , but still be a dirty slut when needed
>>
>>58651057
It was written as a joke response to an anon's poorly worded request for a function that creates functions that add things.
>>
>>58651481
Which string? "10"? That is passed in as the first argument.

the way you pass arguments to javascript functions is actually through an arguments object with syntatic sugar for argument lists

example of changing them
function f(a, b) {
arguments[0] = 42;
arguments[1] = 69;
console.log(a + ", " + b);
}

func(1, 2); // 42, 69


(a shitty designed that allowed for partial application .. but with terrible lexical scoping rules .. blame Eich on trying to implement Scheme but was told to make it appeal to Algol-influenced language users)
>>
>>58651474
>you can abuse lifetimes to do something that's still related to regions
>this means you can abuse lifetimes to do anything
>>
>>58647336
>no one answering java
meme board t b h
>>
>compile .c file with gcc
>no error messages
>run ls
>no executable
>run gcc again and check return code
>it's fucking 1

WUT
>>
>>58651548
see >>58651257
>>
>>58651576
Java's type system is unsound though.

class Unsound {
static class Constrain<A, B extends A> {}
static class Bind<A> {
<B extends A>
A upcast(Constrain<A,B> constrain, B b) {
return b;
}
}
static <T,U> U coerce(T t) {
Constrain<U,? super T> constrain = null;
Bind<U> bind = new Bind<U>();
return bind.upcast(constrain, t);
}
public static void main(String[] args) {
String zero = Unsound.<Integer,String>coerce(0);
}
}


that compiles fine but when you run it:
>Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
>>
>>58651573
But you said that was the radix.
If '10' is the radix then what is the string being parsed?
>>
>>58651584
Post terminal
>>
>>58651576
Not everyone is into AbstractMethodFactoryBeans.
>>
>>58651584
>doesn't have his PS1 display non-zero exit codes
>>
>>58651598
no, it has a default radix

parseInt('10', 10) is the equivalent to parseInt('10') because it checks to see if argument[1] is defined, if its not then it defaults to base 10.

but map is passing the index of the array as the radix to it, so its calling it as parseInt('10',0), parseInt('10',1), parseInt('10',2), etc.
>>
>>58651548
>plus, its been proven strong static typing doesn't help prevent bugs
Oh really?

>for exmaple, in haskell, the IO Monad shit is a pain in the ass and creeps into your code
There's unsafePerformIO if you really know what you're doing, but in general it's a bad idea because Haskell is also lazy and so every function really should be pure and referentially transparent. A strict language lets you separate purity from referential transparency and so you have more flexibility (for example, a function can print to standard output without having to be in some IO type, though there needs to be some way for the compiler to know not to constant fold it).
>>
>>58651605
>oh no le I have to type actual words
>I usually code at the speed of a typist
>writing verbose code actually stunts my workflow I swear!
>>
Why doesn't /g/ learn Cobol?
Cobol programmers can easily make over $100000 starting
>>
>>58651648
>Cobol programmers can easily make over $100000 starting
That's incentive to keep them from killing themselves
>>
A Rust compiler plugin for compile-time C string literals (normal and wide).
>>
>>58651548
it's supposed to creep into anything that does IO, that's the point
things that "do IO" just return IO actions
>>
>>58651648
because they only pay COBOL experts. Nobody wants a jr dev in their very important codebase that you have to hire expensive devs to fix.
>>
>>58651635
>in general it's a bad idea
Well, I shouldn't say this, but you really need to know what you're doing to use it correctly. Also it's technically not standard Haskell.
>>
>>58651673
just use format!
>>
>>58647336
D
>>
File: screenshot.png (14KB, 750x489px) Image search: [Google]
screenshot.png
14KB, 750x489px
>>58651601
>>
anybody here hate uppercase letters?
>name all functions lowercase
>hate cameCase
this is why I use lisp, since symbols can be any case and they'll be the same
>>
>>58651703
isn't it gcc -std=c11 driver_echo.c -o driver_echo.exe
>>
>>58651693
that makes type String, not CString. They are laid out different in memory.
>>
>>58651726
just use std::ffi::CString::new
>>
>>58651693
Like >>58651726 says, it's not suitable in that way nor is it really capable of doing anything useful for me in the first place. Though I don't even want to use CString necessarily, since that would defeat the compile time aspect. It'll just produce null-terminated byte/short array constants and convert from UTF-8 to UTF-16 for the latter.

>>58651756
>compile-time
>>
>>58651724

Order doesn't really matter. Either way, looked up the errno. It's fucking EPERM. What the hell?

>gcc works
>then run pacman -Syu
>gcc giving EPERM on everything
>>
New thread

>>58651763
>>
>>58651548
>plus, its been proven strong static typing doesn't help prevent bugs

if you're talking about
https://labs.ig.com/static-typing-promise

the methodology is VERY questionable.
>>
>>58647596
The purpose for certain things in the language reveal themselves later on as you learn. Right now it's regurgitation. Just keep going.
>>
>>58651719
I'm writing a script to convert all my projects into YELLINGCASE
>>
>>58651331
>>58651374
['10', '10', '10'].map(parseInt)

// is equivalent to:

parseInt('10', 0) // defaults to base 10 (I assume)
parseInt('10', 1) // not a valid base, so NaN
parseInt('10', 2) // base 2, so 2
// parseInt takes a radix as its second argument


Basically map iterates through the array. For each location, the object in the array is passed as the first parameter, and its location in the array is passes as the second parameter.

If the function only took 1 parameter, it would just pass the object at each location in the array. If the function took 3 parameters, it would pass the object, its index, and a reference to the whole original array.

The real reason this is so bizarre is that JavaScript's goal is to generate no errors, or at least as few errors as possible. Instead, it just generates weird and unintuitive results, which probably ends up being a little better for the end user, but a lot more annoying for the developer.

That goal of basically no errors is what results in this:
https://www.destroyallsoftware.com/talks/wat
>>
>>58652408
>['10', '10', '10'].map((a, b, c) => [a, b, c])       [ [ '10', 0, [ '10', '10', '10' ] ],
[ '10', 1, [ '10', '10', '10' ] ],
[ '10', 2, [ '10', '10', '10' ] ] ]


Hey, there's a third parameter. That actually seems quite usefull. I can see it being used in one-liners.

Should RTFM more.
>>
>>58652408
Makes sense. Could happen in statically typed languages as well if map was overloaded to accept functions with more than one argument(and it's often the case, at least with the index).
>>
>>58653419
Radix less than 2 should definitely cause an exception though.
Thread posts: 330
Thread images: 38


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