/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

fabiensanglard.net/c/index.php
ferret-lang.org/
github.com/drmeister/clasp
twitter.com/AnonBabble

trying not to be evil

i think you need to diversify yourself more user

Minecraft clone. Added polymorphic behavior to right clicking last night. Working on macros for creating new blocks easily right now.

Why haven't you posted code yet? It looks quite interesting.

Pickle Rick simulator in VR with Unity/C#

The 'A' one relies on chars being ASCII.

Why do you want to steal his code?

Forgot to add in parenthesis (Assume the character set is ASCII)

Why make dis?

Daily reminder that god's temple must be perfect

I don't want to steal it. I'm curious as to how scheme is being used and how it interacts with C.

Rick and Morty is a normie meme, please return to Reddit.

I use Python to write a bunch of web scrapers and shit and some toy stuff like scripts for displaying graphics in the terminal for desktop thread screenshots

I bought K&R and started going through it and am so shit at programming. Should I even keep going? I'm stuck on this fucking reverse polish notation calculator but I wrote it in Python in like five minutes.

Maybe read an actual C tutorial book and not a reference book.

But fabiensanglard.net/c/index.php

It is the best text on C, but it's a reference text for most people. Trying to learn from it if all you have been exposed to is python scripts, you may struggle and think you're retarded. And you may be, but give yourself a fighting change.

I post snippets of it all the time. I'll release it in due time.

Here's what I wrote today:
(define-syntax make-block
(syntax-rules ()
((_ name constructor methods ...)
(begin
(define name constructor)
(hash-table-set! block-table (quote name) name)
(make-block-class name methods ...)))))

(define (partial-capture macro captured)
(er-macro-transformer
(lambda (expr rnme cmpr)
(append (list macro captured) (cdr expr)))))

(define-syntax make-block-set-verbose
(syntax-rules ()
((_ (slab-upgrades full half player-place! slab-player-place!)
name name-slab (constructor args ...))
(begin
(make-block name (constructor full args ...))
(make-block name-slab (constructor half args ...)
player-place! slab-player-place!)
(set! slab-upgrades (cons (list name-slab name) slab-upgrades))))))

(define-syntax make-block-set
(partial-capture
'make-block-set-verbose
'(slab-upgrades fullblock_model halfblock_model player-place!: slab-player-place!)))

Here's it in use:
(make-block-set stone stone-slab (make_ultrabasicblock SOLID blocksheet #f 1 0))

This macro will get more and more useful (and longer) as I add different block shapes that you'd want to define at once (stairs, fences, etc.)

And this was what I posted last night Why not?

nodejs thermostat with logging and graphing of system efficiency.

Nothing. Sitting here bored to tears dreaming about finally having an idea that will make money instead of actually doing something about it.

i have a multi-dimensional JSONArray in Java, whats the best way to transform it to a set of atoms? eg, i want to take JSONArray "[[1,2],[2,3]]", and produce HashSet {1,2,3}, without spendinging an hour writing and debugging it.

ive been spoiled by better languages and juggling types from JSONArray to Array[x,y] to Array to HashSet seems fucking retarded to me.

What am *I* working on?? Hahahahahhaha

Reduced the number of shift/reduce conflicts in my parser from 12 to 1 with the magic use of parentheses.

Would you guys pick a single thread and stick to it?

So js does pic related when i want to print the hex representation of a float.

Except 10.8 float is stored as 0x412ccccd, how can i get this instead of a.cccccccccd??

Also why do we have code tags when i cant even post a simple code like pic related?
Fuck you Mook.

I'm working on figuring out why you posted this when the "old" thread only has barely any replies you fuckin doofus.

>Also why do we have code tags when i cant even post a simple code like pic related?
var x = 10.8;
x.toString(16);

Shit, I didn't realise I linked the wrong thread.
It's pre-bump limit Sup Forums shit and is invalid. I wish the janitors would get off their asses and delete it.

how

>>> var x = 10.8; x.toString(16);

"a.cccccccccccd"

how what? How did I put code in a code tag and hit post?

WTF?
Stackoverflow is sensoring comments?

I dont get it, why does it work now.
Before it dropped me back to Sup Forums

It's actually a double, and its IEEE representation is 402599999999999a And the tostring is working as intended desu.

What you want is the IEEE representation, which you could construct yourself pretty easily from "a.cccccccccccd."

But why do you need such a thing for Javascript?

GOD TIER PROGRAMMER ALERT

Ayylmao moar cores fags bttffoo haha xdddd

Well, you are right. I thought it was a 32bit float. That explains everything.

Im using firefox firebug to dump restricted data from a site putting a breakpoint inside their running scripts. Firebug has a console that allows js commands to be executed in the context where the breakpoint is triggered.
Theres no way to just save variables to a file from there, so im dumping the data in the console which is around a 100000 element long float array. I thought dumping as hex would take up less console buffer than all the digits of the floats. Even so the browser locks up pretty easily.

What's your fav c++ IDE for Linux? Vim not included

I've tried,
*geany - solid and mature but dated looks and function

*codeblocks - absolutely loved the context assist, best ide in terms of editor. But sadly its written in a shitty graphics api and theming it even to a dark theme is a ridiculous mission.

*eclipse - great UI, button layout and heuristics are 10/10 but the context assist is trash unfortunately

And now I'm using Clion which is my current favourite. I'm used to the jetbeans UI from pycharm, its consistent, helpful and intuitive. Everything just werks

The downside is its non-free, at least as in freedom.

Qt Creator

Neat.

>vim not included
Nano and screen.

Was going to add unions today, but ended up changing my grammar a bit to fix shift/reduce conflicts and fixing a few bugs that popped up.

I don't like any of the IDEs available for linux. I need VS, I demand VS!

So it seems like there is literally nobody on the whole green earth that does TDD and uses a proper CMake setup. Actually it appears to be impossible due to mocks not being visible to production code when the test code is compiled separately, which in any sane build, is exactly the case.
The problem is basically that you can't mock a function in test code, compile test code with -Wl,--wrap=, and then force your library to honor that wrap when it was not compiled with the same linker flags. However if you compile your production code with the same link flags as your test code, then you break your program, you are stuck in test and the mocks get called even when you are executing the main application and not the test suite.
How the fuck can a mere mortal get around this without littering everything with #ifdefs or compromising the overall project structure and modularity?

What language is that?

SAGE THIS THREAD
Current Thread:
MODS DELID THIS THREAD

Cuck

iktf

Unleash the hounds.

Scheme

how do I OOP efficiently?

trying to force a click function on an element in an iframe. no luck so far. any suggestions?

Fuck off with your stupid normie thread this is the real one.

By not using POO

you cant

Rate my code
// main.c
#include
#include

int main()
{
__float128 a = 1000000000000000000000.09q;
__float128 b = 1000000000000000000000.03q;

if(a == b)
printf("Equal\n");
else
printf("Not equal\n");

return 0;
}

gcc main.c -lquadmath && ./a.out

Finessing a ratchet way of doing args in CL.
Basically, I'm thinking of mapping #'make-string-input-stream to *argv* (interspersed with " "), then apply #'make-concatenated-stream to the streams, and then #'read 'ing all the values into a list, which is then set as the property list of a symbol, so that I then can do proper routines if the needed symbols are there or not

My first thought was using keywords, but fuck that, too hard lmao.

Nice

>make_

make- is not a valid identifier in C though user.

C made me do make_.

Employed Haskell programmer reporting in

What have you been working on in Haskell?

You're my new favorite

Is there anyway to make this look better and more concise? I'm pretty new to Clojure.

>implying he's being paid to write Haskell

he just said that he's a Haskell programmer and that he is employed. Flipping burgers in the day and letting the GC generate tons of garbage at night

>he just said that he's a Haskell programmer
So what's he working on at night?

I want fries and a large soda, please.

Why havent you applied to mojang and asked them to hire you yet

Minecraft clones a diamond dozen user, why would mojang give a shit?

That looks reasonably concise to me.
Lisp (clojure) just ends up looking like that.
You can do newline indentation if you'd like, it'll make it cleaner but it'll also make it look way way longer.

You have a lot of repeated code. Abstract it into a function.

I don't wanna move to seattle and work for microsoft

anime

Still teaching myself regression, now by collecting a Sup Forums-related dataset: the number of replies for every thread on a given board over time. It's running now on Sup Forums in its more or less final stage (pic related), writing the output to a JSON file.

I'll likely run it for most of the week and graph the output occasionally, then try to see if I can model the "best time" to post on Sup Forums, I.E. when the number of posts over time on the board is at its highest.

Gonna read up on logical regression soon once I'm satisfied that I can produce effective models.

Trying to run RAID on usb thumb drives

If I'm only comfortable reading the disasm of my program is that 'knowing' asm?

>TDD
It's popular. It just stinks as a paradigm. So much overhead. Every test you make hardens your code and a core philosophy of TDD is that you're locking down your api early for your tests.
But you're probably just a zealot so you don't care for reason. Just deal with your issues. If you can't figure this out why bother with programming?

It's hilarious to me that people who think trans people are delusional are more triggered about trans people existing and having jobs than trans people are that some people think they're delusional.

>a diamond dozen
No, you're wrong, it's "a dime a dozen."
>inb4 "being this new"
No, you're wrong, it's still "a dime a dozen" no matter what erroneous and filthy unfunny memes have come out of it.

please go back to your containment board and stop shitting up Sup Forums

Moral of the story is never work with Go

This sentence absolutely need commas.

but what if he overloads the comma operator?

Try directing your sentiment to the appropriate recipient:

>commas
branlet
no you are not even a brainlet you are a fucking branlet do you understand me
you try to eat raisin bran
but it is
TOO FUCKING SMALL
that's how small your bran is

Is this valid scheme?
(lambda (x x) x)
(let ((x 0) (x 0)) x)

I'm writing a macro where I end up with duplicate symbols in my lets and lambdas.

It works on my machine but my repl is giving off a warning.

I can't use let* because the actual use case is:
(let ((x (foo x)) (x (foo x))) expr)

It may surprise you to know my long sentence is actually grammatically correct as it is, and no commas are necessary--or, in fact, grammatically possible.

What is a good resource to learn Java that is similar in style to Automate the Boring Stuff with Python?

Pig related.

struct meme { meme &operator()() { return *this; } };
int main() {
meme()()()()()()()()()()()()()()()()()()()()()()()();
}

but overloading the () operator is useful for doing things with make_shared and make_unique

overloading the comma operator is just dumb.

Well yeah. The comma operator should not even be a member function in any situation whatsoever.
Also: Why does C++ not have static operators?

which is a goddamn shame, since go actually fills a niche and could use real research development.

yeah, like research into the 70s and "what are generics?"

>It's hilarious to me that people who think trans people are delusional are more triggered about trans people existing and having jobs than trans people are that some people think they're delusional.
It's also disgustingly poorly written. Copyedit attempt:
>By existing and holding jobs, transsexuals trigger people who think "trannies are delusional" more than those people trigger transsexuals. I think that's hilarious.

...

>"what are generics?"
Unnecessary is what they are. Only three use cases and all of them are bad code smells.
>1) You want to pretend your language is dynamically typed.
Just don't.
>2) You manipulate different types of data the same way at different times and want to reduce code duplication.
Again, just don't. Code duplication should only be reduced when the code doesn't mean different things or serve different purposes in the different places it appears.
>3) You're writing a library.
Gross. Don't fucking use libraries or ADTs, ew. Modularity is overrated, real programming is all about doing everything as low level as possible and squeezing every last drop of performance out of every algorithm.

ferret-lang.org/

Hey look, a Clojure -> C++11 compiler.

>Don't use ADTs
Datadata, is that you?

Here we have a common lisp implementation...

github.com/drmeister/clasp

>Building on most systems will take around 8-12GB of memory and ~1-2 hours with a relatively modern processor, so be prepared to watch a movie or do some other useful work until Clasp is all done. You may also want to activate a large enough swap file if your system does not have enough DRAM.
>Currently there are no binary releases available.

Report. Please don't spam next time.