Old thread: C++ is the most powerful programming language.
What you're working on?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
en.wikipedia.org
github.com
myredditvideos.com
twitter.com
Lisp is the most powerful programming language.
do you think c++ man regrets being forever tied down to it?
I wonder if he ever thought about pursuing a new language.
Reposting because of bump limit
Jow Forums I have a week to learn the basics of php, javascript, jquery and mysql, is it possible? My boss gave me a month to learn all this shit but I procastinated like the degenerate I am, now the desperation kicked in.
First for Lox
>If you combine local functions, first-class functions, and block scope, you run into this interesting situation:
fun returnFunction() {
var outside = "outside";
fun inner() {
print outside;
}
return inner;
}
var fn = returnFunction();
fn();
...
I doubt it. He earned his place in history. Whether it is a good or bad place in history, only time will tell.
what's interesting here?
Thanks for using a good OP image.
If your language-fu doesn't even have left to right function composition, she's unreadable trash.
He looks exactly the same now, was that really taken in 1999? It's a good picture, but I wish it could be found (additionally the photoshopped Stroustrup legs one) in higher resolution.
That local functions can access variables outside of their body in the surrounding function, I guess.
>left to right function composition
what do you mean left to right? left OF right or passed to left then passed to right?
so lox has invented closures for the first time in (lox) history?
for the next threads
Shoop the Lisp alien legs onto Stroustrup
Well the chapter is called Closures
>Here, inner() accesses a local variable declared outside of its body in the surrounding function. Is this kosher? Now that lots of languages have borrowed this feature from Lisp, you probably know the answer is yes.
>For that to work, inner() has to “hold on” to references to any surrounding variables that it uses so that they stay around even after the outer function has returned. We call functions that do this “closures”. These days, the term is often used for any first-class function, though it’s sort of a misnomer if the function doesn’t happen to close over any variables.
>As you can imagine, implementing these adds some complexity because we can no longer assume variable scope works strictly like a stack where local variables evaporate the moment the function returns. We’re going to have a fun time learning how to make these work and do so efficiently.
>using anything but tdavis
fuck off, faggot
Who do I hold responsible for go modules being fucking garbage a year after they were introduced? Editor support is effectively non existent and because they decided everyone had to reinvent all the tooling we have had no progress on the normal tools for the past year either.
>We’re going to have a fun time learning how to make these work and do so efficiently.
What if lox were to invent some sort of "garbage" "collection"?
What kind answer do you want?
I just "learned" Go in one week, but I was already comfortable with different programming languages and different paradigms in general. What do you already know?
I believe the book also teaches you on how to implement a GC.
I'd actually like to see what Elon Musk's programming would look like.
I get the feeling he'd just write incredibly mediocre python because he's more of an ideas guy who can delegate work incredibly well.
What if lox were to use some sort of ``prefix" ``notation"?
shut the fuck up
My eyes fucking hurt. What do?
take the dicks out
so you don't C#?
Thank you for not using an anime image.
The output of the left expression is input to the right expression. Examples follow.
[1, 2, 3] & map (+1) >>> foldl (*) 1
-- Result: 24
(&) = flip ($)
total_sum = 1..100_000 |> Enum.map(&(&1 * 3)) |> Enum.filter(odd?) |> Enum.sum
# Result: 7500000000
Looks familiar, right? Yup, it's like pipes in the shell!
no can do dick too big
Kek
so you mean left THEN right?
Hmm... And by "garbage" do you mean "unused memory", and "collection", do you mean "safe deallocation"..? That would be gosh darned useful.
Yes. Just like pipes in the shell. Incidentally, elixir calls their left to right operator "pipe".
What is the difference between class inheritance and prototype inheritance?
>not having whitespace sensitive function precedence
one is a thing and the other is not a thing
(* 2) 3 (+ 1) (/ 10)
((3 + 1) * 2) / 10
beautiful
Javascript exists you know
what is this supposed to be
Language specific features are irrelevant, class based inheritance as a concept spans multiple languages.
((((((((((3 ((((+)))) 1)))) * 2)))) / 10)))))))
a pedophile black kkklansmen trying to grab you out of the screen
also it's got a red nose so it's probably one of santa's reindeer that's escaped. the white bit is probably snow.
shut up
>lua
oh fug i like lua
install terra
Why is right to left even the norm? Who thought it was pleasant to read funcA(funcB(arg1, funcD(arg2, arg3)))
What would you prefer?
i did a while ago
it's neat
good lad
now uninstall it
What is the opposite of right to left? See the examples above. Much clearer about order of evaluation and we read left to right anyway.
under a class-based paradigm, programmer is god and instantiates using his divine power of creation.
under prototypes, programmers instantiate by cloning an existing default object, duplicating the set of its properties. (pic related, the default instance of the Human prototype)
All these suggestions use a custom operator to implement left to right application. Are you suggesting it should be the default?
Hello Elixir fellow
C++20 looks nice, concepts,ranges, modules and coroutines.
Yeah. In the Haskell example, those operators are just infix function calls. Left to right composition in there is already pretty easy.
when you ignore all the bits prior to C++20 it almost looks like a mediocre language
I really don't think (((arg2, arg3)funcD, arg1)funcB)funcA is in any way readable.
Are there any tools that will let me convert C programs into boolean satisfiability problems? Preferably 3-SAT? I don't want to solve the satisfiability problem, just a tool to formulate it for me from source code.
there are definitely tools for verifying C i just don't know the names
I don't want to verify it. I just want to transform it into a bunch of boolean expressions so I can look at it. Is there a way to access the IR?
funcA
that's just dumb syntax for funcA(funcB(arg1, funcD(arg2, arg3
Modern C++ runs circles around other languages in both performance and features. Literally the language of Pillar Programmers.
I think it's better than trying to read a sea of ((())))s, plus it cuts back on typing and very clearly separates which args are to which funcs
And yet it's stealing from D for some mysterious reason.
>it's better because you use
It could be, if there was compile time reflection. Thanks based fusion libraries from boost for letting me somewhat do this.
It's a lot easier to refactor and read clearly than ()s.
The less noise in a language, the better, that's what we should be aiming for.
Lisp zealots got lost in this idea and deny the noisiness of (((((((())))))))))s, and delusionally claim it as simplicity.
>he doesn't know
github.com
behold static reflection via the compile time state idiom (apparently, I hate reading boost style-code, someone else said it used it) and an offset based getter
>only 2 weeks into new term
>school wants me to create and balance a red-black tree in assembly language
why are they like this
>It's a lot easier to refactor and read clearly than ()s.
No it isn't
looks retarded imo just do (->> arg3 (funcd arg2) (funcb arg1) funca)
lisp is superior to your trashlang
I have only done shitty small c++ scripts,
now i am taking on a project that will be 3D rendering engine and physics engine written in c++.
I think I will be using opengl to draw the window to begin with and later maybe change it.
it won't be anything fancy just some basic shit using linear algebra.
If you lads have anything to say to help me I gladly listen. Also got any good sources for learning more advance c++?
>github.com
Sorry, we won't be using libraries that don't have some precedence for LTS and wide support. This is enterprise level software for industrial control, but I'll check this out. Looks neat.
that's counter-intuitive to how most of the world's programmers read.
i don't know of any language that even has that syntax in that context.
what about
funcD arg2 arg3 .> funcB arg1 .> funcA
1. Order of evaluation same as the order you read it
2. Dependencies clearly shown
3. Models computation as a series of transformation on data, which is clearer.
That's not left to right my dude. The order of evaluation is different from how it's written down. You read funcA first, but it gets executed last.
Lol, "most programmers" appreciate a good curry.
yeah now what about when you actually want subexpressions you retard
>t. blub
>The order of evaluation is different from how it's written down. You read funcA first, but it gets executed last.
that's a pretty bold implication based on syntax alone.
Hei guys, I'd really appreciate some help! Thanks.
So, long story short, I have this Python script to alert me when there's lightning (using a Pi and cheap EMP detector), since I'm in a closed room and can't see or hear outside, it's a good way to know to shut down stuff just in case. But sometimes it's sensitive and will trigger when I for example turn the light switch on in the room.
What I'd like to know, is how I could modify this script to only play the alert sound if there's two inputs in one minute? So it won't trigger if there's just one, but counts to 60 and if there's another one turning that time, then plays the MP3? It's been years since I even made this one or did anything Python at all, not that I ever knew much about it.
import time
import datetime
import os
import board
import digitalio
print("Waiting for EMP.")
print()
button1 = digitalio.DigitalInOut(board.D23)
button1.direction = digitalio.Direction.INPUT
button1.pull = digitalio.Pull.UP
while True:
if button1.value:
print('EMP/Lightning Detected: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
os.system('omxplayer --vol -1000 alarm.mp3 > /dev/null 2>&1')
time.sleep(.05)
I hope someone bothered to help me! Thanks!
haskell trannies are so cute
the best general source is practicing and fucking up shit, and other people's code
for specific stuff like multithreading, there's books like concurrency in C++ (2019)
for opengl specifically learnopengl.com goes from hello triangle to physically based rendering
fuck off back to your irc
congratulations you just reinvented & and |>
add a timer that keeps track of how long ago the last input was (it starts at 0, and increases by .05 every time you sleep(.05)) then try using that, e.g. only do os.system when that timer is below a certain amount
Thanks, I'm looking up on how to implement a timer in Python.
>no women
kys
Sorry kid, you might as well go ask /diy/ if you expect someone to help you with that
I don't expect someone to straight out make it for me.
Just general help what and where, so I understand myself too.
Just substitute it in? If, you need to replace some args with function application then go ahead.
If you're talking about lazy langs then just execute in a computational context that guarantees sequential ordering. In general, it's a pretty good assumption regardless.
What's the point of this quip? You're not the only person who knows Haskell in this thread.
i mean you could just have (pseudocode)
last = 9999
while True:
if button1.value:
print('EMP/Lightning')
if last < 1:
print('Second EMP/lightning')
last = 0
time.sleep(.05)
last += .05
>Just substitute it in?
with PARENTHESES you mean?
Makes sense. What's the "last = 9999" part?
I guess I can just make it do nothing the first time? How do I adjust the time period between the inputs?
Thanks.
I will probably start with learnopengl.com first so I can actually get it working to begin with.
I will later implement the multi threading when it works good enough maybe.
Thank you user for the information I will check them out.
Yeah. Like this.
funcD arg2 (funcF arg11 .> funcE arg12) .> funcB arg1 .> funcA