What are you working on, Jow Forums?
Previous thread:
What are you working on, Jow Forums?
Previous thread:
Other urls found in this thread:
github.com
quick-bench.com
github.com
github.com
en.m.wikipedia.org
en.wikipedia.org
twitter.com
What's the point of private functions, besides making sure your own programmers don't mess the invariants up by accisent?
Do they actually prevent outside interference?
>What's the point of private functions, besides making sure your own programmers don't mess the invariants up by accisent?
thats the point
Do you like SICP guys?
In a language like scheme you can do optimizations like inlining or specialization without breaking the language rules. Remember you can set! At any time in full scheme.
Every single CS class:
>How to make Set, Stack, Queue, Bag etc?
>Take a vector, where you can freely access any elements and freely increase the array size, but then add a bunch of methods that arbitrarily restrict which element you can access
Misses the point a little in my opinion
I tried reading that book but there was too much math in there and it had nothing to do with programming.
>too much math
It's just ez calculus
>What's the point of private symbols, besides making sure your own programmers don't mess the invariants up by accident?
For you can also provide a clean interface to the user without having to worry about breaking their code with subsequent changes.
Of course that's often completely ignored or just incidental.
Anyone use tachiyomi? How do I write an extension for a manga reader that I want to rip?
>First, observe that the first step dictates that in order to accomplish the evaluation process for a combination we must first perform the evaluation process on each element of the combination. Thus, the evaluation rule is recursive in nature: that is, it includes, as one of its steps, the need to invoke the rule itself
Am I a dumbass for not understanding this or is it just written poorly?
math is hard and I'm a bit slow, this is the first chapter like what the fuck
I always see people on other forums and youtube videos use Unix's or Shell's timer to measure how fast their algorithms are, even though they often admit it's unreliable
Why don't people just invent something that works like this:
Timer t;
t.start();
Foo();
t.stop(); t.print();
?
>the evaluation rule is recursive in nature because evaluation requires evaluation of sub expressions
Not exactly sure where you are but that's likely what they're saying.
>they often admit it's unreliable
That's just them being lazy.
>why don't they use actual timers
Some people do. People who care do.
>why not Timer t;...
There exists a lot of benchmarking frameworks. What you suggest is alright but if you want to actually microbenchmark something accurately I would recommend you look to something that catches contex switches or just aims to reduce variance.
Like
github.com
quick-bench.com
>his language doesn't have a native bench-marking function
github.com
github.com
A few hundred lines of java compiled into a .apk
Hey! I recently have applied for a remote job and then, after reviewing my resume and shit, recruiter contacted me asking for a code sample. The job is a PHP/mysql developer, I know their product relies heavily on REST. What are some smart ideas I can implement and send it as a code sample? I am exhausted on this searching for a job marathon and I'm out of ideas. Could dpt help me out here, please?
Yeah, I'm very ignorant on the subject
>p
Dude, communism killed over 100 million people
It's not fucking funny
I wrote my first C++ program then compiled and ran it in terminal. I felt my neckbeard grow 1/4 of an inch.
thx, I'm still learning java, any tips? I only knew c++ and python from what I learned back in uni (was Physics Eng. major).
>The job is a PHP/mysql developer, I know their product relies heavily on REST. What are some smart ideas I can implement and send it as a code sample?
Sadpanda reading app
I hope you didn't misunderstand. What you suggest is great assuming your timer has the precision required. It can just occasionally end up being very wrong for reasons out of your control.
If you run it a couple times and it says the same thing you're fine.
>nato hasnt killed anyone
You actually compiled it?
Damn...
>whataboutism
but pls lets keep thread programming related
Those are actually written in kotlin, sorry. I would try to find a similar site that already exists in there and then just copy/paste it and modify it for your site.
>Sadpanda
Not porno or chinese cartoons, obviously.
It's a meme you dip.
Seriously asking should I not be? I'm not gonna lie I'm new to programming.
The opposite of communism is capitalism which has never killed even a single person anyway let's write a program in Go
I'll start
package main
>Seriously asking should I not be?
You write programs to run them. If your program didn't need to run it didn't need to be written, practice excluded. Yes you should absolutely run your programs.
You're supposed to print it and eat it then wait 1 day to shit out the result
He's just amazed your first program compiled.
Ok, thank you very much for the help.
Oh that makes sense.
>any tips?
learn Clojure next
If it's about the sadpanda, it already exists in TachiyomiEH.
What's the best way to discover if a sequence of elements exists in an array? I have [2,4,3,7,8] and want to find out if [4,3] exists. I know I can't just do loop inside loop, but I have a feeling there's a clever way of doing this, I just can't put my finger on it.
How hard to write own driver for RGB mouse? I found that mine isn't customizable on Linux.
>I know I can't
I know I can
Can anyone help me? I got a bug that I have no idea what is going on with it.
I was playing around with some combinations when I got a bug using pow and I am not sure what the fuck is happening.
The following code when compiled using gcc with -Ofast gives a wrong output for the math.h pow function (up to -O3 works fine) when called for example as ./a 1 2 3:
#include
#include
int main(int argc, char *argv[]){
int size;
printf("%d\n",argc); // When calling with ./a 1 2 3 we get 4 as expected
argc > 1 ? (size = argc-1) : (size = 2);
printf("%d\n",size); // Size is 3, still fine up to here
int n = pow(2,size);
printf("%d\n",n); // Value printed is 7 instead of 8
}
This bugs seems to happen only in certain cases, ie ./a 1 2 or ./a 1 2 3 4 5 works fine then everything up to ./a 1 2 3 4 5 6 7 8 9 10 breaks again goes and so on
I'm getting a background check after the onsite interview. Does that mean they like me?
POST SCHEME CODE NOWW!!!
Generally you'd write an FSM and traverse the array with it, especially if your sequences are complex (like if you specifically wanted to find: [4, dont-care, dont-care, 3]).
just getting started with cpp coming from c#
starting to really enjoy it. currently i'm using a makefile to compile my small projects, but is cmake or another build system something you would recommend for a novice?
>No friends, same facebook photo for the last 6 years, almost no activity besides his mom wishing him happy birthday
>Yikes, Carol, if we hire him he'll just shoot up the place
>make project
>write small modular pieces of code
>90% done
>"alright lets combine the pieces into an actual application"
>code quality goes to absolute shit
everytime
how do you write those high level components that need to be integrated with a shitton of stuff and not end up with awful code?
especially when there is concurrency and a bunch of error cases
(define foo "whatever")
>what are design patterns
>how do you write those high level components that need to be integrated with a shitton of stuff and not end up with awful code?
I don't know, but if you find out tell my boss
elaborate
(define-syntax def
(syntax-rules ()
((def rest ...) (define rest ...))))
(def foo "whatever")
>do some programming
>feel like hackerman
very nice feel
yes
If you're still lurking, a reply
pow() returns a double, my guess is the optimizations in -Ofast make it return something like 7.999999 instead of 8 and it gets truncated to 7 when cast to int.
Let me see if I can summarize:
>Extend interfaces but don't extend classes.
Prolly to do with "fast" meaning "sacrifice so the precision in pow()" amongst other things.
Since pow() operates on floats or doubles or would probably be instructive to take a look at its non-truncated return value.
>dir >> folders.txt
Also if you just want 2^n with an int, just do 1
Pretty much, I think the point is that adding stuff to an interface is simple but adding implementations leads to conflicts easily
Some newer languages like Clojure have prohibitions on implementation inheritance.
Maintaining invariants is very useful
Thanks! That solves it. When I removed the if condition and defined the value directly for size it worked fine, so I guess it was optimizing that at compile time, and I didn't realize that, so I didn't think it could have been precision.
This is the diff I was going to post where left is Ofast and right is O3, no idea what I'm looking at though
So, I came to wonder how most statically typed programming languages still don't have higher-kinded types. What this basically means is that they offer absolutely no way for you to define your own generic container types. You have one built-in generic container, arrays, and that's usually it. How have we been able to cope with this lack of custom containers, and why do so few languages still support them?
JavaScript rocks!
>call exp
Looks like the "fast" one is using exp, ie exponentiation in the base of the natural logarithm, so as to substitute pow(x, y) with exp(ln(x) * y). Not sure how it works but that's why it happens.
>You have one built-in generic container, arrays, and that's usually it.
As opposed to what? Could you give an example?
Even C++ has HKT lmao
Takes a bit of a toll on the lang spec and compiler, but that's no excuse. Which langs are you referring to tho? C and Go don't have HKTs but C++ Java C# all do
Java and C# do not have HKTs.
Are there still valid use cases for writing new code in Fortran?
Oh wait you're right I'm on too much Scala rn
It's just a substring searching problem.
en.m.wikipedia.org
>foo
what in the fuck is this why does everyone use it
>foo
more like
>fool
LOL gottem
I'm doing JSON.stringify(array of strings) and my Go backend is seeing this as ["["name", "name2"]"]
i.e. an array of strings, where the strings are meant to be array of names.
How can I convert this into:
["name", "name2"]?
Makes sense.
JavaScript rocks!
Based
Cringe
Based
Cringe
cringe
based
PHP rocks!
Labeled returns. How's this for a new language feature? The idea is that a function can have more than one return statement, with a default one. And you can choose between them when you call the functions. A prototypical pseudocode could look like this
foo() {
// unlabeled return serves as default
return 0
@some return 1
}
bar() {
baz = some@foo() // baz = 1
bazz = foo() // bazz = 0
}
Rust not works!
>foo
because you can just pass a lambda in then return the result of applying the lambda to the return value
Yeah, okay. Now implement it and try writing code with it. Just like with most language features, you'll inevitably find that any use case you can think of is better served by inheritance and polymorphism.
>this is your brain on onions
[code[
return Just 0
return Maybe 1
return Sometimes 2
return Otherwise 3
excellent bait
>blubfag
for me it's macOS, the best OS for programming.
how to write good Java?
I know Java is a bad language but like it or not it's a highly employable bad language and good languages are relatively not employable. But the thing is, being a bad language, it encourages bad code.
How do I avoid falling for this encouragement, and write good code in a bad language?
Cringe