/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

github.com/deeepaaa/hachidori
learnyouahaskell.com/
strawpoll.me/11199302
en.cppreference.com/w/cpp/string/byte/memcpy
twitter.com/AnonBabble

First for D

Still working on dependent elimination of Church encoded data.

Can you explain elimination?

Thank you for using an anime image

nth for i love you all

i think i've realized something. generals where people hate making the new thread and often only do it after the thread archives aren't cancerous, while generals where people make the new thread exactly at or even before bump limit are cancerous

Learning Haskell, having a great time

ask if you need anything

With ordinary inductive types, very informally:
Formation = type construction
Introduction = construction
Elimination = pattern matching & recursion

Dependent elimination is where you eliminate into a type that depends on the term being eliminated.

>be hime
>get blackmailed into crossdressing by cute schoolgirls
>have to live with a tail buttplug inside you all of your life because all of the pegging by the student council has stretched your anus way too much

In other news, I have started learning Haskell. It's pretty comfy until now.

Hey Sup Forums I have a question. Do You feel sometimes that some posts are written by neural networks on other boards?

Thanks for sharing
Good luck, my dude

What, like /r9k/?

I mean, in all seriousness, a brain is literally a neural network.

That's the difference between slow generals and fast generals.

/dpt/ isn't a general tho

No, but I hear voices from the wires talking to me.

And Church encoding is basically describing data by how it is eliminated. For example, Church numerals encode the natural numbers, and their elimination is applying a function N times to a value where N is the encoded number.

However, dependent elimination is tricky because it can only be derived from parametricity, i.e. the free theorem of the data type (which is a polymorphic function type). Actually having parametricity internalized in the type theory is a very new development - it's previously been only suitable for metatheorizing.

I guess You replied to wrong numbers. I mean I saw once one user goofing off on /x/ by kinda making new posts from sentences and single words from previous posts. It did't make any sense but it made me thinking. I also sometimes have uncanny feelings from readings some posts.
>/x/ shilling
no

I want to stop programming, it's not fun anymore

Anyone /Lua/ here?

Don't like to yourself, it was never fun.

trying to figure out how to put writing shell scripts on my resume

put "bash" under your programming languages/technical skills/whatever

thats what i was going to go with. thanks

I made a patch for an open source game.

People liked it.

A few asked me to add some features, I didn't really have time to do that because of work.

They got mad at me over it and I ended up quitting the game altogether because it was no longer fun.

Posting this again only for (You)'s.

That looks a lot worse than just writing the fucking script.

Just make hacks for that game now to spite them : ^ ) Assuming it is multiplayer...

Here's a small fibonacci problem. It says time complexity is O(n) but I was typing not thinking, it should be O(lg(n)).

Basically it says write a higher order function that when provided P,Q,B it returns the function for finding the appropriate Lucas Sequence's nth term.

can anyone give me some god-tier android development resources? i'm currently going down a road of transcribing and running from online tutorials and i feel like it's a waste of time

Nah man, I'm done, I don't want to put any more time into it. I've got a big list of other games to play.

you made a minecraft mod, didn't you

What game?

Nope

I didn't realise it was even open source

github.com/deeepaaa/hachidori

I don't want to say, the community is small enough that you could identify me.

hey anons, why i can't add android sdk in netbeans?

What game?

lol

link?

how do I tail call optimization so that recursing doesn't change the stack?

divided heart on play force one, google it

It isn't, the mod frameworks are reverse engineered as far as I know.

its learnyouahaskell.com/

See

Mister 004 You have licence to kill.

i had no idea that they were such biggots

Don't be a pussy ):

How is this programmable? And how is it any useful? Do you just minimize everything and stare at your desktop?

the best part of my life right now is being hours into reading a boring technical book and finding a joke the author put in there. at first i thought computer scientists have a really great sense of humor, but now i realize it's because the stuff surrounding it - the majority of the work - is so dull

yeah
lyah is pretty darn casual though

Still shilling your non-free shit?

It's GPL, though.

yes.

i'm bored and listless, decide what i do
strawpoll.me/11199302

is there a standard function that copies an array into another array?

std::copy(std::begin(src), std::end(src), std::begin(dest));

That would depend on the language. For example, D has dup and idup

>a standard function

Can I use div to make a fizzbuzz in c++?

en.cppreference.com/w/cpp/string/byte/memcpy

what about c?
you wouldn't wanna write
the for int i=0,j=0; i < whtaver
seems tedious

then it depends on the language. java has a function copyOf that you use to copy an array

memcpy

Not him, it looks exactly the same to me

Hey NEET, github precaches all images that show up in markdown README files, so your pageview counter doesn't work because it's not actually requesting the image from flagcounter, it's being loaded from camo.githubusercontent.com

memcpy works and is type-agnostic
you're copying the raw memory bytes to another location.

bummer, seems memcpy only works for 1d arrays
I wanted to avoid for loops
don't get me wrong, I know I can loop over the arrays and do memcpy(dest[i],src[i], size)

and I assume that the size is a storage unit*n

uh all arrays are 1d...

[ [2,3,4], [8,9,10], [2,20] ]

Let that sink in you retard...

< int a[4] = {1, 2, 3, 4};
> 0 [1], 1 [2], 2 [3], 3 [4]

< int a[2][2] = {{1, 2}, {3, 4}};
> 0x0 [1], 0x1 [2], 1x0 [3], 1x1 [4]

1. Yes, you will need to deep copy that.
2. Don't store 2D arrays like that you retard.

I'd just like to let you know that your autistic pedantry didn't add anything to this discussion

if it contains arrays, then its more than 1d

memcpy still works on 2D arrays.
2D arrays are stored sequentially in C.
#include
#include
#include

int main()
{
int arr1[3][3] = {{1, 2, 3}, {2, 3, 4}, {3, 4, 5}};
int arr2[3][3];

memcpy(arr2, arr1, sizeof arr1);

bool matches = true;

for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
if (arr1[i][j] != arr2[i][j])
matches = false;

puts(matches ? "Matches" : "Does not match");
}

woooooo

fUKEKIng magic

2 dimensions
no loops

how could this
even ??

can we descend into the third dimension

woooooooo???

#include
#include

int main(void)
{
int a_src[4] = {1, 2, 3, 4};
int a_dst[4] = {0, 0, 0, 0};

memcpy(&a_dst, &a_src, sizeof(a_src));

int b_src[2][2] = {{1, 2}, {3, 4}};
int b_dst[2][2] = {{0, 0}, {0, 0}};

memcpy(&b_dst, &b_src, sizeof(b_src));

// verify
for (int i = 0; i < 4; ++i)
fprintf(stdout, "%d ", a_dst[i]);

fprintf(stdout, "\n");

for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
fprintf(stdout, "%d ", b_dst[i][j]);

fprintf(stdout, "\n");

return 0;
}


are aliens behind this????

not in memory

I see, I forgot that, nevermind, pham

pls respond

you're retarded. there's nothing special about arrays having their elements as arrays that would make memcpy not work on it

wow, why did you give memcpy the address of the address of the start of the arrrays?

Working on approaching a girl that I saw.

Taking the address of an array will give the address of the first element.
Pointless, I know, but what he did isn't wrong.

I just started c, give me a break

he did &array, not &array[0]

i don't really C
im a python babby
i just wanted to get a point across

What about an array of char ** where each char ** pointer is a malloc'd char array?

Try memcpying that without a for loop.

this is where the distinction between multidimensional arrays and arrays of pointers to array comes in

a true contiguous multidimensional array is fine to memcpy in one go

>finished codeacademy

What next?

I want to build websites and create forums.

...

Yes, I know.

That's not a 2D array. That's an array of char pointers.
Yes, for a deep copy, you would need to use a loop.
Is this what you actually meant?
#include
#include
#include
#include

int main()
{
int arr1[3][3] = {{1, 2, 3}, {2, 3, 4}, {3, 4, 5}};
int (*arr2)[3][3] = malloc(sizeof *arr2);

memcpy(arr2, arr1, sizeof arr1);

bool matches = true;

for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
if (arr1[i][j] != (*arr2)[i][j])
matches = false;

puts(matches ? "Matches" : "Does not match");

free(arr2);
}

one quick qeustiion
is sizeof arr[2][5] == 10 or 5
is it allways n*m if arr[n][m]?

{-# LANGUAGE TypeInType, GADTs, TypeFamilies, ConstraintKinds, NoMonomorphismRestriction, RankNTypes, ExistentialQuantification, TypeOperators, FlexibleInstances, FlexibleContexts #-}

Thanks nigga

Who is this buttslut?

wow
i cant believe you called her that

rude

Finished reading The C Programming Language today. Pretty good book

wait, wtf, memcpy requires the dest to be void?
why

I don't know. There is never any sauce.

Yeah, but who is she?
Nice, now make me a kernel

It depends on what type 'arr' is.
But what you're getting is the size of the element at arr[2][5], not the size of an 2D array of 2x5 elements.
#include

int main()
{
char arr[3][6];
printf("%zu\n", sizeof arr[2][5]); // 1
printf("%zu\n", sizeof(char[2][5])); // 10
}

because C has no generics so you pretend that void pointers are generics with implicit cast