/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1554885458322.jpg (595x570, 76K)

Other urls found in this thread:

pipenv.readthedocs.io/en/latest/
github.com/dewanai/ranodm-crap
youtube.com/watch?v=2V1FtfBDsLU
twitter.com/NSFWRedditVideo

Reminder to learn Haskell and make use of optics, profunctors, applicatives and all the other jargon

>What are you working on, Jow Forums?
Chasing a long standing bug.

reminder to produce examples of jargon and how they compare against the standard method of working in imperative languages

Come on, user.
You told me we'd be working on your JavaScript project together!

Attached: 81b19fdd12aee690a7282cacb9ea4d75.jpg (736x981, 92K)

reading the racket docs and eating a grilled cheese sandwich
truely the best combination

Still waiting for Jai.

The virgin coding a debugger
vs.
The THAD Computercraft coding to automate your potato farm

it's a long story. which languages are you familiar with?
a functor in Haskell is a type constructor (like a template for a type) F along with a function fmap that lets you lift a function (A -> B) into a function (F A -> F B)
(read -> as "to", i.e. a function A to B. F A can be read as F)
for example, mapping an array
// (A to B, A[N]) to B[N]
std::array map(std::function, std::array);

how the fuck do you make sure javascript objects aren't undefined when networking, especially with nodejs? This is retarded.

I want to cuddle akari

imagine learning entirely new terminology for things you already know for absolutely no reason

I want you to die, disgusting pedo degenerate.

I want to marry akari

excuse me but this thread is lacking lolis
there we go

Attached: 1554560776591.png (1341x756, 1.38M)

do owls count as lolis?

Attached: 1548144663908.png (712x1150, 612K)

that's just the beginning user.
so you also have contravariant functors in which the order is reversed, i.e. (B to A) to (F to F). For example, the argument of a function. A profunctor has a contravariant argument and a covariant argument (e.g. a function is a profunctor).
(Note unlike OOP variance isn't just about subtyping, e.g. converting a thing into a string isn't "casting to a supertype" but it is something you can "lift" over a covariant functor.)
Applicatives are functors that you can distribute over a tuple, i.e.
(F, F, F, F, ...) to F
You also have () to F, where () is an empty tuple or an empty struct.
An imperative procedure is an example of an applicative functor. You can map the result, and if you have several procedures returning results, you can make a procedure that returns a tuple of the results (either sequentially or in parallel).

TypeScript keeps disappointing me.
abstract class A {
abstract method(x: number, y: number): void;
}

class B implements A {
method() {} // Why is this allowed
method(x: number) {} // Why is this allowed
method(): string { return "foo" } // Why is this allowed
}

Can the whole type system be even more useless at this point?

Neck yourselves you scum

neck website

Attached: 1537387168004.png (827x1140, 740K)

Everyone should just write in portable assembly.

Attached: 1558272555029.jpg (619x720, 31K)

nigger

Why has this girl been posted so many times on Jow Forums(nel)?

Behold, Python:
class MyClass:
def A(self, x):
return x + 1

def B(self, x):
return self.A(x + 1)

C = MyClass()
C.A = lambda x : x + 10
print(C.B(5))


It prints 16, by the way.

>girl

which one

Loli website

Attached: 1559050234891.png (1416x2000, 2.03M)

in my experience furries are better programmers than anime girls

>smug
>elitist
>no make up
>not even trying with clothes
She's a chantard alright

>She

delicious

Well, other than using PascalCase for your methods, you did nothing illegal.

so what's the proper way of organizing a python project??
is there something similar to npm in python world? i know about pip and venv. Do i have to use these both tools manually or is there any other good shit?

the latest thing is pipenv.readthedocs.io/en/latest/

Attached: 1535494934935.jpg (601x800, 49K)

thanks user will look into it

Anyone knows networking shit here?
Supposed to connect router isp and br2 together too but the routers only have 2 serial ports lmao so I cant!

Attached: 2019-05-28 18_15_13-NAM_Project - GNS3.png (1037x393, 44K)

>>>/netg/
>>>/sqt/
>>>/hsg/

Just use a switch

so this is the power of a newfag

>programming thread
>asks about networking
kys

nigger

@71158716
t. newfag

Attached: 1549433842740.png (850x1268, 950K)

i was talking about your inability to link to a catalog search

Attached: file.png (1294x478, 139K)

and he clearly wasn't trying to
want us to hold your hand while you go to the other thread, too?

...

Where would API token caches be stored?

abstraction
noun
the quality of impeding understanding

t. suckless sucker

Attached: 1532176955907.png (1834x1200, 639K)

``muh abstract factory''

database

Is Ada still used in critical systems like finance, military, etc?

I've been learning this over the last year and I'm really enjoying it. It's so strongly typed and declarative, definitely more than what I'm used to with C++/C, Java, Python. I wonder the applicability of Ada in terms of finding employment, though.

Sometimes I feel like they didn’t want me to understand what is happening.
// Internal changes to user-defined function handling
GenericScalarFunctionInstance fn0(Function[0], Thread);

GenericScalarFunctionInstance fn1(Function[1], Thread);

GenericScalarFunctionInstance fn2(Function[2], Thread);

which is pretty much impossible because this was written years before I looked at it.

nah dude C++ is used now, perfect for causing infinite project delays so you can keep billing the government billions of dollarydoos

in memory

Gripen fighter jets supposedly run Ada code.

What?

Needs more characters.

ada has the highest kill count of all programming languages

I'm brushing up my C skills with "The C Programming Language" and "Expert C Programming" in order to write a 2D brawler in SDL. Any book suggestions regarding software design/patterns in C are welcome.

Attached: comfy guy inside.png (362x362, 40K)

def cipher(n):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
code = {}
counter = 1
for i in alphabet:
code[counter] = i
counter += 1
check = True
for i in code:
if n in code[i]:
if n == 'z':
return 'a'
else:
return code[i + 1]
return n

def scramble(n):
sentence = ''
for i in n:
if i == i.upper():
x = cipher(i.lower())
sentence += x.upper()
else:
sentence += cipher(i)
return sentence


solving challenges still working through the easy ones. might try a medium difficulty one soon. maybe soon may build like a networking client or something kinda cool but i feel like that is advanced and requires tons of googling.

Not anymore in the USA, the Department of Defense wants C++ now. Northrop found out that using C++ coupled to a static analyzer gave better results than using Ada.

you're using python, it's literally just import solution

Interesting. I think Ada is now my favorite language, but I am definitely the strongest with C++.

Are there any good and cheapish universities to study Masters in Europe?
I finish my CS degree soon

the gang of five and their silly ideas have been a disaster for the programmer race

What is the difference between a scripting language and a programming language?

you can go to a lot* of european universities for free even if you're foreign

*entirely unquantified and unsubstantiated

eh, most programmers use GoF patterns all the time and they often don't even realize it
they're pretty useful
brainlets that religiously preach them and demand to artificially put patterns everywhere because "it's good practice" are cancer and should be hanged though

well i'm not talking about the 0.3% of design patterns that naturally arise out of good design

it's more than that because there is a named "design pattern" for basically every piece of code you think of
initializing a multi field data structure is something that has been done to hell for some reason, there are like 1000 different "factory" patterns for this basic task and your options are:
- delegate it to constructor
- delegate it to a static method
- delegate it to another class
- delegate it to another class, but fancier

your options are pretty much exhausted at this point since this is such a basic task

Do you not have a job?

>just finished my BSc in compsci
>upload all my work to Github

Here's my code breakdown by number of files. It's not really indicative of anything but I thought it was interesting.

>Java, 76 files
>C++, 73 files
>Python, 51 files
>C, 48 files
>Ada, 31 files
>PHP, 30 files
>LUA, 18 files
>Modula-3, 8 files
>ASM, 7 files
>CSS, 7 files
>HTML, 5 files
>Javascript, 5 files
>Shell, 2 files

Attached: bhxo4ivza6x21.jpg (663x579, 39K)

Because everything is a fucking function in JS, and there nothing to do but to be tidy with your code.
Self calling functions are fun and useful. Stop whining.

wat do you mean im new to programming. right now ive been doing challenges i havent tried building anyting yet.

why even bother having types at this point

post ada code

I'm trying to match greentext. So far I have: (^|[^>])(>[^>\s]+[^>\n]*). It successfully terminates greentext on a post link, but it also does so when a single > appears. How do I make it match only two in a row?

No, I mean like during the day, are you in school or do you work? Or do you sit at home doing challenges?

>no C#

grim

also, what's modula-3 doing there?

Spot on. Happens that your shitty console programs do not really need a complex multi-factory pattern just to present a fucking alert message.
Over-engineering stuff is probably the most annoying thing about amateur programmers.

what exactly is wrong with this?
if you treat function as a field in a data structure it makes perfect sense.

and that's a good thing

-- Subsetsum Problem implementation in Ada
-- the SSS problem aims to determine if any subset
-- of a set of numbers can sum to a specified number
-- for example, the set {2, 8, 4} and sum {3}
-- are incompatible: there is no combination of
-- set elements that will equal 3. But consider 10:
-- 2 + 8 = 10, so there is a subset sum. Likewise 14:
-- 2 + 8 + 4 = 14. Et cetera

-- $ gnatmake subset_sum.adb -o sss
-- $ ./sss
-- is the sum to find
-- is a space delimited list of five integers

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_line; use Ada.Command_Line;

procedure Subset_Sum is
-- a set of numbers to find subset sum on
type Set is array(0..4) of Integer;
Arr : Set;

function Find_Subset (Arr : in Set; S, N : in Integer) return Boolean is
begin
if S = 0 then
return True;
elsif N = 0 then
return False;
end if;
if (Arr(N-1)) > S then
return Find_Subset(Arr, S, N-1);
end if;
return Find_Subset(Arr, S, N-1)
or else Find_Subset(Arr, S-Arr(N-1), N-1);
end Find_Subset;

function Verify_Args return Boolean is
begin
if Argument_Count /= 6 then
return False;
end if;
return True;
end Verify_Args;

begin
if Verify_Args then
Put("{");
for i in 0..4 loop
Arr(i) := Integer'value(Argument(i+2));
Put(Integer'Image(Arr(i)));
if i /= 4 then
Put(", ");
end if;
end loop;
Put("} ");
if Find_Subset(Arr, Integer'Value(Argument(1)), Arr'Length) = False then
Put("does not contain subset sum " & Argument(1));
else
Put("contains subset sum " & Argument(1));
end if;
end if;
end Subset_Sum;

>there is a named "design pattern" for basically every piece of code you think of
initializing a multi field data structure is something that has been done to hell for some reason
Surely initializing the members of a structure can only be done one way. At some point an assignment has to be made no matter how many layers of functions/classes deep it is.

Attached: 1554778932900.jpg (500x726, 52K)

neet but i have a few mental disorders so working is hard many included i have more then anyone i met which include fetal alcohol borderline personality autism sensory processing disorder anxiety depression tons of them.

starting new hobby like linux and programming is fun learning more each day about linux through the man pages.

[spoiler]I ported Gorilla.bas to Modula for extra credit once.[/spoiler]

>At some point an assignment has to be made
this triggers the OOPsies and the webshits

Gotcha, well good luck user - I hope programming brings you happiness and a sense of accomplishment

Do people benchmark compilers? I've been using a binary that was built around 200X, simply rebuilding it today (without changing any flags) had a perceptible speedup. I'm wondering if someone has compiled data on this. Comparing things like optimization improvements (shorter runtimes, lower memory usage, smaller binaries, etc.) across versions or competing compilers.

I mainly just want to see and appreciate the work that's been done.

Attached: 51FWXX9KWVL._SX384_BO1,204,203,200_.jpg (386x499, 45K)

>no ML-lang
>no lisp
embarrassing

the people writing them do, presumably. e.g. if you look at the GHC gitlab you can find issues about performance regressions

Hello, I am working on a random generator of latex nonsense math. See and . It's still at baby stage, and it's mainly for the lulz, but if you have ideas on how to improve it I'll be happy.
github.com/dewanai/ranodm-crap

It works by creating first a template, starting with a list of empty bracket pairs '{}', and progressively involving it, for example by turning L[i] into L[i]^{L[i-1]}. Then it turns the list into a string, and fills the blanks with simbols randomly extracted from a dict.

(You have to go to the actual posts at /sci/ if you want to see the result)

>Variable used in lambda expression should be final or effectively final
Explain this you curry niggers

>CSS, 7 files
>HTML, 5 files
???

It was a web development course?

types are a meme, pure functions and controlled effects are not:
youtube.com/watch?v=2V1FtfBDsLU

Java lambdas are just syntax sugar for anonymous classes. Captured local variables are copied into the newly created object rather than being directly referred to on the stack. To prevent you getting the idea that you are mutating those variables on the stack, Java prevents you from mutating them at all. If you want to mutate them, add a single indirection.