/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: oop_2019.png (623x626, 278K)

Other urls found in this thread:

matt.might.net/articles/quick-quickcheck/
pronoun.is/vi/vim/vim
twitter.com/AnonBabble

First for Python

I write a lot of Vulkan-accelerated projects so I'm finally sitting down and writing a little abstraction library for my needs to make some common tasks simpler

Attached: nasa.webm (360x696, 137K)

What elements of functional programming can be integrated into procedural programming with minimal overhead?

savage


I need you guys to help me maintain this list.

Meme languages:
>guile
>purescript
>f#
>f*
>apl
>ats
>J
>shen

Meme languages you should learn:
>rust
>go
>swift
>kotlin
>julia
>haskell
>nim!
>crystal
>zig
>forth
>brainfuck
>idris
>elixir
>ml
>racket
>prolog
>scheme
>cl

Real languages:
>Ruby
>Python
>Java
>C
>C#
>C++
>Scala
>R
>Perl
>MUMPS
>Malbolge
>Fortran
>Ocaml

Other:
>Lisp

PAJEETBNIG PIECE OF SHIT LANGUAGE:
>D

tiddies

Attached: 1513566397294.jpg (778x512, 45K)

dumb frogposter

Attached: 1550430963396.jpg (800x534, 66K)

6502 assembler.. working on audio+drivers. it's kinda nice. I love working with that language. simple to understand, but counting precious clock cycles gets tedious. making sure your routines take the least amount of clock cycles to execute can be challenging, depending on the complexity of the routines.

Hey anyone have experience with vala to create gtk applications?

JavaScript rocks!

Attached: js-rocks.png (1000x494, 368K)

>What are you working on, Jow Forums?
enterprise stuff that NEETs such as yourself can't understand.
interesting links: indeed.com, nareshit.com

Attached: poo.jpg (1577x708, 253K)

ok this is epic

typeclasses, closures, ranges, type inference, property-based testing, etc

In Java (I know, I know) is there a way to write something like this:

public class Shape{
public static virtual Shape factory(String s, //params);
}

public class Circle extends Shape {
@Override
//If factory is called with s = "Circle", run this, return a new Circle object
}

public class Square extends Shape {
// if factory is called with s = "Square", run this, return a new Square object
}

I really just want to get rid of the bloated switch blocks

>property-based testing
not familiar with this

>static virtual
what


anyway you could use a Map[/code]

good type systems
higher order programming

Working on a "simple" travel agency software. Would have finished it months ago if I stopped wasting time on the internet and playing games.

that should be supplier not producer

while i'm here,

if i was designing an API where you have to tell the program "what gpus do you want to use"(in the case that you have intel integrated and nvidia gpu(s) and and amd gpu(s)). how would you want the API to be designed around letting you select which combination of devices to use(allowing for multiple-GPUs to be used)?

1:
>Pass in a function pointer "filter" function that gets passed a std::vector of devices, and you return another std::vector of devices that you want to use

2:
>just expose a "getDevices" function that returns a std::vector of devices and let the user handle the filtering/selection itself and then passing this vector of devices you want into the api's initialization configuration

3:
>give the API some criteria hints (vendor, cuda core count, compute queue, etc) in its initialization configuration and let the API backend decide, eventually adding more and more criteria hints in later versions

what are some good examples of well-designed APIs so i know how to formulate mines?

Attached: 1499222403660.webm (800x450, 2.76M)

matt.might.net/articles/quick-quickcheck/

>functional programming
>testing
Yare yare...

Nare Shit??? Thats a weird name for that website

Thanks

>not an anime OP
ONE JOB

Does anyone take notes as part of their workflow?
I'm not talking about writing a specification, I'm talking about having a notes.md or notes.org saved somewhere which you consistently open and edit.

>Meme languages
>you should learn
choose only 1

It's /dpt/ not /dat/.

I hope youre getting payed by the hour user

>that webm
Holy shit retarded. It's resident evil so they didn't even do it ironically.

I have a notes.txt that I take care of to an autistic extent. No line is longer than 72 character, sentence spacing, using "o" for bulleted lists etc.

It depends of the purpose of the API (and the language).

As a programmer, maybe I want to let the user select the GPU at start (in which case I need solution 2)
Maybe I just want to get the best available GPU ?

I think solution 1 is unnecessary complicated. I would prefer to fetch the GPU list (getDevices()), filter the list, then tell your API the ones I want to use. The code would be more readable than by providing a filter list.

Hi I'm new to programming, not very good at it and the sqt OP pointed me to this general.

In matlab how would I go about creating a vector based on values given by a single function
sorta like "value = value + 0.3value +40" and this loops for n amount of times before it stops

In my attempts I've made a vector of the average which ended up being a totally linear plot by using the vector "vectorname = [starting value:n:value] and placing it after the loop but I'm pretty sure I should end up with an exponential plot
Please help this brainlet out

I know some matlab but I genuinely don't understand what you're trying to do.

>Meme languages you should learn
>lists every buttfuck language a neckbeard shat out while masturbating in their basement

It's been forever since I've used matlab, but are you basically trying to multiply a vector from a function with a vector of coefficients? So why not just build the coefficient vector the normal way and multiply its transpose with whatever the function returns?

Im implementing an orbit camera system. Does any one know why the image get flipped when phi or theta cross 0?

Attached: 2019-02-18 11-59-36 (1).webm (908x512, 233K)

I don't understand. You want to make explicit multi-GPU implicit again?

If you want a useful physical device abstraction, here's my take. I want to know whether a device is discrete or integrated, because that tells me whether it has dedicated memory or whether it shares with the host. I want to know the peer memory capabilities between devices in a group. Just boil down the data into a high level view of the system topology, and let me explicitly use each GPU separately.

I suppose it could also be useful to have a method that takes a set of capabilities and limits (with values) and tells whether the device meets the requirements.

dat /dpt/ dream!

Attached: dat dpt dream.jpg (650x720, 52K)

I have a Todo.md on my global gitignore and I use markdown for all my notes/todos.

checkboxes and snippets and notes and such all go in there in relation to a particular project

I used a standardly formatted // TODO:
format for in-code todos and I put the output of the `date` command at the end of the note.

forgot to mention I'm using matrix rotation. Will using quaternion solve this issue

When will this functional meme die already

rly hate how people have NASA merch as a fashion statement. annoys me more than people who obviously don't listen to metal wearing iron maiden tees

It's a vector of compound interest over a certain amount of time
I don't know how to properly create the vector for the cash so the plot ends up looking like pic related (a) rather than pic related (b)
not picking up what you're putting down

Attached: fuck me.png (375x758, 17K)

Thinking about compression.
I have no formal training or knowledge in it but my imagination runs wild when the problem presented is to create description of an array of bits that is less than the size of the data.

You're probably using the tan-function somewhere isntead of tan2.
It probably will. Quaternions are the single best way to represent orientations.

Art hoes who have never touched a skateboard in their life wearing Thrasher gear are the worst.

No. First paid project, doing it all alone. Agreed on a fixed price. Probably way, way below market, but I'm going to use it in uni. Fixed price (and the fact that the people I'm doing it for have known me for 10+ years) also allows me to be very lax with time constraints and features.
At least I'm going to make something, from talking to other people at uni they ain't getting jack shit from the required project to graduate.

Right now i enumerate device groups, and group them up in a vector and give them to the API user and they pick which device devices to try to use in particular by providing a function pointer to the configuration structure, and it will report an exception should it fail to create it using the selected devices(like if you try to pair an intel integrated with a nvidia gpu)

its kinda bad now but the code base is malleable enough to where i can change it to anything.

basically, how would I encapsulate a particular device-selection criteria at API-Initialization time? This is for vulkan which basically allows you to round up compatible physicaldevices and abstract them into one logical device for piping commands to.

There are later vulkan commands that involve a "device mask" as well which involve you picking which devices get particular allocations using the 32-bits of an integer too.

Normal mathematical notation to reversed polish rotation converter

In my free time, diving into android architecture components, mainly navigation, paging and livedata. Funny thing is, the more I spend with livedata, the more I appreciate how good rxjava is.
At work, a module of an app that uses camera/webrtc. It's a second app where I have to swim in a pool of shit, which the camera api, and in fact the whole android is.

it's already invaded every language at the core so never
the only way to compete in this landscape is through more abstraction, and you can't get more abstract than pure math

post the function

Attached: the functional way.jpg (1131x1600, 512K)

Here is my code
glm::vec3 los;//line of sight from eye to focus point
los.x = Radius*cos(glm::radians(Theta)) * sin(glm::radians(Phi));
los.y = Radius*cos(glm::radians(Phi));
los.z = Radius*sin(glm::radians(Theta)) * sin(glm::radians(Phi));
Eye = los + Focus;
// Calculate the new Forward vector
Forward = glm::normalize(Focus-los);
// Also re-calculate the Right and Up vector
Right = glm::normalize(glm::cross(Forward, WorldUp)); // Normalize the vectors, because their length gets closer to 0 the more you look up or down which results in slower movement.
Up = glm::normalize(glm::cross(Right, Forward));
//Up = glm::vec3(0.0f, 0.0f, 1.0f);
I am implemented it straight from textbook's spherical coordinate. Do you think I'm missing an edge case when either the camera's right or up vector get flipped when they shouldn't

never done this before, so I dont know if this will turn out right

%takes place over 18 years (216 months)
%you start with $1000, add $100 ever month, interest in 5% per month
vectortest = [0:216];
cash = 1000
num = 0;
months = length(vectortest);

for num = 0:215
cash = cash + 0.005*cash + 100;
end

cash_vector = [1000:188:cash]

plot(vectortest,cash_vector)
title('placeholder')
xlabel('months')
ytickformat('usd')

Yeah, if you use a look-at transformation, it's going to flip around the up axis (so that the up vector is always facing upward). The usual solution is to limit the pitch (phi) so that you can't go past all the way up or all the way down (or even a narrower range).

If you want to be able to go all the way around, then you should use two separate rotations, one for pitch and one for yaw (theta).

Attached: 1462468607798.png (657x527, 30K)

stupid frogposter

Based frog-poster.

Attached: 1465923483831.png (255x204, 50K)

I'm not sure what exactly you're doing here, but I think it's pretty logical that something's going to flip, when you're doing those cross products with forward and world-up.

dumb frogposter

Ok, Jow Forums. I beginning to fall for the self-study SIPC meme. What am I in for?

What you're doing (i think) is iteratively calculating the cash balance after 216 months, and then creating a vector that starts at 1000 and then increments by 188 until it reaches cash. This is of course linear (y = 1000+188x)

I suggest
%takes place over 18 years (216 months)
%you start with $1000, add $100 ever month, interest in 5% per month
vectortest = [0:216];
cash = 1000
balanceVector =[ ];
num = 0;
months = length(vectortest);

for num = 0:215
cash = cash + 0.005*cash + 100;
balanceVector = [balanceVector, cash];
end

%cash_vector = [1000:188:cash]

plot(vectortest,balanceVector)
title('placeholder')
xlabel('months')
ytickformat('usd')

This way we just store the balance in the appropriate spot in our resulting vector each iteration.
This can also be slimmed down to not use the variable cash at all, and just work off of indices in the balance vector.

>SIPC
What's that?

you are right. I'll read up on quaternion to avoid singularity case such as this. Thank you dude

Attached: re.jpg (815x629, 23K)

Im trying to find new coordinate system for the camera when I move with my mouse

Meant to say SICP

>be last week
>programmer at startup
>CTO gave $50 Netflix cards to everyone
>i don't watch Netflix at all

where can I sell this shit?

It works and I even understand how, thanks so much man.

nigger bay

What are your preferred pronouns?

Mine are pronoun.is/vi/vim/vim

God

spic*

Begone /v/dittor.

You're most welcome ^^
Glad I could help

DAILY REMINDER
STOP USING GARBAGE ""SYSTEMS""" LANGUAGES LIKE D,GO,RUST.

i don't even program

Based.

F# isn't a meme, it's C#'s feature beta. You still don't really have to pay attention to it, but it is comfy.
Rust is definitely a meme. Use C++ with unique_ptr and shared_ptr. Compile with Wall, Wextra and pedantic. Don't be a retard.
Julia, Nim, Crystal, Zig, Brainfuck, Idris, Racket, and CL are all memes that are worthless or borderline worthless compared to other languages.
Ruby is now a meme. Python is a meme you should learn unfortunately. MUMPS and Malbolge? Are you fucking serious?
Lisp is confirmed for developed by aliens, so other is suitable.
Add Java to pajeetbnig.

>it's C#'s feature beta.
F# is much, much nicer to code in that C#. Just because object oriented languages are picking up features functional languages have always had, doesn't make functional languages betas.

Attached: 1468122243162.jpg (657x527, 36K)

the ps2/keyboard is not supported yet.

Attached: output.webm (1280x720, 215K)

retarded frogposter

very nice user

super cool

Attached: 1468182634932.jpg (238x192, 14K)

russian hacker/10

Attached: 1510059507734.jpg (597x700, 212K)

But it was really made for that purpose though

What happens to the number on the monitor?
dumb frogposter

>What happens to the number on the monitor?

Attached: 1458919161741.png (726x860, 855K)

basedest frogposter

Attached: 1398716806937.jpg (640x426, 47K)

How will I explain my new boobs and higher voice to my parents after transitioning to Haskell?

Attached: 02EA3125-A22D-4A7B-91A6-470FB69481E5.png (600x632, 250K)

What happened to the number that was on the back of the monitor in the previous panel?

isekaid into the same world

dumb broken meme language
struct S;

fn main() {
let v = vec![S, S];
v.iter().map(|&a| {
v.iter().map(|_| &a)
});
}
error: internal compiler error: src/librustc/hir/map/mod.rs:831: no name for expr |&a| { v.iter().map(|_| &a) } (id=42)

thread 'main' panicked at 'Box', src/librustc_errors/lib.rs:600:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error

note: the compiler unexpectedly panicked. this is a bug.

I've had C++ compilers panic on me when I'm neck deep in template hell, but never something this simple

>vec![S, S]
What are you even trying to do?

>SS
>fails to compile
is this because of Rust's tiny CoC?