/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

poal.me/cffayr
twitter.com/NSFWRedditVideo

Krusty Source Observer

Thank you for not using an anime image.

/dpt/ poll. vote for your favorite language!
poal.me/cffayr

SICP. I have no idea what I'm doing

Why am I getting this error?

Nevermind, I had an extra pair of parenthesis around x right after (self x)

God damn it

Is a circle with a radius of 0 a point or a circle?
What's its circumference?

Stupid frogposter.

brainlet detected

@59879103

It's a circle that occupies the same area as the point its centred on. Its circumference s 0.

>Is a circle [...] a circle?
Yes.
>What's its circmuference?
c = 2*pi*R
c = 2*pi*0
c = 0

Which language is best for programming? English, Norwegian, Polish, Russian, Hindi, Chinese, or Japanese?

norwegian ofc

>Is a circle [...] a circle?
>Yes
Is [...] supposed to stand for arbitrary sentences?

times new roman

Lojban.

Why not use a real Scheme and not an abomination?

[...] is optional.

Like what?

Where is Idris?

where is what?

languages used by less than 1000 people worldwide that will be long dead in 10 years not allowed

MIT/GNU Scheme
Guile

Iris

>GNU
Definitely not.
>Guile
Definitely not.

So why is D on there?

In the trash where it truly belongs with all the other Turing complete garbage.

#SHOTSFIRED

Idris is only Turing complete if you want it to be.

...

Because it's used by more than 1000 people worldwide and it'll not be long dead in 10 years

Larry, Mary and Jerry get in a taxi.

They have different destinations, but all the destinations are right on the highway, so no circuitous driving is required.
Larry’s destination is 10 miles away, Mary’s is 20 miles, and Jerry's is 30 miles. The taxi costs $1.50 per mile.

How much should each person pay?

what's ribbit? ribbit isn't a board. are you mentally deficient?

$ man life
No manual entry for life
$


what the fuck

That doesn't make any sense whatsoever, something having a totality checker already means it's Turing complete garbage.
In good languages you don't have to check something which is a core property of the language itself.

Wrong.

>pic
has more to do with lazy programmers than the language

$15 each

$15

>use totality checker
>everything you write must be total
>therefore not Turing powerful

If I am not lazy I would use ASM instead of C, IDK what you are talking about

Taxi travels 30 miles, passengers travel for a combined distance of 60 miles. Hence if each pays half price per mile, the cost of the journey will be covered and each will pay in proportion to the distance he traveled.

Wrong. Try again.

$15

larry would have to be a real asshole to ask the others to pay more

How can anyone who's not NSA shill C anymore these days?

The totality checker can easily miss something which would otherwise be total in a total language. It's garbage. It's merely a hack to allow for a slightly better Turing complete language.
Any why are you typing in this retarded manner?

Larry = ($1.50 / 3) * 10 = $5
Mary = Larry + ($1.50 / 2) * 10 = $12.50
Jerry = Mary + $1.50 * 10 = $27.50

I think $15 is a fair deal. Why is it wrong?

>implying D is to C what C is to ASM

Who wrote "implying D is to C what C is to ASM"?

...

>The totality checker can easily miss something which would otherwise be total in a total language.
It's still a non-Turing complete language, just potentially less expressive than your hypothetical total language.

>Any why are you typing in this retarded manner?
I was quoting myself, obviously.

>1.5/m
>travel 30 miles, since all on the same road
>money raised 27.50+12.50+5, fair is 45

they would all have to be autistic google employees to agree to that

what do you think 27.50+12.50+5 is?

Yes, ensuring that the amounts sum to the total fare is a good sanity check.

>It's still a non-Turing complete language
That's outright false. It has general recursion.

Samefag here... I'm attempting to evaluate the following series (or rather, product)
PI/4 = ((2 * 4) * (4 * 6) * (6 * 8)...) / (3^2 * 5^2 * ...)

And I get the following error
. . num-prod: undefined;
cannot use before initialization


When I run this:
(define (pi-approx n)
(define (square x) (* x x))

(define (num-prod ind) (* (* 2 ind) (* 2 (+ ind 1))))
(define num (product num-prod 1 inc n))

(define (denom-prod ind) (square (+ (* ind 2 ) 1)))
(define denom (product denom-prod 1 inc n))

(* 4 (/ num denom)))


Why is num-prod undefined when I clearly define it?

Would anybody welcome lambdas being introduced in the next C standard?

>lambdas
>C standard
why? just use Rust already jesus

Oh, I should probably mention, product is the following:
(define (product term a next b)
(if (> a b) 1
(* (term a) (product term (next a) next b))))


Basically, term and next are functions and [a b] represents the range of input values

anyone using C would probably stick to their dusty macros.

no

just allow plain old functions scoped inside a function like the GNU extension already has

With Jerry, even though he travels 30 miles, his actual fair should be that of 10. Larry can offer Jerry free ride until he reaches his destination since it does not cost him anything extra.

Larry has to pay $5 in this deal and Jerry has to pay 27.50, Mary has to pay more than $10 as well. 2 people are paying more. I don't think this deal would hold in real life. $15 each is still a fair deal.

Not if you're using the totality checker, which was implicitly assumed to be the case.

Polish is pretty neat for programing
public string Główna()
{
var kurwa = new Gówno();
kurwa.Zażółć(jaźń => jaźń.gęśla);
return "chuj";
}

>C doesn't have lambdas in the standard
I always knew C is for lesser programmers but this is just embarrassing

My game
STOP BULLYING ME

>no
But why?

post your github.

>I don't think this deal would hold in real life. $15 each is still a fair deal.
agreed

but
>Larry can offer Jerry free ride
"in theory" jerry should pay more than larry to make it fair, otherwise larry doesn't have an incentive to give jerry a free ride and he can tell him to fuck off

The language itself is Turing complete (meaning it's trash), but a subset of it isn't.

lambdas are unnecessary neckbeard crap with shitty syntax. do a function definition with the plain old syntax and pass a function pointer instead of defining the function inline. only haskell-tier retards think it's good to have everything on one line

Why is C so ugly? It makes me puke
#include
#include
#include

#include

int main()
{
Display *d;
Window w;
XEvent e;
int s;

if (!(d = XOpenDisplay(NULL))) {
fprintf(stderr, "Couldn't open display, but Arch is the best!\n");
exit(1);
}

s = DefaultScreen(d);
w = XCreateSimpleWindow(d, RootWindow(d,s), 0, 0, 110, 20, 0,
0, WhitePixel(d,s));
XSelectInput(d, w, ExposureMask | KeyPressMask);
XMapWindow(d,w);

while (1) {
XNextEvent(d, &e);
if (e.type == Expose) {
XDrawString(d, w, DefaultGC(d, s), 5, 15, "C is Cancer", 17);
}
yuk!

I wouldn't want to make anybody here feel small, so I won't post my github. lets just say I have over 300 confirmed repos and I am the top programmer in the united states. I can program in over 700 different languages.

I don't have a github account, my current contract gives my employer ownership of all my side projects.

and if you want lambdas and such crap then just use C++ or rust or someshit

why are you posting this again?

also, you forgot XCloseDisplay

>so h-here's my g-game demo
>oh is that the main character? she seems to have rather large breasts...
>y-yeah...

>my current contract gives my employer ownership of all my side projects.
Lol

kys

>I am the top programmer in the united states
An IIT grad here, nice

Vad i helvete sa du precis om Sverige, din lilla danskjävel? Jag ska tala om för dig att jag gick ut som kursetta på Kustjägarkompaniet och jag har deltagit i flertalet hemliga räder mot Danmark och jag har över 300 bekräftade nedkämpade danskjävlar. Jag är tränad i gorillakrigsföring och jag är den främsta krypskytten i hela Försvarsmakten. Du är inte mer för mig än ytterligare en måltavla. Jag ska utplåna dig med en precision som sällan skådats i Skandinavien, sanna mina jävla ord. Tror du att du kan komma undan med att säga sån skit om Sverige genom Internet? Tänk om, danskjävel. Medan vi talar kontaktar jag mitt hemliga nätverk av spioner över hela Sverige och din IP-adress blir spårad just nu så det är bäst för dig att du förbereder dig för stormen, danskjävel. Stormen som utplånar det patetiska lilla ting du kallar ditt liv. Du är helt jävla död, danskjävel. Jag kan befinna mig varsomhelst, närsomhelst och jag kan döda dig på över sjuhundra sätt och det är enbart med mina bara händer. Jag är inte bara utförligt utbildad i obeväpnad närstrid, utan jag har även tillgång till hela Svea Rikes amfibiekårs arsenal och jag kommer använda den till dess fulla omfattning i syfte att utplåna ditt sorgliga arsle från Skandinaviens yta, din lilla danskjävel. Om du bara hade haft en aning om den oheliga vedergällning din lilla “fyndiga” kommentar skulle dra ner över dig så hade du kanske knipit din jävla käft. Men det kunde du inte ha haft, det gjorde du inte och nu betalar du priset, din förbannade danskjävel. Jag ska skita vrede över dig och du kommer drunkna i det. Du är helt jävla död, danskjävel.

...

norsk > svensk

You guys probably assume im retarded for failing at a Object Oriented language but i could really use some help understanding what im doing wrong in this C# application.

Ive created a specification/inheritor class from the class Patient named PrivatePatient, it has its constructor that pulls from the normal Patient constructor and everything worked generally fine, however when i try and create a PrivatePatient object using the Patient constructor i get the error 'Patient' does not contain a constructor that takes 6 arguments.

Here is the code for the Patient constructor
public Patient(String name, int age, String patientType, int hoursTreated)
{
this.name = name;
this.age = age;
assignedDoctor = null;
this.setIdentifier();
this.patientType = patientType;
this.hoursTreated = hoursTreated;
}

And here is the code for the PrivatePatient constructor
public PrivatePatient(String name, int age, String patientType, int hoursTreated,
String privateHealthFundNo, String preferredDoctor)
: base(name, age, patientType, hoursTreated)
{
this.preferredDoctor = preferredDoctor;
this.privateHealthFundNo = privateHealthFundNo;
}


Im sure its obvious to you guys but if you need more info i can post more.

post an example of code where you're trying to create it

>Object Oriented

I only think you're retarded fit having that picture in your hard drive

I'll ignore your use of buzzwords and just address your points.
>shitty syntax
That's quite personal and one that could be addressed if enough programmers cared.
>do a function definition with the plain old syntax and pass a function pointer instead of defining the function inline
But why do that when one could just use lambdas? It'd be easier.
>have everything on one line
Again, quite personal, and that can be addressed by line breaks if you dislike it so much.

Wanting C to have lambdas doesn't justify using very different languages.

I really hope you're not working on the NHS IT system

listOfPatients is an ArrayList, but here you go
this.listOfPatients.Insert(this.listOfPatients.Count, new Patient("Fred Bear", 29, "Private", 10, "HCF236788", "Ben Casey"));
[/spoiler]

>shitty syntax
This is as retarded as saying "functions have syntax" or "loops have syntax".

it's objectively a different syntax compared to everything else in C. you would need a very compelling reason for it to be included in the C standard.

What syntax are you talking about? Are you really that fucking brain-dead to think that something has a fixed syntax?

haven't done c# in a while but shouldn't it be new PrivatePatient(...)?

It's because you are using 4 parameter patient constructor with 6 parameters.

Try using 4 parameters in constructor or create PrivatePatient object cast to Patient, like

this.listOfPatients.Insert(this.listOfPatients.Count, new PrivatePatient("Fred Bear", 29, "Private", 10, "HCF236788", "Ben Casey") as Patient);

Hi all! I would like to ask something about stuff I don't know and in a pretty basic level, but it could feel like I'm shitposting. May I ask it?

any syntax regardless of the specifics of the implementation would be different than what is currently in the C standard you disingenuous sperglord

Can I ask why do you want to ask?