/dpt/ - Daily Perentie Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

wiki.haskell.org/Referential_transparency
gist.github.com/yvesklein/273d0726f7abc71999ef73be75eca2c5
codeabbey.com/index/task_view/modular-calculator
rust-lang.org/en-US/conduct.html
twitter.com/SFWRedditImages

First for C.

Pretend I don't know anything about C development aside from writing some source files and running them through gcc.

Where can I find information on the full toolchain for C dev (unit testing, debugging, makefiles, etc...)?

You've got it user. Most of my complaints in one box. A lot of these are solved in strict mode, though, and most of the rest are solved in TypeScript.

But then there's problems endemic to both languages (TS and Python) in my opinion that TypeScript can't solve, such as not knowing statically whether reading/writing to a property of an object has side effects.

Working on trying to understand Rust's borrow checker. Progressing quite slowly.

C influenced languages get an automatic F in my book.

Compiler now features some actually useful test programs thanks to a researcher who allowed me to use the ones he wrote.

Dumb Yui poster.

Well, I'll be more specific. If you purely keep to TS, you shouldn't run into problems, but interacting with third party libraries exposes the fact that you're actually using JS's object model.

Is OOP acceptable as long as you maintain referential transparency?

Languages with referential transparency aren't acceptable.

OOP is never acceptable.

OOP is fine as long as you komment your kode!

klossy go home please

>referential transparency
I don't see how that could be constructively achieved in OOP.

why not?

It's kinda at odds with OOP.
wiki.haskell.org/Referential_transparency
The statefullness ruins it.

How are classes and methods inherently stateful?

Replace all mutator methods with named constructors/factories
Done.

Yay, fixed it
(let [n (Integer/parseInt (read-line))
xs (for [i (range n)] (Double/parseDouble (read-line)))]
(doall (map println (map (fn [x]
(loop [i 0 acc 0]
(cond
(= i 0) (recur (inc i) 1)
(= i 1) (recur (inc i) (+ acc x))
(= i 10) acc
:else (recur (inc i) (+ acc (/ (Math/pow x i) (reduce * (take i (next (range))))))))))
xs))))

this

>Shitkell
Stopped reading right there.

nice twitter picture faggot

try Erlang

How do I make a small (< 1 GB) Linux virtual machine for software development? All I need is a terminal, an editor and gcc.

I'm running low on space, if it's not possible I think I'll try one of those cloud IDEs

Is Erlang better than Shitkell? If so, why?
Haven't heard much about it but I'm looking for a language.

I did say constructively.
If all you're after is calling methods on stateless objects that's OK I guess. I didn't think that was what you're after.

>install virtualbox
>pick a tiny distro like puppy
>get to work
Freebsd has premade virtual disc images though if youre lazy.

Not programming related.
Try either or

Learning C; going through K&R
/* compute the gcd of two numbers */
int
gcd(int a, int b)
{
if (b == 0) return a;
return gcd(b, a % b);
}

Your post isn't programming related either but you don't see me shitposting about it. Oh wait

>K&R C

Enjoy unlearning it all later because it's dated as fuck

How the fuck do I come up with a name for my fucking project

>unlearn
It's C. All of it still holds.

make new project that generates project names.
First you have to come up with name for the generator project though.

That's absolutely wrong. Just because it *might* compile (and some of it won't under C99/C11), that doesn't mean you're doing it right.

Pick out a minority group you want to trigger with the project name.

Can men learn to program?

I'm trying to learn C by making a simple board game. What kind of data structures should I use for representing a simple game board as in the picture?

I've already written some code which reads two tab-separated files. The first file contains all the nodes ("cities" and all the individual "steps" between them) on the game board. The second file contains the connections between every node and the type of each connection (airplane/car/boat).

This is basically my first programming project that's larger than Hello world.

Trying to implement a kernel from scratch with no reference to see how much I remember, so far I'm having trouble.

learning java...having trouble with this problem. can anyone tell where i'm messing up?

stuck on this. not sure how to fix the issue with needing to add to the list as input comes in, what i have now goes on forever. before i only had one line.

gist.github.com/yvesklein/273d0726f7abc71999ef73be75eca2c5

prompt: codeabbey.com/index/task_view/modular-calculator

>This is basically my first programming project that's larger than Hello world.
That's pretty fucking ambitious, especially considering you'll need to learn how to abstract visual data structures into computational ones.

I would create a "city" struct that contains an array of city structs, and call that "connections". Then for each city a given city is connected to, you populate that array with pointers to the other city struct objects.
Look up doubly-linked lists to get a grasp on how to work towards that.

Use a graph/adjacency list

what is your program even supposed to do?

>list
Pointless.
Read the first line in and add it to a "total" variable.
Then keep your while loop and just += or *= based on the switchcase result.

does the idris guy / welshfag use /dpt/?

>what i have now goes on forever
Please tell me why you are expecting that do-while loop to stop. From what I can see, i = L and the length of the array list is L+1 at all times.

its supposed to take input like this:
5
+ 3
* 7
+ 10
* 2
* 3
+ 1
% 11

and run through each successive line, operating according to what symbol is there.
then it prints the result.

for the above input, the result is 1.

why is the list is pointless? i don't see how this would lead to the desired output...

i know its wrong, i don't expect this to stop. i want to code it to stop...but i don't know what to do.

Posts worst girl and has the worst opinion. Funny how these things works, huh?

The idiomatic way to loop over every line in an input is this.
String currentLine;
while ((currentLine = stdin.nextLine()) != null)
{
// Code that runs for every line
}

!
thank you user

Much appreciated user, thanks. I'll keep your suggestion in mind.

second edition is ansi c genius

>C
Obsolete.

Tell me, meme-kun: what obsoletes C?

C the strongest

>meme
Opinion discarded.

Sure, it's the strongest, but it's obsolete.

You're only reading from the scanner once. Last line in the while loop should be something like
currentLine = stdin.nextLine();

Rust-lang.

Recommend me a name for imageboard software written in Java. Please no references to India and public shitting.

AHAHAHAHAHAHHAHAHAHHAHAHAHA

नामित शिटिंग बोर्ड

Is this a good book to lean C for a beginner?

No. C(ancer) is obsolete. Learn Rust.
rust-lang.org/en-US/conduct.html

Go back to tumblr, you SJW scum.

Any other Rustaceans in this thread?

>programming font without colors.

What the fuck

Is it true that C is considered obsolete?

No, because there is no viable replacement.

what about this? seems like a good replacement.

No, Rust is not a viable replacement.

I'm studying with this, I think it's pretty good and has plenty of exercises.

why not? it seems like a good one.

see

>rewrite your program every 3 months because shit keeps changing
Sounds perfect for a kernel or large program.

FORTRAN

Yeah, IMPLICIT NONE like a boss.

This.

So many autistic children in this thread.

this. I am currently writing my own kernal and large program in C89.

C confirmed only sane choice for kernel or large program.

this! C89 and machine codes of course.
i'm trying to write a hand compiled kernal in x86 intel machine code.

>C
Trash language, what it does is probably wrong.

A proper C replacement would not have garbage collection (reference counting is a kind of garbage collection).

>C89
>2017
Please user, at least use C99.

But what if it does reference counting without freeing memory with zero references?

why? C89 is more hacker-like.

Jesus fucking Christ I've never seen a thread filled with so many incompetent retards.

It's missing a lot of very useful features.
Mixed declarations/code, and designated initialisers are the ones that first come to mind.
All of this code is invalid C89.
printf("Hello\n");
int a = 10;
for (int i = 0; i < 10; ++i) {
/* ... */
}
struct thing a = {
.a = 10,
.b = 20,
};

Go to for actual programming discussion

Fuck off and write your micro kernel or small program in Rust, faggot.

>games
Trash.
>Rust
>micro kernel
Trash.

>>games
>Trash.
Because they have a purpose, they're more focused on getting stuff done than engaging in pointless language wankery and college first week homework.

>No. C(ancer) is obsolete
kek

What? I have syntax on for C++, the Pascal code uses a non-standard file extension though.

>tfw you don't know what would be more efficient, memcpy'ing a few hundred bytes or recreating the data in place using a simple algorithm

What do you do in Idris if it can't even check a basic case like this?

>f (C1 t) = t

>type mismatch between t
>and f (C1 t) (expected)

If it's already in cache go for the memcpy

(the latter error is using f elsewhere in the return type of a dependent function)