/dpt/ - Daily Programming Thread - Cute Edition

Previous: What are you working on?

Attached: 1555706617786.jpg (675x1200, 115K)

Other urls found in this thread:

wiki.haskell.org/Monad
archive.rebeccablacktech.com/g/search/subject/dpt/deleted/deleted/
github.com/vlang/v
en.wikipedia.org/wiki/Web_scraping
vlang.io/
en.wikipedia.org/wiki/Assignment_(computer_science)#Assignment_versus_equality
stackoverflow.com/questions/31155771/symbolic-math-in-julia
volt-app.com/
twitter.com/SFWRedditImages

Almost made a pepe OP you beat me to it

it would have got deleted.

Alright, user. Let me take a look at your JavaScript project.

Attached: bb060d4c841ffbaa60c60039e248d877.jpg (1080x1080, 77K)

Why? If I made it after bump limit and made it first why would it
I wouldn't break any rules

Sure
*unzips dick*
I think there's a leak. Maybe you can fix it?

I dont get the big meme about moan ads being hard to understand, or being hard to find any info on them. The wiki page itself has the best, most intuitive, least food-based explanation you could ask for:
wiki.haskell.org/Monad
>Monads in Haskell can be thought of as composable computation descriptions. The essence of monad is thus separation of composition timeline from the composed computation's execution timeline, as well as the ability of computation to implicitly carry extra data, as pertaining to the computation itself, in addition to its one (hence the name) output, that it will produce when run (or queried, or called upon). This lends monads to supplementing pure calculations with features like I/O, common environment, updatable state, etc.
So using moan ads is pretty much just saying "I have a functor takes a type and provides a way of bundling together some kind of state information regarding that type, and I would like to be able to daisy-chain together a sequence of unary functions that can take advantage of that state and 'change' it across chain nodes, but in such a way that under certain conditions, depending on what specific modifications to the state have been accumulated, procession along the chain may be allowed to cease prematurely."

frogs and wojaks are against the rules.

Attached: 1538276882526.png (790x301, 24K)

it would've

Attached: 1545905458031.png (334x113, 8K)

couldn't they write it in the rules or pin it in the first thread below stallman
also I just want to make a non anime OP doesnt have to be pepe or apu or wojak i guess Ill just post a fucking cat

and anime trannys are high quality?

>anime website

Attached: 1556085489241.jpg (737x737, 52K)

>I just want to make a non anime OP
Then fuck off and go somewhere else.

>brand related banter

Attached: Z7HeRxU[1].png (512x512, 361K)

Why would you do that, might as well go to >>>/wdg/

Hey I like anime I have watched 100+ anime I just don't like meme rules and traditions.
Why should the OP be anime? Ill just post some guy programming that seems related to dpt

They're referring to AMD vs Intel vs Nvidia shit there and good fucking riddance. Fuck that cancer.

archive.rebeccablacktech.com/g/search/subject/dpt/deleted/deleted/
keep in mind most of those are when 2 people make a thread at the same time and somebody deletes one. the frog ones were deleted by a mod and they might of even got banned.
just don't do it.

mission failed, we'll get em next time

Attached: 1550248868884.jpg (1080x1080, 246K)

it doesn't have to be anime but should be approximately 70% of the time. it shouldn't be a frog image though

because /dpt/ is the anime thread?

Attached: 1538664222189.png (1000x1000, 1.53M)

>Why should the OP be anime?
you're asking this question to mentally unstable 14 year olds or 40yo NEET manchildren, don't expect any kind of reasonable response lmao

you don't, i think
you could make fucnt2 have an extra bool saying whether it's true or not, or maybe prolog has some way of testing failed conditions? if you just had
funct1(A) :- write('bad').
i dunno if it would respect the order or what

(but i don't really know prolog so take it with a pinch of salt)

I get flattered every time someone posts Illya. I'm slavic and that is literally how my name is spelled

Attached: 150124232556325432.jpg (850x927, 627K)

Feel free to kill yourself, degenerate.

nice

that's a nice name

You have a cute name, Illya!

My bad. I figured it out. There are several ways to simulate "if". One is like what you're describing and what I tired, the other one I needed is
funct1(A) :- funct2(A), write('good') ; write('bad').

Pretty much saying if anything on left is false then right

Challenge yall to solve my word search puzzle by writing a program.

engine
sudden
plough
flower
because
request
complete
relation
attention
competition
V H R F X Y Q N O C J N T H X G K L H F
U K V A U J Y W I P V T J X J F T T I V
Q F H A X V V K K P X I R E S W T D C R
J M T K E P X A G O I U O N N H F D Q Q
F W K P G M N D N D D L C G C M D K F W
L I S A I I O E M I I K I I L E U K H B
O F U O I W I B L X O V H N O V W K W F
W L J Q J Y T T A G P V K E A E D L A C
E P H H F R I P O J M S C T T E G Q X G
R L T H X Q T E Q B H D T B G C C F W K
T Q K X V V E Q B K B E G M K O N C A D
X G Z T N H P U H E N M Y V M P S E A P
Z T N R L R M J N T C U I P R S Z S X P
U K D O U O O W I U T A L J S N B J W R
X F C Q I G C O D S R E U D Y H Y I D O
S O V B H T N L E O T H B S G U I S A S
A W V W C V A U O E M Y R U E W F P U Z
W D C Q F Z Q L K H P P O Q E W B J F U
C R E F E E S L E R T L O G V A S H G R
X V Y N R Z O L U R P Q G O N E D D U S

ah i see, so it's like if the left thing fails / it can't derive it

If I remember correctly, define a new funct1(A) underneath. Might have been above, I cba to check.

cute!

do your own homework

Cunny!

I already wrote a solution.

Attached: soln.png (359x543, 46K)

Reminder that C is inappropriate for writing high performance software.
Use modern idiomatic C++ instead.

Attached: 1552878727764.jpg (800x871, 442K)

based

C++'s behind-your-back memory management magic makes more segfaults than it's worth. The only good feature that makes C++ worth it is templating for data structures.

>behind-your-back memory management magic makes more segfaults than it's worth
Retard spotted.
It's not magic and it causes far less segfaults. You're definitely fucking it up somehow, like the retard you are.
C++ isn't for retards, it isn't retard friendly.

>magic
look at this cnile confusing magic and technology like the good caveman he is.

Attached: 1533389917135.png (300x300, 136K)

Except templating is useless without well-behaved objects that correctly implement the rule of five and other memory management idioms.

im very dumb but how good would a solution where:
1. Convert search words to circular doubly linked list.
2. Randomly (not sure here... use min word size?) in fixed intervals.
3. Search nearby cells using the linked list (should be straightfoward).

Could you share your solution or idea used? Help a dumb fuck out.

Attached: 543265236.jpg (350x250, 16K)

nice thread you have here
shame if... something were to happen to it...

>sys.4channel.org timed out
>sys.4channel.org timed out
>sys.4channel.org timed out
>you failed the catpcha
>you failed the catpcha
>you failed the catpcha
Why do we let /wdg/ do anything again

Attached: 1408401479542.gif (622x432, 2.34M)

this is the guy the other dude was asking about earlier right, did he get vanned or something?

Good thing all objects that aren't designed by total retards do.

You're thinking way too hard. Just start at each letter, and search for the words diagonally. It's brute force, but nearly anything would be (you could find sub-words in a longer chain, but that's basically a depth-first search where as per-letter is breadth)

I didn't think it would upload the image since I tried re-submitting so many times. I don't know whatever happened to the guy, loli is legal, though obviously that game could cross over into "obscene" for normalfags.

such as?

it depends where you live, i think in america it depends on the state (in practice at least).

But not the ones designed by .

At least we're not Canada right? I can't seem to find the image I have of two Canadian officers frowning disapprovingly at the kind of loli realdolls you see dressed up in fancy clothes around Jow Forums (or used to, it's been years)

new meme language! github.com/vlang/v
so, what do you think?

Attached: american-psycho-bateman.jpg (600x327, 58K)

Well of course. She's a retard after all.

cuz anime is one of the few things that bring joy to lives of anons here

I need help.

I've got to do a silly stupid program in Java that gets all the links in a webpage and downloads them but I'm retarded and can't.

If someone wants to help me I'll expand. If not, laugh at my demise.

if () download() else dont()

read this and look up terms you don't understand en.wikipedia.org/wiki/Web_scraping

Anyone using sage for formal calculus?
Differentiation, integration, solving symbolic systems, eigen values...
I used to use Maple back in the days but it's expensive and proprietary.

I'm torn between sage and sympy.
Sage looks neat but damn the documentation is low quality.

Why not wolfram or gnu octave?

void saveHTML(String html, String destinationFile) {
try {
PrintWriter exit = new PrintWriter (new FileWriter(destinationFile));
exit.write(html);
exit.close();
} catch (IOException ioe) {
}
}

I have this method but I don't think it's correct.

I don't think that helps much but thanks anyway.

There's a /wdg/ I think for webdev. Jow Forums is not for homework questions though.

honestly I didn't think this far

Why does java get all kinds of fancy stuff to allow objects to reuse methods like interfaces and method overriding instead of just renaming things a bit differently?

It is if you mask the questions well enough. He's not masking it well enough, though.

Just have the compiler autocomplete for you.

>no default argument
>no overloading
>:=
>[]type
>python and rust autism
no thanks

vlang.io/

not lispy enough for me.

>Jow Forums is not for homework questions
I know. It was worth a try for me, though.

Isn't Wolfram web based stuff?
And as far as I know, octave is a Matlab clone and designed for numerical computations instead of symbolic ones

>>:=

en.wikipedia.org/wiki/Assignment_(computer_science)#Assignment_versus_equality

Attached: 114.jpg (1920x1200, 635K)

:= is based and redpilled, just like pascal. as expected from an akari poster. don't listen to cringe and bluepilled Cniles

Wolfram Mathematica. There's a few times you can use it for free (I know the Raspberry Pi people have a license)

I was preparing for call it out but it actually seems nice desu

has it been approved by hackernews?

So it's Go with generics, Option and Result?

P.s. I thought Octave was pretty compatible with Matlab. You could see if Maxima fits, it was referenced in SICP and still seems to be kicking around.

sounds pretty good to me

This thread has some suggestions for Julia, I am considering checking it out myself: stackoverflow.com/questions/31155771/symbolic-math-in-julia

interfaces and overrides enable (certain kinds of) polymorphism, and polymorphism enables the use of old code with new objects. for example, if i make my new class comparable and reimplement the compare method, now i can use my class with a generic sort method

double findMaxAverage(vector &nums, int k)
{
double sum_cache = 0;

if (nums.size() == 0)
{
return 0;
}

if (nums.size() < k)
{
int sum = 0;
for (const int &a : nums)
{
sum += a;
}
return sum / nums.size();
}

for (int a = 0; a < k; a++)
{
sum_cache += nums[a];
}

double max_average = sum_cache;

for (int a = 1; a max_average)
{
max_average = sum_cache;
}
}

return max_average / k;
}
[\code]

whats wrong with this? i thought its pretty good consider its using cache and shit

Isn’t that just a complicated way of saying it bundles information for asynchronous operations?

looks like a big meme to me but i've been brogramming for 3 or so years so what do i know? was looking for a safe and compiled lang that i couldn't fuck up with and this came up. figured i'd ask people what they think.

Looks p cool. I'll check it out.

pretty sure you're doing an integer division in the nums.size() < k case
also what exactly do you mean when you say wrong? does it have bugs? performance problems?

the really simple monad explanation for dummies:
it's just overriding the semicolon ( ; ) operator. it defines what happens between two expressions, e.g. variable assignment, or exception handling. that's a good enough explanation for beginners, there's no need to make it more fancy than that.

performance problems, i am only faster than 30~% of leetcode solutions....
and yea, i fixed that parcticular bug you mentioned.

>it bundles information
meaningless statement
here is a really shitty definition everyone will hate
monads basically let you do this
x = a();
y = b();
z = c();
return (func x y z);

this can do a lot of things from exceptions (either trying or catching)/optional/result, async, io, state, etc
if you look at 's explanation, an important point is the = bit. in the case where you just have (a(); b();) you can just imagine """"""""""""""""""""""assigning''''''''''''''''''''''''''''''''''' a variable you don't use

Actually, that's about as good as it gets. Any more of an explanation and you're probably explaining a particular class of monads, not monads themselves.

oh this is a shitty example because that's
just applicative. so you could also have x as a parameter to b and c, or y as a parameter to c, e.g.
x = a();
y = b(x);
z = c(x, y);
return (a_regular_function(x,y,z));

>volt-app.com/
non-bloated alternatives for electron (((apps))) when?

I think you could change sum_cache and max_average to be ints, as you only do the division at the end. that could speed your code up by changing float adds to int adds. you could also try to change the last loop body to be branchless by using bitwise tricks, might be faster since the branch in the loop body may be hard to predict

>can override function operands
>can't override function return values in 99% of real langs
JUST

My Systems Programming class ended up rushing through networking stuff, so I'm trying to learn a little more on my own.
I have the server program in pic related, and it works on my machine when I use localhost in place of the cmu.edu address and open up two terminals. However, I'm not sure how one would go about running this program on the internet and connecting two or more computers. Could somebody enlighten me or give me some resources to look into?

Attached: Capture.png (1467x1089, 120K)

what do you mean "override operands" and "override return values"? you mean like type classes? i wouldn't use override to refer to OOP style polymorphism

to be fair, operand overrides and their interaction with polymorphisms have resulted in some of the worst lookup fiascos in fucking history, i am terrified of what kind of bugs might emerge from return value overrides

>computer """""" science""""""

""""computer'''''''' ````science****