[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: 318
Thread images: 44

File: ilR3i.jpg (52KB, 730x585px) Image search: [Google]
ilR3i.jpg
52KB, 730x585px
What are you working on, /g/?

Old thread: >>58746848
>>
Rust is cancer.
>>
>>58752171
banging ur mum
>>
File: 1484315097089.jpg (2MB, 2000x3200px) Image search: [Google]
1484315097089.jpg
2MB, 2000x3200px
>>58752171
Educating the plebians, how about you?
>>
File: 1468899863437.jpg (95KB, 394x404px) Image search: [Google]
1468899863437.jpg
95KB, 394x404px
Why do the USA has H1B programs?

Is it because Americans are dumb or they want cheap labor?
>>
>>58752171
just thanking you for using an anime image
>>
>>58752221
It's because rich people like to be able to get richer, and have more power to do so than poor people.
>>
File: 2637242874827.jpg (35KB, 590x365px) Image search: [Google]
2637242874827.jpg
35KB, 590x365px
How's your game coming along fellow /g/entoomen?
>>
>>58752221
A little bit of both.
A lot of uneducated Americans can be trained for positions, and made to fill a job, but it's cheaper to just outsource/insource
>>
>>58752250
>but it's cheaper to just outsource/insource
For now.
>>
>>58752282
what you mean?
>>
>>58752294
He's probably referring to the point at which the Great Wall extends around all US borders and/or any entry of any person into the country is illegal.
>>
File: Cw_VWGxVQAAfT9z.jpg (112KB, 700x988px) Image search: [Google]
Cw_VWGxVQAAfT9z.jpg
112KB, 700x988px
>>58751566
>code doesn't judge

Are you sure?
>>
Probably a dumb question, but how much leeway do I get in C when I make arrays of non-specific function pointers?
I noticed C lets me write function pointer arrays without a function signature
eg.
void (*func[])()


Let's say every single function pointer in this array takes 2 arguments, but the last one takes three.
Can I write a loop that passes three arguments to all of them and will the final argument be ignored when needed?
>>
I'm actually working on something that might get me hired at a small marketing company.

I'm supposed to make a website based on a photoshop mockup featuring responsive design. A header picture that changes every few seconds as well as a services section with some icons that changes every few seconds as well as not showin the same icons after updating.

Supposed to solve it with mysql, javascript and php. I have until friday morning. None of this is really hard It just takes a while since I haven't really used php and mysql outside of like one assignment.

I also ignore everything security related for the time being.

So far I have:
- a local dev environment going on my linux laptop.
- visuals are mostly done. Some small bugs remaining (fucking bootstrap navbar colour).
- database and table is created and is accessible trough terminal and php.
- was able to pass the php mysql fetch to a json object that shows up in console.log

So what I need to do is:
- map over the json object to get some strings I can put into an img src tag.
- some simple logic to ensure one icon is not shown twice in a row.
- setup some smooth icon swapping.
- point the contact form to a php script on the server
- I was told I don't actually have to set up an email response. But I will if I have time.

Anything i should look out for /g/?

I started learning about a year and a half ago and recently had an interview at this small marketing firm. Really hope I can finish this and that they like my shitty coding. They were really nice and I need to get out of my crappy current job.
>>
>>58752221
>>58752224
>>58752250


literally every western country has something like it.

you and your kind are fucking retarded.
>>
>>58752447
I never knew that every western country has something like anime images.
>>
>>58752447
anime is available in any country though?
>>
>>58752485
most popular shows on /a/ would be illegal in the UK
>>
"Just copy PsExec onto your executable path. Typing "psexec" displays its usage syntax."


what is this executable path they are talking about? FUCK
>>
>>58752499
doesn't that mean that companies will spend more money and hire less?
>>
>>58752501
i said countries.
>>
File: 1485748069426.png (532KB, 602x699px) Image search: [Google]
1485748069426.png
532KB, 602x699px
>>58752501
Maybe they don't deserve good shows

There's no place for them in the megacorp cyberpunk future
>>
>>58752441

It's called a slider, bro.

a good web developer doesn't develop, a good web developer rips and patches.
>>
>>58752528
yes?
>>
>>58752477

true. you're still a retard though. and I'm posting on a ricefarmer's communal notice board.
>>
>>58752557
the UK is a non-country
>>
>>58752547
>a good web developer doesn't develop, a good web developer rips and patches.
you what
>>
>>58752568
Web developers aren't even true developers.
>>
>>58752584

retard
>>
>>58752520

it could mean a lot of things, we cant do nothing but wait and see how it plays out.

Hopefully STEMkids will get a job and make american software great again

Which i highly doubt considering the area is being plagued with cuck numales who submit to nagging bitches.
>>
>>58752584
this
>>
>>58752566
for sure, bro
>>
>>58752587
>a good web developer rips and patches.
I'd prefer calling them web rippers and web patchers.
>>
>>58752600

fuckin dumbass
>>
File: kytb.jpg (225KB, 1280x1249px) Image search: [Google]
kytb.jpg
225KB, 1280x1249px
>>58752584
Don't bully web developers, they're trying their hardest! It's not their fault they can't do real development
>>
>>58752516
the Path environment variable maybe

>control panel
>system
>advanced system settings
>environment variables
>edits the folder with psexec.exe into the system Path variable
>>
>>58752622
web developers do backend shit too, right?
>>
>>58752584

Perhaps.

I prefer playing with backend logic and databases over fucking around with animations and css but there are a lot more webdev positions and right now I just want to do something programming related.
>>
File: Salt-Pile.jpg (75KB, 502x377px) Image search: [Google]
Salt-Pile.jpg
75KB, 502x377px
>>58752587
>>58752619
>>
>>58752083
#lang racket
(provide sumrek)

(define sumrek
(lambda (n m)
(cond
((zero? m) n)
((< m 0) (sub1 (sumrek n (add1 m))))
(else
(add1 (sumrek n (sub1 m)))))))


Tests
#lang racket
(require rackunit
rackunit/text-ui
"sumrek.rkt")

(define sumrek-tests
(test-suite
"Tests for recursive adding"
(check-equal? (sumrek 6 -4) 2)
(check-equal? (sumrek 6 10) 16)
(check-equal? (sumrek -6 -4) -10)
(check-equal? (sumrek -6 4) -2)))

(run-tests sumrek-tests)


yay
>>
>>58752644
Just not serious backend engineering.
>>
https://www.youtube.com/watch?v=hzf3hTUKk8U
>>
>>58752622

Eh. I'll take whatever job opportunity I can get as long as it's programming related. I'll just live with the chinese cartoon imageboard judgement.
>>
>>58752679
this is a reupload of scala is terrible
everything in that is a criticism of scala
>>
>>58752694
>>58752679
>haskellfags
>>
>>58752441
I work as a webdev and I think you're just overdoing this
should've went with wordpress+basic theme and just added the things you want on top of that
that's the fastest way

>>58752622
mean
I can do real development
I know C++, Python, PHP, JS, C# and other minor things, I started writing my own game along with a server and know how to do async programming
but please, tell me how much better you are and how much more you earn

>>58752644
if you're not a shit one, yes, we do
I try to mostly focus on that if possible, sometimes there's just stuff that you need to do in js, html css and so on, so it's not like you can really limit yourself only to backends without shooting yourself in the face by limiting what you know
there's nothing wrong about knowing too much
>>
>>58752747
>I can do real development
>I can

But do you?
>>
>>58752737
>you're a haskellfag for stating the fact that the presentation is about scala and that scala is not all functional progrmaming
>you're a haskellfag for implying scala is shit
Nice.
>>
>>58752758
>im not a haskellfag

- haskellfag 2010-2018
>>
>>58752747
https://css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/
>>
File: haskellfags.png (910KB, 610x611px) Image search: [Google]
haskellfags.png
910KB, 610x611px
>>58752737
that's right bitch what are you gonna do about it
>>
>>58752757
depends what your lordy self would define as real development

I wrote an entire webapp from scratch (loyalty program thing), only thing I didn't create was visuals and I had codeigniter as my framework
over 20k of php code, lots of controllers, views, models and so on

wrote things that latch on top of woocommerce to basically have a shop that could sell boosts for games, with fields that people had to fill in after purchase, automatic messages, live chat and so on

now I'm working on a theme+backend combination of a system that latches on top of wordpress to create an offer system (think craigslist)

>>58752780
this link still triggers me
I can do fizzbuzz just fine, you sperg
probably in 10 languages too
and recursive fibonnacci and so on
>>
For a language that's over 20 years old Haskell sure has few real applications written in it
>>
>>58752584
>>58752587
>>58752622
>>58752648

I have a degree in computer science and I worked as a web developer for a few years

maybe once or twice a year you get a project that asks for your CS skill. but you have to be fast and get it done before the boss sees the ticket and explains to the customer that "it can't be done, it's not in your budget"

the reality of the matter is that most web development problems (that customers want solved) are already solved.

usually if you only really web develop if you are 1) extending/maintaining community libraries on github (but then you usually don't work with HTML at all), or 2) are inexperienced.

that's my experienced 2c.
>>
is it possible to make a gif image and give it a 3d effect?
>>
>>58752826
For a girl that's under 20 years old your sister sure has sucked a lot of guys' dicks.
>>
>>58752826
avoiding success was one of their goals
>>
File: happy face.jpg (34KB, 293x357px) Image search: [Google]
happy face.jpg
34KB, 293x357px
>>58752791
idk

post anime and read about R
>>
File: 1485723919701.png (36KB, 473x328px) Image search: [Google]
1485723919701.png
36KB, 473x328px
>>58752819
>this link still triggers me
That's why I enjoy posting it so much.
>>
File: Screenshot_2017-02-01_13-20-38.png (17KB, 598x212px) Image search: [Google]
Screenshot_2017-02-01_13-20-38.png
17KB, 598x212px
>>58752780
Oh my fuck
>>
>>58752826

my buddy from HS found a full time 6 digit pure haskell job.

I think haskell's dumb and useless too, but apparently there are big takers.
>>
File: FlGd1Ea.gif (2MB, 640x266px) Image search: [Google]
FlGd1Ea.gif
2MB, 640x266px
>>58752837
>>
>>58752844
I thought /g/ is a safe space
reddit told me that
did they lie to me, anon?
>>
>>58752863
>tfw too intelligent for 5 figure salary
>>
>>58752863

NOT AN ARGUMENT You can make 6 digits programming COBOL
>>
>>58752843
>R

that's not even a programming language m'lad.
>>
>>58752849
There's some real gold in the comments section, perhaps even more so than the article itself.

"Serious backend engineering" remains the choice quote, though.

>>58752867
I don't really have an opinion.
>>
How do I iterate through structs in C?
I don't wanna rewrite them as flat arrays.
>>
omfg

I need to newline this

printf ("%d", 420) ;

\n isnt doing it

but when i do this
printf ("Four-Twenty" /n);
it works

why not with the numbers

Im using 'c' in console

not c++

also, im building in Codeblocks most recent with default compiler
>>
>>58752876

I'd argue that argument's completely missing the point.

COBOL was huge at one point. and as such there's a lot of legacy to be maintained.

what they have in common is that professional devs are rare

the difference is that haskell lacks a justification for existing in the professional field at this stage, IMO.
>>
File: 1400380655998.png (127KB, 257x250px) Image search: [Google]
1400380655998.png
127KB, 257x250px
>>58752876
>number of real applications is an argument
>salary is not
>>
>>58752876
>>58752910
Not an argument.
>>
>>58752876
>self taught hansell dev
>any job i want
>3000k starting
>>
File: Screenshot_2017-02-01_13-25-55.png (16KB, 578x222px) Image search: [Google]
Screenshot_2017-02-01_13-25-55.png
16KB, 578x222px
>>58752890
I think this one is the best desu
>>
>>58752905
you tried

>printf ("fagg%dt"/n, 0) ; ?
>>
>>58752920

how about you respond to the actual argument.

inb4
>not an argument

up yours, buddy.
>>
>>58752937
There's no way this is valid syntax.
>>
obviously that a hit on me

fagg

i will tho, so \n b4 hehe*inb4*

must be why it was saying expecting ; before
>>
>>58752951
>>58752920
Not an argument.
>>
FFS

All I want is it to go

420
then text

not 420text
>>
File: 1471176138158.webm (1MB, 480x360px) Image search: [Google]
1471176138158.webm
1MB, 480x360px
In a way, programming and girlfriends are very similar
>>
>>58752998
"420\ntext"
>>
>>58752999
I'm not good with either?
>>
File: 1485002137932.png (704KB, 2015x2204px) Image search: [Google]
1485002137932.png
704KB, 2015x2204px
>>58752843
Can I post about R?
>>
>>58752999
Both programming and getting a girlfriend (male) are easier wearing a skirt?
>>
>>58752961

why not?

now you have to put
for(;;) printf ("i am afagg%dt" /n, 0); 


in your console for doubting me.
>>
The thing Haskellers don't understand is that the trivial bugs that the type system catches are almost never a problem and don't make it to production if you have code reviews and a test suite.

Secondly Haskell produces code that is often is extremely unoptimal and eats memory and cpu like nothing else. I've seen simple CRUD apps in Haskell crash by taking up >16gb of memory.

This is why Haskell is never going to get a large market share. Also GHC takes shit long time to compile.
>>
>>58752905
>>58752962
>>58752998
>>>/global/rules/2

Read your textbook before you make dumb posts about C.
>>
f u man,

im self-teaching
wtf is a manual?
>>
>>58753031
Please post about R all you want you lovely beautiful perosn
>>
>>58753062
Are you high?
>>
>>58753047
>if you have code reviews and a test suite.
The point is you don't need that shit. Expressive types are also good documentation and assist the compiler with optimization (so it can optimize more aggressively in less time).

>I've seen simple CRUD apps in Haskell crash by taking up >16gb of memory.
Sounds like the devs aren't capable of avoiding simple space leaks.
>>
no but if i was maybe id figure it out :(
>>
>>58753047

TBQH tho senpai a 70% reduction in development time is well worth a 20000% increase in cpu load for analytical programs.
>>
>>58753071
>The point is you don't need that shit. Expressive types are also good documentation and assist the compiler with optimization (so it can optimize more aggressively in less time).

Haskell's type system isn't powerful enough for that, you still need tests.
>>
its almost as if 'c' dosent even want you to separate numbers except on the line its written

of course I know fuck all
but the escape for newline works with text

just my numbers wont newline
>>
>>58753062

http://www.4chan.org/rules#global6

solutions were posted, now gtfo fagulette.
>>
unlike you i cant waste my time on 4chan all fucking day, I have actual learning to do
>>
source for me and ill apologize for being rude
and stupid
>>
>>58753124
I guess so, but Haskell also makes testing a lot easier than most languages with QuickCheck. There's also Liquid Types to specify and prove even more automatically, and failing that it's also much easier to do contracts (Hoare logic) and prove yourself due to purity.
>>
>>58753046
are you serious ?
>>
File: EKbtavj.png (371KB, 1206x855px) Image search: [Google]
EKbtavj.png
371KB, 1206x855px
i added a seekbar today (finally)
>>
>>58753202

yes.

what's objectively wrong with it?
>>
>>58753035
>>58753022
They're both digital
>>
File: hereugobro.png (3KB, 530x222px) Image search: [Google]
hereugobro.png
3KB, 530x222px
>>
File: i.jpg (68KB, 1638x783px) Image search: [Google]
i.jpg
68KB, 1638x783px
>>
File: MVI_0046.MOV.webm (2MB, 1280x720px) Image search: [Google]
MVI_0046.MOV.webm
2MB, 1280x720px
I added a light barrier to my attiny13 tinkering-shit and made a shitty video of it (really gotta get a nice tripod for my desk though).
Still got about 400 bytes left. Not sure how to go on, but we'll see.
>>
is there some smart algorithm that can join two arrays where order must be maintained and one array has a higher priority than the other? which element comes first depends on the order in the higher priority array

example (first array has a higher priority)
12345 join 12 -> 12345
12345 join 12A ->12345A
12345 join 1A2 -> 1A2345
12345 join A12 ->A12345
12345 join 1AB3 ->12AB345
>>
GOT IT

"%d/n"
>>
>>58753281

daisy chain 'em

then you have infinite bytes.
>>
>>58753299
wat
>>58753316
welcome
>>
>>58753323
Doesn't work, because our silicon is finite
>>
>>58753221
everything
>>
>>58753299

map(prexixes, (pref, idx)=>{pref=suffixes[idx];});
>>
File: soeasyicouldntgetit.png (6KB, 494x260px) Image search: [Google]
soeasyicouldntgetit.png
6KB, 494x260px
ok, now i know more.

Thanks 4chan
>>
>>58753343

only in your limited reality
>>
>>58753379

you teach people how to program when you yourself can't grasp the most basic of shit?
>>
nvm, now i dont do 4chan right
>>
File: output.webm (2MB, 1280x720px) Image search: [Google]
output.webm
2MB, 1280x720px
I added a text keyboard to the computer controller I've been working on for a while, it's pretty convenient.
>>
>>58753409
It's clearly a file handed to her by a professor/TA she was supposed to fix so it would compile.
>>
>>58753299
do the arrays only contain unique elements? what should the output of 1234512345 join 1212121212 be?
>>
how do you guys list languages on your resume? I just list Python, C++, C. I've touched other languages academically but wouldn't be confident in saying I know them for interviews.
>>
>>58753470

>how do you guys list languages on your resume

by typing them out
>>
>>58753470
List what you actually did with the language.

If someone says they "know" C++, you bet your ass I'll be grilling them about it unless they're saying they just know the basic syntax rules.
>>
I cannot make this simple program from K&R C in C. Without switch statement.
Any help;
>Q. Write a program to copy its into(getchar()) to its output (putchar()), replacing each string of one or more blanks by a singe blank.
>>
>>58753455

>her(male)

>>58753470

post one of every paradigm (either c or c++, not both, eg.)

also, always list --[----->+<]>----.++++.
>>
File: thinking_hotaru.png (372KB, 954x768px) Image search: [Google]
thinking_hotaru.png
372KB, 954x768px
>>58752927
>bragging about a phys/math degree on a CS blog
>thinks abstract algebra is the pinnacle of mathematics
>tfw I share a degree with this fuckface
I have no mouth but I must scream.
>>
>>58753469
whatever the algo shits out. it expects unique elements in a single list
>>
Is it normal to accept jobs to work on something you've never done before?

I'm confident i can do it, i just don't have experience using that particular tool.
>>
>>58753509
>If someone says they "know" C++, you bet your ass I'll be grilling them about it unless they're saying they just know the basic syntax rules.

that's just autist tier

unless the job application actually calls for a senior c++ developer

what do you consider "knowing c++"?
>>
>>58753547
stupid frogposter
>>
>>58753547
>CS blog

is this what people think CS is these days
>>
>>58752747
>>I know C++, Python, PHP, JS, C# and other minor things, I started writing my own game along with a server and know how to do async programming
>but please, tell me how much better you are and how much more you earn

i am much better and i earn more than you
>>
>>58753548

>create a hash set (or w/e data structure you want that has unique elements and O(1) contains() )
>add the entire first array to it
>for i to array_length: add an element from the first array to the joined array result, then check if the next element from the second array is in the hash set. if it isnt, add it to the joined array, otherwise skip it
>>
>>58753618
This.
>>
>>58753578
>what do you consider "knowing c++"?

"Knowing" any language extends far beyond the language's syntax.

Part of this is knowing your way around common development tools, particularly an industry-standard IDE or a similar homebrew workflow setup.

You should know your way around common frameworks/libraries, particularly of the GUI variety.

Above all, if I ask you to write and compile an application that does a few basic tasks on a fresh install of your preferred OS, you should be able to sit down, install your tools, import your frameworks/libraries (if applicable), and produce a working application of some sort.
>>
>>58752747
>and know how to do async programming

oof, we got a real badass over here
>>
File: 1432164169261.png (289KB, 586x634px) Image search: [Google]
1432164169261.png
289KB, 586x634px
>>58753587
Excuse you the anime cancels it out
>>
>>58753657
>write and compile an application that does a few basic tasks

elaborate a lil plz.

i assume beyond fizzjizz
>>
>>58753628
thanks. sounds good
ill omit using a hashset. I can handle O(n) contains because my arrays will be at worst 5 elements long and i will do this very often to save on memory
>>
>>58753680
Wrong. No gensokyo for you, you're going to hell,
>>
>>58753680
That's not true at all, if anything it makes you worse. Anime is pure, not to be tainted by crossposters fresh off the boat.
>>
>>58753680

          Coooongratulations!

Level Up!

You are now a dumb weeaboo frogposter!
>>
File: 1485974693027.png (184KB, 600x750px) Image search: [Google]
1485974693027.png
184KB, 600x750px
>>58753697
Gensokyo is more like purgatory desu
>>
>>58753681
Could be anything.

Along the lines of "Generate a random racial slur generator utilizing an API for demonyms and a convenient HTML page with all manner of slurs. Display the results in a form-based GUI (web, mobile, or desktop app, your choice), and allow the user to select one and send a spoofed email from '[email protected]' using a given SMTP host."

That would demonstrate a good smattering of basic understanding of the language, I would think. It involves:
>creation of interactive GUI of some sort
>consumption of API data
>HTML web scraping
>various language features for storing and manipulating sets of data
>email generation

Silly example, but it would get the job done.
>>
>>58752998
Lmao im glad im not the only one who prints out dumb shit when trying out a new language

>Mfw I kept printing out nigger faggot in every way possible to get comfortable with how shits done
>>
Is it possible to learn programming language if you stupid in math and don't understand anything in code
>>
>>58753761
Yes to the former
No to the latter
>>
File: 1485510486751.png (442KB, 500x712px) Image search: [Google]
1485510486751.png
442KB, 500x712px
>>58753547
>>58753680
>>
File: smug_youko.png (341KB, 784x549px) Image search: [Google]
smug_youko.png
341KB, 784x549px
>>58753772
There is no need to be upset anon
>>
>>58753796
Those chicken legs are weird, man.
>>
>>58753761
Just try it anon, there's tons of cheap or free courses if you're not good at self learning from a book.
>>
This might be a supremely retarded question, but how do I start a empty new Java project in NetBeans? I got a textbook and I want to program along, but if I create a new Java project and deselect "Create Main Class" and create the project, a text window for the project never appears, even though it shows up in the Navigator.
>>
>>58753880
Right click on project name, go to new -> empty java file
>>
>>58753573
IS IT NORMAL TO ACCEPT JOBS TO WORK ON SOMETHING YOU HAVE NEVER WORKED WITH BEFORE DEE PEE TEE?
>>
>>58753956
>>58753573
Can't be that confident
>>
>>58753956
WHAT?
>>
I need someone to explain lambda expressions to me

n -> n % 2 != 0;


For instance, how do I read this in English?
>>
>>58753991
left hand side is replaced with right hand side when applied/called
e.g.

\x -> x + 1
x goes to x + 1
>>
>>58753986
>>58753988
You've made games before for desktop.
You know the basics of game design.
Somebody tells you to make a mobile game.
You've never used android studio before.
Do you accept the job?
>>
>>58754008
Sounds like a scam
>>
>>58754008
>someone tells you to write Java
run away and go into hiding
>>
>>58753991
For set x (not shown), test all elements 'n' and return a boolean representing whether 'n' is an even number, and return this set of booleans.
>>
>>58753991
a function from n to n mod 2 equals zero
>>
>>58754026
>set
wrong
>>
>>58754036
lol
>>
>>58753991
Function that takes one argument and checks if it's odd
>>
>>58753991
def anonymous(n):
return n % 2 != 0
>>
>>58754023
>Hurr durr every language except the one I like is shit
https://blog.bradfieldcs.com/in-2017-learn-every-language-59b11f68eee
Read that, go into a corner and be ashamed of yourself for being a shitty programmer.
>>
>>58754050
What? I said Java was shit
>>
>>58754037
I'm assuming it was something like {new variable} = x.map(n -> n%2!=0)
>>
>>58754061
it could be bottom, i.e. x = x or x(){return x();}
>>
>>58753991
Can you give me a little more context, would make it easier to explain.

This lambda expression will result to true if (n % 2 != 0).

So consider this:
int[] numbers = {1,2,3,4,5,6};

Now we want to get the count of how many ODD numbers there are in the array;

int oddNumberCount = numbers.Count(n -> n %2 != 0);

Count() is a built in function for every array in this language, which accepts a lambda expression.

The lambda expression [n -> n % 2 != 0] simply returns true if n % 2 != 0, ie whenever n%2 == 1. [since n%2 = 0 or 1, by asserting not equal to 0, we really mean when n % 2 == 1]


In short, the above code does the same thing as just looping through each number in the array and counting every time n % 2 == 1.
>>
>>58754019
>>58754023
For fucks sake. Does anybody on /dpt/ have any actual experience with freelancing/jobs or is this entire thread filled with haskell memes?
Should you have experience in whatever tool you're using before you take the job requiring you to use this tool, or is it common for people to learn on the job?
>>
Is C# worth the trouble to learn?
Theres lots of jobs requiring C# and .NET experience where I live
>>
>>58754072
>the only language that isn't Java is Haskell
Who told you this?
>>
>>58754046
So are they just used for situations where you don't want to make an extra method or class for one job?
>>
File: Capture.png (11KB, 631x229px) Image search: [Google]
Capture.png
11KB, 631x229px
>>58753917
Thanks, I got a bit closer to my goal but why is the program still adding this trash I never asked for? Tried deleting the templates but now it gives an error instead.

I googled around for a bit and apparently this is something that's actually retarded enough to be discussed here and there.

Is there any "I'm a newbie please stop fucking with the line count" radio button somewhere?
>>
>>58754004
Absolutely wrong.

>>58754026
NO, we are testing for odds.
Not returning a set.

>>58754036
Nope.

>>58754044
No not exactly, the lambda expression is merely an expression not a function, it doesnt take one argument and check if odd see >>58754071 for a better explanation

>>58754046
no this isn't a function

>>58754071
too long an explanation but I think its right?
>>
>>58754081
You'll get mixed opinions here.

However, there's a reason it's the only top-5 language to be well-liked.

You can pretty much do anything you want with it, and it's nice for hobbydev because it's got fucktons of convenient syntax sugar and a very shallow learning curve.

I'd certainly recommend it, depending on your programming goals.

Obviously, you wouldn't use it for a kernel or a hardware driver, but it's pretty versatile and easy to work with overall.
>>
>>58753750

in c++.

...

I'd charge you 5k at least for that. no way anyone other than a pajeet would agree to something like this for an interview

also, that doesn't have anything at all to do with the language.


you're deluded broski.
>>
>>58754122
How about you tell us what language you're referring to, fagtron?
>>
>>58754122
>Absolutely wrong.
Not wrong at all, that's the definition of a lambda, a form to be substituted into

>not returning a set
Not what he said
>>
SDL or GStreamer?
>>
>>58754127
This should be trivial to knock out in less than a few hours with any modern language.
>>
>>58753991

it's equivalent to

n->!!(n-n<<1>>1);
>>
>>58754112
Nevermind figured it out, Jesus
>>
For mobile games, do you make menus and gui with graphics and click events, or do you use the editor for your platform?

On android you'd use android stuidio and xml, on iphone you'd use xcode and their editor.
>>
>It's a common experience that 1,000 lines of COBOL -> 100 lines of C -> 10 lines of SmallTalk -> 1 line of Prolog

How true is that?
>>
>>58754090
>So are they just used for situations where you don't want to make an extra method or class for one job?
I don't know these OO words.

>>58754122
>no this isn't a function
It is indeed a function, just an anonymous one (which I admit my code was not: it was just for comparison).
>>
>>58754190
-> effectively 0 lines of Haskell because you'll never even run it
>>
>>58754150

don't disagree.

i think that
1) it doesn't test your c++ skills at all
2) it nearly doesn't test any real programming skills

it sounds like you'd test someone on the couple and only ragtag things you personally know.
>>
>>58754233
lol u read xkcd 2? XDDDDDDDDDDD
>>
>>58754292
what?
>>
>>58754190

there are definitely things where you need 20 lines of prolog to accomplish what 20 symbols in cobol can.
>>
>>58754314
>20 symbols in cobol

in Chinese this is just 意
>>
>>58753047
It's not only that you can greatly reduce the number of tests o spend significantly less time in code review (both are true). It's the fact that you can reason about the code. I've easily retaken completely undocumented projects that I hadn't touched for years and I can figure out other's people code in much less time in Haskell than in other languages.

Why? Because the type system tells me a ton of stuff that that code does *not* do. For instance, if I told you I have a C function
int f();

you can't tell anything about it. However, in Haskell everybody knows that the type
() -> A
is isomorphic to A for any A. Therefore, f can only be a constant integer. This kind of reasoning becomes veey natural with time.

I don't think that I even need to mention that sufficiently expressive type systems (like Haskell's) serve as compiler-checked comments.
>>
Is there a license which allows you to legally kill anyone who obtains an unlicensed copy of your program?
>>
File: ancap.png (200KB, 547x402px) Image search: [Google]
ancap.png
200KB, 547x402px
>>58754468
it's called the NAP
>>
>>58754477
The word "license" presumes copyright, which I don't think most of them support. So no, I need something better.
>>
I'm looking to buy cheap barely competent Indians to code for a shitty project I'm on.

Best best place to hire freelance coders?
>>
>>58754501
intellectual property still falls under castle doctrine
if they touch your waifu you can McNuke™ them
>>
Started working on using Rust, but honestly it really fucking sucks
>>
how do i run a batch file on a computer but make the call to run that batch file on that computer FROM A DIFFERENT COMPUTER? both have windows. Please help desperate here
>>
File: nodejs.png (688KB, 1440x900px) Image search: [Google]
nodejs.png
688KB, 1440x900px
Can someone recommend a meme book for pic related? I need to learn about architecture and structure of node.js programs.
>>
>>58754521
t. is getting stuck because the lifetime system doesn't let him piss mutation all over the place like he's used to
>>
>>58754515
Wait until Trump shuts down the H1Bs, then there'll be Pajeets to spare.
>>
>>58754516
It doesn't. I have literally never met a single ancap who supports IP so I don't think it's what I need.
>if they touch your waifu you can McNuke™ them
Yes, but I need a license for that.
>>
https://www.reddit.com/r/rust/comments/2pn9sk/implementing_the_state_monad_in_rust/
>>
>>58754531
Psexec possibly?
>>
>>58754571
But for now, where to buy free lance coders?
>>
>>58754613
I have some blacks available for sale.
>>
>>58754188
Anybody?
>>
>>58754593
I haven't been around for a while, is it already possible to define Monad in Rust?
>>
>>58754673
No.
>>
>>58754622
Can blacks code? I thought they could only smash.
>>
>>58754622
That's more of a burden than a help to be honest.
>>
>>58754673
not the typeclass
>>
The problem with Haskell is record syntax.
>>
>>58754700
Ah, ok. I thought it was on the roadmap, but it seems that they have other priorities.
>>
>>58754772
Yeah, and the fact that there is no de facto composable effect system. The numeric tower is annoying, but nothing too critical
>>
File: eww 3dpd waito piggu.jpg (212KB, 788x788px) Image search: [Google]
eww 3dpd waito piggu.jpg
212KB, 788x788px
Sup /g/, I ran into a little hangup, and I was hoping you guys could give me a nudge in the right direction.
This is within my main class.
Car toyota = null;//I have to initialize this outside of the try loop, 
try{//error catching because file input
toyota = new Car(); //this should create object toyota of class Car
}
catch (java.io.IOException exception)
{
System.out.println("You dun goofed");
}
finally
{
System.out.println(toyota.getPrice());
etc
}

Anyways, toyota.getPrice is not working because of a null pointer. My guess is that toyota is only overwritten temporarily/isolated to within the try loop.
How do I fix it?
Sorry for being retarded.
>>
>>58754796
know any language that solves these probs?
>>
>>58754876
Yeah
>>
>>58754845
Because the finally block runs regardless. If the constructor of Car fails, "toyota" will still be null since nothing else was executed.

You want this:
try {
Car toyota = new Car();
System.out.println(toyota.getPrice());
} catch (java.io.IOException exception) {
System.out.println("You dun goofed");
}
>>
>>58754845
This means you're getting a IO exception. You should re-write your stuff to do this
Car toyota = null;//I have to initialize this outside of the try loop, 
try{//error catching because file input
toyota = new Car(); //this should create object toyota of class Car
System.out.println(toyota.getPrice());

}
catch (java.io.IOException exception)
{
System.out.println("You dun goofed");
}
>>
>>58754885
which?
>>
>>58754924
first post a single anime image which I shall judge.
>>
>>58752864

not like that, i mean if you put on those 3d glasses or something
>>
>>58754968
i dont have any anime images save on this computer so I will draw one for you

:3 -- am I kawai anon-kun
:^) -- yes inuasha-chan
>>
>>58754876
Monads don't commute in general, so transformers don't generalize well. In fact, anything that contains Cont in particular will be a mess to compose.

Eff, Freer, etc still suffer from performance and are not as general as transformers IIRC, so I don't think there is any (pure) functional language that solves this.

Records are pretty much fixed in any newer language or even Haskell if you use a library.

Numeric towers are hard to get right: you need to be able to stop at any level without it being too fine-grained (cumbersome to use) or use too complicated names (complicated for anyone not familiar with abstract algebra)
>>
>>58755012
so fp is a dead meme then?
>>
>>58755004
>i dont have any anime images save on this computer
then draw a real anime image, not this bullshit. or somehow find it.
>>
>>58755032
No, OOP flaws are much worse to deal with
>>
>>58755012
>Monads don't commute in general
>Eff, Freer, etc still suffer from performance and are not as general as transformers IIRC
Well, yeah. If you want algebraic effects, you have to give up a little bit of expressivity from monadic effects. As for being a performance issue, that's just as libraries on top of monads in Haskell.
>>
File: 1483136707839.png (602KB, 963x720px) Image search: [Google]
1483136707839.png
602KB, 963x720px
>Logic programming is the future, computers will solve problems on themselves!
If so, why do we still write in imperative languages?
Why there's no some, for example, web browser in a logic programming language?
The way I was taught about logic programming, I only can think about LP languages as about some SQL on steroids. What do I think wrog about LP?
>>
>>58755073
There are no good logic languages; the only one of any size is Prolog, which is ugly as sin.

Contrast with FP where there are plenty of acceptably-supported languages.
>>
>>58755073
>we
speak for yourself.
>>
>>58755066
Aren't those effect systems modelled on Monads, though?
>>
>>58755073
Logic programming is limited by what is decidable. Where decision procedures and unification turn out to be really useful is in type inference and automated theorem proving for dependently typed (functional) programming languages - stuff that isn't necessary but makes things much more convenient.

>>58755111
Not in general, no, that's just to get them working in Haskell. They're natively implemented in F* and Idris (the latter to some extent at least, I don't know how complete it is) and otherwise only really a subject in PLT.
>>
>>58755045
like what?
>>
>>58755146
Like all the objects.
>>
>>58755146
all of it.
>>
>>58754796
Composable effects are a meme. MTL works perfectly fine.
>>
>>58755137
Oh I see. That sounds interesting.

>>58755146
Just for starters, there is no such thing as "the base class of everything". It doesn't make sense.
There is also the thing about casts literally everywhere and that's a massive hole in the type system where the user tells the compiler to trust him that everything will be ok. Multiple inheritance is necessary to model some problems, but then you run into shit like the diamond problem. I could go on, but I think you get the point.

>>58755201
Enjoy those O(n^2) instances
>>
>>58755161
Well with record syntax, there are obvious problems like namespacing that require you to split up modules and cause various pain points. Does OOP have any obvious problems like that?
>>
>>58755100
>Contrast with FP where there are plenty of acceptably-supported languages.
I'm aware of them.

>>58755137
It sounds like LP is not much useful outside of academia, doesn't it?
>>
>>58754644
Guys
>>
>>58755146
All of the shared mutable state.
>>
[spoiler]do it work[/spoiler]
>>
>>58755236
>base class for everything
this isnt required for oop, is it?
>casting
I think you can avoid this entirely for good design
>multiple inheritance
you can avoid this an if you need it composition can model your problem
>>
>>58755246
>It sounds like LP is not much useful outside of academia, doesn't it?
I believe that when you don't care about performance, more declarative is better.
And when you consider that no optimisation should be done prematurely, this equate to solving your problem with the most high-level language at your disposal, and only sacrificing power when you've proved its essential to improve performance.
>>
>>58755246
Currently, no, since dependently typed languages aren't in use much.

Though there's an extension for Haskell called liquid types that uses decision procedures to check refined types like "integers less than y" or something.
>>
>>58755276
You have to use [/g/spoilers]
>>
File: squirrel.jpg (25KB, 610x416px) Image search: [Google]
squirrel.jpg
25KB, 610x416px
Best poorfag printers?
>>
>>58755325
Matrix printers
>>
>>58755277
Can you point me at a good OO language so I can check for these kind of things? I don't think you can avoid casts forever in an OO language, and I can't think of any of them that doesn't have a "base class of everything". If you define OO as "objects and interactions betweeen them" then I could say that some operations can't be represented as an object talking to another (when you add two numbers, it's not a number that tells the other one to add itself). Static methods kind of miss the point since that's pretty much falling back to FP o procedural.
>>
>>58752747
>> I work as a webdev and I think you're just overdoing this
should've went with wordpress+basic theme and just added the things you want on top of that
that's the fastest way

They left pretty specific instructions as to how they wanted it to be created. I also need to upload it on their server which is already running phpmyadmin. Seems easier to me to throw up an index.php a few php and js scripts than to make wordpress do what I want.
>>
r8
data OP = OP { 
opToFun :: (Double -> Double -> Double) ,
opToStr :: String
}

-- Solves the "Le compte est bon problem -
-- Given a list of numbers and a goal, create an equation that evalues to the goal using only
-- the given numbers no more than once each and elementry operators (*, /, + , -)
numSolver :: [Double] -> Double -> [String]
numSolver nums goal = map stringIfy (filter works get)

where

-- possible operators that can be used
ops = [OP (*) "*", OP (/) "/", OP (+) "+", OP (-) "-"]

-- all possible orderings of numbers and operators
get :: [([Double], [OP])]
get = [(x, f) | x <- (comb nums), f <- (comb ops)]
where
comb x = (subsequences x) >>= permutations

-- returns true if the pair is a solution
-- we just eval the pair and make sure it matches the goal & verify that there are no trailing ops
works :: ([Double], [OP]) -> Bool
works x = ((eval x) == goal) && (length (fst x) == length (snd x) + 1)
where
eval :: ([Double], [OP]) -> Double
eval (x:y:zs, f:fs) = eval (((opToFun f) x y):zs, fs)
eval (x:[], _) = x
eval _ = 0

stringIfy :: ([Double], [OP]) -> String
stringIfy (nums, ops) = merge (map show nums) (map opToStr ops)
where
merge [] _ = []
merge (a:[]) [] = a
merge (x:xs) (y:ys) = x ++ y ++ (merge xs ys)
>>
>>58755374
>good OO language
This is impossible by definition.
>>
>>58754673
>https://www.reddit.com/r/rust/comments/2pn9sk/implementing_the_state_monad_in_rust/
>>
>>58755374
>point me at a good OO language
1) Smalltalk
2) um
>>
>>58755434
That doesn't answer my question. Monad is an abstraction. It's like asking for the Comparable<T> interface and being told about comparison of integers
>>
>tfw studying stack memory allocation

Why do we even have heaps and asynchronous programming when you can have split stacks instead?

Programs can allocate memory on the stack without fear it will overflow, threads can have small stacks and grow as needed, killing the "LOL BUT ANON YOU CAN'T HAVE A BILLION THREADS THEY TAKE UP TOO MUCH MEMORY" argument.

Prove me wrong (please)
>>
>>58755450
We're talking about statically, strongly typed OO. To be anything else is itself a massive flaw IMO
>>
I'm close to becoming a wizard so I wrote some tools to help me down the path.

One monitors Reddit accounts for new nsfw posts then emails me and downloads it when one is found. I wrote it because a couple girls I like sometimes post a new album then delete it before I get a chance to see it.

Another rips the submission history of Reddit accounts (up to 1000 posts, api limits). I use it to pull down all the content from girls I like. Working on having it scan their comments to check for additional content, right now it only gets submissions.
>>
>>58755137
Plenty of effect systems have an Effect effblob monad where effblob is some data that specifies the effects the Effect monad has. However, embedding this using phantom types is a pain and dependent types complicate type systems so some people choose not to do things this way.
>>
>>58755455
Sorry wrong link: https://www.reddit.com/r/rust/comments/5qd3me/lowering_rust_traits_to_logic/dczxn64/
>>
>>58752660

Rather than
(define identifier (lambda (args) body))


You shoulkd prefer
(define (identifier args) body)


Syntactic sugar exists for a reason.
>>
>>58755426
>((opToFun f) x y)
opToFun f x y
>>
>>58752844
>minus is not defined for string, therefore casts both to numbers
>plus is defined for string, therefore concatenates
>same as first one
>string plus (unary-plus string), unary-plus casts to number, and plus concatenates as string
>same as above, 'foo' cast to number is NaN
>what the fuck??? I don't get the rest
>>
>>58755472
agreed, I literally cannot understand dynamic languages.
>>
>>58755493
That kind of makes sense. Thanks
>>
>>58755472
>OO
Disgusting.
>>
File: 1485725116868.png (5KB, 270x175px) Image search: [Google]
1485725116868.png
5KB, 270x175px
>>58755570
>>
>>58752844
>var x * 3
gives me a syntax error
>>
>>58753205
>youtube-scraping
forwhatpurpose.jpg
also are you hosting source somewhere?
>>
>>58755622
>[] == [] 
false
>[] === []
false

can someone who understands javascript explain this?
>>
File: 1485724898875.jpg (18KB, 238x397px) Image search: [Google]
1485724898875.jpg
18KB, 238x397px
>>58755675
>>
>>58755675
>can nobody explain this?
yes
>>
>PostgreSQL arrays aren't zero-based
>>
>>58755701
Thanks for posting this
>>
>>58755622
>i++ is i += 1 is i = i + 1, string + concatenates
>what? why?
>sort inexplicably converts to string before sorting in lexicographical order
>yes
>huh? fuck this shit is why people make 9001 libs in node
>== casts liberally
>wait how exactly...? probably casting to number as NaN
>is == an eval function? how asinine
>I don't
>>
>>58755701
>arrays in SQL
What's wrong with

CREATE TABLE linked_list (
id int NOT NULL,
head text,
tail int,
PRIMARY KEY (id)
);
>>
>>58755622
>>58755675
how does [] == false but [] != []???
>>
>>58755792
WTF??? how do you query this?
>>
>>58755792
Although that's not actually the most optimized implementation. A better implementation might be:

CREATE TABLE set (
id int NOT NULL,
PRIMARY KEY (id)
);

CREATE TABLE values (
value head,
owner int
);
>>
>>58755813
https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL#Common_table_expression

Although >>58755817
can be more convenient.
>>
Is non-Euclidean geometry a meme?
>>
>>58752780
>I mean – I would be suspicious of someone who could solve fizzbuzz off the cuff. They are likely to:
>1. have too much time on their hands
>2. had too many interviews asking that question
>3. be unsufferably arrogant
>4. or all of the above.

FUCKING NORMIIIIEEEEEESSSS RRRRRRRRREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

This is the ultimate proof that "front end developers" are bottom-of-the-barrel untermensch scum that barely deserves to live.
>>
>>58755839
No, but reals are
>>
File: css.gif (1MB, 427x244px) Image search: [Google]
css.gif
1MB, 427x244px
Fighting with CSS
>>
>>58755839
Don't you think that geometry on a sphere may be interesting? Like, you know, drawing shit on spheres like planets
>>
>>58755792
Arrays are faster. Tables come with overhead, so if all you need to do is append and slice at indices, use arrays.
>>
quck, someone post a programing challenge!
>>
>>58755675
Pointer inequality.
>>
>>58755901
Create your own OS using Java.
>>
>>58755882
You're supposed to pull it all the way back up and then let it down gently
>>
>>58755901
Implement lock-free eventual consistency network synchronisation.
>>
>>58755899
post the slut's name
>>
>>58755944
$YOUR_MOTHERS_NAME
>>
>>58755950
John?
>>
File: Screenshot_2017-02-02_01-15-52.png (10KB, 488x39px) Image search: [Google]
Screenshot_2017-02-02_01-15-52.png
10KB, 488x39px
>>58755944
>>
Damn. Every time I start a new project I think: "I don't need all this stuff, I don't need redux yet, I don't need routing yet" — and then I regret my decision because I always have to refactor the code by adding all this stuff.
Damn. Maybe Elm will save me from this evil?
>>
>>58755979
Damn
>>
I want to start using emacs. Any tips? I've gone through the tutorial already.
>>
>>58756200
Install some plugins and start editing text
>>
>>58752241
engine dev here. didnt even start coding the actual game yet.
>>
To the anons that helped me yesterday with a C++ question from Stroustrup's book about for loops and how to get it to print sequential alphabetical characters - thank you for taking the time to explain it to me. I've re-read your explanations probably 50 times and just a second ago it clicked and I understood it. I really appreciate it.
>>
New thread:

>>58756258
>>58756258
>>58756258
>>
>>58752905
printf("%d\n", 420);

put it inside the parenthesis
>>
>>58755701
have you updated your hydrus to 243 today sir?
>>
>>58756304 (You)
next time google it and look for "stackoverflow" results
>>
>>58756309
No, but I will now. Have not worked on my hydrus replacement in a while too.
>>
>>58752241
I gave up about a year ago, it was completely terrible
>>
>>58755899
such ass
>>
does anyone have those info pictures of the particular kind that list a bunch of programs you should try to do/solve?
Thread posts: 318
Thread images: 44


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