/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

youtu.be/dDg5qa-gVxw?t=20m39s
introcs.cs.princeton.edu/java/stdlib/javadoc/StdIn.html
github.com/bakape/hydron
twitter.com/SFWRedditGifs

immutable or constant parameters?

You really shouldn't use C++. It's complete garbage.

There's a difference?

>Name of your dream language
>it's top 5 features

websocket server in C. Currently implementing roleplaying function for muh erp

That's what happens when your language is without garbage collection.

>dependent types, impredicative polymorphism + all of Haskell's polymorphism, row polymorphism
>first class code, first class modules (which are identical to records)
>pure, not effect based (but could be extended to support it)
>not solely text based
>very fast and efficient

In Go and Java the garbage collector collects the language

>fast to run it
>fast to develop in
>fun
>anime girl as a mascot

>>anime girl as a mascot
shit i forgot
do over

all of this plus the last part of this

yup

What is it then?

>WaifuLisp
>essentially Lisp with static typing
>some syntactic contructs for convenience (looking at you, "(setf (aref my-array 0) 25)")
>anime girl as mascot
>releases have cute names
>awesome IDE

const erases the information about whether the original variable was mutable
or immutable . This information is hidden even from the compiler

But constants are immutable by definition

youtu.be/dDg5qa-gVxw?t=20m39s

String s;
char c;
do {
s = StdIn.readString();
q.enqueue(s);
c = StdIn.readChar();
} while (!StdIn.isEmpty());
Why doesnt this piece of shit exit the loop? It works fine for a finite loop. Input of the format "A B C D E".

Don't have sound at the moment.
What are they saying that you need to post a facepalm-spurdo?

check if stdin is ever empty

Because you have a \n at the end and it's consumed by readString. Use something like ignore or clear after readString, I don't know your shit language

>How do we deal with dick jokes made about D language?

...

>perl has regexps done right
>perl is unpopular

...

Yes, because it did pretty much everything else wrong.

Do you already have a Web server?

comedy gold

>that blank spot on the right
FIX DIS

>>perl has regexps done right
Perl completely fucked up regexes, and most of the other retards followed suit.

No, never.
It's Java but with a custom made IO-library
>introcs.cs.princeton.edu/java/stdlib/javadoc/StdIn.html

You have a readAllStrings method, use that

Didn't work either. What the fuck

fucking hell just drop out already

stupid interrupts.

Is C++ slower than C?

in the brain department? yes.

>Doesn't even have restrict pointers
Yes.

Idiomatic C is much closer to machine instructions which tends to provide the best performances. That being said you can write C++ in a very imperative style that will pretty much be the same. Generally the more you go in abstraction the more overhead there will be/the harder it will be for your compiler to reason on your program and optimize it. So it's more about how you use them. The common implementations are mature enough to produce fast code on good inputs.

>Idiomatic C
what does this mean?

pointer pasta

You can use restrict in both gcc, clang and vc though. Just like you can use stuff like static_assert in C with some compilers.

Writing C using his main paradigm. For exemple not trying to do higher order functions like the retard from the other thread

idiotic c

What I meant by that is there's always some way to do something very slow in any language if you're not paying attention (or being an idiot on purpose). What I like about C is that since its very simple it's usually quite intuitive.

I remember trying to use that library, it absolutely sucked and I never used it over the standard library.

too slow to handle 14 million interrupts per second
++interrupt_count;
current_int.push_back(vec);
byte* esp; asm("mov %0, esp;":"=rm"(esp));
if (static_cast(esp - stack.data())

>tfw based Terry gets 4 million task switches per second
HolyC is the one true language

That's not the language but ring-0 only and no privilege level changes.

Perl is shit.

who is this purple motherfucker

>mfw antlr
didn't expect it to work this well

Is rust in any way affiliated with OOP?

Absolutely.

Looks like you're going to have to satiate your mental illness with another, less useful language.

Maybe, but it's more affiliated with Poop.

>Absolutely.
Prove it using type theory.
>less useful language
Anything which uses POO is already useless as far as I'm concerned.
>but it's more affiliated with Poop
so with OOP?

Type theory is a meme. Nothing of use has come of it.

>the ribbit version of """"meme""""
What an absolutely abhorrent post. Are you Canadian or something?

That explains why every single language is dynamically typed.

Canada is a meme. Nothing of use has come of it.

Only the good ones.

You're so naive it's adorable.

Au contraire, only those who waste their time with strong static typing are fools beyond all redemption.

Only a gay person could think that.

Working on JSON API for a much faster Hydrus alternative. It's backend only. Anyone interested in slapping a GUI on this one, once I'm done?

Whatever you say, dynamic typing allows me to be as gender fluid as I could ever possibly want!

what's a hydrus?

Image tagging/organizing/distributing engine in Python, much like a personal booru.

GUI code sucks ass. Just use one of those GUI generator programs.

You're going to get your heart broken you sensitive boy.

Noice, you got a git or something so I can look at your code, I might do a Qt GUI if I find some time

I am already dead inside.

how does it work anyway?
you serve files based on the tag being searched or what?

emacs like text edtior in C

>reddit newlines in code
why do people do this?

That's funny, I was thinking of writing an emacs-like editor, with an elisp interpreter, in elisp. Should I do it?

I do this because it's actually easier to read. Believe it or not.

how is this like emacs
where's the lisp

>C-h v line-spacing RET

There is a distinction between the view and the model.

The view is how the code is formatted on the screen, whereas the model is the code itself.

You expressed a desire to modify the view, but you modified the model instead. That is a severe antipattern. Why not increase the interline space in the editor?

github.com/bakape/hydron
The serverclient communication will all be done with HTTP/JSON, so the client can be written in any language and be on a different machine from the server. Most of the core functionality is there, but currently only accessible through the CLI.

Fair point. Have any recommendations?

You get JSON that can be easily converted to file paths. These files can be found simply on the file system, or retrieved through HTTP, if the client is on a different machine from the server. That way the client can easily sort, filter or whatever by the information returned.

Lol.
This
>I d o t h i s b e c a u s e i t ' s a c t u a l l y e a s i e r t o r e a d .
is easier to read than this?
>I do this because it's actually easier to read:

my original plan was to embed libguile but I dropped this idea

keybindings

thanks, didn't know about this

I've just used Qt Creator.

Well I'll see about doing a Qt Interface

today i implemented artist pages

next i think i'm gonna add a 'dashboard' page which will contain 'recently popular' music, maybe some review summaries from metacritic or pitchfork, music saved by the user etc

HEEEELP! Sup Forums ;_;

I lost all my rectangles when i resize the JFrame. What should i add to my code?


package ArrayLists;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public class array extends JPanel implements KeyListener{

ArrayList rec_list;
Rectangle r;
int rnd_1, rnd_2;
Random rnd = new Random();

public array(){
rec_list = new ArrayList();
Add_array();
}

public void Add_array(){
rnd_1 = rnd.nextInt(400);
rnd_2 = rnd.nextInt(400);
r = new Rectangle(rnd_1, rnd_2, 25, 25);
rec_list.add(r);
}

public void paintComponent(Graphics g){
super.paintComponents(g);
g.fillRect((int)r.getX(),(int)r.getY(),
(int)r.getWidth(),(int)r.getHeight());
repaint();
}

public void keyPressed(KeyEvent k) {
int key = k.getKeyCode();
if(key == KeyEvent.VK_SPACE){
Add_array();
System.out.println(rec_list.size());
}
}

public void keyReleased(KeyEvent arg0) {
}
public void keyTyped(KeyEvent arg0) {
}

public static void main(String[] args) {
JFrame frame = new JFrame();
array a = new array();
frame.addKeyListener(a);
frame.add(a);
frame.setSize(400,400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}

thank you.

>java

Is your call to repaint in the right place?

Maybe also look into revalidate while you're at it.

well i write both it in inside of every method and it doesn't seem doing anything. Also i hear revalidate() method first time

>Is there already such a machine available?
I believe thermodynamics ensure such a machine cannot exist. At least not one big enough for you to write software for it.
But I'm no physicist.

I'm not 100% confident that row polymorphism is the correct type of polymorphism for sessions, but I'm probably just gonna go ahead and try it this way anyways

I'm really surprised that Andrei keeps hiring these conference organizers. The guy on the left left me with an incredibly poor impression from last Dconf. Maybe they're cheap and efficient in all other aspects than presentation.

Why would you want any other kind of subtyping?

>I do this because it's actually easier to read.
Do you have any construct to paragraph your code? Double newline?
It's common to group lines of code using newline but to newline between every single line is weird.

Also I suggest that for your potential coworkers sanity you just modify your editor to insert extra newlines where appropriate in rendering.

Can't be that hard right?

I wouldn't, but I'm not sure whether I'll need to extend the row polymorphism algorithm to make it work properly

>The guy on the left left me with an incredibly poor impression from last Dconf
Why does he dress like that?

Try doing repaint()
inside your space keyevent like:
if(key == KeyEvent.VK_SPACE){
Add_array();
System.out.println(rec_list.size());
repaint();
}

See if it works.

It's ok guise