Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 34 KB, 736x490, f954d2581538dfa84e6d61b382a2613f.jpg [View same] [iqdb] [saucenao] [google] [report]
63432478 No.63432478 [Reply] [Original] [archived.moe] [rbt]

Pythons are lovely snakes, but terrible programming languages.

What do you hold with, /g/?

Old thread: >>63423609

>> No.63432496

my hands

>> No.63432529

Your hand.

>> No.63432559

>>63432478
>Pythons are lovely snakes, but terrible programming languages.
At least it does not pretend to be fast.

>> No.63432592
File: 108 KB, 800x787, hungry.jpg [View same] [iqdb] [saucenao] [google] [report]
63432592

>>63432478
Continuing my full C modular synthesis program, as always. I'm working on making any component able to modulate itself right now. Like an oscillator's rate of oscillation can oscillate according to the oscillator's own waveform.

>> No.63432608

>>63432592
nice

>> No.63432696

Why is there so much hype about vs code? It's literally atom but a bit less slow

>> No.63432748

>>63432696
>a bit
It's far better than atom.
The only thing it needs is a de-bloating of NPM.

>> No.63432781

>>63432748
>far better

atom: 2
vs code: 3

emacs: 8
vim: 9

>> No.63432789

>>63432696
Unmatched code completion/intellisense, very user friendly UI, great extensions, etc. The main reason for me to switch from Sublime was intellisense.

>> No.63432794

>>63432696
>a bit less slow
You have never used Atom then. It's fucking slow.

>> No.63432797

>>63432781
???

>> No.63432810

>>63432781
>closed source benchmark
kill your self

>> No.63432813

I've upgrade my Ubuntu version (and I assume g++ in the process) and now my code doesn't compile anymore.

auto registeredListener = it->target<Message*(Message*)>();
gives me the following error now (it used to work without problems earlier):
In file included from /usr/include/c++/7/functional:58:0,
from MessageBus.h:6,
from MessageBus.cpp:1:
/usr/include/c++/7/bits/std_function.h: In instantiation of ‘_Functor* std::function<_Res(_ArgTypes ...)>::target() [with _Functor = MyNamespace::Message*(MyNamespace::Message*); _Res = MyNamespace::Message*; _ArgTypes = {MyNamespace::Message*}]’:
MessageBus.cpp:25:70: required from here
/usr/include/c++/7/bits/std_function.h:733:9: error: invalid use of const_cast with type ‘MyNamespace::Message* (*)(MyNamespace::Message*)’, which is a pointer or reference to a function type
return const_cast<_Functor*>(__func);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~


What has changed?

>> No.63432816

>>63432794
this

>> No.63432817

>>63432696
I tried Atom IDE recently. It was so slow that it was basically unusable. VS Code feels 1000x faster in comparison. Not saying VS Code is very fast overall but it beats the crap out of Atom (like pretty much every other text editor).

>> No.63432872
File: 14 KB, 470x367, ss-(2016-02-20-at-02.45.09).png [View same] [iqdb] [saucenao] [google] [report]
63432872

I've been sorting through and cleaning up some older scripts I've written and found this cutie pie. I'll now rewrite it in all the languages I know and perhaps learn some new along the way.

>> No.63432892
File: 82 KB, 600x791, 1510915385532.jpg [View same] [iqdb] [saucenao] [google] [report]
63432892

>>63432478
Newfag to programming here

please explain in simple terms why woud anyone need to use
>pointers
>classes

>> No.63432899

>>63432892
>pointers
manipulating memory, in some languages they're necessary for references

>classes
completely unnecessary

>> No.63432912

>>63432892
>pointers
These differ a lot between different languages, so it depends.
>classes
The cult of OOP tells you that these are for encapsulation and polymorphism.

>> No.63432933

>>63432892
just use structs

>> No.63432941

>>63432912
>>63432899
>These differ a lot between different languages, so it depends.
let's say in this case it's C++?

Also, can anybody explain why OOP is considered hot garbage?

>> No.63432962

>>63432941
in C++ you use pointers to indirectly store things, or as references (though C++ has its own reference system)

>> No.63432969

is this gonna crash? i'm reading files, i need to cast them to int32* but they might not always fit perfectly.

uint8_t file = new uint8_t[10];
uint32_t * ui32arr = reinterpret_cast<uint32*>(file)


am i ok if i don't touch the bytes that don't fit?

>> No.63432978

>>63432941
In C++ pointers are necessary for arrays. But they're also used generally for referring to things.

Most people think OOP means Java, and Java sucks. But then again so does OOP in C++.

>> No.63432985

>>63432969
just use python, bro

>> No.63432986

>>63432478
cute snek

>> No.63433016

>>63432969
>new uint8_t[10];
Why new? Just allocate on the stack or use unique_ptr, if you really need this on the heap.

>> No.63433044

What is wrong with OOP?

>> No.63433045

>>63432969
dude strict aliasing lmao

use unions

>> No.63433066

>>63432478
daily reminder that Javascript is python with curly braces.

>> No.63433078

>>63433016
these files come from outside, they might be several hundred mb in size and this function is not responsible for the memory so i don't have to use smart pointers. file is just an example to illustrate that there'll be 2 bytes which don't fit.

>> No.63433086

>>63433066
But javascript is weakly typed

>> No.63433088

>>63433044
That's what I'd like to know. I see the meme of OOP sucking a lot here, often mentioned in the same meme as Java and Indians.

>> No.63433094

>>63433066
atleast you can't do 1 + '1'

>> No.63433099

>>63432892
I'm the synthesizer guy (>>63432592)
I have a separate struct for each musical voice, which allows polyphonic playback at different pitches, velocities, etc, but those voice structs all reference the same pointer for certain values, like the waveform to play back, since that doesn't differ between voices. Meaning that if I want to change the waveform, I don't have to change the value for every voice (which would be potentially audible during live playback) but just change the waveform pointer once. The latter is an atomic operation so it's threadsafe.

Pointers can be a mess but they're very powerful and have definite practical applications.

>> No.63433107
File: 1.70 MB, 1280x720, MILF Cloak.webm [View same] [iqdb] [saucenao] [google] [report]
63433107

How can I like append a string or add to a string?

Like I want to change a name if it's the same

if Name2 == Name 1 then
Name 2 = Name2("bob") + "-A"

that way Name 2 becomes bob-A, name 3 is bob--B

Ect

Something like that

Any ideas or quick solutions?

Language is Lua.

>> No.63433116
File: 66 KB, 238x192, 1462699649983.png [View same] [iqdb] [saucenao] [google] [report]
63433116

any ideas on getting to a "professional" level by yourself?
its a little hard to describe, but i feel stuck on a level thats just "guy fucking around at home".
Even something simple as html/css i havent mastered, i dont nearly know everything about it, every interaction etc.
All the tutorials and videos are just "this exists", this is how you use it maybe" and just "doing a project" works, but it feels the same. its always "oh this thing is cool, it kinda works" but its so far from completely understanding everything.

>> No.63433136

I posted yesterday, but I just thought I'd ask again.
18 y/o freshman CS/ math student here, and I was just offered my first programming job. The job requires C# and SQL but I've been a Java cuck my whole life.
Any advice?

>>63433088
>>63433044
Also I'd really like to know why everyone trashes on java

>> No.63433153

What's the point of using languages that nobody else uses? Is it elitism?

>> No.63433158

>>63433086
>implying that types in python aren't just a myth

>> No.63433164

>>63433136
C# is just MS Java. You can learn it quick.

>> No.63433178

>>63433136
Because Java is trash

>> No.63433184

>>63433158
You're probably confusing dynamic/static typing with weak/strong typing

>> No.63433190

>>63432794
>Using an Electron code editor.

>> No.63433198
File: 313 KB, 1605x655, C.jpg [View same] [iqdb] [saucenao] [google] [report]
63433198

>>63433178

>> No.63433206

>>63433184
dynamic strong typing is just runtime checks

we've established many times that static strong typing is superior, in terms of speed and ease of development (over the whole lifecycle), software defect rate, and performance

>> No.63433226

>>63433178
Mind giving some reasoning for that? That's really what we're looking for.

>> No.63433237

>>63433206
>we've established many times that static strong typing is superior, in terms of speed and ease of development (over the whole lifecycle), software defect rate, and performance

do you have any study backing that?

>> No.63433242

>>63432978
These operators man. Depending on the position of the *, it is a reference or a pointer.

>> No.63433243

>>63433226
There is an entire wikipedia article on the subject

https://en.wikipedia.org/wiki/Criticism_of_Java

>> No.63433246

>>63433190
It's still faster than an IDE.

>> No.63433251

>>63433237
yer

>> No.63433330
File: 23 KB, 888x392, how2oop.png [View same] [iqdb] [saucenao] [google] [report]
63433330

Hi

I need an advice on OOP.
I'm not a "classically" trained programmer. I do write a lot of code, but it's usually isolated and I don't have much experience with designing large complex systems from scratch.
So I'm designing this complicated piece of software and it really needs to be reliable and easy to debug/refactor.
Without going into too much detail I'm struggling to make a choice between the two on the pic.
The system does fairly abstract things, so the usual naive approach to designing classes and methods doesn't work. Ultimately, what the system does is modifying some environment based on input data. However the process of applying modifications is pretty complicated and it needs to be easily monitored and controlled. And I need to store the state of the process in a persistent fashion.

So instinctively my first design draft looked like the thing on the right, but now that I'm implementing it, I'm starting to doubt myself.
How do people usually solve these types of problems? I _think_ abstracting the processes should ultimately reduce the complexity of the system, but I wonder I'm going to run into some problems later in the project life cycle.

>> No.63433345

>>63433243
>In 2008 the U.S. DOD's Center Software Technology Support published in the "Journal of Defense Software Engineering" an article discussing the unsuitableness of Java as first learned programming language in education.

And look where we are now.

>> No.63433352

nim is good language

>> No.63433371

>>63433345
>look where we are now
Yes. Python and Lua being taught as first programming languages instead.

How I long for it to be Scheme and ML instead once again.

>> No.63433388

>>63432892
Pointers point to memory values instead of being the values instead, which can be useful for optimization. So you can use a pointer instead if the data is bigger than the memory address. Also, C passes copies of the arguments to functions, not the variables themselves, so if you want to edit a value and have it reflected outside of the function you have to use pointers. Being able to manually edit memory locations is very useful in many cases.

Classes are an OOP idea. Theya ren't terribly useful in short code snippets but are great in large codebases for things like encapsulation, basically making it so that you can edit a section of code without any other parts being affected, and code organization, and for making custom datatypes. So for example Iets say I have a number of moderately different processes, the relevant functions and data of which I'm bundling into attributes and methods in corresponding objects. By doing so I can make it so that changing one process via its object does not affect others, and keep it readable and organized, and the code is encapsulated so that changing one process does not affect the others and I can easily alter them, as would not be the case if I were reusing functions. Now, however, I have to write the code of the objects separately, which isn't good. For code reuse purposes I go and take the common methods and attributes and bundle them up into a class, from which I can declare the objects and then manually edit in the differences, or for further abstraction, encapsulation and code readability, use inheritance/polymorphism to differentiate the objects using some other classes whcih contain the process-specific code.

>> No.63433400

>>63432941
Only people who don't work on large projects think OOP is garbage.

>> No.63433421

>>63433116
dumb frogposter

>> No.63433445

>>63432978
Java OOP is only useful for large and complicated codebases and is unnecessary complexity for smaller projects, where OOP from other languages is still applicable. In, say, python bundling up some attributes and methods into a class and then providing an encapsulated interface via getters and setters is very useful is you don't want a headache when refactoring a section of code, since with tregards to the rest fo the codebase you just have to ensure that the getters and setters return the expected values.

>> No.63433453
File: 8 KB, 256x256, 1510127894459.jpg [View same] [iqdb] [saucenao] [google] [report]
63433453

>>63433243
>Java has an entire wikipedia page dedicated to its criticism.

>> No.63433457

>>63433352
why's that Hans?

>> No.63433469

>>63432478
Reminder: https://m.youtube.com/watch?v=iSmkqocn0oQ

>> No.63433471

one of our interns suggested that we rewrite our backend in javascript yesterday because he finds it difficult to keep track of two languages at once. he also asked why we've disabled force push on the company git repo and claimed he needs to be able to do it

>> No.63433483

>>63433453
https://en.wikipedia.org/wiki/Criticism_of_C%2B%2B

it's not exactly an achievement.
There's in depth articles way longer than those about C"s many,many pitfalls.

>> No.63433485

>>63433371
Assembly should be the first programming language people are taught.

>> No.63433492

what language do cia niggers use?

>> No.63433509

>>63433485
Probably an in-house one for the really important stuff.

>> No.63433518

>>63433492
python for scripting and c/asm for meat & potato stuff

>> No.63433521

>>63433330
Mutable state....gross

>> No.63433523

>>63433469
so useless it is being adopted by some companies

that's right, it's useless even at being useless

>> No.63433525

>>63433044
Nothing, it's just that many people here either don't understand it and end up needlessly abstracting their code or have only really used it via using Java for a simple task.

>>63433136
It's highly verbose, and what's useful when you have many developers of varying skill and experience levels in a large project is much less useful when you're a guy trying to quickly implement some stuff. The language has shit like this: https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html, whcih amkes it readilly apparent why epople don't like it for quickly hacking things together.

>> No.63433526

>>63433509
>>63433492

>> No.63433528

>>63432941
>Also, can anybody explain why OOP is considered hot garbage?

Nobody in here actually has to architect and develop large-scale enterprise applications.

You don't need OOP for a script that automatically sends a message to your mom, but things change when more people are involved on a larger scale

>> No.63433545

>>63433471
Describe his beard to us.
How many Star Wars action figures does he have on his desk?
How much did he enjoy the latest capeshit film?
What is his favorite food truck?
What are his girlfriend's pronouns?

>> No.63433547

>>63433528
>but things change when more people are involved on a larger scale
why does it have to?

>> No.63433558

>>63432696
>larger feature set than sublime
>Not as disgustingly slow and poorly optimized as atom.

>> No.63433561

i always wonder what kind of neckbeard hears copy pasta like 'pythons are lovely snakes but terrible programming languages' and just immediately accepts it and starts using that saying everytime he gets an opportunity to.

>> No.63433576

>>63433547
software development was in such a terrible and dire state fucking NATO had to assemble meetings on how to fix it

OOP isn't perfect, but it's proven to work and sure beats what people were doing before that

>> No.63433583

>>63433421
anime website

>> No.63433585

>>63433561
Python is shit deal with it.
Stop being a brainlet 'coder' and learn a real language.

>> No.63433601

>>63433545
>Describe his beard to us.
Bumfluff tache and sideburns
>How many Star Wars action figures does he have on his desk?
None
>How much did he enjoy the latest capeshit film?
What's a capeshit film?
>What is his favorite food truck?
He's obsessed with sushi, don't think you can get that from a food truck
>What are his girlfriend's pronouns?
I don't know if he even has a girlfriend tbqh

>> No.63433604

>>63432941
>Also, can anybody explain why OOP is considered hot garbage?
I too am interested in comprehending this meme. OOP is standard in any CS curriculum.

>> No.63433611

>>63433583
frog is not anime

>> No.63433615

>>63433561
> lovely snakes
They naturally repulse people.

And I especially hate people who have snakes and feed it mammals.

>> No.63433628

>>63433604
Successful marketing campaign by Sun in the 90s. Businesses now demand that students get taught "industry best practices" like Java and OOP regardless of their (lack of) academic merit

>> No.63433640

>>63433604
That question was answered about a million times already

On a small scale (i.e. nerds coding shit in /dpt/) it's a lot of overhead, on a larger scale (i.e. actual production systems) it's useful

>> No.63433648

>>63433525
I've heard people shit on java for years and I always assumed that they meant the opposite, that is only good for small hacks and not great big projects. But in my time of using it, I have found it really useful for putting together these huge frameworks, I've always been confused on that. Thanks.

>> No.63433651

>>63433601
What language is your backend, in?

>> No.63433698

>>63433651
Scala. I know there are better choices but we needed something that we could gradually replace an old Java ball of mud with

>> No.63433714

I really feel like python is so cripplingly simple that I'm glad I didn't learn it first.
Every time I write a program in python, I feel like I may as well be writing in crayon.
It feels like a language that doesn't trust you with the really complicated concepts, and even OOP feels like an after thought.

Anyone else with me on this?

>> No.63433727

>>63433698
Ah, I could see the complaint then.
Have there ever been any suggestions to replace it with Haskell?

>> No.63433732

>>63433714
Yes, everyone who was ever taught a language better than Python.

>> No.63433737

>>63433698
why not kotlin

>> No.63433740

>>63433714
>>Anyone else with me on this?
literally 3/4ths of the programming world.

>> No.63433742

>>63433714
People shit on it, but I really like the indentation being a part of the syntax. It forces retards to make their code look clean.

>> No.63433763

>>63433547
OOP allows you to group your code into self-contained, encapsulated objects which are only accessible through getter and setter functions, allowing you to change code in one are without breaking things in another, and solves the code reuse problems with such object-based implementations with inheritance and polymorphism.

>> No.63433765

>>63433737
kotlin a shit

>> No.63433784

>>63433765
I'm considering learning it, why's it shit?


Looks like Java 9 v2 to me

>> No.63433787

>>63433727
I'd love to replace it with Haskell. I'll never be able to get enough people on board with the proposal, though. It was enough of a struggle getting everyone to accept Scala. Even now, some of them just write Java in it and keep asking if we can move to Kotlin.

>>63433737
Scala was more mature at the time, and still seems to have a more capable type system.

>> No.63433788

>>63433732
>>63433740
Thank you.
My college math professor did a little bit of CS, but he only used it for his mathematics projects, so it is understandable that he used something simple like python.

But when I hear people say that they wish they could write everything in python, I get a lil triggered

>> No.63433807
File: 32 KB, 400x382, phenotype shig.jpg [View same] [iqdb] [saucenao] [google] [report]
63433807

>>63432696
>>63432748
>>63432781
>>63432794
>>63432817
>>63433558
>not using nano or ed exclusively
plens

>> No.63433810

>>63433558
>Still an Electron application.

>>63433628
You have clearly never worked on a large codebase with lots of other developers of varying skill and experience levels. I dreasd the kind of unreadable code you write without a good knowledge of functional programming paradigms or OOP. Have fun breaking your code when try and fuck around with a function, having not encapsulated it properly via either side-effects-free functional code or OOP objects and classes.

>> No.63433822

>>63433787
>some of them just write Java in it
jesus.
JVM bridge langs were a mistake.

>> No.63433830

>>63433698
>Calls itself a language with good fucntional programming support.
>No tail-call optimization.

>> No.63433835

Why the fuck std::bind and std::function makes function pointer seems really clean and easy?

>> No.63433840

>>63433810
Why the assumption that I don't use pure FP?

>> No.63433851

>>63433835
std::function ain't a function pointer m8

>> No.63433855

>>63433807
>one click install code extensions for any language
>extensive macros that are braindead to write
>ricing is one click install and replacing json values if needed

>> No.63433878

>>63433840
Good luck working with less skilled devs than you or with a buggy and poorly-written legacy codebase. Functional purity is fun for small projects, but either gets messy or requires a higher grade of dev than OOP in large codebases.

>> No.63433896

>>63433611
the absolute state of /g/

>> No.63433898

>>63433830
Indeed. Scala has always been OO-first, functional second, and the impression I get is that its creator regrets that some of the more advanced functional patterns are possible in it.

>>63433822
I dread the day that I have to fix something in their code.

>> No.63433908

>>63433855
>Not using Vim instead and being able to turn it into a Sublime Text replacement, even being able to add features Vimscript can't handle with a Python API.

>> No.63433909

>>63433787
Why would you want to write Kotlin instead of Scala?

>> No.63433911

>>63433807
>not using purely I/O stream redirection
pleb

>> No.63433929

>>63433878
Referential transparency is the only way to stop a large project from becoming a ball of mud. I'm not sure it requires a higher grade of dev, but it does require a dev who has been exposed to techniques and languages that encourage that style of programming, and they aren't easy to find.

>> No.63433943

>>63433909
I personally don't. The people I work with who just write Java in Scala do.

>> No.63433947

>>63433714
Agreed, but I still enjoy writing in it. You just have to keep in mind that python abstracts a lot in somewhat bizarre ways that don't carry over to other languages.

I definitely regret learning it first though. Learning C afterward was a bit of an uphill battle because you now have to deal with things that python basically held your hand for. It gives you an unrealistic expectation of the types of things you have to deal with in most programming languages and sets in a lot of bad habits that you basically have to "undo".

>> No.63433953

>>63433908
I used Vim for ~5 months.
I never want to touch a vimrc ever again.
VSC is everything Vim is but better. With the added benefit of built-in Git support. And if you're a masochist, you can even use vim-keys inside it.

>> No.63433960

>>63433898
If I remember correctly, it's because the JVM doesn't have support for tail-call optimization, being designed for usage with Java. Scala actually has a form of TCO, if I remember correctly, and so does Kotlin, but you have to write your code in a certain way for its limited TCO support to be able to optimize it.

>> No.63433976

>>63433960
Why the hell would anyone try to do functional programming on the JVM?

>> No.63433987

>>63433953
>Using an Electron-based text editor.
How does it feel having your text editor use RAM like a browser tab running a webapp and lag when opening large files?

>> No.63434029

>>63433976
Because they don't want to use Java, because their program wouldn't benefit from its verbosity and abstractions, or because of its legacy shit, verbosity, and unnecessarilly complex OOP, but still have to use the JVM.

>> No.63434030

>>63433987
Fine considering my 16GB's don't mind.
>lag
I've never had the slightest issue opening a 100K+ file.

>> No.63434055

>>63433714
>python is so cripplingly simple
Not overcomplicating simple tasks isn't the same as "cripplingly simple".
It's OOP model isn't the same as other languages, but metaclasses and the like are miles ahead of other languages.

>> No.63434057

>>63433960
Yes, I think you're correct, at least regarding Scala - I don't know enough about Kotlin. Scala has an annotation that can be used to cause a compilation failure if it fails to transform an annotated recursive function into a while loop, but it's quite limited and only works in simple cases.

I think it has some other builtin support for mutually tail recursive functions, but I don't bother with it. If I'm doing something that the annotation can't handle then I just use a monad that I know is stack safe.

>> No.63434060

>>63434029
But even then idk why they don't use Scala OOP, which is much less verbose than Java OOP. To be quite frank, trying to do FP on the JVM is a bad idea.

>> No.63434075

>>63433714
I don't understand the hate for Python. I don't like significant whitespace, but I can deal, that isn't a big deal. Why do you think the OOP feels bolted on? Because of Python's type system, it can't be 'advanced' like what I think you want. Are you too thick to see that? There are plenty of things it doesn't do great, but it is sufficient. The only thing standing in it's way of being an actually useful language for systems development is the shitty performance, which doesn't matter in I/O bound applications and an optional type system, which is incoming or here (haven't kept up much).

>feels like writing in crayon
I'm pretty sure not having to deal with obscene and cryptic syntax is a positive, but I guess I forget where I am.

>> No.63434102

>>63434030
>It works fine on my machine!
Not on my 4gb ram laptop with 100 GB SSD, actually like 74 GB after applications, the OS and parts which can't actually be used.

>> No.63434115

>>63434102
>4gb ram laptop
found the problem lmao

>> No.63434121

>>63434060
I use OOP in Scala all the time, e.g. Monad extends Applicative

>> No.63434145
File: 20 KB, 480x360, 1510184453198.jpg [View same] [iqdb] [saucenao] [google] [report]
63434145

Rewriting a backend I made from callbacks to async/await and the new ECMA6 standard.

>> No.63434150

>>63434102
RAM usage actually isn't even that bad if you maintain a sane window. But I have 4-5 windows each with 20-30 tabs at a time so it gets up there.
But I used it on my shittop with way worse specs than that. And it worked fine.

>> No.63434163

>>63434075
>Interpreted scripting language.
>Systems programming.

Fuck, Go's still an option, even if you don't know C/C++ or a .NET or JVM language.

>> No.63434171

>>63432592
I'm learning C, what do you use for graphics on your program?

>> No.63434232

>>63434163
Go is awful. I've written backend in it. I won't again. Java and C# are fine, but you won't catch anyone writing applications in C or C++ anymore. Still Python is fine for shitty personal projects, some math heavy computing (numpy, ML, etc.), and solving HR/PE problems. People who use it outside of these niches should be hanged. But saying because it doesn't fill *your shitty niche* doesn't mean it's a crayon.

>> No.63434241

>>63434171
C isn't meant for modern-day graphics. Use C++/Python/whatever with Qt or GTK, or some Java GUI framework.

>> No.63434267

>>63434115
Fuck off. Maybe if you webshits wrote native code instead of bundling a fucking browser with your webapps we woudln't be having this problem. None of us want to return to the days of like 4 or 5 applications open at any time.

>> No.63434293

>>63434267
Also, you can't use Atom over SSH.

>> No.63434298

>>63434267
>not being a webshit, that writes native code

>> No.63434299

>>63434241
Well, I understand that, but we're using C in class

>> No.63434328
File: 30 KB, 716x205, spring-boot[1].png [View same] [iqdb] [saucenao] [google] [report]
63434328

This fucker right here man

>> No.63434331

>>63434171
No graphics. I don't like skeumorphic interfaces for music. The front end is a Scheme REPL that sends messages to C through stdin. All the instruments, patches, routines, whatever are defined as Scheme code. You can write all the signal paths ahead of time in a .scm folder, load it, and play the instrument with MIDI, or you can do live-coding directly in the REPL, or whatever else.

If I just had a window with a fake keyboard and some click-and-drag knobs on it, it'd be pointless.

>> No.63434339

>>63434121
I guess it's still somewhat side-effects-free if you encapsulate the OOP parts and they only access or are accessed by the rest of your code via the necessary getters and setters.

>> No.63434355

>>63434232
>Go is awful.
Go is fine as a compromise between C/C++ and VM/Scripting languages.

>> No.63434359

>>63434299
https://stackoverflow.com/questions/5450047/how-can-i-do-gui-programming-in-c

>> No.63434389

>>63434331
I like to use the CLI where possible, but sometimes a GUI really is needed, either for the end users or because the program for some reason can't work via a CLI.

>> No.63434407

>>63434171
use SDL to make a gui

>> No.63434487

>>63434389
Nothing wrong with a GUI when it's needed, but I don't think computer music really calls for it. Most composition is going to be algorithmic or responding to MIDI hardware. No need to click anything.

>> No.63434590

int main(void)
{
// variables

// variables initialization
// statements
return 0;
}

or
void main(void)
{
// variables

// variables initialization
// statements
}

I mean, is there any usefulness in returning a value in main()?

>> No.63434611

>>63434407
It works fine for a game like POWDER, but how suitable it is depends on what kind of program he wants to make.

>> No.63434617

>>63434590
beacuse that int could be an error code

>> No.63434634

Always check error codes you lazy bastard.

>> No.63434643

>>63434102
nobody gives a shit about your poorfag ass

>> No.63434652

>>63434590
Newbie C programers, main(void) is considered better than main() because the void argument during declaration specifies that main() can only be called without any arguments. There are, however, no practical differences in C++.

>> No.63434666

>>63434634
No::fuck (You) ;

>> No.63434669

>>63434643
>Who cares about RAM usage?
Keep Yourself Safe.

>> No.63434684

>>63434487
Oh, sorry, I didn't look at the context of the post.

>> No.63434691

>>63434669
only the poorfags; fuck'em

>> No.63434693

>>63434666
satan doesn't check error codes confirmed
>>63434652
He was asking about void main(void), though, not main(void).
The answer is, yes, returning an int is tremendously important: it tells the OS whether or not your program worked

>> No.63434704

>>63434150
That's because you're actually opening Chromium tabs.

>> No.63434716

>>63434704
reminder that even the

>> No.63434721

>>63434145
>Using Node.js.
Hopefully not anything with complex processing needs.

>> No.63434727

>bloat is fine
>just add more ram
>and more bloat while ur at it

>> No.63434735

>>63434590
Some programs use main return value to indicate a status, if you don't care about that, then you may use implicit 0.

>> No.63434739

>>63434693
Yep. The return argument means that you can return an error code instead of your program quitting silently.

>> No.63434763

>>63434055
python doesn't have oop

>> No.63434774

>>63434735
I mean, returning error codes is a good idea.

>>63434727
>Electron applications work fine on my machine.

>> No.63434775

>>63433714
>the really complicated concepts
what complicated concepts?

>> No.63434794

>>63434763
Python isn't Turing complete, according to Zed Shaw.

Anyways, what else do youcall having lasses and objects?

>> No.63434808

>>63434775
>What are decorators?
Seriously, it's like he doesn't know how to use the advanced features of Python.

>> No.63434846

>>63434232
>but you won't catch anyone writing applications in C or C++ anymore
that's because your circle is full of webshits ;^)
every application that ever mattered is written in c or c++

>> No.63434848

Which companies other than Sony make square-ish shaped phones? Preferably with a 5" screen

>> No.63434860
File: 929 KB, 873x1079, sicp.png [View same] [iqdb] [saucenao] [google] [report]
63434860

>>63434794
python doesn't has objects. i am sorry but an object is when the data is abstracted by a procedural interface. python can't do that; there is no way to abstract the data (data encapsulation). therefor python is not oop. this is simple and undeniable logic. anyone who refuse this shall open a PLT book.

>> No.63434869

>>63434808
what advanced features?

>> No.63434891

(((oop)))

>> No.63434893
File: 33 KB, 800x800, 1487515529993.png [View same] [iqdb] [saucenao] [google] [report]
63434893

>>63434794
according to Zed Shaw.

>> No.63434894

>>63434860
>an object is when the data is abstracted by a procedural interface
false, the rest of your post is drivel

>> No.63434896

>>63432696
is is ok as an editor. completely shit as an ide

>> No.63434900

>>63434846
I lafd 6.5/10

>> No.63434925

>>63434860
>an object is when the data is abstracted by a procedural interface
Well now you're just redefining OOP to basically be only C++/java-like OOP.
Most definitions of OOP just define an object as something that can have state and/or methods.

>>63434869
>what advanced features?
Decorators
Custom descriptors (you already use descriptors in the form of methods without realizing it)
Metaclasses
Creating classes programmatically using metaclass constructors directly.
Overriding methods that affect basic class functionality like __getattr__ and friends.
I could go on for a while.

>> No.63434928

>>63434893
>Zed "I only know Ruby" Shaw
ftfy

>> No.63434938
File: 224 KB, 500x286, 8a8.gif [View same] [iqdb] [saucenao] [google] [report]
63434938

How come /dpt/ """"daily reminders"""" are always so hateful, exclusionary, unwholesome, and worst of all unhelpful?
Basically the opposite of everything a PSA should be.
They don't even actually remind you to do anything.

I'm here to change that.

Daily reminder to take occasional breaks from Rustposting to drink water. Health should always come first even if you are a very dedicated shitposter i mean programmer

>> No.63434951

>>63434925
>I could go on for a while.
those are advanced features to you? jesus christ

>> No.63434962
File: 108 KB, 1920x1080, 1423216211144.jpg [View same] [iqdb] [saucenao] [google] [report]
63434962

Daily reminder
>>63434938
is a faggot

>> No.63434980
File: 1.66 MB, 640x360, 2e3od4y.gif [View same] [iqdb] [saucenao] [google] [report]
63434980

>>63434962
>so hateful, exclusionary, unwholesome, and worst of all unhelpful?
>Basically the opposite of everything a PSA should be.
>They don't even actually remind you to do anything
case in point

>> No.63434986

Is there any good reason C arrays don't store their length?
Can't the compiler just optimize it away in cases where it isn't used?

>> No.63435000

>>63434938
you sound like a loser

>> No.63435005
File: 625 KB, 1280x720, sicpbook.png [View same] [iqdb] [saucenao] [google] [report]
63435005

>>63434925
>>63434894
you guys are wrong. read the early papers. either that you use classes, message based, high order procedures, ... the main point of objects are to hide data behind operations.

OBJECT IS A DATA ABSTRACTION TECHNIQUE and working only with objects is considered as a programming paradigm (oop)

another known data abstraction technique is abstract data type.


java and c++ are irrelevant here.

>> No.63435008

>>63434986
Java may be a better language for you

>> No.63435017

>>63434986
why waste memory by storing it when the compiler knows is already?

>> No.63435018
File: 944 KB, 1920x1693, 1453400948152s.jpg [View same] [iqdb] [saucenao] [google] [report]
63435018

Daily reminder
>>63434980
Is a filthy fucking rinfag

>> No.63435024

>>63434951
Then what's your definition of an advanced feature?

>>63435005
And in what way does python not do that?
Just because you don't have an interface defined for something doesn't mean it's not encapsulated.

>> No.63435028

>>63434860
What kind of retarded definition of OOP is that?
https://en.wikipedia.org/wiki/Object-oriented_programming

>> No.63435037

>>63434986
sizeof does "store" its length (in bytes), though.

>> No.63435049

>>63432478

I have constructed unary integers in coq so that every integer has ecactly 1 unique representation. I also constructed addition and im reasonably sure its correct.

How do i know if it's possible to prove commutivity

>> No.63435052

Can anyone who knows python help me out with this problem?
On the left is a set of numbers in a notepad which I read/extract and make into a 2d list like on the right of the picture.

How would I go about converting what's in the picture into a list of tuples where each tuple has 2 elements, the first is an integer, and the 2nd is a list of integers

like so

[(0, [1, 2, 3]), (1, [0, 4, 6, 7, 9]), (2, [0, 3, 6, 8, 9]), (3, [0, 2, 8, 9]), (4, [1, 6, 7, 8]),
(5, [9]), (6, [1, 2, 4, 8]), (7, [1, 4, 8]), (8, [2, 3, 4, 6, 7]), (9, [1, 2, 3, 5])]


Basically, looking at whats on the left hand column and making a tuple of it and all the numbers it matches to.

ex. 0 -> 1,2,3
1-> 4,6,7,9

>> No.63435055

>>63435005
>How it was defined in old academic papers is what matters, not how it's used today.
>Posts smug anime girls.

>> No.63435064
File: 5 KB, 710x298, Untitled.png [View same] [iqdb] [saucenao] [google] [report]
63435064

>>63435052
forgot pic

>> No.63435071

>>63435017
Not when it's dynamically allocated

>> No.63435072

>>63434986
If it were possible to figure out in advance everywhere an array could wind up in your code, and thereby exhaustively determine that its length is never used, then it would never have to store the length anyway, because if it found anywhere where the length IS used, it could just substitute that value in at compile time.
Needless to say, this is indeed not possible, or at least very nontrivial.
So two options remain: always implicitly store the length, or never implicitly store the length.
C went with the latter because the idea was that the programmers themselves could always explicitly store and/or pass the length if they needed it.

>> No.63435075

>>63434986
There's no need to store a length you're not going to use. In the most basic case of an array being used in a fixed scope, there's no need to duplicate what the compiler already knows.

When you start passing pointers out of the current scope, it's retarded. The fact that C doesn't have array slices is bad but excusable - the fact that C++ does not isn't.

>> No.63435082

>>63435052
>>63435064
Feed into a multimap and then get the .items() iterator.

>> No.63435084

>>63435052
Why are you using a list of tuples for that and not a dict mapping the left numbers to a list of right numbers?

>> No.63435086
File: 347 KB, 450x253, 473371a467d71da1b1b1870c45d45117.gif [View same] [iqdb] [saucenao] [google] [report]
63435086

>>63435018
What is a rinfag?

>> No.63435090

>>63435084
we're not allowed to use dictionaries for this assignment

>> No.63435092

>>63435018
And you're a degenerate. I mean, I may wank it to incest hentai, but at least I don't post anime or even talk about it in public.

>> No.63435094

>>63435028
the only one that is valid. ask yourself what are the differences between object and adt which is actually one of the best way to trully understand what are objects.

>>63435024
python object has no semantics for encapsulation excepting the specific cpython implementation hack of prefixing a field name with a double underscore.

>>63435055
>not how it's used today.
how it's used by cs101 and webdevs.

>> No.63435103
File: 36 KB, 490x397, PORRYLXTBD5UOKV6IOA4GMHKFHRO674Q.jpg [View same] [iqdb] [saucenao] [google] [report]
63435103

>>63435000
no u

>> No.63435108

>>63434721
Not really, it's a standard MEAN stack, complex image processing tasks are done with ffmpeg. Everything else is standard MongoDB querying.

>> No.63435110

>>63435082
unfortunately not allowed to use dictionaries, only list methods

>> No.63435117

>>63435094
>python object has no semantics for encapsulation excepting the specific cpython implementation hack of prefixing a field name with a double underscore
So? Being able to violate encapsultion doesn't disqualify something from being OOP. Otherwise Java and any other language with reflection wouldn't be OOP.

>> No.63435127
File: 436 KB, 1280x720, 1506143084524.png [View same] [iqdb] [saucenao] [google] [report]
63435127

>>63435086
you dont want to know
thats how bad they are

>> No.63435144

>>63435071
the storage duration is irrelevant; please learn C

>> No.63435159

>>63434727
bloat is wasting CPU cycles too

>> No.63435169

>>63435090
>>63435110

Well I guess that eliminates my multimap method.

Empty list
loop through elements in the file
loop through the output list
if the first number exists in a tuple, use append to append the associated value to the list in the tuple
if the first number doesn't exist append (number, [associated number]) to the end of list.

remember even though tuples are immutable, append does a mutating modification so the reference in the tuple doesn't change, which means it's valid.

>> No.63435173

>>63435144
please tell me how the compiler can know a length that is only determined at run-time.

>> No.63435175
File: 402 KB, 404x650, ed017893c6b62f3865106f0bdf7a4f97715cefe7.jpg [View same] [iqdb] [saucenao] [google] [report]
63435175

>>63435127
I was called one so yes I do.
I assume the suffix "fag" means the operative part of the word here is "rin."
What is "rin."
Is it a CS acronym, like RAII or RTTI?
Because I've never heard of RIN in that context

>> No.63435202
File: 30 KB, 696x720, 1503648992311.jpg [View same] [iqdb] [saucenao] [google] [report]
63435202

>>63435052
Not python, tried to do it for fun:
use std::collections::BTreeMap;
use std::iter::FromIterator;

fn zip(list: &[(i32, i32)]) -> BTreeMap<i32, Vec<i32>> {
let mut ret = BTreeMap::new();

for &(k, v) in list {
ret.entry(k).or_insert_with(Vec::new).push(v);
}

ret
}

fn main() {
let list = [(0, 1), (0, 2), (0, 3), (1, 4), (1, 5), (2, 6), (3, 7)];

println!("{:?}", Vec::from_iter(zip(&list)));
}

>> No.63435213

>>63435117
it does actually. it's the fundamental property that makes valid all the abstraction techniques, all the software engineering techniques who rely on objects. once encapsulation is broken, everything fall like a house of cards.

>> No.63435238

>>63435090
>>63435110
>>63435064
Parsing something like this is pretty easy when it's a fairly rigid structure like this.
1. Read the whole line from the file into a string
2. Remove the first two and last two characters
3. Split on "], [". This will give you a list of strings of [x, y] pairs.
4. For each of these, strip first character and last character, split on ", ", then parse the two sides into integers. Now you have the whole string processed.
5. If you're allowed to use a set, store the left hand numbers into a set to keep track of what you have. Otherwise, use a list and just check if the item is already in the list.
6. Construct a bunch of (x, []) tuples (second thing is an empty list).
7. Go through your parsed pairs. Add the right side numbers into the respective lists.

>> No.63435252
File: 401 KB, 314x232, 15c.gif [View same] [iqdb] [saucenao] [google] [report]
63435252

>>63435213
Yeah but OOP that's fallen like a house of cards is still OOP, it's just subpar OOP.

(AKA literally just OOP.)

>> No.63435253

>>63435052
Use a for loop to go and extract each element to a temporary variable.

for i in range(0, 19):
listTempVar = listExample[i][0]


Then go and add the matches to a temporary list.

for i in range(0, 19):
listTempVar = listExample[i][0]
for i in range(0, 19):
if listExample[i][1] = listTempVar:
matchesTempList.append(listExample[i][1]


Then you just go and make a tuple containing listTempVar and matchesTempList and append it to the final list.

>> No.63435265

>>63435213
So what you're saying is, because C doesn't do encapsulation by virtue of not being OOP, then somehow every OS in existing is a house of cards?
You're really grasping at straws here. You're trying to redefine "OOP" into "OOP that supports private members and does not support any kind of reflection or other hacks that could remotely violate encapsulation".

>> No.63435266

>>63435173
non-sequitur; why would I do that? is your understanding that I claimed the compiler knows a length not available at compile time? try reading the replies in order and understand the meaning of the words next time

>> No.63435267

>>63435253
Fuck, I mucked up the if statement syntax.

>> No.63435283

so what about C++17?

does is make life easier besides adding the [ ]= thing ?

>> No.63435299

>>63435283
it has std::variant but it sucks

>> No.63435311

>>63435265
>C doesn't do encapsulation
C has the best encapsulation actually

>> No.63435331

>>63435266
How about you try being clear?
I have no idea what you're on about.

>> No.63435335

>>63435283
std::any, std::variant, structured binding, std::filesystem and static if all are nice and useful additions

>> No.63435370

>>63435266
>is your understanding that I claimed the compiler knows a length not available at compile time?
no, and also not him, indeed you didn't claim that, but what you did claim includes it as a necessary premise. arrays can be stored in pointer variables, converted between types, passed to functions, allocated and freed dynamically, and stored en masse in data structures. for a compiler to determine whether an arrays length is ever used, it would have to be able to follow the array through all these possible transformations, which would AT BEST amount to running the whole damn program.

>> No.63435375

>>63435265
no. i am talking about the techniques relying on oop like the design patterns which in reality are interface abstraction techniques; they only works with interfaces. if you break encapsulation, the behavior of an interface is no more guaranteed. take for example the observer pattern, if you start fiddling the data of an object without using its interface (setters/getters), the observer pattern is broken.

>> No.63435382

>>63435331
which part of my reply do you have trouble understanding?

>> No.63435385

>>63435267
finalList = []
matchesTempList = []
for i in range(0, 19):
listTempVar = listExample[i][0]
for i in range(0, 19):
if listExample[i][1] == listTempVar:
matchesTempList.append(listExample[i][1]
tupleTempVar = (listTempVar, listExample[i][1]
finalList.append(tupleTempVar)

>> No.63435407

>>63435335
>>63435299
>variant
>a type-safe union
who needs unions? that shit is from the stone age

>> No.63435428

>>63435407
sum types (tagged unions) are as basic as product types (structs)

what the fuck are you doing that you never use sum types? likely you've only been taught imperative or weakly typed

>> No.63435431

>>63435407
algebraic data types are great stuff m8, once you start using them you'll feel lost without them

>> No.63435457

>>63435431
>algebraic data types
literally just generics on steroids

>> No.63435459

>>63435382
Let's start at the beginning.
What does the compiler already know?

>> No.63435463

>>63435202

Bad choice of function names. Might be confused with:
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.zip

>> No.63435468

>>63435457
>>algebraic data types
>literally just generics on steroids
m8 wat

>> No.63435475

>>63435375
>no. i am talking about the techniques relying on oop
No, you were trying to argue about what consitutes an object
>>>>>>python doesn't has objects

>if you break encapsulation, the behavior of an interface is no more guaranteed
Correct
>take for example the observer pattern, if you start fiddling the data of an object without using its interface (setters/getters), the observer pattern is broken
Correct

We all understand that violating encapsulation breaks things. That doesn't mean that being able to violate it means that a language is no longer OOP. Otherwise, that would mean Java is either OOP or not OOP depending on your security context.

>> No.63435485

>>63435463
It's just a little exercise, the function names don't matter

>> No.63435488

>>63435431
>>63435428
how is it useful besides potentially saving a few bits when your hard drive is 1MB?

>> No.63435497

>>63435488
:thinking:

>> No.63435501

>>63435488
should have said RAM but you know what I mean faggots

>> No.63435523

>>63435488
this isn't about saving space, this is about being able to elegantly represent a closed set of specified states
https://rustbyexample.com/custom_types/enum.html

>> No.63435533
File: 396 KB, 690x688, 1510772188698.png [View same] [iqdb] [saucenao] [google] [report]
63435533

>>63435488
baka

>> No.63435535

>>63435468
It's true.
>sum and product types
Literally just variadic generics. T + U, for types T and U, is literally just +<T, U> for some appropriately behaving generic type +.
>HKTs, type functions / constructors
Implemented differently, but basically all just the same thing as generics.
>enumerated types
Not generics. But also not really strictly a necessary component of an algebraic type system.

>> No.63435550

>>63435535
>they're just the same as generics xD
nope, just because they are generic operations doesn't mean they are "just generics"

do you think recursion is "just generics" too?

>> No.63435559

>>63435370
>what you did claim includes it as a necessary premise
it doesn't; the storage duration of an array object does not affect the ability of the compiler to know its size; I'll remind you that this is a discussion about arrays in C
>transformations
apparently you use that word without realizing its meaning ;)
as soon as you "transform" something it stops being the original thing; but I'm sure you're so confused that you expect to still use it as the original thing, right?
>arrays can be stored in pointer variables
false; only addresses of arrays can be stored in pointers, the arrays themselves can only be converted to pointers
>passed to functions
false; you can only pass one of the two mentioned above: a pointer to an array or a pointer obtained by converting an array
>allocated and freed dynamically
storage duration is irrelevant; I guess you're trying to say something about "length only known at runtime" but you lack knowledge of terminology to express your intention
>stored in data structures
irrelevant again
>>63435459
the size of the array; it knows it because you can't declare an array without mentioning its size; it's literally the only syntax of declaring an array

>> No.63435563

>>63435385
That gives me [(0, 8), (0, 8), (0, 8), (1, 8), (1, 8), (1, 8), (1, 8), (2, 8), (2, 8), (2, 8), (2, 8), (3, 8), (3, 8), (4, 8), (4, 8), (4, 8), (5, 8), (6, 8), (7, 8)]
as the final result haha
[(0, [1, 2, 3]), (1, [0, 4, 6, 7, 9]), (2, [0, 3, 6, 8, 9]), (3, [0, 2, 8, 9]), (4, [1, 6, 7, 8]), (5, [9]), (6, [1, 2, 4, 8]), (7, [1, 4, 8]), (8, [2, 3, 4, 6, 7]), (9, [1, 2, 3, 5])]

^ is what the result should be like

I appreciate everyones help me I think its steered me into the right direction

>> No.63435568

there's nothing wrong with turning c++ into javascript as long as i can still go fast if i want

that's just the perfect language

>> No.63435569

>>63435535
>>63435550
though you can use them in system F without builtins and formalise them as operators in system FW
(technically you don't need FW if you have data declarations)

>> No.63435576

>>63435475
okay, i don't want to talk you anymore. you constantly bring java in the conversation for trolling. your mind has definitely been corrupted by lowtrash programming tutorials written by non experts.

>> No.63435626

>>63435576
No, you're just trying to redefine what an "object" is by bringing in a bunch of correct but irrelevant shit.
The implication of what you're claiming is that because Java allows for reflection, it's not OOP. Which is absolutely retarded - nobody in their right mind is going to argue that Java isn't OOP.
It would also imply that running under a java security context that blocks reflection would somehow make Java OOP again which is equally retarded.

>> No.63435641

>>63435550
No, because in general, recursion is not a generic operation parameterized on type.
Addition and multiplication of types ARE generic operations parameterized on types.

And by the way, it doesn't make sense to call a type system "algebraic" unless it actually lets you do algebra with types. Say you have type A that can be either B or C, so it's B + C. Then you have type D, just some atomic or enumerated type. Then you have type E, defined as having an A and a D: E = A*D = (B + C)*D. Then does it also hold that E/D - C = B? No, because that doesn't make any fucking sense / mean anything useful.

>> No.63435651

>>63435568
Emscripten

>> No.63435655

Are structured bindings for tuples a cool new 17 way of std::tie?

like
//17
{
auto m = std::make_tuple(1, 2);
auto [a, b] = m;
}

//14
{
int a, b;
std::tie(a, b) = std::make_tuple(1, 2);
}

//17, ref
{
auto m = std::make_tuple(1, 2);
auto &[a, b] = m;

a = 7; //std::get<0>(m) == 7
}

>> No.63435661

>>63435559
>the size of the array; it knows it because you can't declare an array without mentioning its size; it's literally the only syntax of declaring an array
With length the amount of elements in an array is meant.
Not the size of the element type.

>> No.63435669

>>63435655
Correct.

>> No.63435674

Regarding ADTs, this is a pretty good blog post: https://manishearth.github.io/blog/2017/03/04/what-are-sum-product-and-pi-types/

>> No.63435681

>>63435641
>recursion is not a generic operation parameterized on type.
type level fixpoint (either way)

is adding functions "just generics"?
i assume you aren't aware, but functions are exponentials on types, i.e.

a -> b
is
b^a

a -> Bool
has
2^a
possible values
you might recognise this as all subsets of a (and a (a -> Bool) function is like a set operation, hence all (a -> Bool) functions are like all subsets)

>> No.63435692

>>63435655
yeah but you can also use it for other types as well (maps, arrays, structs) etc.

>> No.63435735
File: 1.70 MB, 1280x720, remote-keyboard.mov.webm [View same] [iqdb] [saucenao] [google] [report]
63435735

>>63432478
>What do you hold with, /g/?
working on building a robot with ros.
Just written a simple socketserver in python to be able to control it remotly.
We're doing small steps, but that's fine.

>> No.63435757
File: 2.23 MB, 1280x720, remote.mov.webm [View same] [iqdb] [saucenao] [google] [report]
63435757

>>63435735
web related.
Doesnt really drive straight yet, because I aint got no wheelencoder right now

>> No.63435775

I'd like to make a my own 16-bit data type for storing real numbers and then implement the basic mathematical operations (add, substract, multiply, divide) for dealing with them.
Would it be difficult to make my own floating-point (or decimal) data type in C?

>> No.63435793

>>63435775
There's nothing stopping you there. Implementing ixed point arithmetic is a pretty straightforward exercise. or you could implement software floats. 16 bits is a bit tight though.

>> No.63435803

>>63433116
get hired somewhere. tada, you're now at the professional level.

>> No.63435815

>>63435559
>as soon as you "transform" something it stops being the original thing
Then your original question has no meaning.

Without transforming an array in some way, there is no possible way to get it into a context where you would only be to use its length if that length were stored.

So if you're talking strictly about the compiler storing the length of the array and optimizing it out only if it detects the length is never queried from the array *as it was originally declared*, then there's no reason to store it in the first place, because in any scope where the array is available *as originally declared*, the length is also available, as sizeof(the_array)/sizeof(*the_array), no storage necessary.

It was reasonable of me to assume by "using the length" you meant using it even through values that refer to the memory of the array but are not actually the array strictly speaking, because, as I've demonstrated, if you didn't mean that, your question would have been pointless and made no sense.

I see now that I was mistaken: your question was in fact pointless and made no sense.

Fuck you for deliberately wasting everyone's time.

>> No.63435822

>>63433483
C and Java are shit.

>> No.63435868

>>63433483
>>63435822
except it is good. It obviously has lots and lots of pitfalls, but it is still a powerful, super simple language

>> No.63435874

>>63435681
>is adding functions "just generics"?
>i assume you aren't aware, but functions are exponentials on types
Then adding functions, assuming you do mean adding and not composing, is literally just forming a union of function pointers

(A -> B) + (B -> C)
= A^B + B^C
!= (A^B)^C

>> No.63435882

>>63432941
>Also, can anybody explain why OOP is considered hot garbage?
Only people who've never worked in the real world say this.
The entire reason OOP was invented was because massive projects become unwieldy over time. Imagine working on a codebase like Windows or Google where there are literally millions of lines of code. If you didn't organize it in a standard way, it'd be impossible to maintain.

>> No.63435903

>>63435882
>If you didn't organize it in a standard way, it'd be impossible to maintain.
Yeah but there are better standard ways of organizing projects
e.g. modules

>> No.63435921

>>63435874
>!= (A^B)^C
wait fuck i got it backwards
What i meant was
A^B + B^C != A^(B^C)

>> No.63435926

>>63435874
No, A -> B is B ^ A

>> No.63435945

>>63435874
regardless there are a whole heap of things you can do and simply something being generic does not mean "its just generics"
C doesn't have generics or variadics but it has functions which are a generic and variadic feature, pointers which are a generic feature, etc

>> No.63435967
File: 27 KB, 600x600, 0e9.jpg [View same] [iqdb] [saucenao] [google] [report]
63435967

>>63435926
Why is A -> B equivalent to B bitwise-xor A tho

>> No.63435976

>>63435967
dumb frogposter

>> No.63436025

>>63435903
Right and when you have a massive multi-department clusterfuck of programmers, baking your chosen software design practice/organization/etc into the language itself helps you ensure they write maintainable shit. I'm not saying OOP is the only way to solve that problem, just saying that's why OOP languages exist.
It's a lot easier to tell your big team how to design an api when you're speaking in terms of packages, classes, interfaces etc.

>> No.63436038

>>63435945
>simply something being generic does not mean "its just generics"
I would still say it does if it's generic over types specifically
The operation of constructing a function type is indeed generic over types, which is obvious already without conceiving of it as type exponentiation, but a single individual function by itself is not generic over types unless it's a generic function or takes or returns types in a language where types are values
An individual function is instead generic over values in certain fixed types, which is not what's usually meant by "generics"

>> No.63436057
File: 149 KB, 750x1000, throwpillow,small,750x1000-bg,f8f8f8.jpg [View same] [iqdb] [saucenao] [google] [report]
63436057

>>63435976

>> No.63436070

>>63436025
tfw when you are wipwip

>> No.63436090

>>63436038
>a function is not generic unless it's a generic function

>> No.63436115
File: 131 KB, 1797x1055, pencil_skirt,x1055,front-bg,f8f8f8.2.jpg [View same] [iqdb] [saucenao] [google] [report]
63436115

>>63436090
>mfw i was typing that

>> No.63436125

>>63435559
>the size of the array; it knows it because you can't declare an array without mentioning its size; it's literally the only syntax of declaring an array
Oh, I remember you, you dumb animal. I see you're at it again. Please remind me, what kind of data structure does p point to in the following snippet:
int* p = malloc(sizeof(int) * n);

Does it have a name? If so, what is it?

>> No.63436137

>>63432478
Any one got any good tutorials or resources for starting out with evolutionary algorithms?

>> No.63436139

>>63436125
ram buffer

>> No.63436171

>>63436139
>ram buffer
Wrong. Try again, please.

>> No.63436177

>>63436125
>Does it have a name? If so, what is it?
It just points to some memory.
You just decided to treat that memory as an array.

>> No.63436204

>>63436125
It points to a memory leak I guess

>> No.63436242

>>63435559
>the size of the array; it knows it because you can't declare an array without mentioning its size; it's literally the only syntax of declaring an array
You can use a variable for the size in C99.

>> No.63436248

>>63436177
>>63436204
>a sequential collection of elements with indexed random access
Hmm... is there a name for this? I'm sure there was a name for this. You guys don't remember it either?

>> No.63436254

Hey guys. I'm failing my CS program because I hate school and I drink too much and I'm probably gonna drop out. What language should I kill myself in?

>> No.63436261

>>63436254
German.

>> No.63436303

>>63436254
gensokyese

>> No.63436304

>>63436248
If you're saying it's an array, notice that you _did_ specify it's length: n.

>> No.63436306

>>63435407

You can't implement dynamic typing without them.

>> No.63436333

>>63436261
He will be dead before knows a jackshit about German

>> No.63436364

>>63436304
>If you're saying it's an array
I'm not saying it's anything, anon. I'm just asking you what one might call a sequential collection of elements with indexed random access. Are you saying that sort of thing is called an "array"?

>notice that you _did_ specify it's length: n
n is user input. Can you explain how the compiler was able to predict it?

>> No.63436381

>>63436254
Spanish

>> No.63436410

>>63436306
Dynamic typing is useless, why would I want to modify the source code at runtime. The entire program should be typed prior to compile time, none of this "dynamic typing" shit, end users don't need extra stress on their fingers

>> No.63436411

>>63436254
Stop drinking completely, retard. It's literal brain poison.
Get your shit together.

>> No.63436424

>>63436410
>Dynamic typing is useless
>t. fizzbuzzing brainlet

>> No.63436430

>>63436424
>the joke
>your head

>> No.63436433

>>63436411
You sound like a fun person.

>> No.63436450

Can you explain std::string_view to me like I am a retard

>> No.63436458
File: 54 KB, 800x800, flat,800x800,075,f.jpg [View same] [iqdb] [saucenao] [google] [report]
63436458

>>63436433
not him but:
>le "can't have fun without drinking" normie meme
literally how new are you
normies get out

>> No.63436464

>>63432478
Still working on my language. I'm using error values instead of exceptions, but I want to have nonintrusive, short syntax for it (unlike Go). I'm thinking about including a panic built-in which returns a stack trace, and for it to be invoked whenever a returned error is not dealt with. Because errors are defined by the user and I don't want to have some almighty, magical Error interface, I think I might need class qualifiers (error class MyError).

>> No.63436468

NEW THREAD

>>63436461

>>63436461

>>63436461

>> No.63436481

>>63436458
You also sound like a fun person to hang out with

>normies go home
>reeeeeee

>> No.63436502

>>63436430
Your "joke" doesn't have a single element of humor in it, and is indistinguishable from things said in these threads 50 times a day. Retards find the most random things funny.

>> No.63436545
File: 199 KB, 297x310, 1507254418629.png [View same] [iqdb] [saucenao] [google] [report]
63436545

>>63436481
Yeah. Am I RRIIIIiiiiiight ?!!!! lol

now go away

>> No.63436644

Beginner here. My toString says it can't convert an int to a string.
But isn't that the whole point?
Typing down your own format?

>> No.63436662

>>63436644
show us the code

>> No.63436668

>>63436644
you're using java right? just do
int x;
String y = "" + x;

>> No.63436731

>>63436668
I find it extremely amusing how you effectively managed to teach absolutely nothing
go kill yourself

>> No.63436814
File: 21 KB, 470x220, frog.jpg [View same] [iqdb] [saucenao] [google] [report]
63436814

>>63436644
I have to use German words for this shit, so sorry for that.
Essentially I get 2 numbers I want them to show as fraction.
So 1 and 4 would become
1/4 on the console
and 4 and 1
would be just 4.

>> No.63436873

>>63436814
You can't add an int like zaehler to a String like "/".
Either do Integer.toString(zaehler) or use String.format

>> No.63436911

>>63436814
The problem is that if it's 1/4, it will work because contrary to what >>63436873 says, you can put things in a string concatenation and it will do an implied toString() on them.
The problem is the "return zaehler" line. zaehler is presumably an int or a long, but the return type is a string. So you need to say "return zaehler.toString();" on that line.

>> No.63436980

>>63436911
But if it's a primitive type then there's no toString() method.
Does Java still do an implicit conversion there?

>> No.63437017

>>63436980
You're right. It should be String.valueOf(zaehler). But yes, implicit conversion works correctly on primitive types too.

>> No.63437043

>>63436911
Ohh, I tried adding +"" to make it a concatenation that worked.
Well I have other issues now but I can work on that.

>> No.63437675

>>63435563
I've fixed the bug.
finalList = []
matchesTempList = []
for i in range(0, 19):
listTempVar = listExample[i][0]
for i in range(0, 19):
if listExample[i][1] == listTempVar:
matchesTempList.append(listExample[i][1]
tupleTempVar = (listTempVar, listExample)
finalList.append(tupleTempVar)

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action