Old thread: Lisp is the most powerful programming language.
I don't care about what you're working on.
/dpt/ - Daily Programming Thread
Other urls found in this thread:
mcla.ug
rosettacode.org
en.wikipedia.org
github.com
godbolt.org
godbolt.org
bfilipek.com
twitter.com
>I don't care about what you're working on.
Lisp is a language that hates fellowship and tradition. This is why it failed.
>I don't care about what you're working on.
ILLEGAL /dpt/ THREAD DETECTED. OP ALWAYS ASKS WHAT Jow Forums IS WORKING ON
LISP was also coincidentally made by a jew
>coincidentally
:%s/coincidentally/unsuprisingly/g
Bjarne is the voice of the truth
You only need believe in he who believes in C++ to be shown the way.
Since OP is a faggot, what _are_ you working on Jow Forums?
>not every function in the world is a mathematical one with a small fixed domain. >Every test I've ever written has been a bug. "shit, this doesn't work. *write test*. *eventually gets tests to pass*"
>those tests thjen ensure I don't re-add the bug.
Yes having those tests helps, it is MUCH better than having no tests and refactoring is the main point.
But really I am so happy, that today I ran my tests that were written in a different way, a 5 minute tests on multiple thread ensuring that
-the win probability is between 0 and 1
-90 90% of the win probability is the same as in an existing, popular lib
-certain properties hold, like if the rank of the hand is higher, its win probability is also higher
My goal is not to say that those manual tests are worse than nothing, I think we should find ways to test more data. The worst bugs I found in code that was "obviously correct"
I might sound like a sperg, but this testing technique was one of the few things that really helped me and was not just a meme.
>Not formally proving your programs to be correct
Get a load of this pleb.
I will do my best, but really you can't.
I have already bookmarked the formal verifier that claims to work for C++, in my experience so far they only work for a small subset.
And when it somes to verification on paper, it's great when you have a math professor checking it. I was stupid in university, all those tests annoyed me, now I would pay for someone to read my code.
The problem is that when I verify my code I often make the same mistakes as when I wrote it....
And then the second thing: I can for example verify that my result will never be null. But will it be correct? I am currently working on a nash equilibrium solver for yet another poker variant, it is not THAT deep but so far never has solved it. How do I know the result are correct?
Rust >>>>> C++ >>>>>> Power gap >>>>>>> C > Ada > Fortran > Forth
>Forth at the end
can't even fit this bait into my mouth to bite it
Why do C trannies get mad when people call C a subset of C++?
mcla.ug
I'm a faggot that only likes python
I hate JS
I hate Go
functional autism isn't for me
I want to learn something compiled but nim and crystal are both immature
I plan to learn C/C++ eventually, but for now, I'm going through the rust book
Because it's literally not.
QuickCheck doesn't do formal verification. It tries random inputs until one fails, then it attempts to shrink the failing input to a minimal size (so you don't have to).
I see. Still sounds useful.
>lisp
>failed
wat
because it's not and you shouldn't treat it like it is
recommended idioms, general style, pretty much everything differs between C and C++
they just happen to have some level of compatibility
it's only retards who know neither who insist on the phrase "C/C++" - that or it's one of the rare times when someone is talking about behavior common to both
you aren't a C++ programmer if you don't understand this
you may think you are, but you're not, you're not writing idiomatic modern C++, you're writing shitty c++98 tier C++
It's a false statement. You're just retarded or ignorant for defending it.
Because it isn't. Originally, it was, but that's no longer true since the later changes to C and C++.
It's incredibly useful! I use it regularly in Clojure via the test.check library. It invents test cases I would never think up.
Why put Forth last?
Kek, Ritchie even used a C++ compiler when making r&k.
>when making r&k.
>r&k
> C++
>1970s
Second edition.
>Jow Forums -> Fortran
>Jow Forums -> r&k
Why are there so many boomer programming references on this site?
forchan
fortran
The similarity is obvious to anyone who's not autistic.
Because C++ is not a superset of C. There is perfectly valid C code that fails to compile as C++. Obviously, this falsifies the claim that C is a subset of C++ and you're retarded
>ctrl + f "lua"
>0 results
holy shit you guys are all faggots
nobody talks about Lua because it's boring and Portuguese. It's the very best of scripting languages except for being unusable (by default) for suid scripts since it has an environment variable backdoor.
does getting into anime make me a better programmer? i'm tired of chasing 3d every weekend, it wastes a whole weekend. women are way too needy and securing a regular clam supply is not worth the time and effort, and chasing around birds takes friday and saturday night away from me every week. how do i get into 2d? i've tried but i couldn't find any anime that really interested me. i need suggestions, i like paranormal stuff if that helps.
anime is programming related in this case, because i think it might help me become a better programmer.
struct girl *girl = (struct girl *) malloc(sizeof(struct boy));
>Casting malloc
Literal fags confirmed for retarded.
you will be sorely disappointed
lua's fucking great
more people should use it
i wish there were COM bindings to the CLR so lua could easily interop with .NET without using a compiler written in a CLR language
You're stretching.
>casting malloc
also
sizeof(struct boy) == 6
sizeof(struct girl) == 8
woops! segfault. it looks like your trying to access data that doesn't exist. i guess reality disagrees with your expectations.
Why is that? I see weebs when I'm at the mall and they always seem to be having fun, laughing about stuff, and generally enjoying themselves.
>fuck seven bitches (ever in your life)
>get casted into a girl
>suddenly have seven children
Why is the girl bigger?
eventually you'll come to your senses and realize you're a degenerate.
It holds isPregnant
kek
Tag based image management (fap enhancement) software.
you mean a void pointer to another struct girl??
I'm already a degenerate. I chase around women 10 years younger than myself trying to dip my dirty old beak in their sweet young nectar.
I try to keep it related to it's function, though that depends on how frustrated I am. Some times my code does look like though.
naming and cache invalidation are the two hardest problems in computer science.
This is true and not a joke or a meme.
You don't solve it. You just keep doing it.
It's brazilian actually
>Ritchie even used a C++ compiler when making r&k
[citation needed]
"hos are useless" - simon peyton jones
he's just too lazy to fuck them.
don't want to cause side effects
sex is a function that returns a maybe(list(child)). The pleasure is the side effect, degenerate.
>I do say madam your crumpets are looking exquisite this afternoon
>Care for a tea and shag at my flat?
hahaha hilarious joke definitely not cringe
What's stoppiing me from writing an x86 emulator in CUDA and having access to thousands of threads?
Here's a reasonably sized, reasonably understandable, reasonably comparable Rust program: rosettacode.org
how does /dpt/ rate it?
the slowness of each thread.
branching
>println!("There are no tunnels from here to that room. Where do you wanto do go?");
nevermind it's shit.
What if I use a single instruction ISA?
JEEEESUS FUCKING CHRIST WHY IS INXI SO FUCKING SLOW? FUCK FUCK FUCK FUCK.
[user0@primarypc ~]$ time inxi -F -xxx -v 8 > /dev/null
real 0m1.273s
user 0m0.466s
sys 0m0.171s
[user0@primarypc ~]$ inxi -C
CPU:
Topology: 8-Core model: AMD Ryzen 7 1700X bits: 64 type: MT MCP
L2 cache: 4096 KiB
Speed: 3266 MHz min/max: 2200/3400 MHz Core speeds (MHz): 1: 2872 2: 3123
3: 1714 4: 1685 5: 2406 6: 2409 7: 2404 8: 2410 9: 1746 10: 1750 11: 1749
12: 1740 13: 2334 14: 2342 15: 2401 16: 2410
>user0
doxxed
what the fuck is inxi? github.com
>FEATURES AND FUNCTIONALITY
>---------------------------------------------------------------->---------------
>
>inxi's functionality continues to grow over time, but it's also important to
understand that each core new feature usually requires about 30 days work to
get it stable. So new features are not trivial thing
...
>The core mission of inxi is to always work on all systems all the time
...
>README for inxi - a command line system information tool
I haven't been this baffled since I couldn't tell from Eclipse's website that it was any of
1. related to code
2. related to java
3. an editor or an IDE
also it's Perl so it's probably slow because it's looking for and loading modules. You need a fast disk, not a fast CPU.
inxi -D
Drives:
Local Storage: total: 2.84 TiB used: 55.11 GiB (1.9%)
ID-1: /dev/sda vendor: Seagate model: ST1000DM010-2EP102 size: 931.51 GiB
ID-2: /dev/sdb vendor: Kingston model: SUV400S37120G size: 111.79 GiB
ID-3: /dev/sdc type: USB vendor: Western Digital model: WD20EZRZ-00Z5HB0
size: 1.82 TiB
I webcrawled infowars.
wtf
I meant to show that I'm using an SSD
>anime
>infowars
How does a sane person sit through these without visibly cringing?
ok. well, actually looking at it, it's slow because of all the shit it calls.
Take a look at this:
strace -vtfff -s100 time perl inxi -F -xxx -v 8 2>&1 |grep -Po 'execve\([^,]+, \[[^\]]+'
inline void safe_exit()
{
asm volatile (
"jmp label_after\n"
);
}
0x56556d3e push ebp
0x56556d3f mov ebp, esp
0x56556d41 call 0x56556d53
0x56556d46 add eax, 0x22ba
0x56556d4b jmp 0x56556ab1
0x56556d50 nop
0x56556d51 pop ebp
0x56556d52 ret
gcc, what the heck man
-O3 in that example will just return 0 since nothing is done in any of the functions, though.
the point is, there's nothing weird about how safe_exit() gets handled. The assembler is inlined into the 'caller' with no extra baggage as you wanted.
godbolt.org
(C label is from me trying that in a dosomething() function)
#include
auto main() -> int{
return EXIT_SUCCESS;
}
Fuck off
#include
#include
inline static constexpr const auto no_string = "no";
constexpr const auto no() -> decltype(no_string) {
return no_string;
}
auto main() -> int{
std::cout
*inline static constexpr const auto no()
can you do something with some constexpr friends?
aside from this one trick you've seen before with the compile time state?
no
You need to throw some more namespaces or some shit in there.
this takes 7.625x as long (and 2.8x as much memory) to compile as
#include
int main() {
puts("no");
return 0;
}
... and then Zig takes 2.6x as long as even C++.
good idea
#include
#include
namespace nolib::no_string_space{
namespace {
inline static constexpr const auto no_string = "no";
}
}
namespace nolib::no_function_space{
namespace {
inline static constexpr const auto no() -> decltype(::nolib::no_string_space::no_string) {
return ::nolib::no_string_space::no_string;
}
}
}
auto main() -> int{
std::cout
>join leetcode
>get stuck at "reverse the digits of an integer"
life is over
look up the 'modulo' operator in your language. It's probably spelled %
As an intern I've been given admin level privileges to the production database. Instead of giving me a test database they had me do development on the production database. Now my boss is angry about some rows in the table getting edited. Why wasn't I given a test database for testing my code???
What are some of the joys of programming?
Working on a socket application. Trying to add a high-level read function that can receive multiple transport-layer packets corresponding to a single application-layer packet. My question is, if I have multiple different sockets waiting to be read from, and say, the one currently being read from times out (i.e a slow connection, or a connection that gets dropped), could that potentially mean the program gets bogged down and can't do any other work?
Maybe each tick of the program I could make threads for each socket that's ready to be read from to make use of thread-level parallelism. However, say I want to do an application-level broadcast to all the connected sockets by writing to each one. Would this break the program if a socket that's currently being read from is written to? Is there a way to make sockets full-duplex?
That's the dumbest question. I don't get the point of that one. Maybe if you're doing some embedded coding it would be nice to show off your ability to do some bit manipulation, but no one is doing that in user space code.
>Why wasn't I given a test database for testing my code???
Pursuit of this inquiry leads to eventual insanity.
religious wars
runtime introspection
editor ricing
unemployment
Why should I use lua when I basically want to call C functions based on strings from a test file. I can make a hash table of and compare strings in the file to the ones in the table and call the function I want.
If you're using asynchronous I/O it doesn't really matter as long as you handle the socket teardown gracefully (i.e. if API throws an exception you should handle it).
>if a read blocks for a long time, could that block my program
yeah, duh. so either don't use blocking read, or use it in a thread by itself, or use it only after something like epoll() has told you a read definitely won't block.
>say I want to do an application-level broadcast to all the connected sockets by writing to each one. Would this break the program
writes can also block, but I'm not as sure how bad this is in the real world.
>trying to write a macro in scheme after knowing CLs defmacro
Yikes
>big joy
working on some complex really intricate bit of code for hours and it compiles and runs perfectly the first time
>medium joy
finding out about a neat new thing/feature/compiler setting
>little joy
finding a library that has followed proper conventions and not created a bunch of pointless typedefs of standard types
Mate, your code is not even safe.
mod no {
pub mod traits {
pub trait No {
type No;
fn no() -> Self::No;
}
}
pub mod types {
pub struct No {
phantom: std::marker::PhantomData,
}
impl
Yeah, I poll to get which sockets are ready to read from, then make threads for each of them to actually do their reading, and logic for what to do based on what was read. After that, the thread would exit.