[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: 314
Thread images: 27

File: 1480916491815.png (102KB, 1000x1071px) Image search: [Google]
1480916491815.png
102KB, 1000x1071px
What are you working on, /g/?

Old thread: >>57898154
>>
File: 1415732926173.gif (2MB, 357x238px) Image search: [Google]
1415732926173.gif
2MB, 357x238px
>languages with mutation everywhere and forced reference types
>>
>>57904748
What are you talking about.
>>
File: 1363039443572.png (7KB, 500x281px) Image search: [Google]
1363039443572.png
7KB, 500x281px
>What are you working on, /g/?
>>
>>57904789
JS, which is why that anon's code doesn't respect referential transparency.
>>
I can use objective-c protocols with a viewcontroller right? Didn't find any examples other than using it on a NSObject<...>
Callback.h
---------------
#import <Foundation/Foundation.h>
@Protocol Callback <NSObject>
- (void) callback:(BOOL)response;
@end


ViewController.h
---------------
#import <UIKit/UIKit.h>
#import "Callback.h"
@Interface ViewController : UIViewController<Callback>
@end


ViewController.m
---------------
@Implementation ViewController
- (void) callback:(BOOL)response
{

}
@end


[spoiler]pls respond[/spoiler]
>>
File: browser.png (425KB, 737x547px) Image search: [Google]
browser.png
425KB, 737x547px
how do I make browser #113 better?
>>
>>57904860
Make it to look like it's 1996 now.
>>
>>57904730
Why the fuck do people still use the C standard library? It's trivial to obtain copies of replacement libraries written by third-parties using git, package managers, downloading a tarball off sourceforge, etc. The C standard library is small, not the most efficient, VERY unsafe, misleading in their names and functions, and occasionally unintuitive. And that can be easily replaced. People do it with the STL in large application anyway. So... why the fuck do people still use the C standard library?
>>
Which language should I learn next /g/ ? Python or Go ?
>>
>>57904934
>The C standard library is small, not the most efficient, VERY unsafe, misleading in their names and functions, and occasionally unintuitive.
It's well documented. Probably the best documented thing ever.
>>
>>57904946
Why are you given such awful choice?
>>
>>>57904829
Except not at all. What that Anon posted isn't consistent with the defined guidelines for slicing in Python and it's not even internally consistent, as my counter-example showed.

Pointing out a trivial counter-example is not being autistic.
>>
>>57904934
> replacement libraries
For a coule of platforms? Sure thing. Fore everything? No.
>>
>>57904934
Additionally, with that people don't have to care about portability of the standard libraries. Separate interface-compliant, architecture specific and optimized libraries can exist.

I mean IT'S 2016, act like it.
>>
>>57904949
Nothing else can be well documented?

>>57904966
Most of C is portable. Critical sections can be maintained separately, see the linux kernel.
>>
>>57904989
> can be maintained separately
Its C. You already need to maintain a shitton of things yourself. You dont want to get a nice replacement for the standard library and realize 6 month into the project that it does not support THAT function properly.
>>
>>57904989
>Nothing else can be well documented?
Show me something with the same quality doc.
>>
>>57904934
>VERY unsafe
Please provide an example of the standard library being "unsafe".
gets() doesn't count; that was removed.
>>
>>57905031
>Doesn't support THAT function
Implement it yourself? Not every library is complete ya lazy bozo. I'm not supporting func for func replacement.

>>57905038
Ever read the ARMv8 ISA doc?
>>
>>57905073
strcat
strcpy
sprintf
>>
>>57905150
They're all perfectly safe.
You don't seem to understand what a precondition is.
>>
>>57905114
> Implement it yourself?
Then why use the replacement in the first place? Just implement everything youself. It will be safe and efficient. And also take forever to do.

Standard library alredey there and it does what it should in known way. Why bother?
>>
>can't use a lambda as an extern fn
RUST
>>
>>57905150
strncat
strncpy
snprintf
>>
>>57905162
Not original dude. Glad he posted though. You're a stubborn idiot, or a no fun allowed asshole. Either way, begone.

>>57905175
>Standard library already has it
It doesn't have image manipulation?
I guess I should download a library :^P
>>
>>57905208
exactly my point
>>
>>57905230
And my point is that safe versions of those functions do exist, so if you're complaining about it being unsafe, then that's your own fault for using unsafe functions
>>
If I have a file that should be open throughout the life span of my program, should I open the file stream, write, then close? Or should I just keep it open?

My reasoning is for the first is that in case there's ever a power outage, I don't want it corrupting the file
>>
>>57905208
>strncpy
This is NOT a "safe" version of strcpy. It's actually designed for copying non-null terminated strings.

>>57905224
>Not original dude. Glad he posted though. You're a stubborn idiot, or a no fun allowed asshole. Either way, begone.
No, YOU'RE a fucking idiot.
While it's not reflected in the language's syntax, it is reflected in the documentation.
They will say things like "dest must be large enough to receive the copy". If you don't meet that requirement, you don't meet the preconditions and are going to invoke undefined behaviour. There are a lot of times where you can gurantee that you meet these requirements, and the functions are perfectly safe.
That idiot Zed Shaw was arguing the same stupid shit, going on about how string functions fail when you pass it something that isn't a fucking string. YOU'RE NOT MEETING THE PRECONDITIONS.
>>
>>57905295
Yeah safe version do exist, in other libraries... that's why the topic OP posted what he posted, no?
>>
>>57905313
>Everything is safe if you use it correctly.
Well duh, but maybe people are tired of accidentally shooting themselves in the foot because there are no safeties on their guns?
>>
>>57905316
All the ones I listed are in the standard library
>>
File: source2.jpg (59KB, 554x197px) Image search: [Google]
source2.jpg
59KB, 554x197px
Help me out

I'm using C# and htmlAgilityPack, i want Xpath to check if there is selected Title, Description and Price, and if those elements are present to select the link from that li class

Pic related explains pretty much everything
>>
>>57905338
Using other libraries isn't magically going to fix the issues of preconditions. It's the nature of using any language, and how "safe" it is makes no difference.
If you don't meet the preconditions of a functions, it's not obligated to do anything.
>>
>>57905309
Just keeping the file open isn't going to make it more or less likely to corrupt.

If you don't want files to corrupt, every time you want to write to the file you must create a new temporary file, and then atomically rename the temporary file to move it on top of the old file.
Since renaming is atomic, it will never corrupt.

This way you're guaranteed that even if there's a power outage only two things can happen:
- The old file is still intact, but there's a corrupted temporary file that you need to delete
- The old file has been replaced by the new file
>>
>>57905114
>Ever read the ARMv8 ISA doc?
Sorry I should have said software. Hardware is generally well documented.
>>
I'm working on a complete Tinder client for Windows. Actually everything is working, but more or less latest features are working just because I implemented them like in the pic
>>
>>57905338
There are safeties, if you're worrying about a buffer overflow from user input, set a designated length for the string and cut it off there with the n-functions
>>
>>57905407

There is still a possibility that the power outage happen during renaming. The renaming is atomic for the software, not the hardware.
>>
in a function:
print(returnvalue);
return returnvalue;

out of the function:
print(function(x));
>"returnvalue"
>undefined

what the hell why
the return value is literally right there how can it be undefined at the last second if I can print it from in the funtion right there literally the line before I try to return it
>>
>>57905361
Those aren't necessarily 'safe versions' my dude. strncat for example.

>>57905389
That doesn't disprove my point. There exists a variation of the function where the correct usage is more easily achieved. And that can't exist in the standard library because of its requirement for a stable interface.
>>
>>57905449
No, renaming is truly atomic at the filesystem level, and the hardware has to respect that.

The operating system will make sure of that, it's a guarantee.
>>
>>57905468
They can be used to safely manipulate strings to prevent buffer overflow, which I'm assuming is what you're worrying about
>strncat for example
n = length of str1 + length of str2 + 1 for the null-character
>>
>>57905470
>the hardware has to respect that.
No. You clearly don't know how the hardware work.
>>
>>57905562
Feel free to enlighten me, then.
>>
>>57905468
>strncat for example
Actually, yes it is. It's strncpy that was different, as I mentioned before.
snprintf can actually be used to do this though.
snprintf(dest, n, "%s", src);


>There exists a variation of the function where the correct usage is more easily achieved
Almost always at the cost of efficiency. Also, libraries don't have some magical way to make sure that the destination is actually big enough.
The best they could do is handle the allocation itself, but now you're dealing with dynamic memory and reallocs, which is slower than just using automatic memory, and pushes the burden of freeing to the user.

>And that can't exist in the standard library because of its requirement for a stable interface
They can add as many functions as they want. There has been a couple of times where they modified the behaviour of some functions, usually to make the requirements less strict.
They also have a whole optional section of the standard, Annex K, designed for "safe" programming, but too bad it's fucking crap and nobody has implemented it.
>>
>>57905530
>What was your last time when you compiled bash scripts, anon?
Bash scripts don't get compiled. javaScript and F# scripts do however, which I use quite a lot.

>>57905552
>So there are no interpreted languages?
Bash is interpreted
>Everything that happens on a computer happens through instructions on the CPU.
True, but you don't have to *compile* code to run it on a CPU. It can be interpreted instead.

>>57905559
>You said a script file is one that doesn't have to be compiled before execution
correct.
That's correct
> what you're saying is inconsistent with the definition you provided earlier.
Please point out the contradiction
>>
>>57905470
>HDDs/SSDs have atomic ops

Hey, this guy has solved filesystems. Fuck this 2PC, wall or journaling nerd shit. Just rename XDDD
>>
I require assistance. I'm making a http.request using node.js for PUT. Where the fuck do I put the json body on my question?
>>
File: MVI_2667.webm (1MB, 1280x720px) Image search: [Google]
MVI_2667.webm
1MB, 1280x720px
Why u no embedded, bruh?
>>
>>57905641
Are you just pretending to be retarded?

Atomicity is something you defined at the filesystem level. As long as the hardware properly flushes caches when you tell it to, that's all there is to it.
>>
>>57905587
See: >>57904932

I see it as analogous to trying to get a message across to someone through a monologue or through a conversation. In both cases you have a goal you're working toward, but one never varies while the other can adapt to new topics.

>>57905624
>A script file is a programming langugae file that can be executed directly without having to be manually compiled to a separate binary first.
>A scripting langugae can be compiled.
Unless you meant "can" to mean "is possible but not strictly necessary", then those statements contradict each other.
>>
>>57905295
You wanted an example of standard library function that is unsafe, I provided you with one, then you told me to use the "safer" versions, which means, that I was right that they are unsafe. But if you're going to move the goal then I'm gonna go ahead ans say what needs to be said - there are safer languages than C and there's no need to use such error prone language in 2016.
>>
>>57905676
>Unless you meant "can" to mean "is possible but not strictly necessary"
That's what "can" means you stupid nigger. Please learn basic english before posting.
>>
>>57905714
>then you told me to use the "safer" versions, which means, that I was right that they are unsafe
And you're going to ignore my "they are actually safe, you fucking idiot" argument (>>57905313)? Good one.
If you meet the preconditions, and you can reason that they always do, the functions are completely safe and more efficient than their "safe" counterparts.
>there are safer languages than C and there's no need to use such error prone language in 2016
Go home, Zed Shaw, you fucking hack.
>>
>>57905742
In common speech, many people do use "can" in the same way they would use "must" or "is". I don't think it's unreasonable to assume someone might mean the latter.
>>
>>57905586
>Also, libraries don't have some magical way to make sure that the destination is actually big enough.
struct memory {
size_t size;
void *mem;
};

// obviously this is using the standard library function, this could be changed
struct memory mem_alloc(size_t size) {
struct memory mem;
mem.size = size;
mem.mem = malloc(size);
return mem; // most architecture's standard calling conventions support two returns through registers, so compiler optimization would make this just as efficient
}
>>
>>57905765
I addressed that. Finish reading my post.
>>
>>57905714

> I can't get into real programming. The environment should blind itself against my retard logic
>>
>>57905762
>In common speech, many people do use "can" in the same way they would use "must" or "is".
Maybe in Zimbabwe...
>>
File: 1481117479315.jpg (220KB, 1024x1344px) Image search: [Google]
1481117479315.jpg
220KB, 1024x1344px
>>57905422

Story of my life
>>
>>57905714
I wasn't even the original guy who asked for unsafe examples, I'm just saying don't complain about it being unsafe when you got safer alternatives
>there are safer languages than C and there's no need to use such error prone language in 2016
Could you even name an exploitation that is inherent to C other than buffer overflows due to strings (which I already said could easily be prevented)?
>>
>>57905660
>this is what players of cookie clicker and adventure capitalist unironically enjoy
>>
>>57905756
>And you're going to ignore my "they are actually safe, you fucking idiot" argument (>>57905313)? Good one.
Yes because that post wasn't directed to me so I ignored it.

>>57905795
Shame that there are no good C programmers then since 99% of CVEs every year can be credited to the use of C. If only the big dick C programmers from /dpt/ could write the software that runs the world instead, we'd be much better off.

>>57905810
>I wasn't even the original guy who asked for unsafe examples, I'm just saying don't complain about it being unsafe when you got safer alternatives
Up until that point I actually have never complained about them being unsafe, the dude asked to provide an example of an unsafe C function from the standard library that's not gets(), I did and everyone chimped out.
>>
>>57905831
>you will never know they joys of crippling autism
>>
>>57905831
I made an app in 2010 for android which was just a button you pressed and a number incremented and it was shown on the screen.
It was a hit with the class.

I really should have gone with that idea. One of them actually told me I should. I knew about that kind of game but I really didn't think it'd go mainstream. I guess I underestimated how weird normal people are.
>>
>>57905676
I make a bash script which takes input from command line.
Is it a not-script now?
(I don't use the "program" word, since they are both programs)
>>
>>57905851
>that post wasn't directed to me so I ignored it
Address it then, idiot.
For example, tell me how this except of code is unsafe, considering that it uses an "inherently unsafe" function.
char buf[30];
fgets(buf, 20, stdin);
strcat(buf, "asdfghjkl");


>99% of CVEs every year can be credited to the use of C
I'm going to need proof of that. Also, I'm going to need proof that is BECAUSE they were using C, not just that they were happening to use C, i.e. it would be solved PURELY by using another viable language.

>provide an example of an unsafe C function from the standard library that's not gets(), I did
So you're complaining about them being unsafe.
>>
>>57905922
It's still a script, and it's still a program.
>>
File: 1473713001328.gif (115KB, 316x193px) Image search: [Google]
1473713001328.gif
115KB, 316x193px
>>57905945
Well, yes.
>>
File: whatdo.png (28KB, 1123x429px) Image search: [Google]
whatdo.png
28KB, 1123x429px
>>
>>57905922
Program is the most accurate description of your creation in my opinion.
>>
>>57906049
did u hack teh 4chinz
>>
Which looks better to you?

enc[j] = (((enc[j] - 'a') + sector_id) % 26) + 'a';
/* ~~~ */
int c = enc[j] - 'a';
c = (c + sector_id) % 26;
enc[j] = c + 'a';
>>
>>57906832
Depends entirely on if this is a set of steps I'd be expecting to see or not.
I wouldn't write a lerp like:
float res=(1-t);
c*=a;
c+=b*t;

for instance.
It's fairly trivial to see it's a lerp but not as fast as
float c=(1-t)*a+b*t;

You get me?
>>
>>57906832
Honestly the first line is easier to read.
>>
>>57905673
Flushing caches are not instant.
If the power cuts during such a flush the filesystem gets corrupted.
There are various levels of mitigation to this, but ultimately it's an intractable problem in software, only a 100% reliable source of power can solve it (and arguable not even that if we consider radiation flipping bits).
>>
>>57907165
If the power cuts before all the data is written, then you're right that the filesystem is corrupted and will need to be restored from journal or equivalent.

But that does NOT compromise atomicity of rename operations. Either the rename operation happened or it did not happen. There may be some garbage left to clean-up due to the power failure, but there is no in-between state.

If you have a counter example, then please feel free to describe the precise steps.

>and arguable not even that if we consider radiation flipping bits
That is a completely different problem.
>>
>>57907165
Don't computers basically store some power so that if the mains supply cuts all the caches will still be flushed?
>>
File: asshole.jpg (789KB, 2448x3264px) Image search: [Google]
asshole.jpg
789KB, 2448x3264px
Should recursion be totally avoided? Basically I want to calculate something and if the number is too big then set a flag and call calculation again. Recalling the calculate function looks nicer than having a while loop.
>>
>>57907343
Your preference, or if your team's ability to understand is low, well..
>>
>>57907343
>looks nicer
Shouldn't matter.
But it's really just about if you think you will overflow the stack or not. 1-30 recursions doesn't really matter.
>>
>>57907343
If it's tail recursive, go for it.
If the maximum depth of the recursion scales logarithmically (or better) with the input (e.g. walking a binary tree), go for it.
If the maximum depth of the recursion scales linearly (or worse) with the input, don't do it.
>>
File: 0_0_20161209_135813.jpg (216KB, 1920x2560px) Image search: [Google]
0_0_20161209_135813.jpg
216KB, 1920x2560px
>>57904730
I finished my R programming, now making it faster.

Nested for() is the only thing I know.

I am dumb. Help.
>>
>>57907343
Unfortunately it's not common for general recursion to be able to use heap space instead of just stack space. So you may have to switch to iteration (or tail recursion) with an explicit stack if an overflow is reasonably possible.
>>
File: donnie.jpg (74KB, 300x399px) Image search: [Google]
donnie.jpg
74KB, 300x399px
>>57907365
>>57907367
>>57907379
>>57907394
k
>>
>>57907391
i should be for row and j for column, don't be a faggot.
>>
>>57907425
>i should be for row
Row major? Yuck!
>>
>>57907391
Does R actually store arrays as sequential memory? You could just access the data in a single loop by going from 0 -> i*j
>>
>>57907425
Fuck off, my brain is mush and it's Friday. Just work with me mate.
>>
>>57907391
Simd'ize it
Make sure you're using your cachelines well.
Use multiple threads.
Not much else to do.
>>
>>57907448
The problem is that they are two vectors of different content. I need all combinations.
>>
File: go.jpg (149KB, 1200x828px) Image search: [Google]
go.jpg
149KB, 1200x828px
What does /dpt/ think of Go?

>sub-ms pause times on an 18GB heap
>>
>>57907553
>tfw 0 ms pause times because I don't have them at all
>>
>>57907553
But it's not about how large the heap is. it's about how it's allocated and how it's referenced.
>>
>>57907563
what about your development times?
>>
>>57907579
Better than Go's because I use a language that isn't afraid to have actual features.
>>
>>57907592
which language lol
>>
>>57907616
Rust.
>>
>memory management is hard/time consuming/whatever negative
This meme has to end. It's trivial for almost any application. And the applications where it's not trivial are not solved by GC.
>>
>>57907553
Apologies, I don't have experience with managed languages, but are 1 ms pauses considered acceptable?! People are okay with wasting over a million cycles on garbage collection?
>>
>>57907642
Welcome to 2016
Computers are fast and programmers are dumb.
>>
File: 1444350997526.jpg (11KB, 250x244px) Image search: [Google]
1444350997526.jpg
11KB, 250x244px
>>57907640
>mfw GCucks have to do MMM anyways, e.g. because finalizers are inappropriate for freeing resources
>mfw they don't even have RAII and have to call cleanup methods manually and catch and rethrow exceptions to do so across all code paths
>>
>>57907640
>It's trivial for almost any application. And the applications where it's not trivial are not solved by GC.

Lock-free containers like stacks and queues are a simple counter example. Manual memory management is tricky to get right (see https://en.wikipedia.org/wiki/Hazard_pointer), yet GCs make the problem trivial.
>>
File: 1475796453320.jpg (106KB, 593x578px) Image search: [Google]
1475796453320.jpg
106KB, 593x578px
>>57907678
>implementing a stack or a queue using linked nodes instead of arrays
>>
>>57907678
>>57907694
And if you absolutely need a linked structure there's still reference counting which has overhead but at least not pauses.
>>
>>57907694
Unless its a POD, your object won't support atomic operations, so you have to do CAS on pointers to the objects. One way or another you'll have some sort of linked structure.
>>
>>57907721
That's got fuck all to do with the data structure itself, and the contents themselves need not be thread-safe.
>>
>>57907448
Hold on I found a great solution myself for those two vectors with different lengths to create that all combinations.

visibleOutputDebug[overallUniques] <- ifelse(lifeRate==0, "NA", ifelse(lifeRate>40 , paste(lifeRate, "STS"), lifeRate))

Looks much nicer than than if, ifelse, and else slapped together.
>>
>That guy in class that spergs out about any tiny problem in anyone's code, including teachers.
>That fat lonely guy that keeps making awkward remarks on class.
>The super nerd dude who doesn't talk to anyone and it's super lazy too.
>The #GirlWhoCanKode
>The GNU meme fag that hates windows and only uses some shitty linux distro
>The hyper memer that drops out after a year.

How many of these were in your classes?
>>
>>57907748
>me
>no
>me and friend
>male
>yes?
>almost
>>
>>57907748
all of them

>The hyper memer that drops out after a year.
me, but for mathematics because i found CS too easy and not abstract enough
>>
>>57907748
None, I went to medical school.
>>
>>57907678
In certain cases you may want to solve problems the same way most GC's solves the problem.

Nothing particularly strange there.
You just have to realize when it's appropriate and when it's not. I have nothing against having a library for GC. But having it as your default is just retarded as there's so many cases where it's inappropriate.
It's like having a linked list be the default for a language's arrays/lists.
>>
>>57907748
>me
>no
>me
>3 of those
>me
>about half the class
>>
>>57907748
>The super nerd dude who doesn't talk to anyone and it's super lazy too.
Probably. I didn't talk to anyone for a year.
>>
I'm trying to make a function that will read everything from a text file and then store each line in an array.
It compiles correctly but all that I get is zeros or gibberish.
/* Open and read the todo file */
nrOfItems = readItemsFromFile( "todos.tdl", MAXTODOITEMS, todos );

/* Read todos from text file and convert it to an array of TodoItems */
int readItemsFromFile( char *file, int maxNrOfItems, TodoItem arr[maxNrOfItems] )
{
FILE *fp = fopen(file, "r");
int i = 0;
char bufferLine[MAXLINESIZE];
while(fgets (bufferLine, MAXLINESIZE, fp)!=NULL)
{
printf("%s\n", bufferLine);
arr[i] = parseOneLine(bufferLine);
i++;
}
fclose(fp);
return i;
}
>>
>>57907748
>I would but I'm not that autistic
>no
>hi, this is me
>no
>no
>several
>>
>>57907766
In other words, you sucked at actually writing code.
>>
>>57907772
>I have nothing against having a library for GC.
This. Region-based MM where the region is garbage collected is a damn good thing. But if your GC is overarching, it means you have to work around it, it means pausing every thread simultaneously, etc.
>>
C++ is the only language needed, prove me wrong.
>>
>>57907738
I've literally never seen a lock-free stack implemented with a contiguous array of objects and am pretty sure it's possible. When you push onto the stack, you have 1) write past the top of the stack; and 2) update the top of the stack. There doesn't seem to be a way to avoid a race condition. If you write first then increment, two threads can write at the same location, and if you increment first then write, anther thread might increment just before the write happens and now you have a gap in the stack.
>>
will this guarantee that the order in which the numbers are printed will ALWAYS be preserved?

import threading, Queue, random

class Printer(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue

def run(self):
while 1:
i = self.queue.get()
lock.acquire()
for x in range(int(random.uniform(1,1000))):
pass
print i
lock.release()
self.queue.task_done()

lock = threading.Lock()
queue = Queue.Queue()

for x in range(8):
printer = Printer(queue)
printer.daemon = True
printer.start()

for i in range(10):
queue.put(i)

queue.join()
>>
I don't understand this monitor concept, why would you choose to have a process signal and wait, rather than signal and continue?

When would you ever want a process to just sit in the monitor until the signaled process leaves?
>>
>>57907824
>Assembly and C are the only languages needed, prove me wrong.
ftfy
>>
>>57907805
not at all, i had top scores in all my programming courses and have been programming for over a decade now

the low-level programming i enjoy is basically non-existent in academia so i decided to get a degree in something better than "code monkey with a little theoretical knowledge"
>>
>>57907865
Sounds like you went to a shit CS course, then.
>>
>>57907770
What are the medical school's staple characters?
>>
>>57907826
>if you increment first then write, anther thread might increment just before the write happens and now you have a gap in the stack
Uh, no, this can't happen.
>>
>>57907882
Medicine students are all stuck up their own arses.
>>
>>57907828
>while 1
>for x in range(int(random.uniform(1,1000))):
> pass
>>
>>57907798
You chose wrong tool for the job.
>>
>>57907877
You have to accept that maybe not everyone thinks what you think is hard is hard.
>>
>>57907877
probably
in any case i want to do postgrad in the serious abstract/mathematical CS stuff and i figured a mathematics bachelor's degree would be better suited than a CS one
>>
>>57907882
It was Cambridge, so there was only one: the keeno.
Actually, I take that back; there were also caners and rahs.
>>
>>57907898
No I don't.
>>
>>57907826
>>57907885
Though I do see how having to resize the stack would be problematic. Is amortized lock-free a thing?
>>
why does Java promote keyword spam
public static final int main (string[][] *theArgs,);
public static final double pi = 3.1415926;
public static final literal const int = placement new int;
this private volatile void = placement new protected boolean !!sizeof(struct);
>>
>>57907944
Every one of those keywords serves a purpose.
>>
>>57907892
I want the threads to wait for a random amount of time.
That way without the lock, it is unlikely they will print in the correct order.

It honestly doesn't matter. This is just a test script used to exercise an idea. I need to get familiar with multi threading so that when I download and write multiple binary blobs to the same file, the binaries will be in the correct order.
>>
>>57907944
You'd think you could do Keyword: or something for every keyword.
Preferably with blocks
>>
>>57907832
Managed to find a decent explanation here
http://pages.cs.wisc.edu/~mattmcc/cs537/notes/Monitors.pdf
>>
>there are people who write non-referentially transparent functions
>>
>>57907624
t. socialjew
>>
>>57907944
Wait is this really Java?

>string[][] *theArgs
>!!sizeof(struct);

Haven't touched to this language for years so I'm not sure
>>
>>57907982
Doesn't affect me as an ordinary user of the language.
>>
>>57907987
Be glad he didn't use any streams or lambdas.
>>
>>57907992
lambdas are actually nice
>>
>>57907990
t. socialjew
>>
Picture I find certain design patterns/practices completely useless or irrelevant to what I will be doing.

Should I still learn them because I can get something out of it or because I might run into people who do?

Are there good reasons to learn useless shit and do you have good experience with learning useless shit?
>>
>>57907990
Pretty sure anon here is saying that you're supporting them in their political alignments by using the language.

Much like if you used a language made by white supremacists you'd support that.

But that doesn't make much sense.
>>
>>57908016
Learning design patterns has always been about analyzing code after it has been written anyways. If you ever find yourself trying to understand some heavy OOP code, or if you're trying to explain your own code to a heavy OOP user, it might be useful.

A Java fanatic might not understand algebraic data types and recursive pattern matching definitions that well but they will understand Visitor.
>>
>>57908029
>But that doesn't make much sense
it does though
>>
>>57908048
How does anon using the language support much other than the language itself?
>>
>>57908012
Java lambdas are awful to actually use, but the Java devs are so thirsty they'll take anything..
>>
>>57907893
You mean fgets?
What should I use then?
>>
File: wew.png (1MB, 3154x1568px) Image search: [Google]
wew.png
1MB, 3154x1568px
>>57904730
Didn't expect that a simple game could take so much time to make.
>>
>>57907941
Now that I think about it, how exactly can you have a lock-free structure like that at all if it's not got a fixed capacity? Spinning on a CAS is basically the same as waiting on a mutex, no? Unless the API is designed so that the methods themselves report failure and it's the user's fault if they decide to spin on it.
>>
>>57908105
No, the language.
>>
>windows
>can't reopen stdin/stdout in binary mode
>>
>>57908111
What's this for anon? Fun?
>>
>>57908129
That's what games are generally for.
>>
>>57908111
come on anon
show us some actual gameplay
>>
>>57908163
No shit retard I meant why's he making it
>>
>>57908118
Last addendum, I swear:

Okay, so "lock-free" really just means anything as long as you aren't using OS locks that may lead to context switches. If you implement your own mutex using a spinlock, that's still considered lock-free because while you are blocking you're not asking for a context switch. So there's nothing preventing you from implementing a lock-free array-based stack, assuming you consider a linked stack using a spinlock when adding a node to be lock-free.
>>
>>57907798
>arr[i] = parseOneLine(bufferLine);
You are using "TodoItem" and there is no prototype of implementation of parseOneLine so I cant tell if you want to set a pointer or you want to copy.
Depending on what you want to do and what the TodoItem is you maybe want to have an array of pointers or an strcpy.
>>
>>57908180
>>57908129
first app, also I'm curious to see if I will manage to make any revenue from ads/in app purchases
>>
>>57908184
>Okay, so "lock-free" really just means anything as long as you aren't using OS locks that may lead to context switches.
No, lock-free generally means that at least one thread can always make forward progress. So an algorithm with two threads using a single mutex to protect a shared resource would be lock-free (assuming the lock is released properly) because one thread is always guaranteed to be able to use the resource.
Wait-free is a stronger guarantee where you never 'wait' (for example spin on some condition doing nothing).
All wait-free algorithms are lock-free, but not all lock-free algs are wait-free.

You never have control over context switches in a preemtive multitasking OS - they can happen at basically any time regardless if you use any locks.
>>
>>57908254
You can't rely on apps making money. There's too much shit on app stores these days that chances are nobody will even see your app.
>>
>>57908321
What's the problem with a lock-free array-based stack, then?
>>
English variable names or Norwegian variable names?
>>
>>57908254
>first app
>revenue
>>
>>57904946
Racket.
>>
>>57908185
paroOneLine takes a string and converts it to a "TodoItem", which is an id(int) date(int) and a description(char). I want to take the string that is being read in the file and copy it into the array.
typedef struct {
int year;
int month;
int day;
} Date;
typedef struct {
int id;
Date due;
char description[MAXDESCSIZE];
} TodoItem;
>>
Who here /analyze JVM bytecode/?
>>
File: 1468373863007.png (405KB, 501x451px) Image search: [Google]
1468373863007.png
405KB, 501x451px
>school just focused on using C/C++/Java/Python to solve computational problems on single clusters/machines
>does nothing to prepare students for industry
>score new internship at small FinTech company and feel completely lost and overwhelmed

is this what normally happens or
>>
>>57908520
Depends what you're doing at said FinTech company.
>>
>>57908520
>Not learning on your own
You'll never be better than anyone at this rate
>>
>>57908529
Defeats the purpose of school if he's going to one.
>>
>>57908550
The purpose of school is giving you a diploma to help employers filter resumes that don't have one.

School is the lowest common denominator.
>>
How do I make my app compatible with any screen size?

When I ran it on another computer with a different resolution than my own half of it was inaccessible because it was too big, it couldn't be resized, and the components don't automatically slide over in full screen.
>>
>>57908524
Writing data extraction software to feed into REST APIs then coding websites / apps around that for finance applications mainly.
It seems like there was an expectation for me to have picked up mad web dev skills but I haven't even touched web development and the sheer number of tools and different ways to learn makes it hard to find direction and work on personal projects

>>57908529
Yeah I realized that and I'm trying my best
>>
>>57908621
You're not supposed to work on personal projects at work.
>>
>>57908650
I meant outside of work senpai
>>
>>57904730
I want to fuck C-chan.
>>
I got a job as a full stack web dev, but I don't know what I'm actually doing. I have probably 2-3 months to get productive, any recommendations for reading material or online courses? MOOCs, in depth tutorials, or books are all welcome.
>>
>>57908323
>>57908373
You would be surprised to know how much money those shitty infinite games makes.
>>
>>57908772
Just the very most popular ones.
You'd be surprised how much the average application makes.
>>
Figured out how to automate posting with nodejs, no thanks to you autists.
>>
>>57904730
On my thesis about feature selection algorithms for protein to protein interactions
>>
>>57908797
We're not here to serve you anon.
>>
>>57908772
It's more surprising that people are still this delusional that they will somehow produce a mobile hit first try.
>>
How the fuck do you call functions inside of classes which are inside a list made up of multiple class types in C#?

I know how to do this in C++ using pointers, I'm trying to get my head around how you do it in C#.

Here's an example of what I'm talking about in C++:
class ThingOne : Things{
public:
virtual double somefunction(some object){
// operation
return operation;
}
}
class ThingTwo : Things{
public:
virtual double somefunction(some object){
// operation
return operation;
}
}
vector<Things*> list1;
Thingone cunt;
ThingTwo cunt2;
list1.push_back(dynamic_cast<Things*>(cunt);
list1.push_back(dynamic_cast<Things*>(cunt2);

vector<double> list2;

//how do I do this part in C#!!!
for(list1.size()){
list2.push_back(list1.at(i)->somefunction(some object));
}
>>
File: 453dd.png (16KB, 1138x238px) Image search: [Google]
453dd.png
16KB, 1138x238px
>>57908812
Maybe you could just this once.

What string am I supposed to send to send images?
>>
>>57908842
The directory of your file name?
>>
>>57908842
You're in a much better position to answer that yourself. I don't even know what language that is.
>>
>>57908883
node.js
>>
>>57908867
No, I don't think 4chan can do anything with the directory path.

Gonna try copy and pasting a images text (opened with notepad) in there, I guess that seems the most logical.
>>
>>57908903
Nah, don't think that'd work. You'd have to mask a HEAP of un-escaped characters in that case.
>>
Trying to implement a chat feature on an iOS application and while it's receiving everything notification through FCM, it's not processing the data of each one every time. I can't reliably pick when either, it's incredibly frustrating.
>>
>>57908830

vector<Things*> list1;
Thingone cunt;
ThingTwo cunt2;
list1.push_back(dynamic_cast<Things*>(cunt);
list1.push_back(dynamic_cast<Things*>(cunt2);


You see this shit right here? Cut that shit out right the fuck now. You're casting an object to a pointer to its parent class. Either store objects, or store pointers to objects and make pointers to objects. Don't do both. You just created undefined behavior, asshole.
>>
>>57908941
hey now, don't get your knickers in a twist, i'm only new to this
>>
File: previewscreen.png (873KB, 962x601px) Image search: [Google]
previewscreen.png
873KB, 962x601px
Pretty much done with these VR portals
Here's a webplayer demo. Unfortunately, unity webplayer ports are far from perfect but it's aight

https://phygon.itch.io/portal-example
>>
>>57905309
>My reasoning is for the first is that in case there's ever a power outage, I don't want it corrupting the file
Then flush the stream after writing.
>>
>>57908903 Did it work?
>>
>coworker 1 writes code in Swedish
>coworker 2 and project lead write code in Norwegian
>coworkers 3 and 4 write code in Danish
>coworker 5 writes code in English
>get told off if I write code in English too
What should I do?
>>
>>57909049
write code in hungarian, call them racist if they say anything.
>>
>>57909081
I don't speak Hungarian.

I know a very little Norwegian, so they tell me to write code it, but when I do they keep asking me what the cmments are meant to say.
>>
>>57909101
They don't either, run those english comments through google.
>>
why is /g/ full of SJW fags
>>
>>57909049
grow a backbone
>>
>>57909131
point out the sjw fags anon
>>
File: 7.jpg (107KB, 1920x1080px) Image search: [Google]
7.jpg
107KB, 1920x1080px
>>
File: 73020.png (15KB, 551x518px) Image search: [Google]
73020.png
15KB, 551x518px
>>57909081
This. Hungarian notation is the best

>>57909101
I'm curious. How does code get compiled in different languages? You know, code that doesn't share the Latin alphabet, like Cyrillic
>>
File: dee.png (18KB, 1138x245px) Image search: [Google]
dee.png
18KB, 1138x245px
>>57908842
>>57909188
Wahey.
>>
>>57909233
The language keywords and standard libraries are the same, we just name things in the foreign languages and write comments in them too.
>>
File: gre.png (91KB, 255x253px) Image search: [Google]
gre.png
91KB, 255x253px
/dpt/ is dead
>>
test
>>
How do I call on methods from a class that I built inside of my main class. It's not acting like it usual would when you import a separate class.
>>
is adding keys to a dict without locking it dangerous? could the file possible get corrupted?
import threading, Queue

class Printer(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue

def run(self):
while 1:
(i, imgl) = self.queue.get()
data[str(i)] = imgl
self.queue.task_done()

queue = Queue.Queue()

data = {}
image = open('old.png', 'rb')
new_image = open('new.png','wb')
for x in range(8):
printer = Printer(queue)
printer.daemon = True
printer.start()

img_line = image.read(100)
i = 0
while len(img_line) >= 100:
queue.put((i,img_line))
img_line = image.read(100)
i+=1
i+=1
queue.put((i,img_line))
queue.join()
image.close()

buff = ''
for i in sorted(map(int,data)):
buff = buff + data[str(i)]

new_image.write(buff)
new_image.close()
>>
>>57909577
Never mind, I figured it out on my own.
>>
>>57905295

Holy shit, this anon is stupid as hell. Can't follow the logic of the thread AT ALL, but just had to shit the thread up.
>>
>>57907343
>Should recursion be totally avoided?

In production code? Probably.

As a demonstration of an algorithm? No, it's great.

If you want a recursive algorithm in production, you're probably better off looping and using some sort of stack structure.
>>
>drop gives you &mut self instead of self in Rust
FUCKING WHY
This makes specifying drop order of fields impossible for no reason.
>>
>>57909693
recursion is a parlor trick and is entirely forbidden from use in mission critical firmware programming because it leads to shit like toyotas driving off cliffs.
>>
I'm writing a text editor with ncurses. I've implemented a gap buffer and have basic editing. Thinking of keeping an index of all the newline character indices - thoughts?
>>
>>57909708
>what is tco
>>
>>57908449

You're not copying your data structure correctly.
>>
>>57909726
a vendor-specific compiler extension
>>
>>57909693
>you're probably better off looping and using some sort of stack structure.
What I don't get is why there aren't languages where you can say this should happen while still writing a normal recursive definition.

>>57909744
In every language ever?
>>
>>57909744
TCO is a requirement for the Scheme specification.
>>
>>57909233

Assuming it's outside ASCII, the compiler would have to support interpreting Unicode characters (or UCS, or MBCS if you want to get technical, but nobody would do that, they'd support only UTF-8 Unicode these days).
>>
File: tmmhtd.png (24KB, 240x240px) Image search: [Google]
tmmhtd.png
24KB, 240x240px
>>57909468
We're going through multiple threads a day. What the fuck do you want.
>>
>>57909759
>What I don't get is why there aren't languages where you can say this should happen while still writing a normal recursive definition.

They do. Google "Tail recursion optimization" or "tail call optimization".

At least, as I understand it, that's what it does.
>>
>>57909813
TCO doesn't work for all recursion. In general, to transform a recursive algorithm to use TCO, you need a stack structure and you need to write the code a different way so there's little reason to not go all the way to iteration.
>>
What languages should I learn? I already know Esperanto.
>>
>>57909708

>recursion is a parlor trick

Uh. It's a very concise way of expressing divide-and-conquer algorithms.

>and is entirely forbidden from use in mission critical firmware

You mean software that should be rigorously proven? Yeah.

> because it leads to shit like toyotas driving off cliffs.

Oh, so then it ISN'T forbidden. Okay, anon.

You can shit-talk based on your vague understanding of "mission critical" software, as if that's any meaningful criticism of a programming technique, but we've all read the stories of the horror show that is automotive software and even military jet software.
>>
>>57909832
Iterative code is in many cases less clear than recursive code. Prefer simplicity.
>>
>>57909855
It's Javafag, he hates everything related to functional programming irrationally.
>>
>>57909832
>TCO doesn't work for all recursion.

...I never implied anything of the sort.

>>57909846

Japanese, desu.
>>
>>57909708
>recursion is a parlor trick
Non-programmers, everybody.
>>
>>57909861
>everyone who disagrees with me is le java boogeymang

t. idiot node rust sjw faggot kike
>>
>>57909860
Tail recursion is equivalent to iteration. It's a rather straightforward transformation. There are lots of recursive algorithms that don't translate to either without using an explicit stack.

>>57909863
>...I never implied anything of the sort.
You did by implying that TCO solves having to transform the code and using an explicit stack. It doesn't.
>>
>>57909863
Esperanto is like a slightly impure Haskell.
Japanese is like C, or C++.
>>
>>57909861

It's functionalfag, who thinks his dumb academic bullshit has any bearing on real-world software.

The real world is far dirtier than you want to acknowledge. Stay coddled, kid.

C++ programmer by the way. OOP it up, motherfuckers.
>>
>>57909855
>Oh, so then it ISN'T forbidden. Okay, anon.

toyota was in violation of MISRA C coding standards.
>>
I know C++ so I can just put C/C++ on my resume, right? :^)
>>
>>57909897
The real world is only dirty if you let it be.

I've written pure functional apps at work. They were considerably easier to test and get right than impure codebases.
>>
>>57909890
>You did by implying that TCO solves having to transform the code and using an explicit stack

What the fuck are you even talking about?

>TCO solves having to transform the code

Well, clearly it does IF THE CODE IS TAIL-RECURSION.

> and using an explicit stack.

Who said anything about that? You mean the COMPLETELY SEPARATE COMMENT where I told Anon that's generally a better way to structure code, iteration + your own stack?

Jesus Christ, enough with your strawman. Stop making things up.
>>
>>57909892
C is extremely concise
japanese is extremely ambiguous and a sentence's meaning changes with context.
the same spoken word can have 6+ different readings because there's so few phonemes to choose from.
>>
>>57909917
>The real world is only dirty if you let it be.

Said the most naive academia-fag ever.

>I've written pure functional apps at work. They were considerably easier to test and get right than impure codebases.

Neat. And for every line of functional code you get paid to write, literally hundreds of thousands of horrendous, Enterprise OOP is being churned out, and the vast majority of software engineers are going to be paid to write and maintain that for the foreseeable future of commercial software.
>>
>>57909897
I fully understand why you can't naively compile recursion as literally calling the same procedure again on a new stack frame. The problem is not recursion itself, it's how it's poorly implemented in most languages.

>>57909935
>What I don't get is why there aren't languages where you can say this should happen while still writing a normal recursive definition.
>They do. Google "Tail recursion optimization" or "tail call optimization".
For any recursive algorithm that requires an explicit stack to transform into iteration, you need an explicit stack to transform it into tail recursion. That is why it is not a solution. I don't want to have to do this transformation manually.
>>
>>57909955
People shit in the streets in India. I don't let that bother me, either.
>>
>>57909939
I suppose in that sense Japanese is more like Python, or Ruby, or Lisp?
>>
>>57909967
The solution is to use a trampoline.
>>
I'd be happy if the language simply had two keywords you could prefix to a recursive call. "tail" would enable TCO but it would also involve the compiler checking that it is indeed a tail call. "heap" or something would mean the frame is allocated from the heap.

>>57910019
Again, manual transformation, and it also has overhead. Though it is a lot less painful.
>>
>>57910011
spoken language isn't comparable to a programming language

the latter is just a set of instructions for a a computer
any "abstraction" or "ambiguity" is simply just more instructions hidden from the user
>>
>>57910011
Japanese is like Javascript.

Both even start with Ja_a
>>
>>57909996
t. idiot nazi sjw
>>
>>57910053
I don't see any manual transformation required to make recursion work in Haskell, in which trampolining happens. It just works.

It's a language problem. Most languages are inferior.
>>
I've got a problem with Windows windows where if you grab the title bar, polling input from said window blocks the thread.

Is there a name for this phenomenon? Does anyone know how I can go about preventing this? My old method was to throw it in its own thread but I want to know if there's a better way to deal with this.
>>
>>57910084
That's because Haskell is already lazy, which is way more than just a solution for recursion.

>It's a language problem. Most languages are inferior.
I agree.
>>
>>57908960

Learn the basics of the language before you move onto the advanced features. Don't touch dynamic casting until you know what the fuck is and is not a pointer.
>>
>trusting the advice of a tranny jew horsefucker
>>
>>57910212
Ganbaruby!
>>
>>57898312
>>
In Common Lisp, how come when one SETFs a variable to a lexical closure, one can't use function application normally, as in (var arg1 arg2 ..)?
Instead, one has to use funcall.
>>
>>57904860
Are you the guy that developed that originally?
I remember years ago when I first used it. It was kind of nice. Why isn't it /b/rowser any more? :^)
>>
>>57910253

Wot?
>>
>>57910294
You don't. You use auto hotkey instead
>>
I want to start learning python and make basic codes along the way. Where should I start? What compiler should I use?
>>
>>57910299
CL has a different namespace for functions vs regular variables. When it sees (VAR ARG1 ARG2 ...) it gets the binding for VAR from the function namespace.

The usual argument in favor of this is that it allows you to use, e.g. "list" as a variable name and still call the LIST function.
>>
>>57909846
Lojban
>>
>>57910053
It isn't that much work for a compiler to figure out when there is a tail call, you shouldn't have to specify. Indirect tail calls are obviously much more difficult to identify and a lot of (inferior) language runtimes don't have support for this for whatever arbitrary reason they decide is justifiable (e.g. Java or Python). A notable exceptions is C++, when implicit destructors commonly make tail-call-looking code actually non-tail recursive.
CPS makes tail calls automatic, and can be implemented by making all calls allocate the frame in the heap, but this is only efficient for moving-GC's.
Automatic translation of code into heap-building recursion would be very interesting. I'd like to see how this is implemented, it would be possible but I don't think I've seen anyone else require the need for it. FP languages that tend to have a lot of recursion usually have a larger stack in order to possibly remove the need for this.
>>
just found out my school's graduate computer science program is 90% "international". why is this so? the undergraduate program is 90% white guys
>>
>>57910312
yes.
/b/rowser was born on /b/, but now it's all grown up.
it's actually the reason I even started looking at other boards.
>>
>>57910495
>I'd like to see how this is implemented, it would be possible but I don't think I've seen anyone else require the need for it.
Well, a super naive solution would be to simply malloc a frame instead of using alloca and free it when the procedure returns.

A better way would be for each thread to have a linked list of buffers. Instead of overflowing, a new buffer (maybe larger than the last) is linked on. Of course, you would not constantly malloc and free these buffers, you would put them in a pool that all the threads can draw on when they need a new one. You could even make the first buffer for each thread the ordinary stack and only start doing this when there's an overflow, removing the need for the keyword.
>>
Any easy way to re-implement the unsafe gets() function in the new C11
stdio.h
?
>>
>>57910527
It's to meet a quota.
>>
Assembly seems to get messier the more you try to write generic code. I'm starting to get an appreciation for higher level programming languages.
>>
>>57910690
you should try Haskell
>>
>>57910690
>expecting to write generic code at that level
Higher level languages (and the C preprocessor, I guess) can do it without duplication AND without overhead.
>>
>>57910667
#define gets(x) gets_s(x, RSIZE_MAX)
>>
>>57910706
Eh, I'm using assembler directives to do as much of the work at assembly-time as possible. I mean, there's overhead for generic code in any language, pretty much everything is a tradeoff between executable size and efficiency.

I'm developing for an antique so I don't really have the choice to use higher level languages. Even C has too much overhead. Hell, even subroutine calls have to be kept to a minimum and completely excluded from certain sections of code to save cycles.
>>
Does git sync do a pull and push if any changes

what about git merge
>>
>>57910771
Why not write your own simple compiler?
>>
>>57910562
Nice anon. I remember downloading the latest version from /rs/.
<3
>>
File: 1478800513625.jpg (38KB, 266x266px) Image search: [Google]
1478800513625.jpg
38KB, 266x266px
Oh it seems as though the the command I've been trying to make work for hours won't work for what I need it for.

.setBackgroud(Color) only reacts at the end of the method, when I need it to respond when it is called on. Are there any alternatives to this command that will do what I need it to do?
>>
>>57910786
The problem isn't a compiler, there's compilers for any platform. C just isn't good on systems where you're literally counting cycles and working with so little memory that there's a risk of your stack crashing into your heap.
>>
>>57910858
I didn't say C, I meant your own little language
>>
>>57910386
No.
>>
>>57910892
I don't think that'd really be practical or worthwhile. Just have to keep all the complexity contained in its own modules.

Been trying to avoid it by just hardcoding in memory addresses for variables and data, but I think I'm going to have to write a dynamic memory allocator/deallocator, which should be an experience.
>>
>>57910106
See if it's the DispatchMessage function that does it.
If so you should handle WM_MOVE or whatever message is blocking yourself maybe.
>>
Should I learn D, Javascript, PHP, Python or Go?
I wanna learn a new language.
>>
>>57911052
Haskell

or D
>>
>>57910784
>git sync
>git: 'sync' is not a git command. See 'git --help'.

>git merge
https://git-scm.com/docs/git-merge
>>
>>57911075
git gud
>>
>>57911084
git out
>>
>>57911061
>Haskell
I'm an imperative programmer and likely it's all I'l be doing ever.
But maybe. Where can I go to get sold on it? It doesn't seem like my type of thing.
>>
>>57910670
no, they're actively trying to recruit americans now. no american students are going to the graduate program
>>
>>57910527
Maybe you should ask your school?
>>
>>57911131
"hey prof, why are there so many indians in the graduate program?"
>>
>>57911101
do common lisp instead, it has the imperativity you want

haskell changes the way you think
functions are declarative, not imperative
it will force you to think in a pure form, aka, mathematically
you will have to create data structures to fit your problem (I guess in all langs, but haskell takes it to a new level.)

upsides
>very expressive
>faster than java
>will make you never want to use imperative langs again

downsides
>is called a meme lang in dpt
>not enough jobs with it
>>
>>57911137
It's a perfectly valid question to ask if phrased right.
>>
>>57911101
https://wiki.haskell.org/Tutorials

there's a non-free book that someone linked a pdf of a few threads back

there's also LYAH which is out of date

but there's the wikibook series which is free and good
>>
>>57911154
plus it's not like you can't write imperative in Haskell, you've just got to remember how to do it


b proc (a);

becomes

proc :: a -> IO b

though it is definitely more awkward to mutate
>>
>>57911144
>do common lisp instead, it has the imperativity you want
Well I'm questioning if it's not more worth it to go with any of the examples I mentioned over lisp then.
If I'm gonna do something functional I can't half-ass it right? Because it kinda loses the point I'd imagine.
>>57911154
Thanks.
>>
>>57911250
This is the wikibook:
https://en.wikibooks.org/wiki/Haskell
>>
File: sdfa.jpg (12KB, 196x183px) Image search: [Google]
sdfa.jpg
12KB, 196x183px
I need to traverse down some binary trees from the root to a leaf using recursion and I need to store the path I take. In this case, 0 means left and 1 means right. So to get to 'c', the path would look like 100 and to 'a' is 11. Whats the best object to store these? I was thinking a string or queue?
>>
>>57911273
Integer
>>
New thread:

>>57911285
>>57911285
>>57911285
>>
>>57911273
>>57911291

integer -> stack<bit>

loop {
stack.push(i & 1)
i >>= 1;
}


stack<bit> -> integer

loop {
i |= stack.pop()
i <<= 1;
}
>>
>>57911137
It's because they already have degrees in their home country

T. Non-indian at an Indian Uni in Texas
Thread posts: 314
Thread images: 27


[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.