/dpt/ - Daily Programming Thread

Code as data edition
(reminder that lisp > hasklel)

Previous thread: What are you working on Sup Forums?

Other urls found in this thread:

45.32.80.36/board.cgi
open-std.org/jtc1/sc22/wg14/www/docs/n2067.pdf
open-std.org/jtc1/sc22/wg14/www/docs/n2068.pdf
open-std.org/jtc1/sc22/wg14/www/docs/n2069.pdf
wiki.haskell.org/Monomorphism_restriction
twitter.com/AnonBabble

too early, I will be making another

Let the butthurt flow through you

>(reminder that lisp > hasklel)
If you like broken type systems that you pretend don't exist, that is.

can someone explain how the wavefront algorithm actually works? it always leaves holes and I dont see how I can calculate a heat map with it.

I just rewrote my CGI script in C!
It's a comment board!

45.32.80.36/board.cgi
Please try it out and don't break it pls.

Where's the image sharing capability?

Does anyone here know how to write programs in LLVM IR? How did you learn it?

I want to learn how to write it by hand in preparation for using it as a compile target for my language.

That's an upcoming feature.
I wanted to get the hang of string processing in C first.

Last time I wrote an LLVM language, I just dug through the standard every 5 mins writing my codegen.

nice pic, OP. it sort of represents the future of computing

How successful were you? Did you have a lot of compiler experience beforehand?

>C

madman
how many lines of code?

Not very successful because I didn't have a ton of experience. Wasn't my first language but if I did it over it'd probably be a lot prettier.
I've been having more fun just writing interpreters

As a protip, let LLVM do the optimizing.
For instance, you could code your immutable variables to be SSA registers, with phi instructions and shit, but instead just use alloca, and load/store; LLVM has an optimization that turns the stack frame space into a register.

341

why doesn't my stuff work
its supposed to delete trailing spaces & tabs
#include
#define IN 1
#define OUT 0
#define MAX 1000

int main () {
char current[MAX];
int state, count=-1, ind, c;

while ((c = getchar()) != EOF) {
current[count++] = c;

if (c == '\t' || c == ' ')
state = IN; ind = count; continue;
if (c == '\n') {
(state == IN) ?
printf("%.*s", ind, current)
:
printf("%.*s", count, current);
count = -1; state = OUT; continue;
}
state = OUT;
}
return 0;
}

>mfw my XSS doesn't work :-(

#define MAX 100
int main () {
char buffer[MAX + 1];
int len = 0;
while ((c = getchar()) != '\n') {
if (len >= MAX)
break;
else
buffer[len++] = c;
}
while (len > 0 &&
(buffer[len-1] == ' ' ||
buffer[len-1] == '\t' ||
buffer[len-1] == '\n' ||))
len--;
buffer[len] = '\0';
printf("[%s]\n", buffer);
return 0;
}

For your collection

What's the story behind this?

if (c == '\t' || c == ' ')
state = IN; ind = count; continue;
This is equivalent to
if (c == '\t' || c == ' ') {
state = IN;
}
ind = count;
continue;

You shouldn't write your code in such a misleading style.
One statement per line.

She kept on asking for that android dick, he was sick of it.

But what actually happened?

why code doesn't works ?
#include< stdio,h >

main( void){
char* hello=( char* )malloc( 11, sizeof( char)) ;
hello[ 1]="h" ;
hello[ 2]="e" ;
hello[ 3]="l" ;
hello[ 4]="l" ;
hello[ 5]="o" ;
hello[ 6]=" " ;
hello[ 7]="w" ;
hello[ 8]="o" ;
hello[ 9]="r" ;
hello[ 10]="l" ;
hello[ 11]="d" ;
puts( "%s", * hello) ;
return hello ;
}

wew

Are we being invaded by pajeets attempting C?

...

No, use either virtualbox or xen.

>777

Is Xen better than VB?

sorry im new to c

C# 7 is based
if (o is int i || (o is string s && int.TryParse(s, out i)) { /* use i */ }

switch(shape)
{
case Circle c:
WriteLine($"circle with radius {c.Radius}");
break;
case Rectangle s when (s.Length == s.Height):
WriteLine($"{s.Length} x {s.Height} square");
break;
case Rectangle r:
WriteLine($"{r.Length} x {r.Height} rectangle");
break;
default:
WriteLine("");
break;
case null:
throw new ArgumentNullException(nameof(shape));
}

It's the fastest virtualization solution out there, and runs at 95%-98% native speeds. The use case is a little bit different, though, since you install xen as the main operating system on the computer first, then you install other operating systems inside of xen.

>based
>>Sup Forums

Why would pol spout a nigger meme?

>based
Go back to your containment board poltard.

Are you even trying?

>nigger
Racism of any kind is not allowed outside /b. It's in the rules. Now hush.

Are you retarded

Based is from Based God Lil B retarded Sup Forums shitters

> retarded Sup Forums shitters
> Look everyone, I'm projecting!!!

...

Wow. Actually not half bad

You first, stormtard.

Stormnigger taqiyya strikes again.

Hi, guys. I'm pretty rusty. Can you guys check my work?

class DynamicStringArray
{
public:
DynamicStringArray(); // Default Constructor

private:
int size; // holds the number of entries in the array
};

DynamicStringArray::DynamicStringArray() // sets the dynamic array to NULL and sets size to 0
{
string *dynamicArray;
dynamicArray = new string[NULL];
size = 0;
}

Any corrections or tips? I posted this in the last thread, but that thread has exhausted.

You have a newline separating DynamicStringAr and ray.

don't mind me just taking the poo to the loo

It's Data's evil twin. His brother has a completed emotions chip and is a sociopath.

...

You poltards need to stop contaminating our boards and get your white ass back to >>/stormfront

Add some CSS

...

why the fuck isn't dynamicArray a member variable? It's gone after the constructor.

>white ass
Shut the fuck up, nigger.

...

What are you going to do to make me poltard?

Fuck ya'll niggas

...

Okay I'm done. Up next more same fag arguing with himself about niggers.

>white ass
Reported for racism :^)

No wonder C++ is so retarded. They pigeonhole themselves into thinking
>this is the only way!!!!111!!1111oneone

t. PHP webdev

>Punjabi Hindu Paki

Looks like he got all scared getting his cover blown and deleted fucking everything.

What is happening in this pic?

First for challenges

Gonna give the OpenAI gym a shot...

>This is actually kind of impressive. Good job!
why do people think that a very basic webapp is an impressive job? have they never, ever coded in a safe language that supports unicode well?
interesting. and I thought I was useless.

this reinforces my idea that this thread is filled with useless fags that think of themselves as elites or something.

Please help, in python I want to generate a standard result for each user based off their cookies. But because the md5 cookies are provided as strings, I can't perform maths on it.

for example
>>>x = 'b9155515728fa0f69d9770f7877cb50a' ## Some example
>>>x[3]

Looks like he made as much of a cluster fuck out of replacing new as possible.

Do the reptilians have a party van? It looks like he took megadoses of the red and blue pills. That shit is bound to draw attention.

my god share the source you dingus

int(x[3])

They're just words of encouragement to keep people going. Kill yourself.

you can't return a character array, firstly, and you can't return anything out of the main function you cuck

Actually I just realised it would safer and smarter to take the cookies and hash them again with a seed.

Thanks user!

kekek

>They're just words of encouragement
and what if the guy had made the webapp in, say, java? I'm pretty sure you all would be telling him/her to go back to fucking memers.

you can think of it more as a map that takes 2 lists

so, what is haskell / ocaml / fp in general not good for?

>you can't return a character array
>what is string.h

>New C2X proposals

>Named constants using 'register'
open-std.org/jtc1/sc22/wg14/www/docs/n2067.pdf

>Const correct some functions and add type-generic string functions (a la )
open-std.org/jtc1/sc22/wg14/www/docs/n2068.pdf

>Forced implementation of standard headers and new feature test macros
open-std.org/jtc1/sc22/wg14/www/docs/n2069.pdf

What does /dpt/ think about these proposals?
I think the use of 'register' like that seems is pretty unintuitive and I'm not really sure if it's necessary. seems pretty interesting though.

Performance

Anything other than cute code snippets, e.g. real world applications involving state

C11 was a mistake and so was C99.

The only true standard is C89.

You realise code bases are made of code snippets?

>56253775
That was so poor, you don't even deserve a (You)

Yes, except not exclusively ones that print fizzbuzz or find the prime factors 31337

>_Generic

how do I get more gud at haskell
I need a project that involves just logic and and an intermediate knowledge of haskell
no need of knowldege about some libraries

name? show?

...

it's pico from boku no pico

>cuck
Go back to your containment board stormtard.

i just need a name so I can look some pron of her

practice makes perfect

pedo

she's 15 you fucking pervert

Haskell is deprecated. Learn lisp.

>inb4 muh types
>inb4 inb4 >having to fuck up your code with brittle type annotations
>inb4 inb4 inb4 they're optional
>inb4 inb4 inb4 inb4 no, they're not: the wiki even has a page documenting how the type system is broken in hasklel
wiki.haskell.org/Monomorphism_restriction

im ok with that

rollin' 4 dubs?