/dpt/ - Daily Programming Thread

What are you working on?
Previous:

Attached: 1492832377473.png (1052x1342, 769K)

Lisp is the most powerful programming language.

Enjoying Smalltalk immensely.

C++ is the most powerful programming language.

Attached: 1500661449764.png (1920x1200, 2.27M)

Anyone here ever made a page with the intention of gaining passive income?

Should i bother building the site from scratch? Wordpress would speed things up.

not really. i just invest in the stock market with a percentage (read: play money) of my paycheck every so often

I want to use a small app to track my spells/abilities for ghost archipelago.
The available app on google play doesn't work.
Do any of you guys know of any apps that start with a "blank" spell book, and let you enter the information? Alternatively, any spellbook style app that's open source, or will just allow me to mess with the resource files?

good idea lad. have a decent amount of disposable income now. trying to figure out how best to invest

could you take one of the many to do list apps that are out there and tweak it?

What can you tell me about Cloud Haskell? Does it provide any tools for easy app inspection and hot updates? In other words, is it as nice as BEAM?

That's probably what I'll end up doing. Thought I would see if there's anything more appropriate to start with first.

probably obvious but don't buy penny stocks
it'd be easier to just set fire to your money

I'm making a program that will be able to draw spinning swastikas and stars of David on the terminal. I have a problem two clashing overloaded constructors:
public Vector(double x, double y) {
// ...
}

and
public Vector(double length, double theta) {
// ...
}

Basically, I want to be able to construct a Vector either from the xy coordinates, or from its length and angle. What is the most elegant way of making the two constructors not clash?

does this general not have a op with a guide or smt

na lad. literally began researching this week. i've read a bit. would you recommend it?

it's not for everyone, but read investopedia and make that decision for yourself
also look into vanguard funds

Maybe you could add a third parameter to check if it should be a star or swastika?

Cheers lad. Appreciate it. Was mainly looking in to building a site because it was more passive and I wouldn't have to be checking stock values every day.

why doesn't ruby come with a repl if its reference implementation is interpreted?

What happens when you type "irb" in a terminal?

These are just the vectors that will be used for building lines, which in turn will be used for building swastikas and such. Like a line will be defined by two vectors that denote its endpoints (I should probably rename line to segment btw).

well if you look into investing long term, you don't really need to check everyday. just look for stuff where you can park your money for 5-10, 10-20 years and let it grow on its own.

1) use a 2 element array for the x,y. Continue using two doubles for the length/angle one

2) Make two separate classes that implement the same interface.

doing my fucking Java assignment

Attached: 1515334885798.jpg (384x384, 27K)

What is 'irb'? Literally page 1 of every Ruby book ever.

>using a book for ruby

I'm not an ADHD-riddled millennial; so, yes, I do read books.

What's it about?

It's static. You can change a node but can't send runnable closures over if the other side is missing the functions. To get BEAM style hot updates you would have to use a serializable EDSL as haskell compiles to native. If you want type safety in your EDSL take a look at GADTs, Tagless Final, and Delimited CPS.

Note that the EDSL way is much nicer than BEAM as you can ensure type safety if you play right with the type system or use a dependently typed language.

I have to create an "inventory management system", complete with stock lists, pricing, sales, money management, orders etc and implement a GUI

It's a partner assignment but my partner knows fuck all about things like classes and objects so it's basically going to be a "me" assignment :(

So which Lisp should I learn? Common Lisp?

When making C library, should I be worried about how many functions I define?
How much does one function increase the library/executable size in general case?
How about static functions in header files included in multiple compilation units?

Clojure.

Code gets compiled into instructions. Your library side is the sum of all instructions

I ultimately opted for privating the constructor and creating two factory methods "fromPolar" and "fromCartesian".

Common Lisp is the only relevant Lisp.
The scheme rsr{4,5,6,7} do not provide fully functional language.
There are so many scheme implementations, all incompatible but they still provide the same features as CL but without the portability.
There are many high quality Common Lisp implementations(some commercial) being actively developed.
Always prefer standardized language with multiple implementations.

Can I have delimited continuations?

Not sure what those are exactly but some scheme compilers do not implement continuations at all because they can't implement them efficiently. Some implement them but discourage the use of them because they are not efficient.
call-cc just convolutes code, I have never seen it properly used.

still tho
>using a book for _ruby_

I want to C her pussy
Those are some C++ titties

Learning software rendering with the Windows API. I'm wondering, how do I force Windows to redraw the whole Window? I have a single framebuffer/bitmap I want to draw on the screen every frame fully. But right now, not every area of the screen seems to get updated. In the image here, there should be two lines, one of them moving towards the right, but for some reason some of the previous frames are also visible (that is, where the line was earlier).

Attached: Untitled.png (799x597, 8K)

> Ruby is so easy that one can just guess its syntax and methods
How else are you meant to learn it?

>don't use a book for ruby
>come to Jow Forums to ask retarded questions like

>I learn from web tutorials

Attached: 16e.jpg (680x723, 40K)

I learn programming on the youtube feed of a israeli folk dance teacher who drives buses

>I want to C her pussy
So you want to buffer overflow her pussy?
That's pretty lewd.

Option 1: don't use a constructor directly. Use a private constructor that simply sets fields, and a (named) static method to choose which way you want to set them.
Option 2: add a dummy parameter to disambiguate the overload. C++ does this a lot with types like std::in_place_t.

I've been trying RedrawWindow(), UpdateWindow() and InvalidateRect() but none of them seem to do anything. I'm on Windows 7.

>How about static functions in header files included in multiple compilation units?
That bloats binary size tremendously. You should learn how inline works and use that.

a function will only increase the size of the executable if you actually call your function in the code.

>In Common Lisp, iteration via recursion is not an established paradigm. Mostly that's because, unlike Scheme, Common Lisp does not guarantee that tail recursion will be “optimized.”
into le trash it goes

Attached: c++ommonlisp.png (654x403, 29K)

you better start learning Emacs, LispWorks is the shittiest IDE I've ever dealt with.

Only at link time. That might not be what you want if you're making a library.

It's good practice to make symbols static where possible.

>Bitches about inconsistent compiler support for Scheme extensions
>Defends inconsistent compiler support for Common Lisp extensions
C++ommin Lisp: not even once.

Delimited continuations are restricted in that they can't handle as much as call/cc but better in bein more precise. You can use them like call/cc to escape from redundant computation or freeze a computation for further evaluation at a later point in your program.

> can't implement them efficiently
This is simply wrong. Continuations are a natural transformation for funcitonal programs and are only difficult if your compiler isn't CPS based.

> call-cc just convolutes code
Depends on what you do with it. Treating it like a goto won't ever end well. Treating it as a way to save progress / return to a previous state is.

Note that haskell is continuatioons by default.

>the following implementations
of which how many are open source?

lispfags, when will they learn

Use FillRect to clear the window before drawing, you doofus.

ccl, cmucl, sbcl, ecl, gcl, abcl
Only Allegro and LispWorks are closed source.

READ
THE
STICKY

To add to that list the new CL compiler clasp which is open source, no idea about the TCO support but the code is influenced by ecl so I assume it's same as ecl.
There's also Corman CL which was commercial but it was open sourced few years ago.

of which how many have full tco?

I tried that, it doesn't help. And I didn't see it used in any examples either. I'm pretty sure my code is very similar to that in Handmade Hero for example where he doesn't use fill rect, but for some reason I'm not getting it working.

>Always prefer standardized language with multiple implementations
Why would you think dealing with multiple implementations is better than dealing with just one?

ccl, cmucl, sbcl, in total 3 implementations.

Not him, but SBCL is the only relevant choice.

Post code then.

Some implementations might be better for different platforms.
If the support for one compiler stops you there would still be other implementations.
For windows sbcl works but ccl works better. Also sbcl didn't support threads on arm platforms few years back, I think now it does but ccl has always supported them. SBCL is fork of cmucl so they shouldn't be that different, both are still maintained.

Here's what I call every frame (not inside WndProc, tried that too but the result was the same:

RECT cr, wr;
GetClientRect(win->data->wnd, &cr);
GetWindowRect(win->data->wnd, &wr);

int fw = cr.right - cr.left;
int fh = cr.bottom - cr.top;

int dx = (wr.right - wr.left) - cr.right;
int dy = (wr.bottom - wr.top) - cr.bottom;

StretchDIBits(win->data->dc, dx / 2, dy - dx / 2, fw, fh, 0, 0, fw, fh,
fb->data->mem, &fb->data->bitmap_info, DIB_RGB_COLORS, SRCCOPY);
InvalidateRect(win->data->wnd, 0, FALSE);
RedrawWindow(win->data->wnd, 0, 0, RDW_UPDATENOW | RDW_INVALIDATE | RDW_ERASE);


The last two lines don't really seem to do anything. And the weird thing is, it seems as if parts of the window only get updated if I move the mouse or something atop the window.

so 30% of the CL implementations support a core language feature that radically changes the approach of writing most code
this is XMPP-tier "standardization", or what said

You are fucking retarded.

my nipples are getting erect seeing you this booty blasted

Instead of bitching about relatively minor differences, why don't you go and code some Lisp?

It's been a while, but I'm pretty sure you're only supposed to draw in your WM_PAINT handler, between your BeginPaint and EndPaint calls. Isn't that how Handmade Hero does it?

> minor differences
It's the difference between stack overflows and code actually running

Yeah but SDL2 for example doesn't do that. And I've tried that (I just did it like this because I wanted easier cross platform compatibility), yet I had the same results that way.

I've used Lisp for years; never once had this problem.

>why don't you go and code some Lisp?
gave it a shot, was disgusted with how useless it is for real life productivity

functional programming in a Lisp-2 is a chore anyway

>I've used assembly for years, never once had a problem with recursion cuz thats for quiche eaters

I can't even program in mutable state anymore... feels disgusting to even look at.

>Totally disregarding commercial implementations.
>thinking that 3 open source implementations is somehow worse than only 1 implementation developed by one entity
>replacing simple loops with recursions just because

You know what's even less productive than Lisp?

Arguing about that same relative non-productivity on here.

>Lisp-2
>The namespace for function names is separate from the namespace for data variables.
eww

> needing mutable state

You obviously don't use recursion

So we should just avoid the broken ones then?

>I need every minute of my waking life to be monkeying code, or I'm not productive
sorry bout your life turning out that way lad

the ST monad is as close as I'll go

>charging for a interpreter/compiler/runtime is totally not an issue
>what is ADA

>having to do the interpreter/compiler's job instead of just using a direct translation of the algorithm from its domain
ironic coming from the "DSL uber alles" crowd
you lot really are stuck in the past, aren't you

Testing compiler / interpreted environment in a new machine
Tier 1:
Most language :
>print a "Hello Worlds"
Basic:
>print a "Hello Worlds"

Tier 2:
Most language:
>generate and print a fizzbuzz
Basic:
>print "Hello Worlds" indefinitely

>>charging for a interpreter/compiler/runtime is totally not an issue
Being closed source does not imply it costs money.
Charging money for a interpreter/compiler/runtime is pretty common for at least fpga developing and other embedded programming.
Don't know but I assume most of Microsofts tooling is also closed source.
There are many compilers for C and C++ that cost money.
You would know this if you had actually done any real work in your life instead of just being functional masturbator.

>Charging money for a interpreter/compiler/runtime is pretty common for at least fpga developing and other embedded programming.
m8 hardware's a whole nother ballpark
I mentioned ADA for a good reason - it tanked largely because there was no non-shit open source / free compiler for it until it was too late.
Real shame too, something like it is sorely missed in the systems programming scene.

Trying to render text in OpenGL. Everything I try looks like arse.

>You would know this if you had actually done any real work in your life instead of just being functional masturbator.
>unironically said by a lispfag
lawdy

Common Lisp is not "functional", it is multiparadigm and it does not promote functional programming, that's just misconception spouted by retards and schemefags.

>spending money on information that's freely available

Attached: brainlettttt[1].jpg (800x450, 41K)

That's what you get when your idea of language design is slapping together whatever Lisp dialects are popular at the time.

Commonlisp is also the bloated lisp out of the bunch with the most warts.

2 namespaces? The most retarded thing I've ever seen. Either have multiple namespaces support or single namespace but now an arbitrary number like 2.

Interesting. If you're 100% sure it's not because you're painting to a window without going through the correct procedure, I'm afraid I can't help you.