Old thread: What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
pastebin.com
youtube.com
en.wikipedia.org
twitter.com
Fuck anime and fuck japan.
[obsessive whining about language X not having meme feature Y from language Z]
That's not anime, you moron.
please use a programming image next time
haskell, type level lambdas
he didn't say it was
C, built-in string library that doesn't suck dick
obsessive whining about Pascal not having tail call optimization from Scheme
>please use a programming image next time
dumb webshit
JavaScript.
Shut the fuck up newfag I've been here for years I don't even know how to set up a fucking server
>please use a programming image next time
How is the OP picture not programming and /dpt/ related? Also, nobody fucking cares about your stupid SICP edits.
>hey user, show me your assembly program
hlt
mov trash yuno
The internet is vast and deep! Find somewhere else to be.
Nobody asked you :D
Is there any language that has type level lambdas?
xor rbx, rbx
div rbx
other than dependently typed languages?
it Rocks!
loop: jmp loop
Typed Racket is bretty gud.
How are type level lambdas related to dependent types?
Depending whether that's intel or at&t syntax means putting the trash on yuno or yuno in the trash.
>C++ is bad because you can overwrite + and =
well in Agda/Idris/etc there's no problem defining a function from set/type to set/type etc and then using it inside a type
C++ is bad because you can overwrite + and =
>C is good bec-
>Program received signal SIGSEGV, Segmentation fault.
>small brain: C++ is bad because you can overwrite + and =
>normal brain: used responsibly operator overloading can make code shorter and more readable
>galaxy brain: C++ is bad because you can overwrite + and =
and many more reasons
It is from japan though, and I agree fuck touhou.
>C++ is good because it has zero-cost abstractions
Many would if they were real.
.intel_syntax noprefix
#include
.data
msg:
.ascii "Hello, World!\n"
.text
.global _start
_start:
mov rax, __NR_write
mov rdi, 1
lea rsi, msg
mov rdx, 14
syscall
mov rax, __NR_exit
mov rdi, 0
syscall
Yes, I wrote something!
pastebin.com
>C, built-in string library that doesn't suck dick
typedef struct {
int count;
char *data;
char sentinel;
} string;
Do we agree?
C++ has arbitrary functions from types to types, but not lambdas (i.e nameless function expressions)
No. That's garbage.
Why does the first row in main call the default constructor?
Why does the 3rd row call the copy constructor when = is not used?
Post your alternative.
this
who are these people
char *
But if you're one of those length fags,
struct string {
size_t len;
char data[];
};
>char *
You basically just want a library that guarantees null termination then?
some korean guy who wrote a book
???
drunken nip
only respectable looking guy in the image
it doesn't unless you write std::move to make it explicit (which is in effect a cast to Cls&&)
I don't really have many issues with the C string functions. There are a few useless/shit functions, but snprintf replaces most of them.
It'd be nice if a few of those POSIX string functions were made ISO standard, though.
I just tried it though. First main row invokes default constructor, last row invokes copy constructor.
Something something copy elision.
I already know programming and work professionally with it but want to get better and learn Go
Should I get K&R, the Go book by kernighan, SICP or HTDP?
>en.wikipedia.org
meh doesn't even have a wiki page
>snprintf replaces most of them.
b-b-but that means knowing a length, unless you're just using big scratchpad buffers for string manipulation.
Daily reminder that
auto x = 1;
Is valid C code.
SICP and HTDP: Doesn't really matter. Either is a pretty good read. Read SICP for meme cred.
K&R: Possibly the worst book you could read on modern C. However it looks good in a shelf.
Yes but the difference is that in C is does something completely useless and stupid.
It made sense in B, but no longer serves a purpose in C.
Go for the Go book I guess. Kernighan's books are always great.
>want to get better
Read The Practice of Programming and The Unix Programming Environment.
auto is a modifier. You still need a type if that's supposed to be a declaration.
Of course 'x' could be a macro, among other things.
Only in C89.
snprintf only requires to know the length of the destination buffer. Using it, you can implement asprintf, but it'd be nice if that was just made standard.
The only valid complaint is that it involves parsing a format string, but that is such an insignificant price to pay. snprintf is basically the perfect string function for C.
K&R is comfy. Browsing old Unix sources is comfy. Don't you want to program like the 70s on a loud teletype? Getting a qt to load tapes? Running batch programs overnight?
void noop(int _) {;}
signal(SIGSEGV, noop);
>comfy
so just boring?
I thought C89 permitted the type specifier to be omitted, defaulting to int, so long as a storage class specifier were provided.
e.g. static x = 0;
>Don't you want to program like the 70s on a loud teletype?
no
>Getting a qt to load tapes?
All I need is my waifu
>Running batch programs overnight?
I run anime tiddie scrapers all day, all night 24/7
>All I need is my waifu
Why not both?
assigning icons in qt is so fucking slow jesus christ
hopw so
you're a qt
well it's slow, that's about the extent of it
y-you too user
Oh user, you're the qt here.
>making gui in cpp
Why
Me on the right
You on the left
let's hope you don't have javascript in mind
That's halt
Who the fuck makes a GUI in cpp?
Use C++ instead.
I wish I were a qt
Only one thing is missing in this image, a comfy blanket to wrap those girls in.
you are
which Qt subclass is he?
I tried.
based user.
QIODevice
sounds impure
Damn right
What's better
divide(x, y) {
try (return x / y)
catch (division by zero)
throw (error)
}
Or
divide(x, y) {
if (y = 0)
throw (error)
return (x / y)
}
template
std::optional divide(F x, F y) {
if (y == 0) {
return {};
}
return x / y;
}
Second one, always. If you can prevent a failure before it happening, do that
Fuck, I forgot code tags again
template
std::optional divide(F x, F y) {
if (y == 0) {
return {};
}
return x / y;
}
why not ? :
if (y = 0)
well clearly not this one
You can if you want
Need to learn spotfire and tableau. What advice do you have and what tutorials do you suggest?
>spotfire
what?
>tableau
what?
Fuck off
>haskell software pandoc
>100 packages, 421 MB installed
thanks obama
What's better?
Guard block:
function setRandAttr(Object obj) {
if (obj == null) {
return false;
}
obj.setX(Math.rand());
return true;
}
Or if/else?
function setRandAttr(Object obj) {
if (obj == null) {
return false;
}
else {
obj.setX(Math.rand());
return true;
}
}
I found a job offer (not really coding) that lists basic sql and basic Java skills as requirements. What would you say those are? What specific things can a person having 'basic' sql and java skills do? some basic CRUD app using hibernate would do?