/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1530859560033m.jpg (1024x640, 130K)

Other urls found in this thread:

lmgtfy.com/?q=JDBC and JavaFX
en.m.wikipedia.org/wiki/Countdown_(game_show)
nim-lang.org/docs/tut2.html
history.computer.org/pioneers/von-neumann.html
twitter.com/SFWRedditImages

T-they are stealing my smd capacitors, stop them.

I wish tiny anime girls lived in my computer and fixed my computer for me and wrote my programs for me too.

Second for C

nth for the Shakespeare Programming Language

More learn like they are installing it

off by one as always dear Cnile

you son of a bitch
whatever, nth for nim

Attached: DeepFluidKingsnake-size_restricted.gif (334x251, 1.97M)

oops

n is already defined, you should be embarrassed.

> gif
Okey, this is funny

Can someone link me to a sample application using both JDBC and JavaFX? Need to quickly get an application out for my uncle's firm.

>off by one as always, dear cnile

Attached: e5f58daf7659a84b396ea5b63a2216c4103438a8_hq.jpg (1024x576, 47K)

lmgtfy.com/?q=JDBC and JavaFX

Googling gives 1,000 pajeet tier tutorials, all I need is a repo.

>off by one as always, dear cnile
Kek

How will cniles ever recover?

Resl question for nim users.
Why does nim have classes, but without assigned methods to it?

Why not simply use struct then?

4 chan won't let me post the link cause it thinks it's spam, so you will have to type it out manually from the picture, oh it's also the 6th result on Google fucking retard

Attached: Screenshot_6.png (620x117, 10K)

Someone give me an interesting idea for a C++ project

Torn between a crypto-trading bot and implementing my own python interpreter.

Still working on my web DSL thing, gonna start on CSS-related directives soon. Realized I'm probably gonna have to tweak the evaluation model (both branches of if statements are always evaluated, though they have no side effects so It's sort of ok for now).

Also writing a Last.FM API bindings library in Nim using its async library. I'm very experienced with protothread, but I'm still getting used to the different semantics.

I'm shadowing it, fuck u

I wish tiny anime girls helped me solder minuscule SMD components

by him quoting the wrong post, and thus being off as well

...nim has methods, user. structs and classes share one word: object. Classes are just ref objects to other objects, and the method keyword can be used with them.

I'm a tiny anime girl, I'd be happy to help

JavaScript rocks!

Attached: js-rocks.png (1000x494, 286K)

Between those two, the python interpreter. A crypto bot is either going to be either too simplistic and shit or require ridiculous amount of research and will beyond the scope of 1 person

Personally, I'd do the python interpreter. I've done a couple interpreters now, and I find that the bottleneck is always the tokenizer. I'd be curious to see what other people find in their work.

Let's have a moment of silence for people using languages that can't do function composition, the most basic means of abstraction.

compose = (f, g) => x => f(g(x))

#
>crypto-trading bot
i like this idea, i will try it myself

> fast and short project
en.m.wikipedia.org/wiki/Countdown_(game_show)

> letter round and number rounds

this what im working on right now.

Your skill and experience levels, interests, and other factors can make a difference... Or just do a ray tracer or something.

This:
nim-lang.org/docs/tut2.html

>Nim avoids these problems by not assigning methods to a class. All methods in Nim are multi-methods. As we will see later, multi-methods are distinguished from procs only for dynamic binding purposes.

In Java this is just
public class Compose
{
public static Function

Nice.

JavaScript rocks!

Attached: javascript rocks.png (1000x494, 134K)

In JS, with Firefox 58+ compiled with a flag and in all future JS environments, this is just
const compose = (f, g) => x => x |> g |> f;

They can't, the core dumped.

What does this gay syntax even mean?

Seems like a unix-y pipe operator, apparently those are coming to JS. Not a bad addition desu.

>This proposal introduces a new operator |> similar to F#, OCaml, Elixir, Elm, Julia, Hack, and LiveScript, as well as UNIX pipes.

I used to think this was a meme, but holy fuck It's awesome. As a professional C developer who took the Haskell/Scheme redpill a couple months back, I yearn daily for the kinds of abstractions that those languages let you create.
Granted, I wouldn't actually want it in C, as it would make the language less transparent (and transparency is tue exact reason C is relevant). However, maybe one of the up-and coming C++ competitors (e.g. Rust) could find a way to integrate it.

Hmm, I guess their definition is a bit different from the one I tend to use. Methods really aren't used a whole lot in Nim, either way.
I never use them in the Last.FM library I'm working on. I do use inheritance once, however- allows me to leverage the type system to distinguish a normal API instance (just application API key), and a client-authenticated session (inherit the API key, add a client-authorized session key). Since the latter is a perfect superset of the former, both in terms of the data stored in the object and the functions that can be called with it, it works out pretty nicely.

I wish I were tiny anime girl living in your computer user

>used to think this was a meme, but holy fuck It's awesome
You're right on point. Doesn't seem like a huge deal to the naive eye, but it simply makes the most sense. We build our programs of function definitions and calls, why shouldn't we be able to compose those functions themselves without using dumb intermediary semantics like objects?

C obviously gets a pass for being low-level, yes.

>C
>Low level

Don't start, it maps closely to assembly languages and that makes it low(er) level in my book.

Was thinking about writing a multiple choice cli game in python because I think it would be easy to implement would there be any downside to writing a simple game in python or should I go for a different language?

Your book is fiction then

you could do assembly in it
no reason why you'll do it nowadays, but you could.

C is the highest level of crap

How can you say C isn't closer to x86 ASM for example than Prolog is?

It's fine, you can safely ignore any autist who tells you to write in lisp or haskell instead.

at least in prolog the abstractions you make don't end up leaking everywhere

That wasn't the point of the debate though, the point was that C is low lever compared to most other languages.

I cannot really think of any practical downsides. Quite good python games have been made. But, you probably want to determine the structure before you begin

clearly you should write it in C++
performance matter, no way you can be taken seriously of you think otherwise
there's not reason for you to use something as slow as python
clearly your choice of language has the biggest influence on performances

This is like insisting on taking the airplane to the supermarket because performance matter. How many clicks per second do you think he needs? Python also have realm of c implemented libraries so as long as you keep away from huge for loops performance will be fine.

You're the reason why we have so much low quality and bloated software today

You're the same as people who kept touting that assembly is the only thing that matters when C came around.

nah C is shit

C came a bit late for that, but it reminds me of how autistic von Neumann was about assemblers and fortran.

> In the 1950s von Neumann was employed as a consultant to IBM to review proposed and ongoing advanced technology projects. One day a week, von Neumann "held court" at 590 Madison Avenue, New York. On one of these occasions in 1954 he was confronted with the Fortran concept; John Backus remembered von Neumann being unimpressed and that he asked, "Why would you want more than machine language?" Frank Beckman, who was also present, recalled that von Neumann dismissed the whole development as "but an application of the idea of Turing's 'short code."' Donald Gilles, one of von Neumann's students at Princeton, and later a faculty member at the University of Illinois, recalled that the graduate students were being "used" to hand-assemble programs into binary for their early machine (probably the IAS machine). He took time out to build an assembler, but when von Neumann found out about it he was very angry, saying (paraphrased), "It is a waste of a valuable scientific computing instrument to use it to do clerical work."

history.computer.org/pioneers/von-neumann.html

Attached: Von_Neumann_5.jpg (590x400, 54K)

It's my girlfriend's second whole day as a software developer. She is using some intellij IDE thing. They gave her socks with the company name on them.
Let's all wish her luck!

>They gave her socks with the company name on them.
programming socks or just normal socks?

also
>she

is it okay to use visual C# to quickly make a frontend for my c++ program?

Fascinating story user. Funny how some people, even the brightest minds, initially fail to see the joys of abstraction.

Jej

Seething js brainlet

stupid Cnile poster

C is pretty nice, simple yet powerful.
t. JS mastermind

>Quite good python games have been made.
Can you give some examples? Not of a cli game ofc, but of something more "good" and capable of doing decent physics/graphics.

Personally I'm not aware of any modern game engines that use python as their main language. Godot has GDscript which is pretty close to python but still it isn't python. So if you want to make games with python you either have to use outdated and rather limited engines like pygame or make your own. Also, GIL gets in the way.

Attached: trine.jpg (1920x1080, 557K)

>clerical work
programmers eternally BTFO

Attached: 1545614347223.png (2000x1658, 1004K)

>Von neumann
>brightest minds

it's not a game if it has fancy graphics

Attached: 1519679628148.jpg (850x601, 115K)

Is there anything worse than processing data from textfiles where there is no guarantee that the source is properly formatted?

Holy fuck

This, but they were cockroaches who laid eggs in your case because it was the warmest place in your room, and they will all hatch in march

I suspect the issue wasn't abstraction but redundant indirection. There was only one machine code to account for. Could be wrong.

Maybe I'm retarded, but I thought most languages let you do that?
For instance if g is parameterized for an int and f returns int too, you can just nest them like that

von Neumann was extremely intelligent, he contributed to a lot more than just CS.

He is the einstein of CS, take that as you will

You can nest the calls like f(g(x)), but you can't always create a new function h(x) that's just like the two initial functions but returns the result of piping data through the two initial functions.

He was primarily a mathematician and physicist. Read a book or at least the wikipedia page, retard.

>negatives of boxed primitives:
>They are worse than primitives in all regards

>benefits of boxed primitives
>Java is a shitty language and you can't typecast primitives, so you HAVE to use them

Amazing

That was a higher order function. The nested call expression was the body of a HO function (generic functions used in place of specific functions).

The other user is not quite right, depending how you look at it...

One form of abstraction is having parameters replaced with actual values. In this case those values are themselves functions, but would typically be data parameters.

Text-based macros (e.g. as used in C and assembler) do something similar but with parts of expanded text parameterized.

Or you can look at it as procedural abstraction, that could apply to their example too. Or, lambda calculus is all about mixing and matching various combinators.

Stuck with Legacy Scala uh? Maybe one day we can finally get decent re-specialisation and put Scala & the LSVM firmly into the 21st century...

Would that be the same effect as following in Java and most other languages?

var compose(var x){
return f(g(x));
}

or as lambda simply

Function func = y -> {return f(g(x)) ;};

>Jow Forums, the "smart" board
>can't write an algorithm that stacks 5-dimensional spheres optimally

Attached: 1518317287460.jpg (319x320, 13K)

Nah, that compose function doesn't take f and g as arguments and return a new function that takes x, instead it just applies x to two fixed functions that are defined somewhere inside the scope.

var compose = function(var f, var g) {
return function(var x) {
return f(g(x));
}
}

var h = compose(f, g);

h(1) // same as f(g(x))

I think you're mistaken, Jow Forums is the stupid board

you first

does it have to be efficient?

composition should be an operator anyways, it's a crime against humanity to make it as verbose and make chaining impossible

found the haskell faggot

No, but the stacking must be provably optimal

If you think about it rationally, not programming in Haskell is the cuck thing to do. You're doing the compiler's work, performing menial tasks because your language lacks the abstraction. Only to have your code run on somebody else's computer. Think about it logically.

1) encode the solution as array of input values
2) define fitness function
3) try all permutations of solution array
4) return solution with highest fitness

done, next.

brilliant

this is what you get when you don't ask for efficient

Roll for a project if you're bored.

Attached: progChal.png (3840x2160, 1.61M)

You generally can't compose functions, in a non-functional language, with a value that is itself a function...

Forth is very good at chaining function calls together for instance, but that isn't the same as dynamically creating a new function. Not quite... Forth probably could be used to compile a new function but nevermind that possibility...

You could simulate having functions as a composable object with data structures much like those that would be used in an interpreter. That way you would actually invoke an "eval" function that takes both an interpretation context/environment/definitions and the actual parameter. e.g. eval(&F, x);

The disagreeable Java code above is doing things not unlike that, making the baggage of a functional language compiler explicit instead of implicitly hidden.

Of course you can compose expressions in any language, at least conceptually if not with builtin support, to some degree. But that would usually be as an expression not a functional object.

"operators" shouldn't exist, everything should be a function.

Disagree, operators improve readability, and they should be definable just like functions.

Has anyone here actually used object inheritance in a non-trivial manner?
What I mean is "Apple is descendant from Fruit which is a descendant of Food" sounds good in a classroom but I have never found a practical use for it

I don't mean interface inheritance, I use that all the time, I mean actual object inheritance.

I seen this list has fizzbuzz, which scares me deeply, but I'll roll anyways.

Just give the users the ability to define the fixity of a function.