/dpt/ - Daily Programming Thread

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

Attached: 1563292281569.jpg (1069x700, 161K)

Other urls found in this thread:

youtube.com/watch?v=YnWhqhNdYyk
twitter.com/NSFWRedditGif

Lisp is the most powerful programming language.

3d > 2d

Attached: 8b9698b21e6e27a3569ddacd7a46d33f4d945ad6.jpg (1080x810, 113K)

Whats the best simplest setup for a console roguelike? Windows console is complete garbage

use curses

Get some 3D with proper layout and proportions.

my mammal nature finds this most acceptable

>post most fake species to exist

at least you can you know touch them and fuck them
unlike 2d

Look at this beauty.

Attached: Platycercus_eximius_diemenensis_girl(male).jpg (2136x1424, 1.98M)

a 2D girl is probably more real than a Korean one

Should I add a ternary operator to my shitlang?

nice meme lmao

Trying to figure out a more detailed solution for a simple decentralized network to replace sadpanda.
I've been looking into using holochain for a tagging system, except they only support rust and assemblyscript.
Maybe it really will be better to just have each releaser stand up a tag server parallel to their catalogs

Suppose you have a long flowerbed in which some of the plots are planted and some are not.
However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.

Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty),
and a number n, return if n new flowers can be planted in it without violating the no-adjacent-flowers rule.

Example 1:
Input: flowerbed = [1,0,0,0,1], n = 1
Output: True

Example 2:
Input: flowerbed = [1,0,0,0,1], n = 2
Output: False


p.s.
>The input array won't violate no-adjacent-flowers rule.
>The input array size is in the range of [1, 20000].
>n is a non-negative integer which won't exceed the input array size.

Yes but you should probably focus on more interesting things.

haha thanks

Do your own homework. It's just an O(n) walk. How are you having so much trouble with this trash?

Looking for college advice.
I can go to a community college for 10k/year less than a local university. If I go to the community college I can get an associates in "Computer Networking and Cybersecurity". This would take two years. The only programming class would be Intro to Python, but I would take 10 other classes relating to servers, networking, and security.

The alternatives are going to the community college for a more broad programming associates degree, or spending about $20k and 2 years more going to a four year uni.
Thoughts on this? What would you recommend?

>being this retarded

this is daily programming thread not daily puzzle thread

see

see

you're retarded if you think posting brain teasers is a good discussion topic

community college and then uni

free your mind

this challenges have been posted in the past 10 threads or so.

don't like it? don't solve it and refrain from posting.
simple as

well since I already had the trouble of doing it, I'm gonna post it here

input = logical([1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0]);

input = padarray(input,[1 1]);

k = [1 1
1 1];

area = 0;
while sum(input(:))>0
area = area + 1;
input = imerode(input, k);
end

output = area^2;

Don't like it? Complain about it autistically.

xor rax, rax
leave

Attached: 1536681515850.jpg (640x480, 211K)

keep being booty bothered

I like the challenges. Fuck the autists.

Yeah and I've refrained from posting for the past 10 threads, now I'm telling you to fuck off and stop posting non-programming related topics in the programming thread

His posts are programming related, you stupid nigger. Remove yourself from the gene pool.

What should I do?

Attached: hello.jpg (979x1260, 885K)

Discovery phase of a web application for an aerospace company I used to work for. I'm a sophomore in college, 1 more semester til a junior.

I'm not really sure what I'm going to do since all I've ever done is C++ school work with some assembly, and the data structures course. I feel like it might be too ambitious to make a giant web app but hey. Worth a try. I have a company who wants to check it out when it's done so that's cool.

But so far I know I have to figure out how to Port stuff and make the front communicate with the back and shit. Kinda wish I had a mentor to guide me through whenever I get stuck.

Puzzles aren't programming related, they'd be more at home in the stupid questions thread

About as programming related as computer science has anything to do with computers or science.
Go fuck yourself.

I should be programming but instead I decided to glance at HN...
what kinda crack are these people smoking?
>C++ is ugly but not C, asm, or Rust

Attached: ugly.png (1557x909, 60K)

catch it and make it your pet

Attached: 1511224431532[1].jpg (4032x3024, 2.94M)

hacker news is the bluecheckmark twitter of programming

programmers in high positions who are pretentious but really know dick about shit

They are all ugly.

They're all ugly. Python and Pascal are pretty but those are the only pretty ones off the top of my head.

flowerbed = logical([1,0,0,0,1]);
n = 1;

output = sum(1-imfilter(flowerbed,[1 1 1],0)) >= n;

I'm getting burnt out with this programming book, too much left to go through. What do

Oh and ML.

which book

SICP.

write code
take a break

>There are people who care about how a program's source code looks

Attached: 1441923416377.gif (355x360, 1.82M)

not everyone is an unemployed guy who works only in his own toy projects, terry

What would be ugly about C?
C++ has all these very strange & deep nestings which look awful.
C is not the prettiest language but it doesn't look that cluttered.
// A sample standard C++20 program that prints
// the first N Pythagorean triples.
#include
#include
#include // New header!

using namespace std;
template
struct maybe_view : view_interface {
maybe_view() = default;
maybe_view(T t) : data_(std::move(t)) {
}
T const *begin() const noexcept {
return data_ ? &*data_ : nullptr;
}
T const *end() const noexcept {
return data_ ? &*data_ + 1 : nullptr;
}
private:
optional data_{};
};

inline constexpr auto for_each =
[](R&& r, Fun fun)
requires Range {
return std::forward(r)
| view::transform(std::move(fun))
| view::join;
};
inline constexpr auto yield_if =
[](bool b, T x) {
return b ? maybe_view{std::move(x)}
: maybe_view{};
};

int main() {
using view::iota;
auto triples =
for_each(iota(1), [](int z) {
return for_each(iota(1, z+1), [=](int x) {
return for_each(iota(x, z+1), [=](int y) {
return yield_if(x*x + y*y == z*z,
make_tuple(x, y, z));
});
});
});

// Display the first 10 triples
for(auto triple : triples | view::take(10)) {
cout

do people use all these new shiny features of sepples or is there a huge burden of knowledge to not be guaranteed to fuck it up? my only experience of C++ was like writing C but with classes.

yes and also add the disgusting pipe operator that hack has

$thing = getThing() |> $$ ? transform($$) : null;

>do people use all these new shiny features of sepples
no they just shitpost about how amazing they are

I don't think this is right.

Attached: Screenshot from 2019-07-26 21-04-30.png (478x251, 17K)

>do people use all these new shiny features of sepples
No. It varies a lot how people use C++. And that's naturally a big problem. Looking at most codebases I'm coming in contact with they're very restrained.

What does it do?

her ass must taste like heaven

well it isn't, but it passed the unit test so it is fine

do kpop girls have to serve in the south gookistani American foreign legion?

her ass must taste like plastic factory solvent

why are shitters so afraid of new and delete ?

don't care, as long as i'm able to stick my tongue up it.

because of people like you who think you can use it properly but actually can't and then you shit the entire codebase with dangling dynamic memory

what is a shitter

a python programmer

just do it to your samsung tv, it will feel exactly the same

why are python programmers afraid of new and delete?

they are afraid of many things, specifically the void.
they are children and children have many irrational fears.

A c programmer

It's c programmers who always say not to use void*

Evaluates to falsehood.

i'm back
wasn't nearly as satisfying as you made it seem

which language does arrays/lists/vectors/etc. best?

c++

library features? meh
core language features? yes those are usually useful although a few are niche e.g. structured bindings

C

Elixir

fold expressions are amazing

Attached: es6px7h02g531.png (550x514, 461K)

it's actually easier to understand, IMO.
just declare everything as values, use reference parameters, use RAII, use STL functionality, templates for polymophism/generics/codegen, and everything is super easy. No need to learn about pointers, no need to ever touch new/delete, no need to worry about lifetimes or reference cylces or memory management or anything.

modern C++ is both easier mentally and programmatically.

Unironically Python

user post a mildly hard problem (like Medium in LeetCode) and include anime girls please!

So, I've been studying blockchains for the past couple of days and want to implement them in some fun project but I just don't have a clue on what to build with them. Any neat shit I can rip-off for fun?

if you can learn on your own, i dont think uni will do you any good
i went to uni and didn't learn as much, i could have read all this fucking thing from the book
whats more important is to have working experience, dont matter if its carrying boxes, if you can have 1 talk with a manager/boss or whatever fuck handling a software company, youll get hired
just show enthusiasm

and it can improve performance wise by a long shot thanks to compile time expressions

90% sure I got all of the cases.

from itertools import groupby

def runs(l):
return [(k, len(list(g))) for k, g in groupby(l)]

def flowers(flowerbed, n):
rs = runs(flowerbed)

if len(rs) is 1:
return rs[0][0] is 0 and (rs[0][1] + 1) // 2 >= n

if rs[0][0] is 0:
n -= rs[0][1] // 2
rs = rs[1:]

if rs[-1][0] is 0:
n -= rs[-1][1] // 2
rs = rs[:-1]

return n

>circumvent the absolutely awful guarantees of typeid by implementing constexpr sha1 and then taking a hash of the commonalities between compilers of the pretty_function string to get your cstring of your struct's name, hashing that and having its digest all at compile time (acting as a substitute for shitty typeid) consistent across all useful* compilers.

youtube.com/watch?v=YnWhqhNdYyk
teaching C and C++ as if they are the same is a mistake
C++ is practically a new language, its entirely possible to program in C++ not know C exist
using STL algorithms, TMP and the rest can make for an easy life
best thing is you can always break the warranty and tweak shit yourself whenever necessary
see Sean Parent's talk and watch in amazement how good C++ code is easier to parse while performing as if you write everything by hand

C++ programmers worship complexity. They build temples in its name and call it יהוה.

>and it can improve performance wise by a long shot thanks to compile time expressions
Imagine being so bad at programming you actually think this

made a fizzbuzz in common lisp using with-c-syntax:
(ql:quickload 'with-c-syntax)
(named-readtables:in-readtable with-c-syntax:with-c-syntax-readtable)

#{
int i;
for (i = 1; i

jew, please. I don't understand your mind control runes.

>יהוה
blasphemer

I literally gave an example. It takes a value and shovels it into a special variable called $$ that you can use to test in a ternary or do other stuff with

>just declare everything as values, use reference parameters, use RAII, use STL functionality, templates for polymophism/generics/codegen
>easy to understand
>pointers, new/delete, memory management
>hard to understand
This is your brain on sepples.

Attached: cat++.png (200x209, 34K)

ideas for part time gigs to make money while a full time student? do part time programming gigs exist? i could def use $20 / hour to git-gud-@ programming while in uni. freelancing just seems so unreliable

What does cat# look like?

find a local shop, see if they have websites, talk to them and say i can make it better for 100 bucks