/dpt/ - Daily Programmmmmming Thread

Haskell is an extremely practical, dynamically typed, imperative programming language.

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

gist.github.com/anonymous/57e98d1dc695d10792e1c9a067271a3d
github.com/morhetz/gruvbox
github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md
twitter.com/NSFWRedditImage

fuck opengl

...

>Intro
It's almost as if you wanted to make me angry.

Well, it's Christmas, so I've been lazying about all day. Probably gonna try to get through "Programming in Haskell" by Hutton some time this week.

Reminder to celebrate Grav-mass, /dpt/.

>tfw embraced finally java
>tfw much more happy now
>tfw making lots of shit now rather than masturbating to fizzbuzz
>tfw getting paid millions

daily reminder there's not shame in developing software in java, is as usefull as C/C++ and is literally easy as fuck, plus you don't need to worry about literal BS.

Embrace it my friends, then you can stop being a neet and doing something productive with your life rather than shitposting about meme languages.

Java literally has the most library support from any meme language, only surpassed by C++, but not having to deal with C++ make java simply better.

Reminder that Nocth made 2 billions from a java game and people don't give a fuck about it's shit performances, normies rather buy more expensive hardware than expect your shit to run better.

>tips fedora
dumb frogposter

this would make pointers much simpler to understand, thank you. so, suppose z is an array:

int z[30];
int *x = &z[0];

*(x + 1); // adds 1 to memory address of z[0], returning content of z[1]

>read str :: Word8
No, no, no, you have to let Simon guess!

crosspost from
lain /%CE%BB/res/785.html#5841

First time looking at Ruby and I'd like to reimplement this in it

gist.github.com/anonymous/57e98d1dc695d10792e1c9a067271a3d

As far as I understand it could pretty much go 1 for 1, with some differences in syntax.

Is there anything I should be aware of before I start?

I understand, for instance, that for Luna in Ruby you need to do intervals in separate threads?

Also understand that if you were to scale the number of tasks running in intervals you'd have to spawn a thread for each task which seems bloaty?

Would it be better to appoint blocks/callbacks to Luna along with their intervals;

then with a single thread run any block/callback eligible for a run?

haskell is an intel processor you stupid fuck

You've got it though. There's one important thing to remember about arrays though: arrays implicitly convert to pointers to their 0th element. Array indexing is also implemented in terms of arithmetic on pointers.
int arr[30];
int *ptr;
ptr = &arr[0];
ptr = arr; // same thing

int x;
x = *(ptr + 1); // Increases ptr by sizeof (int)
x = *(arr + 1); // same thing because of the implicit conversion
x = ptr[1];
x = arr[1];
x = 1[ptr]; // even this works!

he'll just pick ()

minecraft was a fluke

Cute
Sauce?

...

Is there a resource that a literal retard could use to learn programming?

I've tried several times before in the past and keep hitting a wall. I think my biggest problem is that I am learning all these programming concepts and unable to really apply them to anything and have problems retaining them.

As far as games are concerned, yes, but the majority of money in software is not made in games. Like it or not, Java is the dominant language in industry by a large margin.

...

that's lovely sauce
tnx

doubt anyone of age cares about gets, pal

here

Writing a modular config system using JSON Schema, JSON Patch and JSONPath

damnit Simon!

>x = *(ptr + 1); // Increases ptr by sizeof (int)
>x = *(arr + 1); // same thing because of the implicit conversion
>x = ptr[1];
>x = arr[1];
>x = 1[ptr]; // even this works!
gorgeous! thank you so much for this

anyone good with react and redux? Want to help out a fellow user who's struggling

>his programming language only has a type system
>his programming language doesn't have a superior category system
How will typelets ever recover?

>What are you working on, Sup Forums?

Exploring the deepest, darkest corners of Racket. advent of Code 2017.

What’s the problem?

Viva muthafuckin’ Racket!

racket is a horrid mutation of scheme

What is the difference between text mode and binary mode in fstream?
Both seems doing the same thing, and the only explanation that I can find is text mode will convert the \n to the os specific line ending.

I'm a failure and can't do anything on my own.

I am rendering out a list of users on one side of my page and a chat with whichever user I click on on the right side. I set the state of that users_id in my playerlist component and send it along to the chat component which is a child of playerlist.

In chat i have a componentDidMount to get all players messages. I am trying to pass along the props of the clicked player_id so that I can sort out which messages I want on my backend and then render them out on the front.

Pretty simple but like I said, I'm a failure.

Your setup always looks so comfy. What color theme is that?

github.com/morhetz/gruvbox

>the syntax of her programming language allows for incorrect programs in the first place

>the concept of its programming language allows it to conceive of incorrect programs

>knows what "error" means

I fell for the rust meme and I actually want to try it. I mostly code in Ruby at work, wonder if I could use some rust in my current projects.

>

...

A guile application that will retrieve using the Sup Forums api all the loli threads images on Sup Forums

...

>tfw using java

Why don't you use a better language like Haskell or Agda?

"use a better language"
>stop liking things!!

because I need to make games and not shitty fizzbuzz on FP?

>Why don't you use a better language like Haskell or Agda?
Because Haskell can't even statically verify my monads, and Agda can't even statically verify that its computations will terminate within X time units and never require more than Y bytes of memory.

Define a time unit

A time unit is a unit of time. I see the concept of computations taking a finite amount of time is very difficult for a typical functional programmer.

Java is garbage compared to C#

C# is just Java but with more garbage bolted on. Saying C# is better than Java is like saying C++ is better than C.

>actually useful features
>garbage
Choose one

>C# is just Java but with more garbage bolted on

What is the jvm...

Better generics aside, whatever you think those useful features are, you don't need them.

>What are you working on, Sup Forums?
Writing an iTunes replacement.

>you don't need them
Alright, you don't "need" any features of Java either, so why don't you just use Assembly? What a dumb argument

What's the term for when a conditional check is skipped after a failed condition. For example:
boolean condition1 = false;
boolean condition2 = true;
if(condition1 && condition2){
//Since condition1 is false, condition2 is not checked before stepping past the if
}

short circuit evaluation

No, the concept of there being a fixed time unit is very difficult for anyone who's ever worked with any real computer system

>Be me
>Friend asks me to help him for his homework on C for beginner class
>The task is :
> >Make a program that generate an array of integer from 1 to 100
> >Write the array to a file
> >Make another program that open the file, then print the sum of all array in the file
>He sends me his second program and ask me where is wrong
>nothingwrong.o
>ask him for the data file
>he refuse, because he said that it already perfect
>after 1 hour searching for the problem and could not find it, he gave me the data file
>confused.gif
>datafile's size is only 8 Byte, instead of 400Byte (sizeof(int) == 4, 4* 100 = 400)
>Found out he write the pointer to the array instead of the array

I want to die!!!

I'm still not hearing why any of the crap C# has to offer is an improvement. Simply having them isn't a benefit in and of itself, as sepples demonstrates.

#!/bin/sh
echo "Syncing with iPhone, please try again later."

Go away Pajeet

It's my lowest priority, but I'm not looking forward to it.

Thanks senpai

>minutes/seconds/milliseconds/nanoseconds etc. don't exist for anyone working with real computer systems
>real computers are outside of spacetime

How fast is a cycle? EXACTLY how fast is it, every time?

>Spending an hour blindly searching for a "mistake" that someone else claims to be present
>Not setting up a quick, like 5 minutes tops, unit test to verify that it operates as expected
See

>How fast is a cycle? EXACTLY how fast is it, every time?
What difference does it make "exactly" how long a cycle takes? There's an upper bound, and depending on the granularity you care about, the average over billions of cycles can be a pretty good indicator.

>there's an upper bound
There's a 99.99% reliable upper bound.

>There's a 99.99% reliable upper bound.
Come on, now, user... I'm trying to be nice today and not call people retarded. If I set the upper bound for a cycle as 5 years, is it only 99.99% reliable?

In a faulty piece of hardware

>In a faulty piece of hardware
Since you don't seem to understand what probability is, I think we can stop here.

>probability
If you run your code on something that doesn't work, the probability that it's bounded by 5 years is 0%.

Nice goal-post shifting. It's clear to me that you're trying to save face after making this retarded statement:
>There's a 99.99% reliable upper bound.
And apparently realizing how arbitrary it is.

It's obvious from human experience.
You're not one of those skeptics are you?

What's "obvious from human experience"? That's there's a 99.99% reliable upper bound? You just pulled a ridiculous number straight out of your ass, and now you're trying to justify it by appealing to broken hardware, as if it's in any way relevant to the discussion.

>a ridiculous number
When someone tells you they're 99.9% sure of something, do you really believe they've been doing thousands of tests and calculating bounds on the probability?

Look, it's clear that you don't have any valid point to make. Your hypothetical broken hardware is irrelevant, and you can get an upper bound of arbitrary reliability depending on your safety margin. All your remarks so far have been thoroughly stupid.

>your hypothetical broken hardware is irrelevant
But user, I thought you wanted the language to prove your program would perform in a certain number of time units.

tried writing a hack for pubg again. gave up because it's too hard

>I thought you wanted the language to prove your program would perform in a certain number of time units.
And you took it to mean I wanted the language to prove that an airplane won't crash into my house, killing me and damaging my hardware in the process. Of course.

What's wrong with Agda then?

Scheme is garbage compared to Racket

That it can't guarantee that its computations will terminate after at most X time units given the appropriate upper bounds.
>b-b-but muh asteroid strike
Nobody asked it to verify that the upper bounds are correct.

could you fuck off already?
>durr why don't you use wat I use lmao i love funtional programin becuz Sup Forums told me ids gud

>it can't guarantee X
>>b-but it can't guarantee X
>nobody asked if it could guarantee X

I would love to see a language that statically verifies properties of the time-complexity / execution time. Do you know what the research landscape is like here? Any notable attempts?

>"X can't guarantee Y"
>hurr durrr nothing can guarantee Y because what if alien invasion
>"X can't guarantee Y given some axioms that are assumed to hold in reality"
>durrr no you obviously meant you wanted it to guarantee no alien invasion!

>hurr durr X hurr durr Y hurr durr XY *attaches r9k meme*

>literally incomprehensible response

/agdg/ here:
github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md

opinions on jai?

>I would love to see a language that statically verifies properties of the time-complexity / execution time
I think they already do use theorem provers for that. You just can't apply it to itself (I guess you could, in theory, though it would take inhuman amounts of effort).

>purity is friction or idealism
Jai is for radical centrists

Why don't you try it first for small project, then give the review here?

I'm skeptical about how memory management works, but will definitely check it out when it gets released (in whatever distant future that's going to be)

Implementing a standard library from scratch for a C-like programming language I wrote from scratch (the entire compiler is hand-rolled).
Finished C's string.h, ctype.h, malloc and family, basic syscalls, and some of stdlib.h.

So /dpt/, if you could go back in time and change anything in the C standard library, what would it would be? What would you add to the C standard library?
Genuinely interested in your guys' opinion.

For a start I wouldn't use null terminated strings

>no argument
>turbo-deflection ensues
God damnit, user. I wanted to be nice today, but it's impossible to be nice to you. You're such a brainlet.

What would you use instead?
Add a two-to-four byte overhead and store the size?