/dpt/ - Daily Programming Thread:

Anime edition

Previous thread: What are you working on Sup Forums?

Other urls found in this thread:

dlang.org/comparison.html
dlang.org/phobos/index.html
code.dlang.org
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
wiki.dlang.org/Books
dlang.org/blog/2017/05/31/project-highlight-excel-d/
dlang.org/blog/1997/05/31/project-highlight-excel-d/
gmplib.org/manual/Integer-Division.html
twitter.com/SFWRedditGifs

First for Trashkell.

It computes the 100th fibonacci number in more time than D computes the 1000,000th one.

So in other words, trashkell is up to 1000 times slower than D

Don't know what's going wrong.
Maybe it's the syntax.

I have to use Javascript for something and I'm Greenspunning hard

It's like pottery

Trying to decide whether I should either re-write my webscraper in ruby (from python) or to fiddle with godot

What do ya'll think?

Changed the first :if to :collect .... :and :do (setq ... str nil)

>spent 20 minutes freaking out on why my code wasn't working as expected
>finally give up and decide to just ask on here
>as i'm writing my post and explaining the problem I realize I used '>' when i meant '

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!

>Features
dlang.org/comparison.html
>Standard library
dlang.org/phobos/index.html
>Package manager
code.dlang.org
>GC
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Books
wiki.dlang.org/Books

Brainfarts happen, just learn to live with it.

No there's nothing wrong with GC. In theory GC can even run completely in parallel.

The non GC autism should be optional as it is.
And don't post the picture

Made a thread asking the same question, don't think it's going to pick up any steam, so here it goes again.

Hey Sup Forums, new to programming, really seeing myself getting into machine learning and artificial intelligence. To get started, I decided to start with a small project:

A machine learning program made to beat some Touhou game. Simple sounding enough.

But then I came across the idea, is it possible to create a program that can eventually beat any game you give it?

My knowledge of machine learning is small as of right now, but I'm really interested.

can someone help me out? I don't know how to select UTF 8 inside nano

look into neural networks homie

Rust is a great language, imagine Java without the inefficiency

>The non GC autism should be optional as it is.
It's not completely optional which is the problem. But yes, I agree with you otherwise. I posted those GC links because people need to educate themselves and realize that a GC isn't inherently bad in a general purpose systems language or otherwise. dlang-chan's quite fast.

>And don't post the picture
I'm going to update the mascot soon.

>It's not completely optional
You have to use different libraries, that's it. Why would you use standard libraries in the kernel in the first place anyway

Reminder this is still true no matter how much you wish it weren't.

I'm trying to understand why the with_index method isn't working. When I run it with this I get a LocalJumpError.

class MyClass
include Enumerable

def initialize(array)
@array = array
each.with_index do |value, index|
puts "Value is #{value}, index is #{index}"
end
end

def each
@array.each do |i|
yield i
end
end
end

a = MyClass.new [1, 2, 3, 4]


But when I run it with this, it runs correctly.

class MyClass
include Enumerable

def initialize(array)
@array = array
each_with_index do |value, index|
puts "Value is #{value}, index is #{index}"
end
end

def each
@array.each do |i|
yield i
end
end
end

a = MyClass.new [1, 2, 3, 4]


Why do they run differently? I thought they were basically the same methods?

do people still den ythis?

>Fast development
>Trashkell
1000x slower, thanks to 12Gb/s

Haskell is 1000 times slower than other languages.

Wow, you couldn't even READ the graph

The beauty of languages like Idris and Haskell is you can run your programs written in them orders of magnitude fewer times during development, because you have more than just tests available to check correctness.

Different guy here, I'm interested in this. But, would like to know how to make a bot like this in the first place.

How can you develop anything fast if it takes 1000x more time to crunch numbers?

You're correct of course, but having the standard library have GC-free alternatives for each of its constructs would be nice. As it is now, they only have some alternatives.

i understand that codelets like you might need to test everything because they use such awful languages that don't correspond meaningfully to a simple syntax whatsoever

Fact: Fortran has both good performance and fast development.

And not just test it, but test it thousands of times, I doubt the languages they use have good generative testing libraries

I don't think you understand. You need a server PC to run haskel programs to develop because average PCs are too weak to run resource hungry programming languages like haskell

I agree that it has great peformance. I disagree about the speed of developing programs in it.

>Not testing
Is this supposed to be a "plus"?

I think it's just another way to avoid the obvious fact that haskell is like 1200x slower

Assembler is not a language, is this your first week in programming?

Judging by the fact that he "doesn't need to test because the language apparently does it for him", yes.

>>it isn't necessary to test nearly as much
>is this supposed to be a plus

Yes, it is.

No, I've been programming for 9 days, shitlord

>it isn't necessary to test nearly as much
But one test of haskell takes 1000 times more than a typical test in other languages

By the time haskel finishes 1 test, my language can finish 1000 of them

stop bullying hasklel

You really don't need to test a function with type

forall a b c. (b -> c) -> (a -> b) -> a -> c

if you're using a consistent language. Really. Honestly. There's only one behavior that an implementation of that type could have in such a language.

>I disagree

You can write knowably reliable Haskell code without using any tests whatsoever.

>if you're using a consistent language
I am though. It's consistently faster than your scripting language

Coincidentally there is no haskell programs that one relies on

no

If nothing else Haskell/Scheme/etc. code will generally be shorter than corresponding FORTRAN code, making it quicker to write.

>relying on haskel
>NASA puts haskel in their space shuttle
>space shuttle comes back to land in the US
>emergency situation due to weather condition
>oh let's run that haskell program to compute the safest distance from the tornado
>haskell program freezes for 1000 minutes
>space shuttle lands in white house and kills trump
win win

Someone sure shoved a Haskell stick far up your ass for you to be this pissed off

I don't like America so this would be a plus for me.

Java is the most POWERFUL language

...

Studying dynamic programming by watching ucdavis' algorthm design playlist.

>shorter code = faster development
If by "development" you mean "writing buggy code" then sure.

>ALEX WHY IS THE PROGRAM TAKING SO LONG?
>S-sorry you can write reliable hasklel code without using any test
>AND WHY IS THE PROGRAM FROZEN
>I-I didn't test it to see how many hours does it take to compute fib(n)
kek

IS HASKELL PART OF A BRITISH FUNCTIONAL PROGRAMMING CONSPIRACY?

Haskell was developed by Simon Peyton-Jones, a KNOWN BRIT.

ML was developed by Robin Milner, also a KNOWN BRIT.

Idris was developed by Edwin Brady, yet another KNOWN BRIT.

>britcuck lang
>1000 times slow
yeah

My sides

Shorter code means fewer locations for bugs to reside.

kekd

Britain is just superior and you're going to have to accept that at some point. Haskell is an Anglican language.

Legend says the space shuttle finished counting 1000 minutes after it crashed on the white house

By buggy code I also mean not getting the results you want, not just compile errors/seg faults/etc.
I presume you've never done any scientific computing?

An advanced type system helps in that regard. Scheme might not have one, but Idris certainly does.

Which programming language should I teach my boa constrictor? Python? ASP? He's keen to learn.

Hey guys! I just wanted to chime in--

If haskell is a thousand times slower than D, how many times is it slower than C?

*engages damage control mode*
The time saved developing in Idris cannot compare to the time saved by running heavy-lifting programs in Fortran.

D is dead, so that must mean Haskell is dead and buried.

You mean *rekt, dead and burried.

It might be faster overall (development + runtime) to first develop a program in Idris and verify its correctness, then translate it to FORTRAN.

What's more funny is the hasklel faggot himself started this in the previous thread.
How ironic.

If only it was that simple user.

>Getting tucc'd by a dead language
That's a new low, user!

STOP BULLYING HASKELL

>D is dead
dlang.org/blog/2017/05/31/project-highlight-excel-d/
Here's the latest example on why that's false.

Stop false-flagging, faggot.

Which programming language should I learn?

Fuck haskell, I want to see how does D compare to C in performance.

Fortran.

Programming language waifus unironically help me stay motivated.

D > Haskell > C > FORTRAN > SBCL > Julia > Rust

is there a way to extend a object[] in c#?

I need to add some functions that operation on the array but be able to load values into the object as if it was a object[] from functions.

python

Push_back??

>dlang.org/blog/1997/05/31/project-highlight-excel-d/
Wow, D's been dead this long?

Any C fag here? Can you fix this? I just want to find out the remainder of 10 of the computed fibonacci number
#include
#include

int main(int argc, char **argv)
{
mpz_t buf[2];

mpz_init(buf[0]);
mpz_init(buf[1]);
mpz_set_ui(buf[0], 1);

if(argc != 2) return 1;

for(int i = 0; i < atoi(argv[1]); i++)
{
mpz_add(buf[0], buf[0], buf[1]);
mpz_swap(buf[0], buf[1]);
}

printf("%Zd\n", buf[1]%10); //

>implying D isn't Sup Forums as fuck

the function I am dealing with always returns an object[] { (int)id, "name", Object("object") }

I have multiple classes that have similar object array values and I am not sure the best way to avoid reusing code. I'd rather define my own class and have it be able to be case as a object array.

>have a conference to have a meeting to convene to decide to go ahead with the plan to make a plan to plan the new planning of the D logo

Let me do that properly:
printf("%lu\n", mpz_mod_ui(buf[1], 10));

In Mathematica this is just
object = Append[object,x];

...

and adding ; still doesn't work

Oh I didn't read the documentation properly. There was another argument.
Just read it yourself: gmplib.org/manual/Integer-Division.html

Someone post the books picture

...

At any rate. Here is D taking 1/5th of a second in my machine

Try this

#include
#include

int64_t fib(uint8_t n)
{
if (n 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

return d;
}

Wtf is this?

that's not the same algorithm but let me try

A function to calculate the nth Fibonacci number (as long as it fits into a 64-bit signed integer).

What language is the most fun for just doing random projects that pop in your head? Probably just text based simulations and games, but 2D vector graphics would be fun. I have experience with Java and C++ already.