/dpt/ - Daily Programming Thread

Old bread What are you working on, Jow Forums?

Attached: 1486421329689.png (1280x720, 972K)

Other urls found in this thread:

reddit.com/r/programming/comments/13ccbh/reddit_was_originally_written_in_lisp_when_it_was/
rust-lang.org/en-US/friends.html
stackoverflow.com/a/495056
en.wikipedia.org/wiki/Aspect-oriented_programming#Criticism
rtyley.github.io/bfg-repo-cleaner/
codegolf.stackexchange.com/questions/1956/generate-the-longest-error-message-in-c
twitter.com/AnonBabble

I gotta do an assignment using linked lists for adding / subtracting large numbers
Kinda dumb

a dynamic array sounds better for this task

Thought problem:
I need to write an algorithm which will generate an infinite maze. There is no well defined start or end, the intent is to basically wander forever. The maze can make use of non-euclidean geometry, and wrap over itself. So if you're in a hallway, make a left, then another left, you can find yourself in a new hallway that would logically intersect the old one, but is simply a new area.

What I'm stuck on is how to approach the generation of the maze itself. Would starting with a simple 2D array and only permitting right angle turns be a decent approach? I figure if I get that working I could scale it up and increase the size of the grid but apply it to the same "space", which would allow me to use curved paths and such without much rewriting.

i want to fug gab-chan

I would represent the maze as a tree.

Trying to use Thema ExecutorService to calculate Thema PrefixSum of arrays, but i cant wrap my head around the exservice.

That seems like it would be extremely costly because I'm essentially generating new maze as I go along. I forgot to mention that for now, doubling backing doesnt need to lead to the original areas, just to keep it easy.

Was about to suggest a tree as well. If you want the whole thing to be "non-euclidean" in the way you described, a tree should be enough.

In that case, can't you just keep track of the current area and procedurally generate everything?

Is there any reason why I shouldn't use Firebase for a desktop dev project? A magical real time database would be a godsend for one of my current projects, but the Firebase ecosystem seems to be very mobile-centric. Are there any desktop friendly alternatives?

>I forgot to mention that for now, doubling backing doesnt need to lead to the original areas, just to keep it easy.
Then it's hardly a maze, you would get the same thing by simply offering a random number of directions at each step where the direction doesn't actually matter, every step just gives you a new set of directions. Otherwise, you can't get out of storing the past cells. What is inefficient about storing moves in a tree? Just keep a pointer to the current cell. You can even do this in a pure functional language like Haskell with a zipper.

Correct, which is what I'm trying to figure out how to approach.
Ultimately there will be multiple player objects moving through the maze, and none of them should bump into each other, which should be pretty easy by just doing lookaheads and generating new maze based on that for both players.
But for now, just the one. Is a 2D array a bad approach for this kind of thing or? I'm not sure how to apply a tree to this per se.

See above. It's not a maze, it's just easy to describe it that way. Also this will eventually be applied to actual physical spaces, so the non-euclidean redirect is important to keep people within the literal bounds of the movement space.

Basically I'm just not super sure where to even start prototyping this. In concept I know what needs doing, but I'm just a little flummoxed as to where to start writing.

>new thread
>at 220 posts in old thread
OP is a faggot

>non-Euclidean
>grid
Silly user. Mazes are easy to represent as trees, each node has a child for each direction you can continue on with (except backtracking). Directed acyclic graphs if you want paths to be able to join up.

my b, I wasn't wearing my glasses. Thought it was 308, not 208.

If you only need to keep track of a single spot, why would you need an array? If you're never going to revisit a once-left area, there's no need to store it.

decent excuse, but talk is cheap
you're shitting up the board with your sloppy shit, thus it's time to shit up the thread (more than usual!) in response

ur waifu a shit

Seemed like a logical place to start since the idea is to loop the player around inside a certain space, and just for visualizations sake.

Gabu is for headpat, not for lewd

>can [...] wrap over itself
ya dumb fucks
which means a generic graph

Retard.

I'm writing a word search solving program that takes in a puzzle file and word list as a dictionary which I sorted using a TreeSet(java btw). Now I just need to make it solve the puzzle.

nimrod

Say you represent the maze as a tree where each node can have up to 3 children (so 4 cardinal directions). If you have 4 left children in a row, the maze is intersecting itself, but that's okay because OP specified non-Euclidean. Going from a tree to a graph would allow paths to split and join up later or go in cycles.

what is your favorite language?

English.

desu languages i don't know and never have used look cooler than everything I know

"can wrap over itself" is generally understood to mean "the path can have loops", i.e. a node in the path can point to a previous node in the path.

No, I don't think so.

What do you think, then?

>The maze can make use of non-euclidean geometry, and wrap over itself. So if you're in a hallway, make a left, then another left, you can find yourself in a new hallway that would logically intersect the old one, but is simply a new area.
I think he was elaborating on the non-Euclidean aspect.

>find yourself in a new hallway that would logically intersect the old one, but is simply a new area.
Ah yep, you're right. I skimmed too quickly and didn't notice this part.
Cheers, that was what I was missing.

How does webgl performance compare to native performance?

Shit.
It's still pretty good for what it is, but compared to native OpenGL straight-to-hardware code, it's shit.

>not batching every single thing into a single drawcall

WebGL isn't accelerated? What the fuck is the point then?

Erlang Vs. Common Lisp?

Common Erlang.

erlisp?

erlang is actually used by more than hobbyists.

>algebraic enums

Attached: thatgayshit.png (345x345, 190K)

>maxima
>allegrograph
>reddit
>hackernews
well some serious software is written in CL

what capacity is it actually used in maxima?

Used to be written*

>reddit
>hackernews
christ user. can't you mention autocad? if you limit yourself to the neckbeard lisp you'll have to reach for that shit.

>reddit
Is this supposed to be an endorsement r a denouncement?
What would such a thing even look like

A common lisp meant for concurrency ? Erlang but with extreme metaprogramming?

There's nothing that stops you from writing a lisp for the erlang VM. It already exists actually and it's called lisp flavored erlang.

Yes yes yes dear user
However
What about black hat erlang?

>can't you mention autocad?
Sure but it's only used for scripting and it seems autolisp is lisp dialect, I was talking about Common Lisp.

>Is this supposed to be an endorsement r a denouncement?
some faggots think that software is "good" if it's used by lot of people. Otherwise I would not even mention them.

template
void sort(It first, It last, Comp comp);

/* ... */

sort(foo.begin(), foo.begin()+8, [](int a, int b) { return a > b; });

>void Example::sort(RandomIt, RandomIt, Compare) [with RandomIt = __gnu_cxx::__normal_iterator; Compare = main(int, char**)::]', declared using local type 'main(int, char**)::', is used but never defined [-fpermissive]

Just wtf, am I doing wrong, I've been stuck for so long on this shit now.

I should have sticked with the brainlets languages...

I'm consider an okayish-haskell programmer. I just started looking at Idris...and my brain hurts. Will this get better? Or am I just a brainlet?

I've just GADTs before, but Idris type level magic confuses me.

>radditz
>rewritten 12 years ago, once they had real-world requirements
reddit.com/r/programming/comments/13ccbh/reddit_was_originally_written_in_lisp_when_it_was/
>If the Lisp community is still butthurt over this, that sounds like a personal problem.
>All five of them are really really pissed.
>Wow, they've seen some growth recently.

>In the second paragraph of the first chapter of Practical OCaml you can read
>>OCaml is not a popular language in the way that Java is a popular language. Flame wars rarely break out over non-Lisp languages that are not in the mainstream.

>ocaml
>no native thread support
>no unsigned types
>boxed types
>shitty FFI
>no macros, have to use external tool
>;;
Ocaml is shit
consider SML, SML# or actually good programming language

Did you actually define the body of the function any where?

Paul Graham did take it personally and did show that you could run a reasonably large reddit clone in lisp, so there's that.

yes.

no dog in that fight m8, I'm disappointed by the MLs for small-scale fucking around and have chosen to invest in other PLs.

It took me a little while for dependent types to "click" but afterward it was smooth sailing. Maybe look into first-order predicate logic to understand the logical basis of dependent functions & pairs as universal & existential quantification.

pg being butthurt by something is usually an endorsement for said something
c.f. michael o church

nvm I forgot to add it in the makefile.

Attached: 1512084790765.png (207x243, 15K)

it happens; linker errors are usually obtuse to me trying to figure out too.

Rust doesn't have this issue :^)

because nobody has ever tried to build rust program because there are no programs written in rust

rust-lang.org/en-US/friends.html

>we re-wrote one tiny module in Rust, see Rust is production now!
Call me when companies 100% switch.

>Aspect-oriented
>Role-oriented
>Subject-oriented
Which one is best for seperation of concerns?

my dick oriented

Aspergers-oriented

>stackoverflow.com/a/495056
wew... I'm starting to understand why everybody hates on sepples.

>Aspect-oriented
>literally COME FROM
lawdy
you're suggesting GOTO-tier programming for "separation of concerns", despite it in effect doing exactly the opposite

en.wikipedia.org/wiki/Aspect-oriented_programming#Criticism
>The most basic criticism of the effect of AOP is that control flow is obscured, and is not only worse than the much-maligned GOTO, but is in fact closely analogous to the joke COME FROM statement.
>"one must, in general, have whole-program knowledge to reason about the dynamic execution of an aspect-oriented program."
>The problems with pointcuts are deemed intractable: if one replaces the quantification of pointcuts with explicit annotations, one obtains attribute-oriented programming instead, which is simply an explicit subroutine call and suffers the identical problem of scattering that AOP was designed to solve

That's a babby level complaint. Templates in headers makes perfect sense, you need to dig deeper into sepples to see the really awful stuff.

role-oriented
>what does this do
>ok that's all it has control over

>AspectWerkz
kek

>I don't understand templates the post

>Given the power of AOP, if a programmer makes a logical mistake in expressing crosscutting, it can lead to widespread program failure.
>Conversely, another programmer may change the join points in a program – e.g., by renaming or moving methods – in ways that the aspect writer did not anticipate, with unforeseen consequences.

What is the difference between CMake, autotools, and manually written Makefile?
Which one is preferred most of the time, and why?

Starting the second chapter of SICP, the box-and-pointer notation is CUTE!

Attached: IMG_20180330_223312.jpg (3264x2448, 880K)

>closely analogous to the joke COME FROM statement.
For example, compare the COME FROM program:[12]
5 input x
10 print 'result is :'
15 print x

20 come from 10
25 x = x * x
30 return

with an AOP fragment with analogous semantics:
main() {
input x
print(result(x))
}
input result(int x) { return x }
around(int x): call(result(int)) && args(x) {
int temp = proceed(x)
// return temp * temp
}

It is accelerated but the browser adds huge overhead onto every drawcall. The performance of draw operations once they reach the GPU is identical, but before that they have to filter their way through Javascript bullshit, security bullshit, browser bullshit and driver bullshit. You can get performance that is identical to native if you're just drawing one thing though.

I'm eagerly awaiting webvulkan so that we can cut out all the middleman software layers and just run whatever on the GPU.

If AOP is so shit why do all PLs that are relevant (Ada, Haskell, C, C++, .NET, Java, etc.. ) 'implement' it? Only few relevant PLs implement such as Perl and JS.

Wouldn't webvulkan make things way, way, way worse? vulkan's speed comes from being basically a diy abstraction layer. When you have to write that shit in javascript, lol.

Vulkan lets you prebuild command buffers though. Building a command buffer set to draw the scene would be slow as shit, but once it's there you could use it basically for free. You'd probably get native performance for static scenes.

cmake is best, despite the atrocious script language. supports all toolchains
autotools is a generator of 10k+ lines build scripts which is slow as shit and also unusable on windows. never use
makefile is ok for projects so small you don't need file dependency tracking

so tired literally can't pick up a new book
corporate is killing me sould my dudes ;_;

The code you have to write for Vulkan that you wouldn't have to write for e.g. OpenGL doesn't involve any heavy lifting.

Haven't used autotools. CMake is nice, might need to dig through the documentation a bit to find the stuff you need. For small projects I still prefer a manual Makefile. CMake is definitely a good choice for bigger stuff.

What would be a good language for a music program that allows you to link your Spotify or whatever and set a certain amount of time (e.g. 2 hours) and makes a playlist that is exactly that length?

python for the quickest and dirtiest
literally any language that can do basic networking though.

is there a way to "pretty print" recursive data types in Haskell?

I've got a data structure:
data ProofRecord = Record ProofConjecutre Rule [ProofRecord] | Empty deriving(Show, Eq)

and for long proofs it is basically just a wall of text so it's a bit hard to follow. Is there an easy way to make lists on a newline or do I just implement Show for my class manually?

So I accidentally pushed a file to git that contains an API key. Thankfully it's a private repo, but I was planning to make it public at some point. Is there a way I can modify past commits to remove it?

Yeah stop using git - you don't need that - it's made for big projects like the kernel.

Yes. You can either do it manually through a rebase, or use a purpose-made tool, for example I've used this one rtyley.github.io/bfg-repo-cleaner/
Either way you'll want to preserve commit times; both have options for doing this. You'll also be changing all the commit hashes from that commit on, but if it's for an initial OSS release that shouldn't be too big of a deal.

Yeah yt-downloader is made in python. Otherwise javascript because of spotify.

None. Do single translation-unit programs (all included). The compiled program will be better.

codegolf.stackexchange.com/questions/1956/generate-the-longest-error-message-in-c

I wish that concepts had made it into C++11 instead of being thrown out at the last minute back in 2009. They've been delayed for ridiculously long, and the version we're finally getting in C++20 is weaker.

Concepts make template error messages so much nicer that it's not even funny.

>just copy and paste your code into a new folder every time who needs version control that's for scrubs

#include
#include
int main()
{
int a;
std::vector< std::vector > v;
std::vector< std::vector >::const_iterator it = std::find( v.begin(), v.end(), a );
}

Gives a 15 kilobyte error message in gcc.

reworking on my homemade bash until sunday. Gotta implement pipes and redirections too. Also working on a 8bit-like final-fantasy-ish rpg with CSFML, any advices?