/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1543143971112.png (500x492, 350K)

Other urls found in this thread:

0x0.st/zOSe.txt
0x0.st/zOSp.txt
nuitka.net/doc/user-manual.html
youtube.com/watch?v=D7Sd8A6_fYU
0x0.st/zOS4.txt
pythonclock.org/
python3statement.org/
twitter.com/SFWRedditVideos

sensitivity conjecture

{-# LANGUAGE LambdaCase #-}
import Data.Function

foo = foldl f []
where
f a = \case '#' -> drop 1 a; n -> n:a
ans = (==) `on` foo

i was banned

nth for haskell tiddy monsters

Attached: 1549294056742.png (850x1200, 938K)

vkCreateInstance(&(VkInstanceCreateInfo) {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = &(VkApplicationInfo) {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pApplicationName = "vkcube",
.apiVersion = VK_MAKE_VERSION(1, 0, 2),
},
.enabledExtensionCount = extension ? 2 : 0,
.ppEnabledExtensionNames = (const char *[2]) {
VK_KHR_SURFACE_EXTENSION_NAME,
extension,
},
},
NULL,
&instance);

>reverse lookup

Attached: 1564923769904.jpg (1500x1500, 170K)

Cute laptop!

Can your langauge beat me?
function Is_Reserved_Char (ch : Character) return Boolean is
begin
case ch is
when ';' | '/' | ':' | '@' | '&' | '=' | '+' | '$' | ',' =>
return True;
when Others =>
return False;
end case;
end Is_Reserved_Char;


1 _ada_is_reserved_char:
2 lea ecx, [rdi-36] # _4,
3 xor eax, eax #
4 cmp cl, 28 # _4,
5 ja .L1 #,
6 mov eax, 1 # tmp97,
7 sal rax, cl # tmp96, _4
8 test eax, 314575237 # tmp96,
9 setne al #,
10 .L1:
11 ret

First for erlang

Attached: 1563187092321.jpg (992x1403, 198K)

You can have designated initializers in a function call?

Attached: 1494853390612.png (2015x2204, 704K)

You can do it, user! You can learn JavaScript!

Attached: c1c40feb1c8a7f46ef6d9583228fe6be.jpg (1000x1500, 180K)

bonkers innit

yes

auto isReservedChar(const char c) -> bool {
switch (c) {
case ';':
case '/':
case ':':
case '@':
case '&':
case '=':
case '+':
case '$':
case ',':
return true;
default:
return false;
}
}


isReservedChar(char):
add edi, -36
cmp edi, 28
ja .LBB0_2
mov eax, 314575237
mov ecx, edi
shr eax, cl
and al, 1
ret
.LBB0_2:
xor eax, eax
ret

It's pretty cool but requires due deference and wisdom to not be abused.

What flags

Was that with GCC? Kind of amazed if so that it didn't generate the exact same instructions.

Why does sepples look so alien now?

>What flags
-O3
>Was that with GCC
No, I used Clang 8.0.0

That example looks pretty nice tbqh

auto is potentially gay, however.

>Clang
Yep. GCC makes some weird looking shit for it. How have they fallen so far behind?

yeah I got you
def is_reserved(s: str) -> bool:
return s in [';', '/', ':', '@' '&', '=', '+', '$', ',']

0x0.st/zOSe.txt

>0x0.st/zOSe.txt
Python doesn't produce assembly. Where is this coming from?

It's because verbose asm is on
lolwat

>>> import dis
>>>
>>> dis.dis(lambda s: s in [';', '/', ':', '@' '&', '=', '+', '$', ','])
0 LOAD_FAST 0 (s)
2 LOAD_CONST 9 ((';', '/', ':', '@&', '=', '+', '$', ','))
4 COMPARE_OP 6 (in)
6 RETURN_VALUE

how do I transform the entire embedded industry into using C++?

In other words you get something like
y(x) = x^2 + x + 1 > 0


Mathematics can (in many cases) be reduced to manipulating symbolic constructs, i.e. a symbolic activity (literally). You convince yourself that the above inequality holds because Trump is president. Through symbolic manipulation you may check the truth of your argument:
A. Trump is President.
B.
y(x) = x^2 + x + 1 = (ax + b)^2 + c
= a^2x^2 + 2abx + b^2 + c
(fundamental theorem of algebra) =>
a^2 = 1
2ab = 1
b^2 + c = 1
=>
c = 3/4
a = +-1
b = +-1/2
y(x)_+ = (x + 1/2)^2 + 3/4 = x^2 + x + 1/4 + 3/4 = x^2 + x + 1 = y(x)
y(x)_- = (-x -1/2)^2 + 3/4 = (-1)^2(x + 1/2)^2 + 3/4 = y(x)_+
Q.E.D y(x) > 0 for all x and Trump is president

std::transform

archiving youtube with stolen modules and libs
for l in locate_videos:
print l.text
os.system("youtube-dl " + l.text)
driver.close()

Attached: 1564675346250.jpg (1024x595, 69K)

>python 2

practicing for python MTA exam tomorrow.
any tips are welcome.

Attached: NEOBK-2364645.jpg (346x500, 45K)

>t. neet
embedded industry is using sepples whenever they can
sepplers are much cheaper to hire than chads

0x0.st/zOSp.txt
bython :DDD -> C -> asm
nuitka.net/doc/user-manual.html
this is with
$ nuitka --standalone --lto

everybody already uses C++ in every industry, user

>t. neet
not a neet but I don't work in embedded and want to get in.
Everywhere you look people keep saying it's only C. Don't necessarily have a problem with it but I barely see any mentioned of sepples

Looks fine to me. Clang generates the code as-is where GCC gets clever and makes a jump table.

Attached: what.png (1920x921, 122K)

youtube.com/watch?v=D7Sd8A6_fYU
You stop trying. If you have to argue you already lost.

How do you keep your divs in check? Every time I need to change something I have to add another div and find where the hell it's gonna close

>Clang doesn't get clever
Clang has always been three years behind GCC. Thats the power of GNU

learn Lambda do alot LAMBADA

>What is Python?
>Describe some features of Python.
>How does Python execute code?
>What are some built-in types in Python?
>What are bindings, i.e., what does it mean for a value to be bound to a variable?
>How do you create a list?
>How do you create a dictionary?
>What is a list comprehension? Why would you use one?
>What is a generator? What can it be used for?
>What is inheritance?
>What happens if you have an error in an init statement?
>What happens in python if you try to divide by zero?
>How can you return multiple values from a function/method?
>What's the fastest way to swap the values bound to two variables?
>What is the importance of reference counting?
>Do functions (or methods) return something even if there isn't a return statement? If so, what do they return?
>How do you reverse a list? Can you come up with at least three ways?
>How would you merge two sorted lists? They can be any length, or empty.
>How would you count the lines in a file? How would you do it if the file was too big to hold in memory?

That looks like a cool book.

on GCC GNAT 8.2 I get for Ada
on the GCC GNAT latest from truck i get your jump table like C++
neat

they're retards, i'm in auto and 80% is sepples
you still need to know c to get hired

well that's pretty cool then
what kind of other tools do you use for work if I may ask

What up to date book could Jow Forums recommend to learn oop in c++?
I'm hoping to learn so what words like virtual, this, copy move operators and assignments, default or syntax like ec(const string& ss) : s{ss} {} don't look alien to me.

yes i love python2.7 more than 3.x syntax

get a book on sepples, not oop

#include
int isReservedChar(int c) {
return strchr(";/:@&=+$,", c) != NULL;
}


.LC0:
.string ";/:@&=+$,"

isReservedChar:
sub rsp, 8
mov esi, edi
mov edi, OFFSET FLAT:.LC0
call strchr
test rax, rax
setne al
add rsp, 8 movzx eax, al
ret

Please switch to Python 3.

>call strchr
Hmm...

int main()
{
Rectangle myRectangle, *x, *y;
x = new myRectangle;
y = new myRectangle;
Rectangle *rectPtr = nullptr;
rectPtr = &myRectangle;

std::cout > x;
rectPtr->setWidth(x);
std::cout > y;
rectPtr->setLength(y);

std::cout

i want to nakadashi yuki

all i can find are just books who say what certain language features do.
I want something what would also explain in what cases these features are best used and how.

why?

coverity, klockwork, cpptest, polyspace and lots of SSRIs

what snytax

now also include the assembly of the function you're calling :^)

Read this.

Attached: 200_.jpg (394x499, 26K)

here's
$ crystal build --release

0x0.st/zOS4.txt
$ crystal --version
Crystal 0.30.0 (2019-08-05)

LLVM: 8.0.1
Default target: x86_64-pc-linux-gnu

def is_reserved(s)
s in [';', '/', ':', '@', '&', '=', '+', '$', ',']
end

pythonclock.org/
python3statement.org/

>programming book
>random wildlife photo or illustration
>scandinavian author name
How did this culture develop?

Attached: 1564922803255.jpg (1015x1042, 182K)

Hey guys I completed the tribute page (the first project)
Look at how sleek it is! You know how long this took me? 3 HOURS
Be honest with me here, am I a ngmi?

Attached: 2019-08-05 16_12_36-Fork Me! FCC_ Test Suite Template.png (1342x781, 207K)

If you wrote the whole thing by yourself it's not that terrible time for a beginner
Could use some colour fading though

It's interesting how O'Reilly stick to animals, Manning stick to drawings of people in period clothes and almost no programming books have computers on their covers

/agdg/ is having a very heated argument about fixed timesteps vs variable timesteps, please opine

is_reserved c = elem c ";/:@&=+$,"

Two days and still you got it wrong.
assert (ans "axx##b" "ayy##b")

Because you can't read the real ones in public.

Attached: this.witnessed.jpg (600x315, 48K)

>what snytax
the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.
>If the code you care about is still on Python 2, >that's totally understandable. Most of PyPI's >popular packages now work on Python 2 and 3, >and more are being added every day.

why?

fuck off back to when they have a heated argument about the blue waters topo, then come back

agdg is from /vg/ not /v/

nigger i was asking what syntax differences are there that put you off

the
print()

bullshit
operators and methods are not the same
FUCK THAT!

lol

Code monkey.

A time step is dependent on local computing conditions, i.e. speed and load, so it should always take into account a delta and therefore be variable.

yeah, i'm bad at faggot lore, go to whatever shithole you came from, you /v/ shitters ruined this board with consumerism bullshit

But a unary print operator is kind of retarded

>What are you working on Jow Forums?
Bought a new graphics card so I could hop on this vulkan fad. Just got my linux partition to finally boot with video. Kernel needed amdgpu.dc=0

#include

int is_reserved (char);

int
main (void)
{
char c = getchar();
return is_reserved( c );
}

int
is_reserved (char c)
{
if ( (c == '@') || (c == '&') || ( c == ',') || ((c | 0x10) == 0x3D) || ((c | 0x02) == 0x2F) || ((c | 0x01) == 0x39) || ((c | 0x10) == 0x1B) ) {
return 1;
} else {
return 0;
}
}
/

is_reserved:
leal -38(%rdi), %edx
cmpb $26, %dl
ja .L2
movl $67108929, %ecx
movl $1, %eax
btq %rdx, %rcx
jnc .L2

>unary
>Code monkey.
thats right tards coding is not even my job.
i just do it for fun

Attached: 1539769009647s.jpg (225x225, 8K)

Hmm
movl %edi, %edx
movl $1, %eax
orl $16, %edx
cmpb $61, %dl
je .L1
movl %edi, %ecx
orl $2, %ecx
cmpb $47, %cl
je .L1
orl $1, %edi
cmpb $57, %dil
sete %al
cmpb $27, %dl
sete %dl
orl %edx, %eax
movzbl %al, %eax


That don't count does it

can you post the struct?

why this?
std::cin >> x;

and btw you can use this:
using namespace std;

it will save you the hassle of typing std::

what do my fellow programming-socks wearers use to collaborate with other programming-socks wearers?
is slack the best thing for this?

Characters are not numbers. You want atoi or whatever it is in sepples (string to int)

rocket chat

Works on my machine.

Attached: clip.webm (1280x720, 1.38M)

What a disaster of a webm.

whats happen next?

>Collaborate
I just fight them in the parking lot to assert dominance.

Okay, I think I just figured it out, but thanks for the (you)'s.

int main()
{
double num, areaOfRect;
Rectangle *rectPtr = nullptr;
rectPtr = new Rectangle;

std::cout > num;
rectPtr->setWidth(num);

std::cout > num;
rectPtr->setLength(num);

areaOfRect = rectPtr->getArea();

std::cout

Bjarne's book and Scott meyer's essentials series for general C++ best practices, there's no book for best OOP practices in C++ because C++ is multiparadigm and restricting yourself to OOP is stupid.
>virtual
Tells the compiler to generate a lookup table for the function, instead of just generating the function. Allows you to override it in inheriting classes/structs.
Used to provide dynamic interfaces.
Abstract base classes, which a classes/structs with a virtual function declared like this,
virtual return_value func_name(params)=0;
can never be created directly, you can only get a pointer/reference to them from some inheriting class/struct which must override all abstract virtual functions or it too is an abstract class/struct.
>this
Pointer to the current object, basically useless except in cases of ambiguity, when you're using the curiously reocurring template pattern for static interfaces/polymorphism, or type punning shenanigans.
>copy/move constructors/assignment operators
Sometimes something cannot be copied normally (like if it's got non-owning pointers in it)
Sometimes something cannot be moved normally.
Sometimes you might not want something to be copied, but moving it is okay.
Defining, and deleting copy/move constructors/assignment operators allows you to control this behavior.
But define or delete one, and you have to do them all. See the rule of three/five/zero.
Which leads to
>default
This lets you tell the compiler to generate what it would normally do for a defaultable thing when it cannot do that.
Which saves a lot of typing in the long run.
>ec(const string& ss) : s{ss} {}
Allows you to initialize members before the body of the constructor.
If you can, always do this.

?

Attached: file.png (410x144, 10K)

wow thx a ton!

What's the point of Rust? Like
>writing in Rust
>need a 3rd party lib
>it's in C
>tfw unsafe
So?

Their plan is to rewrite everything in rust. To them this is not a bane but a boon, now they have a reason to spread their aids language everywhere it can be shoehorned

I honestly think the ever-looming unsafe is going to eat away at the Rust community.

cellular automata guy from a few threads ago
I've been working on land generation algs based on CA, but recently switched to convolution filters to achieve the same effect but much faster. I will probably add some CA into this simulation to give a more natural look, and might even write a subroutine to generate fauna.

Attached: landdemo0001-0690 (2).webm (400x400, 1.72M)

forgot to mention I also added waves (which you can see in effect in simulation 2) which erode the beaches

In golfing terms, yes.
r=(c)=>c.test('/^[;/:@&=+$,]$/);

Is there the official /dpt/ languages tier list? What positions are taken by the following languages: Python, C#, Golang, TypeScript, JavaScript? What languages are God tier and what are shit tier? Is there below shit tier languages?