/dpt/ - daily programming thread

What are you working on Sup Forums?

Previous thread:

Other urls found in this thread:

youtube.com/watch?v=1PhArSujR_A
youtube.com/watch?v=ydyztGZnbNs
learnxinyminutes.com/
ziglang.org/
stackoverflow.com/a/7820701
cs61a.org/
github.com/zig-lang/zig/commits/master
composingprograms.com/).
berkeley-cs61as.github.io/
youtube.com/playlist?list=PLhMnuBfGeCDNgVzLPxF9o5UNKG1b-LFY9
wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems
twitter.com/SFWRedditImages

Threadly reminder to use #![feature(nll)].

Reminder that only php kids pretending to be hackers in the internet ever mention SICP.

>"php kids"

...

just got hired as a backend dev in python. I'll have to implement "low-latency, high-availability' solutions. Should I just convince the team to drop python and use Go? Gimme some arguments I could use, /dpt/

The software Carmack wrote before reading SICP: tonnes of brilliant code.
The software Carmack wrote after reading SICP: ?

he's a professional racket programmer now.

>washed up has-been falling for memes like FP and SICP
you know this isn't helping your cult's image, right?

he talked about that and function programming on Quakecon
youtube.com/watch?v=1PhArSujR_A
and then 2 years later made Racket the scripting language for Oculus
youtube.com/watch?v=ydyztGZnbNs

I guess that explains why Oculus is such a failure.

he's gone full meem!

>The software Carmack wrote after reading SICP: ?
>he's a professional racket programmer now.
Makes the perfect sense

>becoming that old

working on programming interview question practice

sicp is the best book ever and some shall better read it.

reminder that these workarounds to make Rust compile are in C++ either solved the same way (costful copying with new allocation) or ignored and cause memory bugs.

Those who are self-teaching, how do you get the motivation to keep going?

passion for the thing is usually enough

Get a ban, your motivation will come back automatically.
Sup Forums is unproductive.

...

Trying to substitute Javascript for TypeScript.
TypeScript seen more easy because i already master C#

how wipe hard drive???

>TypeScript seen more easy because i already master C#

yes
What is your problem

kek

what

Not eveeryone speaks English.

Is there any other book than sicp that amateurs took time to translate or rewrite? sicp is truly the only one of his kind.

What's a good resource to learn Python for someone who already knows a programming language or two?

You don't need a PhD in English to not to talk like an utter brainlet.

pajeet's

The funniest thing about SICP shills is that most of them haven't got past chapter 2 or 3.

The docs to figure what all features you lost assuming you come from a decent lang.

learnxinyminutes.com/

Got a neat applications question for you Sup Forums.

Ever heard of a Fresnel zone? It's an ellipsoid between two radio transmitters which graphs the trajectory of a radio frequency over a given distance.

What I know:
I'm working in GPS coordinates (decimal degrees). I know the distance between points A and B in meters. I know the radius of the Fresnel zone at any given point from start to end. I know the height of the Fresnel zone at any given point. I know it's bearing.

What I don't know:
What I need to do is plot the Zone in 3-D space. To do this, I have to get one thing, which is a set of 4 GPS coordinates, coordinates which will represent points along the circumference of the Zone at any given point of it's center of symmetry.

What I planned to do, but so far have failed, is to step to any point along the Zone, and pick a bearing, and walk out for the distance of the radius, then plot a point there. I may be failing because this is a bad plan, or because I am executing it poorly.

>want to program in chapel but not production ready
>want to program in ats but the syntax sucks
>want to program in lisp but all the implementations suck
>have to program in c because there's just no good alternative, there are million shit ones though

They are craving for validation.

Most aren't going further than the first chapter actually. Since data structures are only introduced in the second chapter. the first one is filled with examples relying on mathematics only. And SICP being a MIT crafted book, its of course exaggerating on the maths. because of that, many don't go further the first chapter. If you are not math literate, the SICP course from UC Berkeley is much better.

R U S T
U
S
T

>#99732 shitty C alternative
No.

>want to program in lisp but all the implementations suck

I will confess, haven't read the last register machine chapter because books are boring and lisp is ugly and hard to read.

>>have to program in c because there's just no good alternative, there are million shit ones though

ziglang.org/

t. dumb shitter who has never programmed in CL or tried to deploy application written in it.

It's the only viable alternative out there tho.

That's just a hobby project,

>ziglang.org/

pub fn main() %void {
_ = c.glfwSetErrorCallback(error_callback);

if (c.glfwInit() == c.GL_FALSE) {
_ = c.printf(c"GLFW init failure\n");
os.abort();
}
defer c.glfwTerminate();

>% void
>_ =
it's shit

just pass the necessary params to matplotlib?
stackoverflow.com/a/7820701

>SICP course from UC Berkeley
cs61a.org/
>01.py
fuckin' dropped

github.com/zig-lang/zig/commits/master


%void is the c compatible type

Don't program, write fantasy novels instead

Just like I said, SICP shills are all about feeling smug and talking on the internets about using obscure vintage technology and not about actually learning anything.

berkeley replaced the classic sicp course with composing program (composingprograms.com/). when that happened, a group of women started cs61as as an alternative. cs61as is a modern, shortened, lab oriented version of the classic course.

berkeley-cs61as.github.io/

the classic course:
youtube.com/playlist?list=PLhMnuBfGeCDNgVzLPxF9o5UNKG1b-LFY9

That occupation is reserved for "rust programmer"s.

This should be automatically appended to every /dpt/ from now on.

>a group of women

.t mozilla employee

Is called 'a screech'.

c++ is the greatest language of all time

>professor calls gigabyte, jyga

redpilled

Can I get some haskell exercises?

Yes, make a haskell program that finds and uninstalls ghc on your system.

wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems

Continuing on the previous question: I'm attempting to write this iterator wrapper. I got it to work after a fashion, but I need to use it with std::reverse as well, but when I try to use it, the compiler spits out errors about std::_Is_trivially_swappable and not detecting iterator_category as a member. To be honest, I'm way in over my head, but if anyone can spot a quick solution I'd appreciate it .
template
class ModulusIterator
{
T it;
const T start, end;

public:
ModulusIterator() = default;
ModulusIterator(T i, T e) : it(i), start(i), end(e) {};

auto& operator++()
{
++it;
if (it - start == N)
it = start;
return it;
}

auto& operator--()
{
if (it - start == =)
it = end - 1;
else
--it;
return it;
}

auto& operator+=(int n)
{
if (auto diff = end - it; diff

Sup niggas.

I'm working on some illustration software (js/es6), a couple after-effects plugin (c++/aftereffects SDK), a wikipedia scraper for data art (php/js), and a phone app/ game (react-mobile).

Day job is webdev.

no it's not you poo poo head

make minecraft in haskell

public class MyClass {

public static int oddSum(int n)
{
if(n%2==1&&n!=0){
int x = oddSum(n-1);
int y = n+x;
return y;
}else{
if(n!=0){
oddSum(n-1);
int a = oddSum(n-1);
return a;
}else{
return 0;
}
}
}

public static void main(String args[]) {
int f = oddSum(9);
System.out.print(f);
}
}

My method for finding the sum of odd integers up to n.
Is any of my code superfluous? Bear in mind that this exercise is before the Loops chapter.

Hello, I am just building a Windows compatible software, and I need to know how to do this command on windows?
ping -c 4 8.8.8.8 | tail -1| awk '{print $4}' | cut -d '/' -f 2

>/dpt/ when I last looked at it
>haskell
>/dpt/ now
>rust
What happen?

/sqt/

Rust happened.

New month new flavor

In the last six months?

>>/dpt/ now
"C++ is the .... ... ... ...e"

I apologize if this doesn't help, but if you know the height and vector of the zone, couldn't you just do some calculus on the size of the zone (like a triple integral) as a sphereoid?

i hope one day you listen to reason.

It's getting momentum. Also, I don't remember /dpt/ discussing Haskell a lot 6 months ago, it has transcended to the meme status years ago.

Why do so many "old school" hackers and autists at suckless dislike C++ so much?

The same reason lisplets mindlessly bash every other lang. They can't accept the reality of their beloved lang being shit.

The same reason they dislike Rust - they're rightfully afraid of being obsolete, but at the same time too emotionally invested in their shitty old language to move on and learn something new, so they try to justify their position by bashing every innovation and improvement.

All the special soyboy snowflakes realized they're not employable with Haskell so they moved to another unemployable language

Explain what a pointer is, how/when to use structs, and the difference between the stack and the heap (and why it matters)

Pic related, O(1) solution.

What this guy said, also does that really have to be a class?

>does that really have to be a class
>Java

This aint your grandpa's /dpt/. None of that matters anymore. Prepare to be put out to pasture with the other dinosaurs. Javascript is faster than c++ now anyway. #timesup

A pointer is an address space that links to another address space in memory
A struct is an object that holds data next to each other by having the data be at a fixed position from the start of the struct. It's useful to abstract away multiple return values and inputs in C
The stack and heap are memory allocation schemas that create two sections opposite side each other and have dynamically allocated memory on the heap while small objects are initialized on the stack. This allows for large objects to not destroy cache and allow for "hot code" to have access to all of their variables that would hopefully fit into one line

Also C++ is infinitely times better than C

Great b8 m8

Fuckin got me man, I just glazed over that system.out.print() as if I didn't even see it. I think I have PTSD from programming java mah dude.

It has more cruft than any other language that you can't remove because of backwards compatibility. Modern C++ is basically 1 part great language and 9 parts shit, and nobody can agree what constitutes the 1 good part. See also: Scala.

chunk
then chunk some more

Threadly reminder not to use Rust.

Right, use Swift.

Call me when, NLL is stable.

So much greatness

>Rustlets will actually use nightly builds of a language because they think it's safer than alternative langs
Absolute delusion.

I don't think the exercise wanted me to plug in a formula but for the life of me I couldn't figure out how you got that formula. It's a fucking easy one but 3 years of being NEET and 4 years of shelf-stacking has ruined my brain. I have a fucking maths degree.

C++ is the art of making life more complicated to yourself (and everybody else)