What are you working on, Sup Forums?
Previous thread:
What are you working on, Sup Forums?
Previous thread:
Other urls found in this thread:
groups.google.com
github.com
stackoverflow.com
amazon.com
pastebin.com
isocpp.github.io
twitter.com
Making a CLI calculator app because bc doesn't parse a arithmetic expression from the arguments.
Waiting for the second part of Crafting Interpreters to appear.
>most of Rust's moves are implicit
No, they are explicit unless your type explicitly overrides this and passes by copy.
Implementing the Copy trait means that the type is POD and a copy is equivalent to a move.
Yes, and you need to explicitly implement this trait.
Using a neural network to make taytay lewds
Why do people use this thread like an IRC chatroom?
std::thinking(&mut self::brain).unwrap()
godspeed lads.
>there's nothing stopping you from reporting such a failure (even in a destructor), you just don't use exceptions to do so
You can't use a return value. You can't even use an out parameter. And you certainly can't throw.
The only thing you can do in this circumstance is set a global flag, which is horrible.
>as i said, RAII doesn't have to be suitable for every scenario because the language doesn't require that you use it in every scenario, and is not in any sense mutually exclusive with alternatives like goto cleanup or scope guards.
This is the problem with C++ as a whole, isn't it?
>Foo being terrible doesn't matter because you don't have to use Foo
The increase in complexity is not worthwhile considering how limited the utility is. You can't fix misfeatures by adding new features.
Anyone here knows OpenCL? I have a C++ program that I want to run in my CPU and GPU at the same time, can I just use OpenCL to concurrently execute the for loop that is in use 99% of the time? It's just number crunching with some random number generation, so it's just pretty much C code anyway, I can just use it as the OpenCL kernel right?
Why don't you fuck off if you hate it so much?
What are we supposed to use it for? There's like fifty threads a day you can't fill that much with projects you have completed or whatever reddit shit you want.
Ok guys, so I've made a backgammon game which runs in the terminal in Java. How do I go about making it in a GUI? Any tips?
I man in the last thread there were
Rewrite it in C++ with Qt.
Just use ascii art
pls put it on github when done
/* btfo */
just use JFrame JPanel and JButton stuff
or get netbeans to do it for you
there were about 30 code blocks
but I agree, rust shills and corresponding bait takers should restrain their CoCs
>you can only talk about programming if there's code posted
alright then
>Hahaha, you clearly never thought I could post anything in code blocks rite btfo xDD
The mental age of Sup Forums
>judging the thread based on the formatting
>>>/wdg/
>rust shills and corresponding bait takers
user, please, we're in a civilized thread. Use proper English: surely you meant "Rust shills and their baitees".
>formatting
yes, formatting
>life without types
test
Rate my code block:
(define (compose2 f g)
(lambda args (call-with-values (lambda () (apply g args)) f)))
(define (compose . fs)
(if (null? fs)
(lambda args (apply values args))
(compose2 (car fs) (apply compose (cdr fs)))))
((compose (lambda (x) (+ x x))
(lambda (x y) (+ x y))
(lambda (x y z) (values (+ x y z) (- x y z))))
1 2 3)
should i learn java or scheme ?
...
ah indeed
what do you want to use it for?
both are worth your time
dude whitespace lmao
(define (inc n) (lambda (f z) (n f (f z))))
(define (add a b) (lambda (f z) (a f (b f z))))
(define (mul a b) (lambda (f z) (a (lambda (s) (b f s)) z)))
(define (succ n) (cons n n))
(define (_0 f z) z)
(define _1 (inc _0))
(define _2 (inc _1))
(define _3 (inc _2))
((mul _2 _3) succ '())
Rate my church piano arithmetic fizzbuzz.
Why is LISP so dead?
that's nice but can it play ode to joy
>that's nice but can it play ode to joy
Only if you know what a paren sounds like.
nicely formatted / 10
It's already distributed, you can find it on reddit
mostly boredom, although i've considered doing some android dev
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Buzz
17
Fizz
19
Buzz
Fizz
22
23
Buzz
Fizz
>16 is buzz
>3 is fizz
I think you are mistaken
dude weed lmao
Why sometimes seppelsfag makes this code??
class Foo {
Bar something;
public:
Bar & bar() {
return something;
}
};
where
I'm looking for a way to encrypt a set of identifiers in a dataset (name and date of birth, about 100,000 unique ids) into a simple alphanumeric string. The process should be invertible using some private key or passphrase. Ideally this should be achievable using just cli tools or maybe R. What should I look for? I have no clue how to go about this.
dude getters and setters lmao
If you think that's funny, you should see kids your age getting together on the internet and talking about writing their next-gen CoD clone in C++, and how they'll "pay" artists with a percentage of their future profits.
Getter and setter are understandable. But that shit does nothing than just put it to public or use struct.
Cargo cult programming. It imbues your POD struct with the magical powers of good OOP design.
Having both getter and setter is the same thing as having direct access to the object.
The only difference I can think of is that they might be virtual.
>Having both getter and setter is the same thing as having direct access to the object.
Not in general, because a getter and a setter can guard against violation of some internal invariant.
setter is really usefull to check whether something should be legal or not such as:
class Foo{
int data_size;
public:
void set_size(int i){
data_size = (i < 21 || i > -21) ? i : ( i > 0 ? 20 : -20 );
}
};
and getter is to know the value of the variable
But the best method should be:
class Foo{
int data_size;
public:
int size(int i){
data_size = (i < 21 || i > -21) ? i : ( i > 0 ? 20 : -20 );
return data_size;
}
int size(){
return data_size;
}
};
How do I see changes I've made to a python library?
I want to contribute something to the discogs python api. I've cloned the repo on my local machine, but to play around with it to add my change I'd like to be able to add print statements etc..
github.com
Is there a way I can specify my python terminal to use my local edited version of the library instead of the official pip install version I already have downloaded? in other words, how can I see changes I'm making to this python api?
>and getter is to know the value of the variable
>his language doesn't have a .value property for every variable
doesn't python have an import tracking system?
as far as I know, if you put it in a different folder you can access your new version by specifying that it's in that folder
found it (but python doesn't have the feature)
stackoverflow.com
I don't normally see this in a normal named member functions, but C++ does this all the time with operator[] (std::vector, std::string, etc.)
Three is supposed to be Fizz.
Why does it have to be so hard to do something as simple as portably declaring a unique identifier in C?
...
uh you don't get to bring Buzz
How easy would it be to develop a UberEATS like delivery app?
Can anyone help me with some boolean fun?
I’m trying to find the disjunctive normal form of (a v ~b) -> ((a -> b) v (~a ^ ~b))
I started this way:
Removing ->: ~(a v ~b) v ((~a v b) v (~a ^ ~b))
De Morgan: ~a ^ b v ((~a v b) v (~a ^ ~b))
And now I’m stuck there, I believe I need to use the distributive rule but I’m not sure how to do this exactly.
What systems programming language should I learn?
>This is the problem with C++ as a whole, isn't it?
it's not a problem at all. a tool which costs you nothing when you're not using it and even costs you nothing when you're using it properly and reduces redundancy and/or eliminates contextual invariants/sources of programmer error isn't a problem, it's a solution. and if it's not suited to your problem, all that means is that it's not a solution for that problem. it's no less a (better) solution for any number of problems. you're literally trying to make a case against specialization
>The increase in complexity is not worthwhile considering how limited the utility is
it's not an increase in complexity. it reduces the complexity of the problems it's suited for (sometimes drastically, in non-trivial cases). and its utility isn't very limited considering the only thing it really doesn't handle for well is errors on destruction, and most things have no good reason to produce errors on destruction, anyway. for the things that do, it doesn't get in the way of alternatives
C
In conjunction with this:
amazon.com
C isn't even self hosted anymore
why not just use veich diagrams
>a tool which costs you nothing when you're not using it
>in C++
It literally costs money when the employers of C++ code monkeys have to pay them a salary to deal with problems created by C++ itself when its half-assed features interact in weird ways or necessitate the introduction of endless arbitrary rules that nobody remembers.
>C rating drops with Rust's first stable release
>yet Rust is still so low on the ratings that it doesn't even show up on the graph
solid implication there champ
(a ^ b) v c
(a v c) ^ (b v c)
sorry forgot you call it a karnaugh map
>First stable release will magically turn all the existing C codes into Rust
Yeah a solid one indeed
wait I'm retarded you don't need the minimal form
Not easy when you consider that hungry, angry, stupid humans will be using it.
Okay but what if its not for food and im talking about developing the app itself
It increases the mental burden whether you're using it or not. When you have to refer to external declarations to determine if Foo f; is going to break you out of your function, or if you have to check the compiler isn't sneaking extra code behind your return statement which is why it won't tail-call, your misfeatures are costing you.
Learning a thousand idioms which are collectively more flexible is not a preferable alternative to learning a single universal idiom. The onus is on the programmer to learn those in order to understand other people's code. Mistakes are made when the context is so great that bugs can be concealed - not when someone forgets to follow init with defer close, which will be detected instantly under review.
I'm very new to C and programming in general. I've noticed something that I don't understand, I'm wondering if someone here could explain it to me.
Check this code: pastebin.com
When USE_POINTER is 1, if W > H, then it crashes. But it works properly if W
Your app has to be used by people. Making an app is easy. Making an app that works well and provides value is not easy.
Building an algorithmic trading system.
IMO it looks like all those other things just went up.
> Array = calloc(H, sizeof(int*) );
H is 8, then comes the following loop
> for(x=0; x
Where does the c come from?
what
those problems aren't created by C++, they're created by people using C++ features incorrectly. have we seriously come to "idiots can use it wrong therefore it's bad"? jesus
>when its half-assed features interact in weird ways
what? most C++ features are entirely heterogeneous/standalone, except in the obvious complementary cases. naturally. otherwise you wouldn't be able to opt in or out of them in whatever combination at your discretion. you can certainly combine them in complex ways, but they remain entirely predictable provided you understand each feature you're using on its own
i think user already knows this law, just not how to apply it in his calculation
Great advice lord Autismo, im sure youre having a giggle there
isocpp.github.io
Did Stroustrup seriously write a library that serves no purpose other than to force users to adhere to his vision of how the language should be used?
C++ features are so poorly implemented that it's entirely possible that even seasoned programmers will make mistakes.
Combine them and the probability is multiplied.
I had a mental breakdown due to work stress in my electronic eng job 5 years ago, became a neet for 2 years after. Finally got my shit together, went back and did a conversion to CS but I am shitting myself to go look for a job and my course is ending in 3 months. I used to be so confident..
Welcome to my blog.
>those problems aren't created by C++
Yes, they are.
>most C++ features are entirely heterogeneous/standalone
They should be, in theory, but they aren't due to C++ implementing them so poorly.
is Kotlin going to replace Java?
Beef out your linkedin and recruiters will come to you. That's what I did and I get 1-3 recruiters a week calling me now in a non-tech city
What are you afraid of?
>Kotlin
no
because oo is about operations, not attributes, you ignorant fuck.