/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1555786551660.jpg (1039x1329, 820K)

Other urls found in this thread:

ghostbin.com/paste/9kgeq
sbcl.org/getting.html
sbcl.org/platform-table.html
sourceforge.net/p/clisp/clisp/ci/default/tree/
unlambda.com/lispm/ANSI X3.226-1994.pdf.gz
lispworks.com/documentation/HyperSpec/Front/Contents.htm
github.com/clojurians-org/lisp-ebook
github.com/clojurians-org/lisp-ebook/blob/master/ANSI Common LISP.pdf
microsoft.com/en-us/research/wp-content/uploads/1994/04/classhask.pdf
shaunlebron.github.io/parinfer/
github.com/rust-lang/rust/search?p=1&q=madoka&unscoped_q=madoka
nickgravgaard.com/elastic-tabstops/
coursera.org/learn/algorithms-part1
shenlanguage.org/osmanual.htm#4. The Core Language
haskell.cs.yale.edu/wp-content/uploads/2015/03/HSoM.pdf
twitter.com/SFWRedditGifs

Lisp is the most powerful programming language.

Attached: _tifa_lockhart_final_fantasy_and_final_fantasy_vii_drawn_by_morisawa_haruyuki_bdf53adaed971157399fbf (609x991, 75K)

nth for Nim!

> Them: Where did you eat today?
> You: North is the best direction.

my cock

>them: Lisp is the most powerful programming language.
>you:
>> Them: Where did you eat today?
>> You: North is the best direction.

Attached: 10262051_10202271916658945_1058480794194592846_n.jpg (600x611, 53K)

Damn she is so cute. What language does she use?

Some project euler stuff.

Apparently problem 14 gives faulty solutions, and can even break with high enough optimization, unless you declare explicitly that all numbers are unsigned.

>having to declare numbers as unsigned

It's obvious that she uses C++

My guess is that there might be integer overflow at some point during a multiplication.

>
> >>if Lisp can do all these things, why has it been near-universally panned?
> >The main reason is because retards see the parens and walk away.
Definitely a part of it. It's not ALGOL and that makes people look to Python.
> >Various other reasons include:
> >the AI winter, because of a misconception that Lisp was literally designed for AI
Definitely. AI gravitated towards lisp because:
a) it was available at the time AI really began to be a thing,
b) it largely eliminated fretting about pointers, the current memory state, and data types,
c) it had a garbage collector to manage memory automatically, and
d) it allowed for 'structured programming' (meaning, it didn't make ridiculously hard to read code using goto statements, so it provided some level of security and confidence that the code would do what it was supposed to and nothing more).

This allowed for ideas and abstract concepts to be communicated in code more efficiently and effectively than would be possible with other languages available at the time.

> >Lisp performance used to be total shit, even though it's considered relatively lean by modern standards
Definitely. Though this is why Lisp machines were created in the 1980s – to make Lisp run faster on those old, slow, rickety NMOS-process chips.
> >Lisp didn't fully embrace the OOP meme when it was at full steam in the 90s
100% truth. Even COBOL(!) has an object oriented revision nowadays. Lisps didn't really "change" in response to OOP; they just continued to exist since OOP is easily implemented in lisp if desired but is usually a waste of time and not really a good fit to the language. It didn't become a shambling horror like C++ to fit the meme.
> >more recently, it's not Javascript so it's automatically shit, because Javascript.
This saddens me, but is likely true. "Why can't I install packages via clpm (common lisp package manager)?"

The concept of OO in itself isn't bad, it's actually a good way to organize large software sometimes. The problem is that the way Java and C++ do it (which is also the most popular one) is bad. It's way too rigid and inflexible.

Oh, forgot point e) on why AI gravitated to lisp.

It was largely research focused at that point, and unlike the other software being written at the time, didn't need to be written in a language just slightly above machine code level to have decent performance on 80khz processor clocks.
(The IBM 704, the original platform for Lisp, ran one cycle in 12 us, so the "clock" was about 80khz)

>too rigid and inflexible
Another reason Lisp is awesome.
Using lists, you can pretty much make anything *be* anything. That means you can just shove the appropriate elements into a list and BAM, it's magically the correct type to be processed by your "sort-apples-and-oranges-into-separate-baskets" function.
(in that example, I'd probably pass the (list of all unsorted fruits), the (target basket for apples), and the (target basket for oranges) in that order. The function would populate the target lists with the apples and oranges from the unsorted list, and remove them from that list, leaving only other produce (i.e. cucumbers). The target baskets would now contain each instance of apple and orange, respectively).

I can also see that being a drawback, but it totally depends on how you think about the problem and how you name your function.

Re-posting an edited version of a post from last time, since the thread changed right after I posted it.
Then I'm done ranting about lisp for a while.
In response to my posting this Pokémon type calculator:
ghostbin.com/paste/9kgeq
(Cross-thread)
>That's pretty nice, user.
>How do I into Common Lisp?
I did it mostly through google, though prior experience using the HP-28S and HP-48SX calculators was sort of helpful, since the RPL calculators' "stacks and lists" concept isn't really too different from how more 'normal' lisps work.
Also, if you've ever used scheme for automating tasks in GIMP, that helps. Using emacs also helps a bunch since it's scriptability/configurability is due to its use of a lisp dialect.
It feels sort of like python, if python didn't use ALGOL syntax and wasn't slow as shit.
I chose to use SBCL as my Lisp compiler:
sbcl.org/getting.html
sbcl.org/platform-table.html
If you run Windows, try CLISP. I've had luck with it in linux/unix, too: sourceforge.net/p/clisp/clisp/ci/default/tree/
Here's the documents I found most useful, in no particular order:
The official ANSI Common Lisp standard, in searchable (OCR'ed) PDF form (run 'gunzip' on it to decompress it):
unlambda.com/lispm/ANSI X3.226-1994.pdf.gz
This is my favorite, by far, since it's the undisputed 'correct' documentation, but it has the disadvantage of being kind of shifty to obtain for free.
The Common Lisp Hyperspec (google searching for how to do stuff in lisp often returns function documentation from this):
lispworks.com/documentation/HyperSpec/Front/Contents.htm
A repository of ebooks:
github.com/clojurians-org/lisp-ebook
This one's pretty nice, I guess:
github.com/clojurians-org/lisp-ebook/blob/master/ANSI Common LISP.pdf

Revitalized my image recommendation project. Finally got all my tag data loaded into a sqlite database so I can more easily analyze my jerking offs.

>WPF is MIT though
That doesn't change jack shit. It's still a herculean task to make it work on anything that isn't developed at redmond, since it uses windows API's and those windows API's are definitely not MIT licensed.

I don't fucking understand generics, whats the difference between

var Numbers = new List

And

Var Numbers = New List (int)

Ofc the 2 wont work but what i mean is whats the fucking difference in terms of working.

If generics let you use what type you want why do you have to specify what type you fucking want to use

Attached: 1547585670529.jpg (1113x640, 55K)

>Not using Electron for multiplatform easy Programs

You can even write a C++ app in it.

You don't have to specify what type you want. You can filter that post read.

it gives you type safety without having to have a list class for every type

>webkit

this is why you need haskell. What you call generics are either parametric polymorphism or ad-hoc polymorphism. Please, come with me to understand the journey of how "generics" came to be.

microsoft.com/en-us/research/wp-content/uploads/1994/04/classhask.pdf

This Remi a cute!

Fuck off.

thank you this nice OP

haskell tiddie monster > tifa

Attached: 1539827003540.png (850x1200, 938K)

why are you obsessed with this image? what if someone edited it into a non haskell book

Why aren't you?

Attached: 1554947402853.png (643x844, 490K)

>meme sweater
>shitty 60's style hippie headband
>cowtits
>has to push her tits up with a book she never read so they don't sag
1/10, would hit with shovel

Attached: gh.jpg (948x1264, 493K)

Your taste is deplorable.

>used to think a simple for loop was the only way to do things, it's so fast and can do anything after all
>now I just 1 line everything with the perfect uses of FP functions

>used to be horrified of recursion
>now I can't live without it, solve hard as fuck problems in a few lines easy as shit

based

Can you please stop shitting up the thread with your cancerous reddit/v/pol vocabulary

you're a homosexual

working with CI for the first time, to automate builds / releases of a project of mine that is growing mature.
as somebody who loves desktop programming and doesn't do remote web / container shit, it's a pretty annoying experience.
but I want my library to be easily available, new releases to happen without manually going to different OSes and trying to package everything up, etc.
obviously I've been out of the loop for a long time, but software is just weird now. like there's this whole pipeline of cloud infrastructure you've got to deal with, even if you're writing desktop apps. everything depends on everything else. humbug.

I'm reading the chapter 2 of SFML Game Development and try to make my own Resource Manager.

Attached: ResourceManager.png (1912x985, 540K)

why do you have to deal with "cloud infrastructure" if you're making desktop apps

why is it resourceManager.textureManager and not just resourceManager.textures

Becuase you have to have a build process, and a build process needs CI/CD, and then you need testing, bug catching, logging, monitoring, deployments and containerising etc.

All of that stuff is done in the cloud, usually.

is there a reason why input values to a neural net are usually between 1 and 0?
like if possible values are between 0 and 9 and I want to represent a 9 I'd write (0, 0, 0, 0, 0, 0, 0, 0, 0, 1) instead of (9)

Because I find this 2d character retarded? Already the meme sweater makes her pure garbage. There is nothing OC about it. Can we please remain on topic, anime shitposter-kun?

I'm making some libraries open source so other people can use them. but I also want to make binary releases, so they're ready to use without having to build everything first. also it's cross-platform and having to check every commit / package up releases on 3+ operating systems would be an asspain.

what do any of those things have to do with desktop applications? aside from testing and bug catching, but that's a human process

anybody got node-gyp working on windows 10? shit just doesn't work and get

error MSB4019: The imported project "D:\Micros
oft.Cpp.Default.props" was not found.

that's a very long explanation and I'm too lazy to explain it. long story short, you're asking a human to keep doing a repetitive process, with many little steps (a whole checklist of things). if you automate it then the humans can focus on the interesting parts (actually writing code), not going through a 100-step process across multiple computers to produce a new release.

>"meme sweater"
>"There is nothing OC about it"
>HUR DUR NOT ORIGINAL = BAD ALWAYS
>HUR DUR SWEATERS ARE MEMES
No, you fuck off.

have you ever even made an offline desktop application? You don't actually do any of those things

Who are you quoting?

Haven't seen a do-while loop in a while. Took me few minutes to recall what "do" statement even is.

are you trolling or legitimately retarded? either way you don't deserve any more effort.

No
I've sold applications and I have no idea what any of that shit even means

>T-that doesn't change jack shit!!
It sure shows you pulled your claim that wpf wasn't open source out of your gaping asshole

And I'm sure your little one-person toy apps are very useful for the people who pay money for them. But there's so much trivial contract work and ad hoc nonsense out there. If you want to grow up to big boy development, you're going to need an automated, test-driven feedback and deployment process.

>your simple lack of exposure to a concept is evidence of its complete irrelevance to all other humans
great news, go let all the higher mathematics people know they're wasting their time, none of that stuff means anything if you can't understand it!

I wasn't referring to testing, everyone needs to test their applications, I was talking about the other bullshit

>you need to do X to Y
>I've done Y and never needed to do X
>yeah well you're ignorant

You are so stupid that you are a lost cause.

convincing argument

>2nd character
if you don't know Fumika /dpt/ isn't the right place for you.

that's not the meme sweater
retard

Attached: 1545964642730.jpg (2079x2953, 1.69M)

Lisp tip of the day:
Install parinfer if your editor supports it shaunlebron.github.io/parinfer/

github.com/rust-lang/rust/search?p=1&q=madoka&unscoped_q=madoka

Attached: homura madoka.jpg (850x876, 139K)

Is Rust weeb meme language? Like brainfuck?

// why do you do this....
auto texture = resourceManager.textureManager.get(something);

// instead of this?
auto texture = resourceManager.getTexture(something);

// or even this...
auto texture = resourceManager.textures[something];


I also did not expect texture loading to work before a context/window is created.

i'm sure you can find an answer to that in the documentation of the library you are using.

list get_list()
{
return l;
}

auto l = co.get_list();

This is a copy.

list &get_list()
{
return l;
}

auto l = co.get_list();

This is a copy.

list &get_list()
{
return l;
}

auto &l = co.get_list();

This is a ref.

>Mixing tabs and spaces
I'd like to see an IDE with virtual indentation so no matter if they use tabs or spaces or both, I always see whatever I configured the IDE to show me .

But also lang formatters with some strict arbitrary standard set up by the language makers themselves so everybody can have the same format regardless of how they feel about it.

Unnecessarily retarded.

I don't know why some people prefer different operating systems for programming, I see a lot of people using Linux for some programming tasks and Windows for others. Am I just retarded?

...

it's a complex question. sometimes it's just business needs, sometimes it's historical, sometimes just a matter of what you have in front of you.
I'm doing cross platform stuff right now and win, mac, and linux are pretty similarly capable (for what I'm doing). but if you start getting into something specialized (say, video/audio software) then you're going to have to narrow things down to one platform to make something good (but again, that depends on a lot of factors, too).
if I'm writing a server that needs to be hosted somewhere, I'm going to use linux no question. but some people don't have that choice, they're forced to use a microsoft stack and so it has to be windows server / azure / etc.
but if I'm writing a desktop app then I'm going to use win32 because that's what I know and am comfortable with. others would choose osx/cocoa.
you're not retarded, you're probably just not deep enough into anything that would force you to pick one or the other.

Its not because of the kernel but the tools on there

many many years ago, there was this:
nickgravgaard.com/elastic-tabstops/

gae

The manpage of write() mentions both cases where the length is zero or too big.
while the manpage of send() only mentions that when the length of the buffer is too big, it should returns an error,

What is the behavior of send() when the buffer length is zero?
Will the program send an empty TCP/UDP package?
Will it activate the poll() on the receiving machine?

I think it'll send an empty UDP packet, but I can't actually say I've tried myself. I don't imagine it would for TCP.

The best way would be to just try yourself.

Do I use NASM or FASM for my toy compiler?

The correct one.

You seem to misunderstand generics as some sort of super-type to all types. What it actually means is that you can specify a type used with the class, based on whatever constraints are set, if any. This way, you don't need to have separate identical class for every type.

Why is C++ blooming that much all of a sudden?

it's not.
Sepples has been on a slow decline for a decade and a half.

How do i into algorithms and do i have to use a le epic data science language like Python or some speedy low level stuff like C++ or C for them or can i use C#?

Attached: 1543570837891.jpg (749x710, 62K)

Python, C, and C# aren't programming languages. So that leaves just C++.

My ResourceManager class:
#ifndef RESOURCE_MANAGER_HPP
#define RESOURCE_MANAGER_HPP

#include "AssetManager.hpp"
#include
#include

class ResourceManager
{
public:
void loadTexture(TextureId textureId, const std::string& filename);

void loadSound(SoundId soundId, const std::string& filename);

void loadMusic(MusicId musicId, const std::string& filename);

void loadFont(FontId fontId, const std::string& filename);

/*
using TextureManager = AssetManager;
using SoundManager = AssetManager;
...
*/

TextureManager textureManager;
SoundManager soundManager;
MusicManager musicManager;
FontManager fontManager;
private:

};
#endif // RESOURCE_MANAGER_HPP


You mean I should write a getter function for each AssetManager (TextureManager, SoundManager, ...) in the ResourceManager class to have an access to the resources without using the public members of the class?

Like that:
std::shared_ptr getTexture(TextureId textureId)
{
return textureManager.get(textureId);
}

std::shared_ptr getSound(SoundId soundId)
{
return soundManager.get(soundId);
}

std::shared_ptr getMusic(MusicId musicId)
{
return musicManager.get(musicId);
}

std::shared_ptr getFont(FontId fontId)
{
return fontManager.get(fontId);
}
private:
TextureManager textureManager;
SoundManager soundManager;
MusicManager musicManager;
FontManager fontManager;

There are algorithm courses on coursera
coursera.org/learn/algorithms-part1

Language does not matter. The book (sadly) uses java, but it's not that important.

Why tf nobody talking about joe

Attached: real programmers.jpg (500x335, 25K)

Made a gopher server. Then updated chicken scheme and broke it since chicken 5 isn't backwards compatible with chicken 4.

Very nice. It would be even better if it treated consecutive spaces as if they were a tab. I'll try one of the plugins.

install Shen.
shenlanguage.org/osmanual.htm#4. The Core Language

haskell.cs.yale.edu/wp-content/uploads/2015/03/HSoM.pdf

Still working on my wayland-native image viewer. This is the same capture I posted last time, though.
Nothing graphically has changed, I was just writing some infrastructure for my rendering loop. Now it can try to guess when the next frame is going to be presented using the wp_presentation extension as well as through a less reliable fallback. It's useful for driving smooth animations, and APNG/GIF/WebP etc. is something I want. I even found a minor bug in sway while I was doing it.

Attached: output.webm (1920x1080, 2.97M)

God C++ code is so ugly. Imagine having to declare a function in TWO separate files because your compiler is too stupid to check for definitions first.

Attached: 1545007180605.png (593x403, 181K)

>unrendered areas when resizing
I THOUGHT WAYLAND WAS

PIXEL
I
X
E
L

PERFECT
E
R
F
E
C
T

You have no idea what header files are, what their purpose is, how C++ works, or the fact C++ is getting modules.
Fuck off.

Wonderful

Attached: poo sir.png (891x1194, 542K)

It turns out sway kind of sucks at server side decorations. There is absolutely no reason it can't get it perfect, but is still fucking it up somehow. In fact, the top left corner should be stationary, but it's not.
That's something I intend to look at eventually.

he isn't wrong and modules took 20+ years to show up

Yes. Also I wouldn't bother having an AssetManager class at all. Just put the maps directly in ResourceManager.

>cant even implement bresenham's line algorithm by reading the definition of it after 15 years of programming
being a brainlet/mathlet fucking sucks

I wish more Jetbrains IDEs had a free community edition like PyCharm.
I could get them for free with student license but I dont want to have to switch or pay once I get used to them after I graduate.

Attached: Dabi.png (1044x1440, 705K)

>using anything other than Vim
Sad!