[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 344
Thread images: 39

File: 1479581157926.jpg (63KB, 643x645px) Image search: [Google]
1479581157926.jpg
63KB, 643x645px
Previous thread: >>60746958

What are you working on, /g/?
>>
>>60753596
Lisp is the most powerful programming language. Mathematics is evil and wrong.
>>
give me a fucking tool i can use to truncate a decimal number so that it has the minimum number of digits required for the compiler to uniquely identify the 32-bit floating-point number closest to the decimal number entered.
>>
>>60753638
https://www.h-schmidt.net/FloatConverter/IEEE754.html
>>
>>60753651
btw use the +1 -1 buttons on the right to get the closest number you're looking for.
>>
/dpt/ - Dead programming thread
>>
>>60753821
This isn't /dpt/, look at the OP image

What does it have to do with programming?
>>
>>60753615
Lmao there isn't even a predicate for an empty vector.
>>
File: 99% chance of success.jpg (25KB, 320x213px) Image search: [Google]
99% chance of success.jpg
25KB, 320x213px
>>60753596

I'm working on some functions for making graphs (the vertex and edge kind, not f(x) = ... kind), as part of another project.

What is the correct way to construct a hash function for an unordered_map in C++?
>>
>>60753900
what is null
dumbass
>>
>>60753949
http://en.cppreference.com/w/cpp/utility/hash
>>
>>60753984

Thanks buddy
>>
How do I read a specific column of text from file, in C?
Like
Bytes: 01001011 Symbol: &
Bytes: 01110101 Symbol: W
...


I need to get &, W, and so on. How?
>>
>>60754111
sscanf
>>
>>60754111
>c
Stop using unsafe code, anon
>>
File: anon joins the programming club.jpg (372KB, 1280x720px) Image search: [Google]
anon joins the programming club.jpg
372KB, 1280x720px
How stupid would it be to get around POSIX shell's inherent lack of variable scope by devising a pushdown automata as a sort of stack to create stack frames and, naturally, maintain continuity in all the scopes above the one I'm currently in?

I hear javascript doesn't have any sort of lexical variable scope either, should I try doing this in javascript first?
>>
>>60754150
Oh, thank you.
>>
File: diary.webm (1MB, 784x592px) Image search: [Google]
diary.webm
1MB, 784x592px
C++/Qt Widgets
upload limit is 3mb so i couldn't show you all the features.
>>
>>60754169
Do it in Common Lisp. It has lexical and dynamic scope.
>>
>>60754302
What's wrong with a text file?
>>
>>60754302
How much of this is actually qml?
>>
File: diary2g.webm (2MB, 784x592px) Image search: [Google]
diary2g.webm
2MB, 784x592px
>>60754302
custom progressbar is the best thing i've ever made. look at how beautiful it is.
>>60754341
none of it is qml. i didn't use qt quick.
>>60754340
i don't even know desu, wasn't trying to make anything useful.
it has statistics though.
>>
>>60754487
>Eats for 1 hour straight, no breaks
>Swims for 8 hours straight, no breaks
lol hax
>>
File: Capture.png (16KB, 561x340px) Image search: [Google]
Capture.png
16KB, 561x340px
>>60753596
I am doing something.
How would I go about getting the coordinates out of those?
>>
>>60754634
what language
>>
>>60754651
Java.
>>
>>60754487
nice theme but the scroll bars are annoying
>>
>>60754634
i dont get what you are trying to do . Post the full class code, so i can help you out.
>>
>>60754487
That's pretty cool anon
>>
>>60754704
https://pastebin.com/vqB3Dy7T
>>
>>60754792
So your "xy" stands for some value in row X, and value in column Y right? You need to loop through your 2d arrays using double for loops. Sorry I'm on my phone, so something like this.
 
for(rows here){
If(value at row == x){
Stop we found our x.
Save x row value.
for(collumns value){
If (value at collumn == y){
Stop found our y
Save y to some variable
Now you know which row and collumn to has xy
>>
>tfw to smart to understand file serialization in c#
pliz help im a newb

also why is working with files so cancer
i hate it
>>
>Interface transposes the x and y axis when it applies changes to the model in the background
>similarly when using the undo or redo to change the model and sync the interface to the model it transposes them back
>everything else that converses directly with the model had it's shit fucked up

Two wrongs don't make a right but they make it hell of a time figuring out what's wrong.


My question to you /dpt/ is if undo is ctrl + z, should I make redo ctrl + y, or shift + ctrl +y?
>>
>>60750116
>>60750115
>>60750113
>>60750112
>>60750111
>>60750109
>>60750108
>>60750107
If you're still here can you post the source code?
>>
>>60755049
the fuck is that
>>
>>60755025
Redo should be both ctrl shift z and ctrl y. It's always annoying when using a program and doing one only to find out it's the other.
>>
>>60755025
Ctrl + y. Keep them paired with x and y
>>
>>60755065
An anon made a spambot
>>
>>60755097
It's not a spam bot. He did that by hand. How do u even bot, against a captcha? even if he uses a 4chan pass, there is anti spam/post limit in 4chan already.
>>
>>60755079
I think you are right, I'll make it both. No that my program will have so many shortcuts that I'll be missing some of them.
>>
>>60755126
Look at the post times . He probably did something similar to delayclose
>>
>>60755147
I just looked at the time stamps. That's pretty interesting. I dont know how he's doing it, I thought it was impossibe
>>
>>60755170
>I thought it was impossibe
lmao go check
>>>/vg/gw2g/
for the impossible

There's a bot that spams /gw2g/ threads for months now, mods have admitted to rangebanning nearly 170 ranges in an attempt to stop it, but it's still going full ham.
>>
hey /dpt/ I have a php job interview tomorrow. What are your tips to get employed?

I can't rely on autismbux forever.
>>
>>60754302

That's pretty quality
>>
>>60754487
Very nice
>>
>>60755453
write a fizzbuzz on the whiteboard
>>
File: 1472425752138.png (4KB, 334x526px) Image search: [Google]
1472425752138.png
4KB, 334x526px
>tfw you almost fell for the programming job meme
>>
>>60755523
for($x=1;$x<101;$x++)echo($b=(!($x%3)?'Fizz':'').(!($x%5)?'Buzz':''))?$b:$x;[/cpde]
>>
File: 1491825308235.jpg (40KB, 650x500px) Image search: [Google]
1491825308235.jpg
40KB, 650x500px
>>60755453
>practice basic programming interview questions
>practice basic PHP interview questions
>just b urself
>good luck
>>
>>60755537
Sorry, you couldn't close your code tag properly, so we cannot trust you with a job.
>>
File: STAR00486.jpg (3KB, 90x122px) Image search: [Google]
STAR00486.jpg
3KB, 90x122px
PyPleb here.

Why am i only getting pic related instead of the actually cover image, that i get from inputing the URL manually into my browser.


import urllib.request

url_template = "http://pics.r18.com/digital/video/1{0}/1{0}pl.jpg"
user_input = input("Enter a movie ID (eg. STAR00486) :")
url = url_template.format(user_input)
print(url)
urllib.request.urlretrieve(url, "{0}.jpg".format(user_input))
>>
>>60755549
They probably test for user agent
>>
>>60755560
can you use headers with urllib.request?
>>
>>60755545
that makes me perfect for a php job!
>>
>>60755549
>>60755571
>Python
Who fucking knows. Literally any decent library in any other language would let you set this stuff. Python is a flaming pile of trash though so don't expect anything. People who programming to do don't use Python. Python is for nongrammers who have to make a computer do something without knowing a fucking thing about what computers do.
>>
>>60755591
It pisses me off how simple this HAS to be, but i end up going in circles with conflicts out the ass no matter what i try.
>>
>>60755549
Cookies, sessions and login probably.

When I go to http://pics.r18.com/digital/video/1{0}/1{0}pl.jpg I get redirected to https://pics.dmm.com/mono/movie/n/now_printing/now_printing.jpg which is precisely this Now Printing icon. You've clicked the "I am at least 18yo" in your browser haven't ya? It probably created a cookie you'll need to send along in the Python script.
>>
>>60755591
>Literally any decent library in any other language would let you set this stuff.
And urllib perfectly lets you do it. It's ok not to like Python-sensei fampai, but if you want to criticize him, try having actual arguments.
>>
>>60755571
Yes. Use add_header("User-Agent", whatever the fuck).
>>
>>60755724
I meant http://pics.r18.com/digital/video/1STAR00486/1STAR00486pl.jpg
>>
>>60755549
Just tested it and it works fine:

import urllib.request

urllib.request.urlretrieve("http://pics.r18.com/digital/video/pppd00383/pppd00383pl.jpg", "test.jpg")


So my guess is that your generated URL is wrong
>>
>>60755767
I still get a printing icon from that URL in my browser.
>>
>>60755782
Me too that's the point
>>
>>60755724
>It probably created a cookie you'll need to send along in the Python script.

Shit, that's way beyond me.

Any hints on how to progress?
>>
>>60755775
Dunno. I don't go on r18 so I took >>60755549's word as to where the image lives.
>>
>>60755808
Yeah, so did I but see >>60755767. The URL just seems wrong
>>
>>60755775
weird, any idea what's wrong with my generated URL?

As an example i'm trying to retreive the cover for STAR-486
>>
>>60755834
The "real" URL is http://pics.r18.com/digital/video/1star00486/1star00486pl.jpg

So just try to make your movie ID small caps (lower() in Python)
>>
>>60755834
Ok got it now.
*/1STAR00486/1STAR00486pl.jpg

doesn't work, but
*/1star00486/1star00486pl.jpg

does work
>>
File: 1368231041648.jpg (36KB, 480x480px) Image search: [Google]
1368231041648.jpg
36KB, 480x480px
>>60755850
Yeah, that was it.

But now i noticed that their site seems to generate a random Char before the movie ID like the 1 in 1star486.

Is there a way to make sure my script takes that into account?
>>
File: 1493296778994.jpg (265KB, 689x816px) Image search: [Google]
1493296778994.jpg
265KB, 689x816px
Rate my true unix $wc, losers
import std.stdio;
import std.string;

void main(string[] args)
{
if (args.length > 1)
{
calculate_words_in_files(args[1 .. $]).writeln();
}
else
{
int word_count;
string input;
while ((input = stdin.readln()) !is null)
{
word_count += input.split().length;
}
writeln(word_count);
}
}

int calculate_words_in_files(in string[] file_paths)
{
import std.file;

int word_count;
foreach (file_path; file_paths)
{
auto current_file = File(file_path, "r");
string current_line;
while (!(current_file.eof()))
{
word_count += current_file.readln().split().length;
}
current_file.close();
}
return word_count;
}


user0@primary:~/devel/proj/test-d$ echo abcdef ghijkl | ./wrdc
2
user0@primary:~/devel/proj/test-d$ ./wrdc wrdc.d
69
>>
>>60756033
It's fucking shit.
>>
>>60756061
Why?
>>
>>60756069
It's written in deadlang.
I don't like your bracing style
There is code duplication
It's very inefficient
>>
>>60756082
>It's written in deadlang.
More active than ur mum's git repo, loser
>I don't like your bracing style
Suck my cock too
>There is code duplication
I'll give you that
>It's very inefficient
I won't give you that that
>>
>>60756033
Why do you waste your time writing primitive programs in a dead language?
>>
>>60756100
That an answer to my question
>>
>>60756033
0 for using a dead language but +10 for using a cute akarin image so 10/10
>>
>>60756118
>dead language
More alive than your penis in the heat, loser
>>
>>60756139
what do you mean by this
>>
>>60756033
> input.split().length;
> for each word in each input line the code creates an instance of String on heap and copies the word from the input line to the new instance only for it to be counted and then take up space until the GC collects it
So... this is the power of D....wow
>>
>>60756185
Uh? Why would GC run in the first place if you are not running short of memory?
>>
>>60756208
That's my point, these totally unnecessary objects will be taking up space for an unspecified amount of time. Or, and you'll be running short on memory if you count big enough files, because of all the garbage split().length generates.
>>
>>60755893
If it is truly random just would have to bruteforce it. Otherwise you can retrieve the right id from the search: http://www.r18.com/common/search/searchword=<movie ID>
>>
>>60756243
So instead of deleting the garbage each time it's created you kill them periodically
>>
>>60756033
>.readln().split()
disgusting

#include <stdio.h>
#include <ctype.h>

int word_count(FILE *f) {
int c, prev = 1, count = 0;
while ((c = getc(f)) != EOF) {
if (isspace(c)) {
prev = 1;
}
else if (prev) {
prev = 0;
count++;
}
}
return count;
}

int main(int argc, char *argv[]) {
int count = 0;
if (argc == 1)
count += word_count(stdin);
for (int i = 1; i < argc; i++) {
FILE *f = fopen(argv[i], "r");
if (f == NULL) {
fprintf(stderr, "Error opening file '%s'\n", argv[i])
continue;
}
count += word_count(f);
fclose(f);
}
printf("%d\n", count);
}
>>
>>60756265
Right, I know how GC work. The problem is, you don't need to generate any garbage at all here, see >>60756274 .
>>
>>60756274
>doesn't compile
>>
>>60756314
This is fully standard C89 fyi, it's normal that dmd does not want to eat it since it's not shit.
>>
>>60756333
>This is fully standard C89 fyi
So did C break backwards compatibility? How sad
>>
>>60756333
>This is fully standard C89
You're missing a semicolon on fprintf.
>>
>>60756314
Rite, missing semicolon. That was difficult to figure out wasn't it?
>>
>>60756351
So doesn't compile then. Why are you dumping your shit here?
>>
>>60756344
>D-sucker bitching about backwards compatibility
So ironic
>>
Gosh, D-fags are so pathetic.
>>
>>60756362
>>60756369 (samefag)
Are you just mad that you can't even write a program that compiles?
>>
>>60754302
Woah! Good job, now i want to learn qt too
>>
>>60756358
I'm not >>60756274 but here's a fixed version just for you retard.
#include <stdio.h>
#include <ctype.h>

int word_count(FILE *f) {
int c, prev = 1, count = 0;
while ((c = getc(f)) != EOF) {
if (isspace(c)) {
prev = 1;
}
else if (prev) {
prev = 0;
count++;
}
}
return count;
}

int main(int argc, char *argv[]) {
int count = 0;
if (argc == 1)
count += word_count(stdin);
for (int i = 1; i < argc; i++) {
FILE *f = fopen(argv[i], "r");
if (f == NULL) {
fprintf(stderr, "Error opening file '%s'\n", argv[i]);
continue;
}
count += word_count(f);
fclose(f);
}
printf("%d\n", count);
}

Now can we get back to >>60756300's point?
>>
File: mad.png (6KB, 487x112px) Image search: [Google]
mad.png
6KB, 487x112px
>>60756374
A missing semicolon is better than the inability to implement a trivial program without shitting all your memory with unnecessary objects.
>>
>>60756404
>>60756410
>One minute apart
Why are you still trying?

>Now can we get back to >>60756300's point?
Yes. You do have a valid point, I'll agree. However for almost all use cases the performance gap is quite negligible.

What you >>60756404 did can be done in just about any language, really it's not C-specific. So >>60756185 was wrong.
>>
>>60756410
The ability to have tons and tons of trivial stuff taken care of already by the programming language you use is far more valuable than a few MB smaller memory footprint.
>>
>>60756442
It's 55 seconds, you stupid fuck.
>>
>>60756521
Size of the file?
>>
For comparison, Rust's implementation of wc uses "split" function too: https://github.com/uutils/coreutils/blob/master/src/wc/wc.rs#L172 . The key difference being, the split function in Rust returns an iterator of &str, and not an array of Strings.
Since Rust's iterators are lazy and &str is just a pair (pointer, length), no allocation will take place, the iterator will be inlined and the result will be a simple loop, analogous to the manual implementation in C. Meanwhile, in D split will first allocate an array (since arrays are just incorrectly named vectors) and then the instances for all the words in the input.

>>60756442
>everyone who disagrees with me is a single person
Wew, lad.
> So >>60756185 was wrong.
Wrong how? https://dlang.org/phobos/std_array.html#.split says my description is right.

>>60756472
So why don't you use Python?
>>
>>60756550
>Wrong how?
If you look at the posts you reply to very carefully, you'll find out that I said "What you >>60756404 did can be done in just about any language, really it's not C-specific."
>>
>>60756550
https://dlang.org/library/std/algorithm/iteration/splitter.html
>>
Do you guys ever feels lost when programming with C++ which kind of object to use?
For example if i have child and parent classes and I want to reference parent from child, I could use:

> reference. Can't use copy constructor.
> reference wrapper. Have use to use annoying get() everywhere.
> Raw pointer. <...>.
> weak_ptr. Only if parent is owned by shared_ptr, have to use lock() before each use.

It just seems like there's no winning. In similar situations I often consider my options and go with raw pointer. What is your go-to choice?
>>
>>60756572
C++ was a fucking mistake.
>>
>>60756550
>Rust
you can't even compare strings and characters in Rust
str[i] == 'a' doesn't even work in Rust
>>
>>60756591
OMAGAD
OMAGAD OMAGAD

It's horrible.

Not.
>>
>>60756606
post yfw you can't check if abc[i] == def[j] in rust
>>
>>60756617
Wait, I remember that /dpt/ meme a few weeks ago. That's because of variable-length encoding right? In that case it's perfectly natural for Rust not to implement random-access because it's nonsensical. Now you tell me, who the fuck uses anything besides utf-8 nowadays? Write your programs correctly and idiomatically and stfu.
>>
>>60756568
I see Andrei actually makes D better, still tho, it allocates a new string on each iteration.
>>60756591
>redherring
You can. What you cannot do is to access a Chan in a String by index, since all the strings are UTF-8 by default and you can't index inside an utf8 string because code points have a different width. What you can do is either get a Vec<Char> from a string and index a Char inside it, or to ignore utf8 by using the string as &[u8] and comparing with b'a', the 8-bit ascii value.
>>
>>60754487
Is this public anon?
>>
>>60756617
kek is this actually true? How would you go around it?
>>
>>60755001
Are you trying to serialize an object to/from a file or what?
>>
>>60756723
depending on the situation: cast and compare raw bytes, utf8decode and compare the codepoints, iterate from the beginning. It's not a limitation, it's just superficially counter-intuitive, which is why /dpt/ goes crazy over it.
>>
It's hard to really get in to programming because I don't know what would be the best platform. Desktop, web or android. I'm interested in all of them.
>>
>>60756792
>It's hard to really get in to programming because I don't know what would be the best platform. Desktop, web or android. I'm interested in all of them.
Pick one and start. Once you know one, learn the others. Do you currently know a language?
>>
I personally wish Rust gets a nice toolkit with Qtcreator. GNOME devs are interested in Rust so those people can integrate a RAD tool with GNOME-builder. Thus we can forget about C++ and Qtquick
>>
>>60756792
javascript can do all 3
>>
>>60756812
I actually know basics of many languages because I'm struggling with that I don't know what I would want to learn.
>>
>>60756865
Basically you need to force yourself to pick one and stick with it. It's going to be an exercise in discipline, and this board is going to actively push you against it. They'll push you toward whatever new meme language they like, and they'll try to shame you if you don't buy into their hype. Just choose something and stick with it. The worst possible outcome is in a few weeks you realize how much you hate that language and that you never want to touch it again. You'll be more wise for it.
Also remember, the deeper you get into your problem space, the less important the language is. Great programmers can write good code in any language, just pick the tool you're most comfortable with.
>>
>>60756865
What language features interest you?
>>
File: 14921321102545.jpg (31KB, 439x521px) Image search: [Google]
14921321102545.jpg
31KB, 439x521px
>>60756865
pick one thing randomly, come up with a project and dive balls deep into it and stick with it. along the road you will realize some things and get a clearer vision of everything, no shortcuts around it

it feels like you are in analysis paralysis and it's a counterproductive bitch
>>
>tfw it's so cold at home I can't bloody focus on my work
actually considering buying dem fucking high socks you memed about /dpt/
>>
>>60757013
They're a very good investment. Consider the programming gloves too.
>>
>>60757013
Buy compression pants. They're warm as fuck, and comfy. Great for wearing under jeans on a cold day
>>
>>60757013
Quit being faggot and drink beer.
Then it doesn't matter even if it's bit cold or your fingers hurt or some shit.
>>
Why is Ruby such a comfy language?
>>
>>60757169
I haven't used Ruby, but it looks quite nice. I'm considering using it for an embedded scripting language for a game I'm working on. It looks a bit cleaner than Python, and I expect it'll be easier for non-programmers to learn than scheme
>>
So Go is basically like C but without the manual memory management
>>
>>60757191
Crudely, yes.
>>
>>60757191
Go is more like java without the jvm and huge library count.
>>
>>60757163
>programming while drunk
literally can't do it
>>
>>60757191
Go is like my anus without your penis

>>60757216
>drink a beer
>get drunk
wut
also, programming with hard liquor is the best, you hit this sweetspot where you're able to tune out all the distraction and just jam
>>
>>60757184
Use Lua instead; a lot of games use embedded Lua for a reason, such as WoW.
>>
>>60757191
Go is like C but with fewer features
>>
>>60757231
I don't really like Lua. I've tried using it in other applications, and I just find it to be so annoying. Totally a matter of my having weird taste, I definitely get why people use it
>>
File: 1490698984741.jpg (43KB, 400x400px) Image search: [Google]
1490698984741.jpg
43KB, 400x400px
>>60753615
So the most powerful programming language is evil and wrong?
>>
>want to insert an object into this nested object
>use
>
main.exercises.push({
"parentworkout": edata.data.parentworkout,
"excercisename": edata.data.excercisename,
"weight": edata.data.weight,
"sets": edata.data.sets,
"reps": edata.data.reps
});

>and get pic related where in the for loop assigns itself to all objects on that level instead of the current one in the for loop
>try main.exercises = ({ instead
>it just assigns one entry even if there could be more
wtf I hate javascript now? I thought it a meme. Anyone want to enlighten me about this?
>>
File: 1469673577715.png (96KB, 902x436px) Image search: [Google]
1469673577715.png
96KB, 902x436px
>>60757638
fugg the picture
>>
>>60757638
>meme
You might want to to try >>>/v/
>>
>>60757711
whats a v?
>>
>>60757721
A subreddit for your kind.
>>
>>60757734
okay thanks for the redirection. you know any thing about my question?
>>
>>60757801
I'm on >>>/v/ too. Just ask there, I'll answer it. Don't forget to close this tab though.
>>
What is the drawback of using C as a compiler backend?

Why so many new languages chose LLVM instead?
>>
I am trying to find a general way to build a filter network in python without hardcoding logic or misusing "None".

There is one entry point in the filter network, which is the root of the tree. Each node in the filter tree might have multiple child nodes or be a leaf. I want it so that I have the network process a batch, and all the leaf nodes have all the processed data.

So, something like...
lines = (line.rstrip() for line in file)
linecount = sum(1 for line in lines)
without_empty_lines = (line for line in lines if line)


But of course, you can't use 'lines' multiple times. and I don't want to cache, the possible input could be LARGE. So it has to evaluate all the branches of the filter network simultaneously (not necessarily concurrently). And some of the nodes reduce the input or can hold state, but I don't want to cache or abuse the use of None, because that might end up being a value passed through the network and not a "there was no output".
>>
>>60758024
Undefined behavior.
>>
>>60758024
http://lmgtfy.com/?q=C+vs+LLVM+as+a+compiler+target
>>
>>60753596
How can i change the behaviour of a class in alibrary im using. need to replace the following code in the Lanterna library for java to return directory instead of the error message that a file is not choosen.

https://github.com/mabe02/lanterna/blob/master/src/main/java/com/googlecode/lanterna/gui2/dialogs/FileDialog.java
[CODE]
private class OkHandler implements Runnable {
@Override
public void run() {
if(!fileBox.getText().isEmpty()) {
selectedFile = new File(directory, fileBox.getText());
close();
}
else {
MessageDialog.showMessageDialog(getTextGUI(), "Error", "Please select a valid file name", MessageDialogButton.OK);
}
}
}
[/CODE ]
just adding my own java file and make some changed to the library just to be able to choose a folder instead of a file seems like overkill.
>>
>>60758232
Extended the class, override that function, use super to call call the original function.
>>
>You know Java that means you must know JavaScript

So anyone here know how the fuck Unity's GUI interface works? I can't seem to wrap my head around that canvas shit
>>
>>60755477
>>60756397
>>60754763
>>60754660
>>60755500
thanks anons.
>>60756697
i'll eventually make it public, but for now i'm to embarrassed to post it anywhere. i just learned about mvc, orm and databases other than SQLite, so massive refactoring is needed.
>>
>>60758315
>Javascript
Please use C#. Please.
>>
>>60758356
Why would you want to use anything but SQLite for something like this?
>>
>>60758380
i don't know yet.
>>
>>60758416
I'm implying you wouldn't.
>>
>>60758359
Already do. C# is just a better Java. Outside of that I have someone screeching at me that i'm not using javascript for some backwards fucking reason
>>
>>60758443
Oh, so this isn't your decision, so sorry.

What exactly are you not getting about Unity's GUI?
>>
>>60758468
First time working with front end stuff in particular so i'm not sure what the best practices are for doing it mainly. Outside of that trying to get a menu that works like persona 5's menu and i'm not sure if I should have elements be hidden until I hit the button, or have a separate canvas. Just general things like that
>>
>>60758424
oh okay
>>
>>60758039
Probably my biggest issue is that I can't have a function that doesn't return something, and there is no way to check if the output was nothing or an explicit None. So i can't use functions.

Maybe I could use generators, but I'm unsure how you go about building generators with push semantics instead of pull.
>>
>>60753596
Simple computer game, Account system, and a few web related tools to learn Idris properly.

Idris is the future Haskell was moving towards slowly but is still behind on plus better target
support with JS and C by default and .net, jvm, &c... in the works... thing even compiles to
whitespace....
>>
Is kotlin just better java?
>>
>>60758640
Only time will tell.
>>
>>60758640
Idris will hopefully kill it
>>
>>60758710
Google will keep it alive.
>>
Can anyone code me a program that will make me not want to kill myself? Thanks in advance
>>
>>60758812
while (1) {
puts("kys");
}
>>
What are some good resources for learning C++ and the Windows API? My endgame is to write a creative nondestructive malware just for fun. I'm already fairly familiar with the syntax but know nothing about how to approach the goals I have in mind for this program.
>>
>>60758638
>web related tools
Use >>>/g/wdg/
>>
Do two different Java programs which are started out of the same project use the same memory space? Or does each of them run int their own separate memory space?
>>
>>60758960
Different proceses always use different memory space
>>
>>60758597
Really, I think the only way I'm going to do this is with continuations, which are impossible to implement in standard python because lol C stack is my best friend, or just dealing with the fact that functions won't be able to return None.
>>
>>60757104
>programming gloves
Elbow gloves right?
>>
>>60759015
Ahh shit, you're right, so obvious. Thanks!
>>
>>60757104
Gloves get in the way.
Buy arm warmers, preferably cute striped ones.
That way you can still type and keep your wrists warm
>>
>>60758947
Idris is a general purpose language targeting everything from C to php, opengl to webgl
>>
How do you go about turning pseudocode into actual code?
>let Rp be the region covered by site p
>nowhere does it say what p is supposed to be or how you calculate the region
And as a follow on question how do you make sure the examples you are looking at are actually correct? I just noticed a bunch of github implementations are using some guys homework which he admits is buggy and unfinished.
>>
>>60759094
Your point being? Web """dev""" doesn't belong in this thread regardless of language.
>>
>>60759094
Is Idris still slower than Haskell?
>>
Is SWT for Java outdated? I've learned it in university and I find it pretty easy to use plus it uses the native windowing system so it doesn't look like shit like Swing GUIs do.
>>
>>60754634
Looks bad non
Have you tried rewriting that using fors instead of typing everything out. There must be a general solution
>>
File: 1495680017780.png (2MB, 1366x768px) Image search: [Google]
1495680017780.png
2MB, 1366x768px
>>60759137
Please do not mention haskell ITT. Spamming is not encouraged
>>
>>60759245
>Yes
ok
>>
>>60759253
Go to hell, misquoter.
>>
>>60759219
All the cool kids use JavaFX.
>>
>>60759286
>Idris' performance is to Haskell's what Haskell's performance is to C's
embarassing
>>
>>60759304
From whom did you reference this statement?
>>
>>60759137
Currently for certain programs but will be faster in the end as programs are now closer to proofs and use eager evaluation rather than lazy.

>>60759133
Idris is haskell with dependent types so it's not a webdev language but a language that just happens to have a JS target ontop of the C and LLVM it's meant for. Just take a look at it, with Uniqueness types it's possible to write device drivers which is certainly not webdev.

>>60758812
http://0x0.st/6dk.c
Enjoy music (connection "faliure" won't let me post source here)
>>
>>60759293
I've used it once but I didn't like how it looked like and it somehow felt "slow" regarding reactions times.
>>
>>60759333
You
>>
Hi, I am the guy who tries to code a Sudoku game for Homework.
My code has grown a lot since I planned and gone over with paper and pen before continuing my endeavor.
It is slowly coming to an end.

I think I am learning a lot.

https://pastebin.com/fdKGCW0h
>>
>>60759357
>programs are now closer to proofs
It has general recursion so any proof done in it has no value whatsoever.
>Idris is haskell with dependent types
Wrong.
>so it's not a webdev language
Irrelevant. You shouldn't be discussing web """"dev"""" here regardless of the language.
>>
>>60759370
I didn't say that though. Are you sure you were quoting me?
>>
File: 1487608084850.jpg (53KB, 312x312px) Image search: [Google]
1487608084850.jpg
53KB, 312x312px
>>60759397
java truly is shit
>>
>>60759439
I was quoting >>60759245
please refer future responses to this post
>>
>>60759407
> It has general recursion so any proof done in it has no value whatsoever.
It has the concept of totality tho, you can localize partiality in a function or two and then construct proofs with the rest of your program.
>>
>>60759484
I don't see "Yes" or "Idris' performance is to Haskell's what Haskell's performance is to C's" anywhere in that post. Are you sure you were quoting it?
>>
>>60759407
>It has general recursion so any proof done in it has no value whatsoever.
apparently you have not read up on it
>Wrong.
Yes but it's better than throwing the full definition at someone not familiar with it as it mostly works as haskell would with a few extensions enabled (type families, &c...)
>Irrelevant. You shouldn't be discussing web """"dev"""" here regardless of the language.
If it's a language feature it's relevant plus it was an example of how easy it is to get running for completely different targets. If I was discussing webdev I would be in the webdev thread but currently it's the language itself.

Oh and you are not a moderator so kindly step aside with your "it's webdev if jsssssss"
>>
>>60758812
https://play.google.com/store/apps/details?id=com.mezamane.asuna&hl=en

>>60753900
what do you mean by "an empty vector"? a vector has a length thus
(= 0 (vector-length v))
or
(equal? #() v)
are correct
>>
File: wayland-screenshot.png (50KB, 1920x1080px) Image search: [Google]
wayland-screenshot.png
50KB, 1920x1080px
I'm trying to go hardcore and write gentoofetch in pure C.
>>
>>60759572
Stop replying to him
>>
>>60759595
privet dmitry
>>
>>60759506
>It has the concept of totality tho
What is that even supposed to mean? Idris isn't a total language. It having an optional totality checker doesn't make it one.
>you can localize partiality in a function or two
Which invalidates the whole language.
>and then construct proofs with the rest of your program
A proof done in an inconsistent system doesn't have much value.

>>60759572
>apparently you have not read up on it
Read up on what?
>Yes but it's better than throwing the full definition
Anyone can look up the meaning of the full definition if they care enough.
>If it's a language feature it's relevant
Nope. Not in this thread. Take your web ""dev"" garbage discussion to >>>/g/wdg/
I don't care if you do it in Coq or assembly. It's still web """dev""".
>>
>>60757191
yes, go makes a obsolete programming language a little less obsolete but it's still obsolete. oh, and they removed union which is a great feature of C.
>>
>>60759640
>.60759640 â–¶
Fack off slavshit, I hate slavs.
>>
>>60759662
Fuck off you memefag. True programmers never fall into interpreted shit.
>>
>>60759656
>Which invalidates the whole language.
No more than executing "proven" code on an "unproven" hardware invalidates it.
>A proof done in an inconsistent system doesn't have much value.
It'd still be a valid proof about the total part of the program tho. And you can write a program without partial functions if you so desire.
>>
>>60759806
everything is interpreted by the cpu at the end
>>
File: trackers-low.png (510KB, 1150x5438px) Image search: [Google]
trackers-low.png
510KB, 1150x5438px
Anyone know an alpha assembler?
It has to be OSS.
>>
>>60753596
Replacing the smashed screen on a laptop, turning it into a Linux system to play around in. Once I feel I have it to the point that I can play my gaymes at stable frame rates I'll be switching to it on my main desktop.
>>
>>60758265
Thanks, gonna try it out and see if I get it to work.
>>
File: oss.jpg (106KB, 1305x818px) Image search: [Google]
oss.jpg
106KB, 1305x818px
>>60759897
It is, here, I've found it.
>>
>>60759810
>No more than executing "proven" code on an "unproven" hardware invalidates it.
A proof about software usually doesn't say anything about the hardware. Or it's operating under the assumption that the hardware works as intended. Which certainly doesn't invalidate the claims it's making.
>It'd still be a valid proof about the total part of the program tho
Only if you prove the correctness of your proof using another system. Which defeats the whole purpose.
>And you can write a program without partial functions if you so desire
Any sane person would do obviously do that, but that would be the total subset of Idris, not Idris.
>>
>>60759853
Not interpreted, executed.
>>
>>60759983
Keep partial code low and aim for totality by default. That's the style most go with so it's fine.
>>
>>60759970
I can't upload the full image, which is like 3k by 15k
>>
>tfw stripping js from website name generators to create a directory/file structure generator creating a new 'world' from names and defined attributes for rolling
Working on implementing it at the moment but I don't have a swift environment with personal tools yet - I've been lazy, but I'm working on Make templates and dir setup sh'es.

I'll eventually breeze thru it... eventually.
>>
>>60753596
Well, it might be a bit retarded question, but I really need some advice.

I am from Russia.
I decided to learn programmind and went to Applied Mathematics and Informatics faculty of one of our meduim-tier universities. It was my most dumb decision. After two years of learning it turned out that we won't have any IT-related subjects in 3th and 4th years of learning. Now all my classes are about Mathematical Physics and related topics. It is also interesting of course but I'm not sure I will use any of this in my future work.

Now all I know about programming are OOP basics, some skills of work with WPF (C#) and HTML/CSS basics. Can you give me some advices? What and where should I learn to become Programmer in the future? What should I do if I have to earn money with it right now?

And what do YOU learn in IT faculties in your countries?
>>
>>60760028
https://www.wikiwand.com/en/Execution_(computing)#/Interpreter
>>
>>60760086
Sure, it's a language which is better than the vast majority of languages, but that doesn't make proofs done in it valid.
>>
>>60758934
https://www.youtube.com/watch?v=7nF2BAfWUEg
You might find what you're looking for in here
>>
>>60760141
spend 3 hours a week writing a side program that does something you are intrested in
>>
>>60760141
Hold that thought. I don't know if Git has user messaging functionality, but hit up ecronogist @ github,I'll provide you with a torrent to an incredible vast amount of learning resources (only programming if needed).
>>
>>60760141
>OOP
Stopped reading right there.
>>
>>60760292
Not him, but just post it here.
>>
File: Capture.png (60KB, 1191x712px) Image search: [Google]
Capture.png
60KB, 1191x712px
YYYYYYYYYYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!
>>
>>60760292
Why not just post a link of the torrent ITT?
>>
>>60760362
My friend, I am on my phone and cannot create the torrent/share said files at all. I'll be about 1 hour before I arrive home and can provide.
>>
>>60760545
Just post it when you can then. Do you have math related resources too?
>>
>>60760141
They teach Java at most schools in the US. After a semester of Java, they touch on some assembly, and a fair bit of C and C++. They don't really do to much HTML/CSS/JS stuff unless you try to take classes in that field. That's just my experience in the State Uni's I've attended, and from my friends in other programs.
C# is pretty big where I work (upstate NY), every job I've seen have been for C# jobs, the only place using a lot of Java has been a couple major insurance companies. In general, they won't care too much about what language you know or don't know, they'll be thrilled if you can even kinda write code and know what VCS is. If you can have a small portfolio of projects, that show that you understand and enjoy programming, they'll probably like you.
So write some dumb toy programs, and try lots of different things.

Have a passing familiarity with the major application programming languages like C#, Java, and C++. Know a bit of C, since it's used in everything. Learn a common high level scripting language, like Python or Ruby or Perl or whatever, since it's useful for writing mini programs to do odd jobs, and pick a few niche fun languages, like Scheme or Rust or D or Go. These will help you think in new ways, and will signal to recruiters that you have an actual interest in programming (and they are a lot of fun).

I'm guessing you're a young person, so be a sponge. Learn as much as you can, and don't be bothered if you don't completely understand everything in a field. You'll specialize when the time is right. Most importantly, if something sounds cool/fun, try it. You might find your niche that way.

Good luck.
>>
>>60760611
Yup. Its a megaresource from /sci/ that I copped from /t/. You might be able to track it down there, actually.
>>
>>60760455
PowerShell
Absolutely disgusting.
>>
>>60760222
Thanks anon. I'll give it a watch when I get off work
>>
>>60760789
powershell is great and finally put a end to the "everything is a file text" stupid philosophy from unix. i am using powershell on linux through appimage.
>>
>>60761104
appimage tards please lea
>>
>>60761104
That's why they made WSL when they realize how wrong they were. You'll realize that soon anon.
>>
>>60761104

Technically the philosophy of Unix is "everything is a file". Sockets and named pipes are files, but aren't text files.
>>
>>60760705
Thank you anon, it is very inspirational post. I will do as you said.

>>60760292
I will really appreciate it, should I contact you via GitHub or wait untill you post it here?
>>
>>60761295
>Technically the philosophy of Unix is "everything is a file"
That's incorrect
>>
My head feels funny. I want to take a break.

How do I train my head to use the focus more efficiently?
>>
>>60761792
Drink beer you scrub.
>>
File: reimu_snapchat.png (891KB, 770x1063px) Image search: [Google]
reimu_snapchat.png
891KB, 770x1063px
>>60761792
Press shift.
>>
>>60761400
Everyone needs some advice. If you've got code you want reviewed you can email me at [email protected]
>>
>>60760141
>It was my most dumb decision.
Transfer is not an option, aнoн? We got a lot of math disappointed student on our 3rd year.
>>
File: 1467167612479.png (15KB, 176x879px) Image search: [Google]
1467167612479.png
15KB, 176x879px
>>60759397
Whatever the fuck you're doing, you're doing it wrong.
>>
File: yuuka_unamused.png (275KB, 568x310px) Image search: [Google]
yuuka_unamused.png
275KB, 568x310px
>>60759397
>>60762397
Please let this be fake.
>>
>>60759397
>>60762397
>>60762606
Its obviously the work of a beginner but it works which is awesome.
>>
File: 1466760100193865949.jpg (149KB, 900x900px) Image search: [Google]
1466760100193865949.jpg
149KB, 900x900px
>tfw he uses floating point
>>
File: 14560630908730[1].png (67KB, 707x681px) Image search: [Google]
14560630908730[1].png
67KB, 707x681px
>>60762397
>>
File: 1494510047791.jpg (25KB, 400x386px) Image search: [Google]
1494510047791.jpg
25KB, 400x386px
>>60762701
>he uses strings
>>
>>60763021
Are you one of those cucks that uses a language without fixed point?
>>
>>60760141
>>60761400
Here: >>>/t/741840
>>
>>60763021
stupid frogposter
>>
>>60762397

Don't know Java but i'm sure you can do something like

var sudokuGrid = new Array(9);
for(var i = 0; i < 9; i++) {
sudokuGrid[i] = new Array(9)
}

for(var i = 0; i < 9; i++) {
for(var j = 0; j < 9; j++) {
sudokuGrid[i][j] = String.fromCharCode(i + 65) + "" + (j+1);
console.log(sudokuGrid[i][j])
}
}


>>
>>60762397
What the actual honest fuck
>>
>>60759397
post imports and source for SudokuWindow
>>
>>60754634
>hardcoding it like that
anon no.
>>
File: dlang_chan.jpg (70KB, 349x368px) Image search: [Google]
dlang_chan.jpg
70KB, 349x368px
Threadly reminder that dlang-chan has RAII; she's quite fast in execution and compilation; and she's super duper cute! Say something nice about her, /dpt/!

>Tour
http://tour.dlang.org/
>Books
https://wiki.dlang.org/Books
>GC
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
https://wiki.dlang.org/Libraries_and_Frameworks#Alternative_standard_libraries_.2F_runtimes
>>
>>60760455
>powershell
>java
you're on the special bus aren't you ?
>>
>>60763021
dumb frogposter
>>
what are the 5 languages that every good programmer should master?
>>
>>60763758
english
japanese
your home language
C
C++
>>
>>60759245
>that picture
I wanna commit a crime!
>>
>>60763758
LISP
C
Haskell or OCaml
Bash
JS
>>
File: nct_bar.png (1MB, 960x540px) Image search: [Google]
nct_bar.png
1MB, 960x540px
>>60763790
>memory unsafe languages
>>
>>60763758
C, Rust, POSIX sh, Javascript, Python

This should cover your bases for usefulness.
>>
I learned Processing, where do I go now?
>>
>>60763820
>being a pussy
Danger is good.
>>
>>60763863
what is Processing, anon?
>>
>>60763820
name one memory safe language
in your hands there isn't a single language safe from uncertain memory death
>>
>>60763863
What the hell is processing?
Is this some shitty language taught to art majors so they can make visualizations?
>>
Will POSIX standard ever be superseded?
>>
>>60763819
>JS
>>
I want to learn how to code and program, /g/.
Where do i start? Any advise?
>>
>>60764002
Learn Lisp.
>>
I have a friend who wants to get into programmagin, he has no prior knownledge.
Is python good or he should start with something not related to a specific language?
>>
File: 2017-05-31-171026_509x430_scrot.png (37KB, 509x430px) Image search: [Google]
2017-05-31-171026_509x430_scrot.png
37KB, 509x430px
>>60761205
appimage is great and approved by linus torvalds himself
>>60761216
no, representing data as text is like using linked list for everything; 99% of the time you have to parse the text one character a time before doing anything useful. O(n) at best. David Cutler already understood that when he designed VMS, this is why Windows is much better than unix for data sharing between processes and is better for concurrency. Powershell is truly great because it doesn't pipe text but objects!
https://msdn.microsoft.com/en-us/powershell/scripting/getting-started/fundamental/understanding-the-windows-powershell-pipeline
>>60761295
text is considered to be the universal interface for communicating with programs and users.
>>
>>60764035
Tell him to buy some cute girl clothes before he commits to any language or programming paradigm.
>>
>>60764035
See >>60764021
>>
>>60764002
http://www.bootstrapworld.org/
or
code.org
>>
>>60764056
The shell is not designed for performance. You got everythin gwrong anon.

By the way, Linux is fucking faster than NT.
>>
>>60764078
>>60764021
Thanks.
How much time would you say you need to become a pro coder/programer? I have some basic knowledge and i am really good at typing, surfing, browsing in general.
>>
>>60753596
Nice job on starting the thread for once without animeshit.
>>
>>60764002
Learn Python, it's a very good beginner language.
>>
>>60764124
http://norvig.com/21-days.html
>>
>>60764124
it is a never ending journey. new styles and ideas come out all the time. the professional programer must constantly update her skills and knowledge
>>
Is the use and usage of this "obvious".

class AnalysisNetwork:

def __init__(self, network):
self.network = network

def __call__(self, x, node=None):
if not node:
node = self.network
for func, child in node.items():
y = func(x)
if y is not None:
try:
child.append(y)
except AttributeError:
try:
self(y, node=child)
except AttributeError:
raise TypeError('AnalysisNetwork nodes can only be functions or output lists')


out1 = []
out2 = []
out3 = []

a = AnalysisNetwork({
lambda x: x + 1: {
lambda x: x * 2: {
lambda x: x // 5: out1,
lambda x: x % 5: {
lambda x: x * 8: out2
}
},
lambda x: x * 5: {
lambda x: x - 1: out3
}
}
})

for i in range(10):
a(i)

print(out1)
print(out2)
print(out3)
>>
>>60764148
>>60764145
>>60764140
Thanks for the answers!
>>
>>60764148
This is why programming as a job sucks ass
KEEP LEARNING
KEEP LEARNING LIBRARIES AND TECHNOLOGIES
WHAT DO YOU MEAN YOU'RE NOT USING HIPSTER.JS YOUR SKILLS ARE OBSOLETE
You will spend your free time performing non-stop job training and you will be EXPECTED to enjoy it.
And for good measure, you're also expected to like programming so much that you do it for free on the weekends and publish your source code for free on the internet for companies to steal.
>>
>>60764213
>lambda
> lambda
> lambda
> lambda
> lambda
What the fuck dude.
>>
>>60764110
it is, you can implemented a shell command with any .net languages seamlessly because the communication is done through objects.

>>60764110
Windows IIS servers beat linux servers in all tests.
>>
>>60764213
no, first of all this is written in python so the type of "network" is unknown to me, even after reading your sample usage
secondly modifying out1 out2 and out3 without obviously passing them in as a parameter or returning them is spooky action at a distance and not expected at all
thirdly what node does or its type is expected to is completely opaque

hope this helps
>>
>>60764276
>Windows IIS servers beat linux servers in all tests.
Tests nade by Microsoft.
>>
>>60764035
>Is python good
No.
>>
>>60764127
You seem to be new here. All the *chan websites are born out of anime culture.
We apologize that seems to intrinsically trigger your plebbit sensibilities.
>>
File: 1490543423363.jpg (61KB, 666x632px) Image search: [Google]
1490543423363.jpg
61KB, 666x632px
>>60764443
Computer science will never be cute
>>
File: 1491035068797.png (335KB, 1023x619px) Image search: [Google]
1491035068797.png
335KB, 1023x619px
>>60764603
I prefer to call it "computational/anime mathematics".
>>
>>60753949
>C++
Stopped reading right there.
>>
File: 1491372077168.png (286KB, 500x705px) Image search: [Google]
1491372077168.png
286KB, 500x705px
>>60763888
A memory safe language is one that has constructs that highly discourage practices that lead to incorrectly handling memory or corrupting memory in general. Rust is a prominent example, and D is also in the process of becoming memory safe as well.
In systems programming, for example, you'll need to perform memory-unsafe tasks; however, by separating what's memory-unsafe and what's not, you can better design and QA your software such that problems relating to mishandling memory are reduced to the minimum.
C and C++ allow you to easily shoot yourself in the foot, and the average programmer is too stupid to handle this responsibility. As such, in big projects, one has to design their process around this giant liability that the average programmer possess when working with the two aforementioned languages. Memory safe system languages will allow you to obviate most this.
Naturally, the occurrence of bugs and security holes direct varies with the skill and experience of the people designing and creating the software, but if using safer tools you can at least weed out quite a bit of said issues and focus on other problems.
>>
>>60754165
it's only unsafe if you make it unsafe
>>
>>60764766
Nice blog post, weeb.
>>
>>60764737
So you read the whole thing?
>>
File: 1485637232234.jpg (80KB, 1280x720px) Image search: [Google]
1485637232234.jpg
80KB, 1280x720px
>>60764815
>No anime.
... on an anime site.
you have a very low IQ anon.
>>
>>60764837
>>60764603
>>
>>60764834
No. Where did I imply that?
>>
>>60764837
>Says the person that implied something I didn't
>>
>>60764837
Are you on adderall or something?
I don't know how you could spend 5 hours spamming an entire thread with the same identical shit over and over, you clearly weren't using a bot.
>>
>>60764854
Oh, you missed a, "?".
>>
>>60753596

> a bitwise shift is not the same as division by a power of two for unsigned integers

well fuck me
>>
>>60764873
I too, enjoy using comma, in a stupid way.
>>
File: 1491686736920.jpg (4MB, 2877x3246px) Image search: [Google]
1491686736920.jpg
4MB, 2877x3246px
>>60764815
I'm simply answering that post, shitposter-kun. Stay mad though
>>
File: 1493526220146.jpg (76KB, 515x698px) Image search: [Google]
1493526220146.jpg
76KB, 515x698px
>>60764853
It is anime though. And anime is cute.
>>60764860
I really don't understand your motivation. Why are you on an anime site yet you despise anime fans? Why are you wasting your life away arguing with anime fans?
>>60764862
>Are you on adderall or something?
No, just caffeine.
>>
>>60764241
Lol
If you want a job where you don't have to learn McDonalds is always an option
>>
>>60764895
>-kun
>>>/a/
>>
#include stdio


struct llist[T] {
//_ means it's only visible inside llist and doesn't affect identifier
struct _lnode {
T data;
lnode *next;
};
lnode* head;
void append(llist* this,T x) {
lnode *current = this.head;
while(current.next)
current++;
lnode *temp = new lnode;
*temp = x,nil;
current.next = temp;
}
T operator[](llist* this, int at) {
//muh unsafe, don't care
lnode *current = this.head;
for(int i = 0; i < at; i++, current++)
;
return current.data;
}
lnode *operator++(lnode *n) {
n = n.next;
return n;
}
};
//it would be more readable to keep everything out of struct, but I wanted to remark the type relation of polymorphic type between //llist[T] and llist::append(T)

void main() {

llist[int] x;
x.append(1);
//equivalent to append(&x, 1);
x.append(7);
x.append(10);
int y = x[2]; //y = 10;

}


Do you like it, /dpt/? Looking for most simple and elegant design.
>>
File: 14648897474250.png (522KB, 794x1108px) Image search: [Google]
14648897474250.png
522KB, 794x1108px
>>60764921
please, don't say that, especially when posting on this website. without anime, 4chan would not exist. this is the truth.
>>
>>60764886
Mathematically they are identical, but it's up to your compiler to figure out that optimization.
>>
>>60764894
How was that stupid?
>>
>>60764873
No. I started reading from the "?"
>>
>>60765042
Stopped reading at the ""?""
>>
>>60759397
Dude, use a loop, never do anything that is that repetitive.
>>
>>60765126
why is a loop better?
>>
>>60764253
It's an example dude.

>>60764288
>first of all this is written in python so the type of "network" is unknown to me, even after reading your sample usage
Yeah, I'm having trouble naming it. The point of the class is to make a tree structure of functions that can perform different filtering, transformation, or reduction logic on the same data simultaneously. The point is to perform multiple analyses of the input data with only one pass over the input data.

The "network", which is a nested dictionary, represents a n-dim tree. Each node in the tree is a function of it's input, from its parents, to all of it's children (assuming there is a result, which is why the __call__ function checks for None).

>secondly modifying out1 out2 and out3 without obviously passing them in as a parameter or returning them is spooky action at a distance and not expected at all
Yeah, I thought of this. The only way I can see around it is by using names.
a = AnalysisNetwork({
lambda x: x + 1: {
lambda x: x * 2: {
lambda x: x // 5: 'out1',
lambda x: x % 5: {
lambda x: x * 8: 'out2'
}
},
lambda x: x * 5: {
lambda x: x - 1: 'out3'
}
}
})

for i in range(10):
a(i)

print(a['out1'])
print(a['out2'])
print(a['out3'])

But I'm not certain it's really all that much better. I thought of doing something like this.

a = AnalysisNetwork()
b = a + lambda x: x + 1
c = b + lambda x: x * 2
d = b + lambda x: x * 5
out1 = c + lambda x: x // 5
out2 = c + (lambda x: x % 5) + (lambda x: x * 8)
out3 = d + lambda x: x - 1

Where you build the tree of functions by composition, which I like, but you end up with references to out1, 2, and 3, which can do nothing on there own. The input of the network is fed into the root of the tree.


>thirdly what node does or its type is expected to is completely opaque
What? In this instance, it can only be function or an output.
>>
>>60765156
No, you're right.
Your way is much better.
>>
I have a problem that I am trying to solve:

>10 columns of varying height
>30 pieces make up those 10 columns
>find the order of those pieces to fill those columns

This is not homework, it's for my house. At the moment I am doing this by randomising the pieces and just checking if they fit. But is there a better system?
>>
>>60760455
Did you fix your coordinates?
>>
>>60765156
I hope you don't intend to write a sudoku solver without using loops, jesus fuck.
>>
>>60765164
im not him just curious
>>
>>60765169
yes but fuckit
computer's effort is free
go relax by the pool why the machine works for you
>>
>>60765198
Are you that "i don't wanna learn programming" guy?
Fuck off.
>>
>>60765198
It's more compact? Which means:
- Less time to write
- Less likely to fuck up the copy-paste (very common)
- Easier for someone else to read

This is a prime example of where you SHOULD use a loop, and not doing so makes you look incompetent, something you don't want to do on the job.
>>
>>60765216
im completely serious. is there a performance or readability benefit?
>>
>>60765213
What is currently happening:
>Randomise placement of pieces
>Take height of column 1
>Add pieces lengths until adding next piece would put it above column 1 height
>Continue to height of column 2 and repeat for all

What's currently happening is that because the order is wrong, not all of the pieces are used, so columns 1-10 are all too short and say 8 pieces haven't been used in the calculation.

The combined height of all the pieces is 3400, but I'm getting a maximum of 2850, nothing longer. (The difference being unadded pieces left aside).

Is bruteforce really the best solution?
>>
>>60765285
Why don't you go learn C?
Just spend an afternoon on it, you'll stop asking about stupid day one concepts.
>>
>>60765285
Readability for sure, Performance is up in the air, it completely depends upon how good your compiler is. If it sees a static memory space being assigned constant, albeit, computed values, it should be able to do the computation at compile time.
>>
>>60765198
>>60765285
How would you write a sudoku solver without using loops?
>>
>>60765400
How would you write a sudoku solver without using recursion (or some shitty flattened recursion [that isn't actually avoiding recursion you neckbeard fucks])?
>>
>>60765400
we're specifically talking about the part where he defines the coordinates variable
>>
next episode
>>60765457
>>60765457
Thread posts: 344
Thread images: 39


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.