[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: 33

File: icelandscenery.jpg (2MB, 1920x1200px) Image search: [Google]
icelandscenery.jpg
2MB, 1920x1200px
Welcome to the daily programming thread! What are you working on, /g/?

Previous thread: >>62101129

Recommended /dpt/ videos:

https://www.youtube.com/watch?v=uqsZa36Io2M

https://www.youtube.com/watch?v=hIZxTQP1ifo

https://www.youtube.com/watch?v=3U3lV5VPmOU
>>
File: permutations.png (59KB, 821x921px) Image search: [Google]
permutations.png
59KB, 821x921px
>>62107950
Am I doing it right
>>
https://github.com/nodejs/node/issues/12115

>Node occasionally gives multiple files/folders the same inode

>Node sometimes reports different files/folders to have identical ino values.
>I can't reproduce this consistently and copying/reproducing a folder structure that contains dupes elsewhere doesn't replicate the issue.

W E B S C A L E
>>
>>62108078
>List
>>>/trash/
>>
>>62108135
You need to be able to remove from it
>>
File: but.png (199KB, 1075x437px) Image search: [Google]
but.png
199KB, 1075x437px
people who hate on java is simply a neet whos too dumb for java and cant get a job.
>>
>>62108078
>>62108170
How am I too dumb for Java if I just fashioned a program in it
>>
Thoughts?

  501 FORMAT(3I5)
601 FORMAT(4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2,
$13H SQUARE UNITS)
602 FORMAT(10HNORMAL END)
603 FORMAT(23HINPUT ERROR, ZERO VALUE)
INTEGER A,B,C
10 READ(5,501) A,B,C
IF(A.EQ.0 .AND. B.EQ.0 .AND. C.EQ.0) GO TO 50
IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) GO TO 90
S = (A + B + C) / 2.0
AREA = SQRT( S * (S - A) * (S - B) * (S - C) )
WRITE(6,601) A,B,C,AREA
GO TO 10
50 WRITE(6,602)
STOP
90 WRITE(6,603)
STOP
END
>>
>>62108229
obsolete.
>>
File: more-permutations.png (19KB, 362x439px) Image search: [Google]
more-permutations.png
19KB, 362x439px
>>62108135
>>62108170
Look I can even generalize it to arbitrary dimensions
>>
>>62108237
Fortran is still a far more important language today than what shitters in the open source community believe.
>>
>>62108170
Jokes on you I have a job as a full stack dev, working with mostly PHP and Ruby web applications, but we would take on Java maintenance clients but fuck making a new project in Java its gross.
>>
>>62107950

https://jsfiddle.net/zeh9uv2u/

I'm trying to figure out why the computer player sometimes doesn't work. It's essentially supposed to generate a random number, modulate it to the range of the number of buttons, then click that button number. It doesn't always do it though, but it isn't throwing an error either...
>>
File: Screenshot_2017-08-26_23-05-29.png (315KB, 558x523px) Image search: [Google]
Screenshot_2017-08-26_23-05-29.png
315KB, 558x523px
Currently dicking around with a linear type I made in D, only issue is that there's no way to get it to automatically deallocate once it's been used.
>>
>tfw offered a nice paying job by a close friend in engineering for C++ programming
>don't even know C++, just said i might start learning it
>>
>>62107950
Is C++ worth learning career-wise? I hear a lot of people (even some well known people, like Torvalds) shit on it all the time, and recommend to use C instead. Why is this?
>>
>>62108337
They have different priorities than normal people might. C++ is an excellent language to learn.
>>
>>62108337
That was when C++ was shit. Torvalds uses C++ for his non-Linux projects, nowadays.
>>
>>62108337
Because they suck at writing it, and it illustrates their lack of talent more than any other language ever could.
>>
>>62108330
>linear type
what is that?
>>
File: 1503805419806.png (256KB, 2571x1023px) Image search: [Google]
1503805419806.png
256KB, 2571x1023px
>>62108170
This to be honest
>>
>>62108337
There are only two kinds of languages: the ones people complain about and the ones nobody uses.
>>
>>62108363
Why would you need to like a language to be able to get a job programming in that language? Isn't that the point of being the boss? To screw people by making them do something they hate?
>>
>>62108358
Type that can only be used once. One implication is that it can be deallocated as soon as it's used.
>>
>>62108488
Are you sure it's linear and not affine?
Affine means it doesn't have to be used, linear means it must be used at least once
>>
>>62108560
Actually it's affine as of now, but it should be easy enough to add a check in the destructor that'll throw an error if it hasn't been used.
>>
File: rubyfag.jpg (178KB, 634x640px) Image search: [Google]
rubyfag.jpg
178KB, 634x640px
Why would you ever want to program in Ruby in 2017?
>>
>>62108652
I can see why girl (female)s would
>>
>>62108652
Because it's a pretty sane dynamic language, reasonably performant, with some cool meta-programming stuff (relative to the dominant paradigm) thrown in?
>>
>>62108652
Ruby is quite a nice little language, if a little over bearing if you aren't a big OOP fan.
>>
Guys. Is programming becoming outdated? Everything is slowly becoming web apps. Hell, desktop applications are slowly becoming web apps too. Atom just to name one.
>>
File: fragezeichenmödchen.jpg (34KB, 500x375px) Image search: [Google]
fragezeichenmödchen.jpg
34KB, 500x375px
>>62107950
SO I just found out today that C99 allows you to declare variable-length arrays on the stack wtf

Should I use this feature for simple things like reading the names of files, or is it inherently harmful since you only have a limited amount of stack space?
>>
File: wvs7.jpg (178KB, 700x350px) Image search: [Google]
wvs7.jpg
178KB, 700x350px
>>62108724
Is there a problem?
>>
>>62108337
>I hear a lot of people (even some well known people, like Torvalds) shit on it all the time, and recommend to use C instead
Torvalds shits on it because that's what torvalds does.

Most people shit on it because it's grown to include a ton of features which don't always interoperate in the neatest way.

Java people shit on it because it has cool features they secretly wish they had but to cover the shame they make up long impassioned arguments about how cool features are "dangerous".
>>
>>62108724
Electron is a pile of shit, a fucking blight upon desktop development. Just because it exists and people use it doesn't mean it's good.
>>
Is this guy correct?

https://www.youtube.com/watch?v=QM1iUe6IofM
>>
>>62108751
>OOP Is Bad
He's of to a good start with that title
>>
File: PRODPIC-1661.jpg (115KB, 500x798px) Image search: [Google]
PRODPIC-1661.jpg
115KB, 500x798px
Anyone here know any z80 machine code?
>>
>>62108078
So since I'm so good at Java why can't I seem to find a job? I wonder why...
>>
>>62108705
>sane
>>
>>62108724
It's just another way to oppress and control the masses. saas is the antithesis of free software and it's whole purpose is to rob users of while minute freedoms they had left.
>>
>>62108767
>not making an argument
>>
File: oop is shit.jpg (173KB, 700x350px) Image search: [Google]
oop is shit.jpg
173KB, 700x350px
>>62108758
This.
>>
>>62108751
>defends procedural/functional programming
>explicitly goes into detail as to why state is bad while saying no one defends inheritance
of course not, why would you think so?
>>
File: 13122862.jpg (31KB, 326x323px) Image search: [Google]
13122862.jpg
31KB, 326x323px
>realloc(): invalid next size: 0x569eb120 (self.Steam)
https://www.reddit.com/r/Steam/comments/6w4bqo/realloc_invalid_next_size_0x569eb120/
I don't get the weird obsession of manual memory management among the devs when it's not required. It's not the fucking game, it's a client that launches game. In for what reason would you ever think manual memory management is necessary here?

High level language should handle steam client just fine. Use C# or D or even Rust and stop breaking shit every now and then
>>
>>62108737
Fuck off back to wdg, tranny.
>>
>>62108861
RAII was a mistake
>>
>>62108652
Its reflection and metaprogramming facilities are unmatched as far as I'm aware.
A short sampling of all the disgusting things you can do in ruby:
>method_missing -- you can override it to provide a custom undefined method handler that accepts the undefined method identifier as a symbol and the arguments passed to the undefined method as an array; you can then abuse this hook to implement custom nonstandard name resolution, e.g. to allow dictionary values to be accessed as though they were object variables, or to allow method-like syntax for calling lambdas stored in a data structure
>proc -- a lambda, except it's substituted in instead of called, so you can do things like put a break in the lambda to break out of a loop in the caller for example
>instance_exec -- executes the body of a lambda or proc as though it were a method body of the receiver -- e.g.
o.instance_exec(lambda {|x| @a = x; return self }, 1)
would set o's a to 1 even though it's a private instance variable, and then return o
>passing raw blocks of code as arguments with &, e.g.
def do_block(&block); block.call; end; do_block { puts "this text will be printed" }

>include -- allows multiple inheritance via modules, which are like abstract classes
>extend -- allows already existing objects to newly multiply inherit from modules without affecting other objects in their class, a la traits
>>
>>62108886
forgot a big one:
>the fact that classes and modules are objects and you can define new anonymous classes and modules by passing the class or module body as a code block parameter to the Class or Module class 's constructor
also my mistake, it should be
o.instance_exec(1, &lambda {|x| @a = x; return self})
not
o.instance_exec(lambda {|x| @a = x; return self}, 1)
>>
>>62108861
well, I don't get why someone would not use manual memory management. you allocate something, and free it when finished. how are you going to keep track of the resources you use?
>>
>>62108861
did you read that thread? OP said it was a bug in libdrm.
do you think graphics drivers should be written in C#? surely they don't do much with memory.
>>
Why doesn't unique_ptr have a copy constructor and copy assignment operator? It would have been so easy to have such operations copy the pointed-to object instead of throwing exceptions, and just that simple adjustment would make writing classes that use it so much easier when you do happen to need copy construction and copy assignment. Such as linked data structures like graphs
>>
>>62109019
Oops, bad example, graph nodes don't own their neighbours
Say a rooted tree then
>>
>>62108977
libdrm is fine, steamfaggots is not keeping up to the pace
>>
>>62109019
>instead of throwing exceptions
Also I forgot it throws compiler errors not exceptions
It's late at night and I'm sick, I'm not on my A-game
>>
>>62109019
That would create confusion between whether duplicating the unique_ptr or the object it points to, and the type backed might not be copy-constructable.
>>
>>62108762
ask on /vr/
>>
File: what.png (25KB, 963x477px) Image search: [Google]
what.png
25KB, 963x477px
how come front-end people do this graph shit

my job is having me look through applications for 3 front-end positions we have, and people keep doing this and i have no idea what it means. sorry guy but ive been doing full stack for 4 years and i have no idea what you mean by "90% html5" and "20% php". into the trash it goes
>>
>>62109019
it means he can't actually quantify his experience. an easy flag to dump their cv into the trash.
I'm 70% sure of this.
>>
>>62109124

It takes up a lot of whitespace, it's colorful and it makes you look quirky/fun. "Hehe i'm just made up of tech stuff". It looks nice, but really doesn't tell you much. Every front-end designer I've encountered is a numale reatrd. It's also VERY safe to say he knows nothing about jQuery or PHP.
>>
>>62109133
that was meant for >>62109124

>>62109019
why would unique_ptr have a copy ctor? its design goal is >The class satisfies the requirements of MoveConstructible and MoveAssignable, but not the requirements of either CopyConstructible or CopyAssignable.

making a copy implies there are now multiple ownership of the same data, which is very much not unique. as for copying what it contains, how easy is it to deep copy /any/ T?
>>
>>62108861
>High level language should handle steam client just fine.
Man I use love little programs that come with a gigabyte of stuff with them, like the .NET framework!

Though, Steam still manages to be shitty bloatware and slow as fuck.
>>
>>62109144
well his website has a bit of jQuery on it but its nothing more than someone who just finished a tutorial or looked at wc3 lol

desu the real problem im seeing across the board is these guys make their websites as obnoxious as possible, probably to show that they know how to do certain things. but its never more than just random bootstrap stuff so it just makes them look worse than making a simplified html/css only portfolio

i'd be much happier about them just making a one page with picture + link to projects/experience etc
>>
>>62109159
>as for copying what it contains, how easy is it to deep copy /any/ T?
It could be impossible, seeing as how not every type one could create and use with unique_ptr would be copy-constructible.
>>
>>62109189

The issue is that employers like this shit. They see all these animations and graphs and think it's really cool stuff that "pops". After highschool, I had a VERY brief intern position at a webshop in my city. Most kids there just knew how to plug things into existing frameworks. Chart.js was a big one that one guy loved to talk about, but you can literally just plug values into existing lines of code. I have mixed feelings on asking someone to demonstrate some programming knowledge upfront, but a lot of people are somehow skating by and then end up fucking you over after they've been hired.
>>
>>62109019

The definition of "unique" is that there's only one of something. If it had a copy constructor, it would fail that basic definition
>>
>>62109227
>I have mixed feelings on asking someone to demonstrate some programming knowledge upfront,
Why?
If they can't program under pressure what good are they at crunch time?
>>
>>62109245

For me, I care about what you have done in the past, jobs and side-projects and what those side-projects were. Being prepared for crunch is valid, but I think it's completely ok to be nervous during an interview. When you're asked by your future employer to do something outside of the box quickly I think there's too many factors that could cause that to end up badly. Crunch doesn't always mean "fix this thing in five minutes or we're all dead". You'll have a team with you to solve problems. Quick thinking is great, but don't beat the shit out of the poor guy. And of course, I think some type of problem or challenge should be giving. But I'd be just as likely to hire the guy who really tried his hardest and put the effort in to do his best as I would the guy who solved the problem immediately. Everyone works differently.
>>
>>62109159
>>62109244
I was talking about copying the pointed-to object. Perhaps more apt name for a class that does this would be own_ptr, as in a pointer to an owned resource, that can be duplicated, but shouldn't be shared. As opposed to a unique resource, which is the same thing but can't be duplicated.
This hypothetical own_ptr would be trivial to implement if we allow ourselves to assume T has a copy constructor. (If it didn't, we'd be using unique_ptr, I guess.) But it just seems like a thing that should be possible without having to do it yourself. To own a resource exclusively, and also be able to create copies of the owner that exclusively own copies of the resource.
>>
>>62109297
Well that's the problem with most programming interviews. If they're obviously nervous and fucking up small things, but can grasp and comprehend the problem quickly, then its fine. But most people just blanket fail anyone who doesnt 100% it.

But then again, its not like places even bother actually having their own programmers do the interviews. So theres more important problems, yet.
>>
File: 15006286503.jpg (163KB, 1024x768px) Image search: [Google]
15006286503.jpg
163KB, 1024x768px
PROGRAMMING CHALLENGE

Make a £sd calculator. It must be able to add, subtract in £sd. Lowest coin is farting.

So far, we have a solution in APL!
What other languages will present /g/ later?
>>
>>62109360
>non USD currencies
not even once
>>
>>62109360
>Lowest coin is farting.
amazing
>>
>>62109320
Is this so we could make it look like we were copying a unique_ptr?
>>
>>62108734
It's not harmful. Stack space is quite massive. You can go ahead and measure it.
For storing temporary file names it's very appropriate.
>>
>>62107950
Who here /Idris/?

Really missing a good package manager, but shit's fun as hell.
>>
>>62108861
I think this is more a case of software bloat than a memory management issue.
But yeah a launcher for a game is a perfect example of trivial software.
>>
>>62108724
>Is programming becoming outdated?

No. Just too many JavaScript-writing morons thinking they're programmers pumping out shit en masse. They guarantee our job security just like the PHP retards before them.
>>
>>62109373
¼ of a penny.
>>
>>62109360
It's farthing.
>>
>>62109448
What happened to php people? Do they just drop like banana flies and start working at McDonald's? Or are they forced into new 'technology' like JS?
>>
>>62109245
People who are "good at crunch time" are unfortunately the same people who throw modulus operations that check against zero in heavily used loops when they can almost always just use a check against another variable, and a conditional addition of that variable. A variable that will literally just sit in a register the entire run of a loop, with occasional addition, vs a modulus, every single time. Then they leave it there, forever. And they do similar things everywhere else, because in actuality, that's how they work all the time and their window for quality is more narrow than it would appear.

There's more to be being good at crunch time than not suffering paralysis about basic architectural decisions.
>>
>>62109462
The latter. Some have other jobs to escape to, McJobs or not.
>>
>>62109431
Hello lad.

I'd rather it have something as nice as rdmd for easy compiling of multiple modules. A nice package manager can wait since theyre pretty sparse anyway. But i kind of like the wheel reinventing with it.
>>
File: ... (2).jpg (132KB, 797x515px) Image search: [Google]
... (2).jpg
132KB, 797x515px
>>62109469
>conditional addition
You really love all those pipeline flushes, aren't you.
>>
>>62109489
I'm pretty okay with it when it'll execute 1/300 runs of the loop, and generally won't be mispredicted. It's little different than the modulus check for zero.
>>
>>62109390
no it's so we could avoid writing trivial custom versions of default member functions for recursive data structures
>>
>>62109431
you can invent new numbers in it therefore it's a bad language
data X: Nat

X is now an entirely new natural number not equivalent to any preexisting natural number
>>
>>62109545
Youre literally that same autist from last time when i was idris posting.
>>
>>62109556
: ^ )
>>
>>62109556
the irony of this statement :^)
>>
>>62109019
>Why doesn't unique_ptr have a copy constructor and copy assignment operator?
because unique_ptr is a formalization of unique ownership semantics. allowing moves but not copies enforces those semantics at compile time

>It would have been so easy to have such operations copy the pointed-to object
that's not what unique_ptrs are for. if you want copies (value semantics), either simply use a value, implement a copy constructor with deep copy functionality for pointed-to objects when that makes sense for the type in question, or even implement your own "value_ptr" or some such type (and in fact, others have done just that; see below). unique_ptr is designed specifically for unique ownership, and exposing/enforcing semantics/guarantees surrounding unique ownership. there's no doubt it has its place, it just sounds like it might not be what you're looking for right now

https://github.com/LoopPerfect/valuable
https://github.com/martinmoene/value-ptr-lite
>>
>>62108734

You shouldn't need a VLA for a filename length, since those have a predictable maximum length.

>>62108724

>Everything is slowly becoming web apps
Pretty much. All the more reason for me to go into research.
>>
To. 62109567
It's the same complaint you/he had last time.
Hasklets can't handle the power.
>>
>>62109481
Doesn't seem like it does much over the standard compiler which already has a notion of system packages and doesn't recompile unnecessarily. Am I missing something?

>>62109545
Kilometers and miles are both represented in numbers. Guess it's perfectly fine to operate with a mix of them then.

Inb4 "don't do that":

https://en.wikipedia.org/wiki/Mars_Climate_Orbiter
>>
>>62109591
That guy wasn't me but I can handle the power just fine, I simply refuse to because it's bad
Evidence of its badness: the fact that you can invent new numbers
Also Haskell sucks, it doesn't even have first class types
>>
>>62109603
>Kilometers and miles are both represented in numbers. Guess it's perfectly fine to operate with a mix of them then.
That's unrelated. You're talking about inventing new numeric types, which is a great feature -- not new numbers, which is completely asinine.
>>
>>62109628
Sounds like Go is right up your alley if you believe this is something confusing that's prone to create bugs.
>>
>>62109582
>predictable
most of the time, but UNCs can have a variable length that isn't determinable at compile time.
>>
>>62109603
>Am I missing something?
It automates linking and executing.
>>
>>62109664

>Windows universal naming convention
32K characters maximum path length. If after reading that many characters, stdin still has characters, throw an error at the user that it's an invalid filename.
>>
>>62109644
I don't. Thanks to Idris's very general and powerful type system, it's actually valid, conceptually straightforward, and stable. However, that doesn't change the fact that it's meaningless and stupid, and just the fact that it's even possible makes Idris less respectable as a language. Although allowing the possibility to do bad things does not normally make a language itself bad, this particular allowed possibility -- to invent new numbers -- is so god awful as to transcend that general rule. It's not confusing or prone to create bugs. It's also not useful. Not only is it not useful, it's mathematically impossible. Nothing should be computationally possible that's mathematically impossible. That's retarded.
>>
>>62109411
>You can go ahead and measure it.
T-thanks!! >////////<
>>
>>62109644
(continued from >>62109702)
My phone died and I can't find the charger so rather than use my laptop in bed for much longer I think I'll go to sleep
Goodnight
>>
>>62109693
I thought the Idris compiler already does that?

>>62109702
> this particular allowed possibility -- to invent new numbers -- is so god awful as to transcend that general rule

No point in special casing something that no one is ever going to do on purpose or on accident. It's just pragmatism.

Good night.
>>
>>62109701
I was more pointing out how you'd need to use GetVolumeInformation to get the root lengths, at runtime. (w/r/t to constructing paths for whatever work needs to be done).
>>
>>62109758
given
q.d
void main()
{
import mod : hi;

hi;
}

&

mod.d
module mod;

void hi ()
{
import std.stdio : writeln;
"hi".writeln;
}


With regular dmd we need:
dmd q.d mod.d 
and then q.exe

But with rdmd we just need
rdmd q.d 
and it executes the directory while also not having to make a binary or obj file. Which is very handy for quick demos or brain-storming.
>>
>>62109702
>Nothing should be computationally possible that's mathematically impossible. That's retarded
What is approximation?
>>
>>62109795
With Idris is more or less the same except if you don't specify -o (output) you'll boot into a REPL (which works for demos).

idris -p containers Application.idr -o MyBinary


It exposes the whole containers package to Application.idr. This is as many modules as containers.ipkg exposes.
>>
>>62109820
Yeah, its nearly there but i still feel rdmd is much cleaner. But having a repl makes iteration faster so im torn.
But I really like D and Idris together.
>>
Text - Machine instructions
Heap - Malloc'd memory
Stack - Function variables and return addresses
Data - Global variables

Do I have this right?
>>
I don't intend this to be taken as a joke in any way, nor do I intend it to be unnecessarily mean, but I think that the Rust community inadvertently discovered a new paradigm of software development: Autism-Driven Development.
When we look at what they've created, both from a technological standpoint and from a community standpoint, I can't help but notice the impact that Asperger Syndrome may have had on how things have developed.
Let's start with the community. While the communities of languages like Perl, C++, Python, Java and C# developed organically over time, it is almost as if the Rust community has been manufactured instead. It's like the community's interactions have been scripted, to use a programming analogy. It seems to me that the Rust Code of Conduct may actually be there as a way to allow people who suffer from varying degrees of social ineptitude to interact in a way that mimics how they see other, naturally-formed programming language communities made of sociable individuals interacting. They wouldn't be able to manage this social interaction on their own. But if you give them a script or a checklist they can follow, they can at least engage in something that appears, on the surface, to be socializing. That's why I think their incorporation of social justice is quite interesting. In many ways the concepts of social justice are all about imposing a foreign order on what is naturally a very chaotic and perhaps unfair reality.
The language and its standard library also reflect behavior that may be expected from those suffering from Asperger Syndrome. While creating the language, it is as if its developers haven't been able to make the normal trade-offs that other language developers have made with ease. We've seen this result in Rust, as a language, constantly change over time. It's like they're striving for some unattainable form of perfection that most normal people would realize could not be attained. [...]
>>
While other people would accept some drawbacks to their creation and move on, the Rust community appears to waver back and forth, unable to really make up its mind about how to proceed. Even the supposedly stable Rust 1.x release branch has seen 19 minor releases!
I think the complexity of the language also reflects the role that, I suspect, Asperger Syndrome has had on the development of Rust. It has become an immensely complex and convoluted language, even compared to a rather complex language like C++. It's like the language has been designed, perhaps unintentionally, to be cryptic and unwelcoming to normal people. By its very nature it is like it is trying to be self-isolating, to avoid having to interact with the world and the people around it. Programming languages like Java, Python, C++, Perl and PHP want to be used by normal people. Those languages evolved in ways that draw in new users. But Rust? It has evolved to become very difficult and awkward to use, especially for new, average users.
From what I can see, the entire Rust ecosystem exhibits the traits that have come to be associated with Asperger Syndrome, or autism in general. Rust has a certain natural awkwardness to it; a inherent difference from every other programming language and programming language community that exists. It's like it wants to fit in, yet no matter how hard it tries it just can't. It's like, in my opinion, the entire Rust ecosystem lacks a natural understanding or ease of existence that other programming language ecosystems develop naturally.
I am just speculating here, as I do not know any of the Rust developers on any personal level, but could it be that mild/moderate autism or some degree of Asperger Syndrome has influenced how the Rust programming language has developed? If the developers of a programming language exhibit autism or Asperger Syndrome, could they in turn pass this on, so to speak, to a programming language and a related community that they have created?
>>
Could Rust be an example of, for lack of a better term, Autism-Driven Development?
>>
>>62110036
>but I think that the Rust community inadvertently discovered a new paradigm of software development: Autism-Driven Development.

Sorry, but this was first discovered in the 1950s.

The relevant paper is "Recursive Functions of Symbolic Expressions and Their Computation by Machine"
>>
>>62110050
>It's like the language has been designed, perhaps unintentionally, to be cryptic and unwelcoming to normal people.
I know this is just shitposting for the sake of shitposting but I feel the need to point out that the Rust compiler probably has the most helpful error and warning messages a compiler has ever had.
>>
>>62110106
But that doesn't make the syntax any less cryptic. They pay for those pretty messages with the syntax, rather than paying for syntax with shitty compiler messages (lol Scala).
>>
Do the opinions of non-autistic programmers even matter?
>>
>>62110106
Post one, i doubt theyre better than Elm's who does spell-checking for you.
>>
File: 1498034444637.png (626KB, 1199x631px) Image search: [Google]
1498034444637.png
626KB, 1199x631px
Starting my data structures class. We're coding in Java, what IDE do I use? Sick of being a netbeaner. Also trying to get good, I've been doing code academy tutorials but I'm rough around the edges, where can I hone my craft?
>>
>>62110128
The syntax is ok. I am not a Rust fangay but I've tried programming in many languages so I know what cryptic syntax is and I think that Rust code it pretty easy to read compared to C++ and C. The problem is that many people come to rust from C/C++/Java world and instead of appreciating the (relative) readability of code they whine that it's not the same as in their Assembly-like readable languages
>>
>>62110128
fn do_something (myvar: u8) -> u8 {
match myvar {
1 => 0
2..10 => 11
_ => 1
}
}

What's so hard about that?

>>62110138
error[E0106]: missing lifetime specifier
--> src/main.rs:199:56
|
199 | fn setup_display (picture: Vec<Vec<Codel>>) -> Option<(std::sync::mpsc::Handle, std::sync::mpsc::Sender)> {
| ^^^^^^^^^^^^^^^^^^^^^^^ expected lifetime parameter
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the a rguments
= help: consider giving it an explicit bounded or 'static lifetime

error: aborting due to previous error

I think Rust does spellchecking too, although I'm not sure. Post Elm errors too friendo, it's interesting.
>>
>>62110194
Did Rust get rid of headers, forward declaration, etc?
>>
>>62110138
gcc/g++/gfortran does spell checking for you. Well, shitty spell checking with some edit distance with context.

test.cc:9:10: error: 'struct F' has no member named 'shift'; did you mean 'shit'?
return f.shift;
^~~~~
shit
>>
>>62110194
is rust's clippy still a thing?
>>
>>62110208
Yup. Feels good not to have to fuck around with headers.
I'm still on the fence about installing libraries through a language-specific package manager (cargo) instead of the OS's package manager but I must admit I enjoy having my dependencies automatically downloaded when I try to compile code for the first time.

>>62110222
I'm not sure I know what you're talking about but I see nothing about clippy in rustc's manpage.
>>
>>62110233
its what they called their linter a while back.
a quick search reveals it still is.
https://github.com/rust-lang-nursery/rust-clippy
>>
scrum and sprinting
yay or nay?
>>
>>62109360
>Make a £sd calculator.

I don't even know what the fuck that is.

Can you at least post this APL solution we can marvel in the terror of APL?
>>
>>62110036
>>62110050

Were these posts Autism-Driven written?
>>
>>62110250
clippy just provides additional lints that are not in the compiler. Lints, that are useful enough get ported to the compiler.
>>
>>62110036
>We've seen this result in Rust, as a language, constantly change over time. It's like they're striving for some unattainable form of perfection that most normal people would realize could not be attained.

Sounds like butthurt.
>>
>>62110136
Almost never.
>>
>>62110329
Solution in APL: >>62104379
>>
>>62110168
eclipse editor of course :^)
>>
reminder that companies have information obtained from your ISPs and browsing 4chan will be visible to the employer.
>>
>>62110411
Show the usage, mine sucks.
   lsd =.    0 20 12 4&#.
plus =. +&.lsd
minus =. -&.lsd
times =. (]&.lsd)@:*
over =. (]&.lsd)@:%

15 8 4 0 minus 2 3 3 2
13 5 0 2
13 5 0 2 plus 2 3 3 2
15 8 4 0
13 5 0 2 over 3
4 8 4 0.666667


>>
>>62110278
Indian coworker suggested scrum. Immediately making the entire concept illegitimate for anyone on the entire planet.

So no.
>sprinting
Whatever.
>>
>>62110601
I don't care, I don't live in """""free"""""dom land :^)
>>
>>62108126
>I suppose it could be either a Windows bug or quirk1 but it could also be caused by node.js converting libuv's 64 bits st_ino field to a double, which won't be lossless for large numbers.
Haha oh wow.
>>
>>62108126
>>62110991
Javascript is a fucking joke.
>>
>>62108126
https://www.youtube.com/watch?v=XEQtSOTTPXw
>>
I'm solving this right now https://projecteuler.net/problem=11
The answer I'm getting is 70686616

here's my code:
arr = []
arr.append([ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8])
arr.append([49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0])
arr.append([81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65])
arr.append([52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91])
arr.append([22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80])
arr.append([24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50])
arr.append([32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70])
arr.append([67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21])
arr.append([24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72])
arr.append([21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95])
arr.append([78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92])
arr.append([ 6, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57])
arr.append([86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58])
arr.append([19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40])
arr.append([ 4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66])
arr.append([88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69])
arr.append([ 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36])
arr.append([20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16])
arr.append([20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54])
arr.append([ 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48])
>>
>>62111300
(code cont'd)
product = 0
for y in range(len(arr)):
for x in range(len(arr[y])):
if x < 17:
if arr[y][x] * arr[y][x + 1] * arr[y][x + 2] * arr[y][x + 3] > product:
product = arr[y][x] * arr[y][x + 1] * arr[y][x + 2] * arr[y][x + 3]
if (y < 17) & (x < 17):
if arr[y][x] * arr[y + 1][x + 1] * arr[y + 2][x + 2] * arr[y + 3][x + 3] > product:
product = arr[y][x] * arr[y + 1][x + 1] * arr[y + 2][x + 2] * arr[y + 3][x + 3]
if y < 17:
if arr[y + 1][x] * arr[y + 1][x] * arr[y + 2][x] * arr[y + 3][x] > product:
product = arr[y + 1][x] * arr[y + 1][x] * arr[y + 2][x] * arr[y + 3][x]
if (y < 17) & (x > 2):
if arr[y][x] * arr[y + 1][x - 1] * arr[y + 2][x - 2] * arr[y + 3][x - 3] > product:
product = arr[y][x] * arr[y + 1][x - 1] * arr[y + 2][x - 2] * arr[y + 3][x - 3]

print(product)
>>
If I wanted to make a game to use my sprites but had basically no knowledge is there a way to make it fast without months of reading with Unity or some other dumbed down tool?
Reading is fine mind you, just something that can be done rather quickly.
There is no way all these indie "retro" devs have all this knowledge and push out those turds, right?
>>
>>
>>62111366
Depends. I made my first "real" game in C/SDL in a week two or three months after having started to learn C, it was an Adventure Wars clone. Even though you could play a map to completion it was buggy has hell, crashed a lot and had quite a few memory leaks. Nothing you could sell but surely something you could put on a resume.

Programming takes years to learn and even after all these years, if you want to make a game you still have better chances of success if you use a "dumbed down tool" such as Unity or Gamemaker.
>>
Javascript has the worst community. Holy fucking shit.

They pretend that Javascript is the only (((Real))) programming now and Javascript is everywhere. Javascript will take over programming scene entirely.

Fucking Pajeets
>>
File: Unsorted:V 31.jpg (226KB, 1329x1500px) Image search: [Google]
Unsorted:V 31.jpg
226KB, 1329x1500px
>>62111485
now that multiple c to j.asm compilers exist, and of course any language really can do this. why not just move a javascript interpreter into the kernel and forget native code entirely

it's the most popular language with the most powerful modern oop opensource codebase.

portability would be solved forever and we can really do what we've been flirting with for years now, this is obviously what we need

browsers are the portal to 90% of average users programs, this can finally end this and make the computing world make sense.

Q1. Won't this be way slower than C or something?
WRONG! asm.js is approaching C speeds even with little investment being done so far, infact C compiled into asm.js is actually faster than Clang compiled code for box2d game engine.
Source: https://hacks.mozilla.org/2013/12/gap-between-asm-js-and-native-performance-gets-even-narrower-with-float32-optimizations/

Q2. what about vm overhead! it can never truly be as fast!
WRONG!. Infact according to a study by Microsoft a shift to virtual memory protection instead of hardware based irq we can increase speed by 25 - 40%
using a conservative 80-90% vm overhead we can actually gain a modest speed increase with our new kernal j.asm interpreter
source: http://research.cs.wisc.edu/areas/os/Seminar/schedules/papers/Deconstructing_Process_Isolation_final.pdf

Q3. Won't this be insecure!
WRONG! how often does javascript break out of sandbox today? Anyway. libcurl is written in one of the most insecure and outadted languates ever C, with no garbage collection and shitty manual memory management its practically a joke in the security world; yet libcurl is constantly and exhaustively searched for issues and therefore remains relevant even now
source: https://daniel.haxx.se/blog/2017/03/27/curl-is-c/
>>
>>62111450
Should I follow those Unity tutorials then?
>>
>>62111485
>Javascript has the worst community

>Rust
>SJW shit
>>
>>62111521
I don't know, I've never used Unity. What exactly is making you feel like this might be a bad idea?
>>
>>62111505

kys.
>>
>>62111539
nice argument retard
you cant even discuss programming against a 15 year old anime girl
>>
>>62111537
The fact that I only know it by reputation and am not sure it's an actually viable platform.
>>
>>62111552
Plenty of games are built using Unity, it looks like a viable platform to me.
>>
So I just learned about lambda captures. Can I save the same lambda function with different scopes as function pointers and use them later? Is this magic?
>>
>>62111577
fuck off to >>>/vg/agdg
>>
>>62111549
>discuss programming
>most retarded shit i've ever read

low quality bait
>>
>>62111588
I'm going to stay and answer every question related to programming and there's nothing you can do to stop me.
>>
>>62111592
damm dude you really told us why it was retarded prooving yourself intelligent you're smart
>>
File: youre-a-faggot.jpg (124KB, 500x414px) Image search: [Google]
youre-a-faggot.jpg
124KB, 500x414px
>>62111505
>>>/g/wdg
>>
>>62111616
simply incredible
another /dpt/ intellect
>>
>>62111628
>>62111615

Come back here when you write first Javascript kernel you stupid cunt.
>>
>>62111505
>http://research.cs.wisc.edu/areas/os/Seminar/schedules/papers/Deconstructing_Process_Isolation_final.pdf
Very interesting paper, thanks Anon.
>>
>>62111647
it already exists you stupid retarded moron
im not even going to google it for you you piece of trash
>>
>>62111607
>>62111300
>>
>>62111682
There's no question though.
>>
>>62111682
Forgot to mention it says my answer is wrong
>>
I want to move from a sys admin role to a dev ops.

What languages do I need to learn?

Python and Powershell have been recommended to me.
>>
File: 1502010096772.jpg (53KB, 500x737px) Image search: [Google]
1502010096772.jpg
53KB, 500x737px
I'm at a loss guys.

Is it possible for two completely identical pieces of code using he same libraries generate completely different results? I'm trying to use pdfbox to turn first page of a pdf into a thumbnail, it all works fine if I use it as an ordinary java application it works for ALL pdfs, but when I try to use it on a tomcat server I get a blank image 90% of the time and I actually get the image for only a handful of pdf books, the rest is just white image with the same dimensions as the one generated with an ordinary java application. I tried different versions and API calls.

What the fuck is going on?
>>
>>62111719
when you get problems like this its best to stop for the day and try tomorrow becuase usually its just something you're missing and will see tomorrow

like, if you know something 100% logically should work, just sleep on it and rewrite with fresh eyes
>>
>>62111737
Mate.

Today is tomorrow.
>>
>>62111694
>>62111698
>>
>>62111309
I know nothing about python but first you should probably remove your < 17 checks, remove one from your range if needed. This should make your program faster.

You should probably store the product in a temporary variable instead of computing it twice.

Also there's something wrong line 11.
>>
how does one reverse a list recursively in scheme?
>>
>>62108652
Because the SJWs moved to Node.
>>
>>62111300
>>62111309
I just did this in a couple minutes for fun. The solution is in C and the answer it gives is correct.

https://pastebin.com/2apctW7S

The thing about euler problems is they're about logic, not programming ability so it shouldn't matter what language you use.
>>
Why is make so hard to learn? It is so convoluted with shit. Why couldn't they have designed make to be simpler?
>>
>>62112010
make is fucking simple
>>
>>62112010
use a language with modules so you dont need make shit.
>>
>>62112010
it's weird at first but once you get it it's really simple
>>
>>62112054
I can't figure out how to make tests with it. I'm trying to make a separate target but I can't seem to get it to work. I want it to compile the tests whenever I call `make test`.

ODIR = obj
SDIR = src
TDIR = test
IDIR = include

CC = clang
CFLAGS = -v -pedantic -Wall -I$(IDIR)


_DEPS = eprintf.h heap.h state.h enum.h resource.h rescst.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))


_OBJ = eprintf.o heap.o state.o usearch.o rescst.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

_TEST_OBJ = rescst_test.o $(_OBJ)
TEST_OBJ = $(patsubst %,$(TDIR)/%,$(_TEST_OBJ))


$(ODIR)/%.o: $(SDIR)/%.c $(TDIR)/%.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) -ansi


usearch: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)


.PHONY: test
test: $(TEST_OBJ)
$(CC) -o $@ $^ $(CFLAGS)


.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~
>>
>>62108767
KeyboardInterrupt sucks
>>
>>62112095
python also isn't sane.
>>
#include <stdio.h>

#define MAX 20

void main()
{
for (int i = 0; i <= MAX; ++i)
{
if (i % 15)
{
printf("Fizz buzz");
}
else if (i % 3)
{
printf("Fizz");
}
else if (i % 5)
{
printf("Buzz");
}
else
{
printf("%d", i);
}
}
}


Do I pass the coding interview?
>>
>>62112071
you call
TEST_OBJ = $(patsubst %,$(TDIR)/%,$(_TEST_OBJ))

after
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

so TEST_OBJ become test/rescst_test.o test/obj/eprintf.o .., are you sure this is what you want to be doing?
>>
Why should I make all my variables const by default, except for when the variable's value will change?

>>62112134
>void main()
>printf
no
>>
>>62112140
I don't understand?
>>
>>62112140
becomes*
>>
>>62112134
>void main
0/10
>>
>>62112140
>>62112171

I modified it to this and it still doesn't work.
ODIR = obj
SDIR = src
TDIR = test
IDIR = include

CC = clang
CFLAGS = -v -pedantic -Wall -I$(IDIR)


_DEPS = eprintf.h heap.h state.h enum.h resource.h rescst.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))


_OBJ = eprintf.o heap.o state.o usearch.o rescst.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

_TEST_OBJ = rescst_test.o
TEST_OBJ = $(patsubst %,$(TDIR)/%,$(_TEST_OBJ))


$(ODIR)/%.o: $(SDIR)/%.c $(TDIR)/%.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) -ansi


usearch: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)


.PHONY: test
test: $(TEST_OBJ) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)


.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~
>>
>>62112148
Future changes where you attempt to change its value will give a compile time error. Occasionally the compiler can perform certain optimizations.
>>
>>62112148
gives the compiler a hint that it won't change so it can reorder things, make assumptions about access/layout and other neat optimizations.
also, users of the contract (your library, api, whatever) will get an error when modifying something you don't want modified

(also helps if you say which language, I'm assuming C and C++)
>>
On a scale of 1-10, how cyberpunk is Common Lisp?
>>
>>62112307
8
>>
Should I learn Haskell or Ocaml?
>>
>>62112343
Thyburpunk
>>
>>62112363
Haskell.
>>
On a scale of 1-10, how useful is Haskell?
>>
1. What are the top 3 most cyberpunk languages?
2. What are the top 3 memeiest languages?
>>
File: txt.jpg (39KB, 592x521px) Image search: [Google]
txt.jpg
39KB, 592x521px
Am I retarded?
>/ *Compute the sum of the list of exam scores stored in the file scores.txt */
>scores.txt isn't anywhere in the main
I don't uderstand
>>
>>62110903
  17 13 5 2 plus 15 17 7 2
33 11 1 0

17 13 5 2 minus 15 17 7 2
1 15 10 0

1 7 11 0 times 3.5
4 17 8 2

4 17 8 2 over 3.5
1 7 11 0

It works! (except of situation when after subtraction we get negative pounds, i.e. £15-17-7½ - £17-13-5½ must result £ -1-15-10)
>>
>>62112485
I think C would probably be the most /cyber/. Assembly too. Mainly because they are low level and cyber punk is usually about hardware and low level things like networking and hacking.
>>
>>62112487
Maybe the author has a bash script that retrieves the scores from the internet and cats the file to the program.
But yeah, the comments are kinda misleading.
>>
File: ledditlicenses.png (84KB, 831x424px) Image search: [Google]
ledditlicenses.png
84KB, 831x424px
>>62107950
>state of leddit
>>
File: python_2017-08-27_14-16-08.png (33KB, 1164x362px) Image search: [Google]
python_2017-08-27_14-16-08.png
33KB, 1164x362px
what the fuck am I doing wrong here?
>inb4 using Python
>>
>>62112604
are your indents spaces or tabs? are they mixed?
we don't like whitespace mixing 'round here.

>>62112487
have you tried piping scores.txt to your program?
(foo < scores.txt)
>>
>>62112604
>what the fuck am I doing wrong here?
>windows
>sublime
>python 2.7
>python
>>
>>62112639
that's a npp
>>
>>62112635
thanks, anon, replacing that one tab I didn't notice with spaces fixed it
>>
>>62112307
10, it's just by the original MIT hackers.
>>
>>62112686
>thanks, anon, replacing that one tab I didn't notice with spaces fixed it
Python everyone.
>>
I'm learning C right now and I heard that HTML is relatively easy to learn.
Can you recommended any books on HTML?
>>
>>62112363
both
>>
>>62112741
hey, no bully

>>62112789
TAOCP
>>
>>62112949
>hey, no bully
That's a known Python problem and that's another reason to not loce this language.
>>
Turtle graphics in python is making me want to blow my fucking brains out.
>>
set your router to APC and configure a port setting to 280 and a null transmitter or transmitters to pointing at the router and only away. You get to those other points and you'll see what I mean.

Nevermind. Don't do that. They ruined my sense of mingling about the figures. Not here either.

I don't code anymore. Not until you guys gave it all to rust and swift so maybe the north koreans will figure it out.
>>
>>62112686
One word, the forced indentation of code. Thread over.
>>
Is there any reason at all to ever use inheritance?
>>
I want to suck my dick.
What program would tell me if I am able to do this?
>>
>>62113145
When you have a is-a relationship, brainlet.
>>
File: 2017-08-27-143009_800x600_scrot.png (19KB, 800x600px) Image search: [Google]
2017-08-27-143009_800x600_scrot.png
19KB, 800x600px
I made a maze game where you try to guide a ball from the start of the maze to the finish, rotating the maze and using gravity to make the ball move
>>
>>62113238
Language?
>>
>>62113245
BBC BASIC
>>
>>62113249
Want it!
Share the game please.
>>
Does anybody here know the basics of Go? I have a beginner question which I could not solve on my own the last 3 hours or so.
>>
>>62113326
Ask the question, don't ask to ask.
>>
>>62113259
I can't share it yet, I need to tidy it up a bit and improve performance, and fix a bug, I may post the code later today or in the next thread
>>
>>62112470
1
>>
>>62113326
>>62113332

Ok, I made a function and did
run install
. This command generated a path and a package in my "pkg directory". I tested the function by using it in a "main .exe" and everything worked just fine. After that I wanted to see if I understood the concept of packages in Go correctly and deleted the source file of the function in the "src directory" and deleted the "main exe". I did NOT remove the package file in my pkg directory. Then I tried to
go install
the "main exe" again, but it didn't work. It says: "package cannot be found". I obviously missunderstood the whole concept because I thought I could use the packages in "pkg" without the source files in "src". If that is the case, why do I need the "pkg" directory at all?
Thank you so much!
>>
>>62113238
this puzzle is traditionally played with a spherical maze and the goal in the center. any reason for your divergence from that?
also, these puzzles are the spawn of satan
>>
>>62112470
-10
>>
>>62112503
   minus =. (* * lsd inv@|)@-&lsd 
>>
>>62112470
100
>>
>>62113508
are you talking about your GOPATH?
GOPATH/pkg/* is used for linking for binaries -- like .so or .dlls, but a bit different.
"go install" will run "go build" then copy any binaries produced by a 'main' package to your GOBIN (defaults to GOPATH/bin) environmental variable
"go build" will put any intermediate compiled packages in GOPATH/pkg to speed up any further compilations. but it won't put any 'main' packages there because that nonsensical.

to use GOPATH, set it to a directory, put your package name under src, go build will put its build files under pkg (under your package name) and go install will put any binaries it produced under bin.

it'll look like this when you "go install" in the "hello" directory
GOPATH ->
src/mydomain.foo/luser/hello ->
lib/foo.go (named "package foo")
main.go (named "package main")
pkg/mydomain.foo/luser/hello ->
lib/foo.a
bin/hello.exe (might be main.exe, I can't remember. haven't used go in a long time)

(run "go env" to see the env vars its using for gopath, gobin, etc)
>>
>>62113674
fuck, forgot it'd eat spaces. I had the gopath all whitespace..d out.
>>
>>62112134
>if (i % 15){ printf("Fizz buzz"); }
You mean
if (!(i % 15){ printf("Fizz buzz"); }
?
>>
>>62112134
>macro constants
>>
>>62113674
thank you!

I need a couple of minutes to reply, but you already helped me a bit.
>>
>>62108327
You know why? Because you only check if it collides with the player 1 array but not the player 2 array. So sometimes it clicks on itself I guess. A very quick glance, not very sure, but that's what I think.
>>
>>62111887
this should maybe work
(define (reverse L)
(cond ((null? L) '())
((not (pair? L)) L)
(else
(cons (reverse (cdr L)) (car L)))))
>>
Why is const so useless?
>>
>>62108652
* $$$ in supporting legacy Rails code.
* To prepare yourself of the coming of http://crystal-lang.org/.
>>
>>62113674

I didn't want to put a main package into GOPATH/pkg. I successfully made a function (NO! main function) and - like you described - a package of this function was generated in GOPATH/pkg. I did NOT expect any main function in GOPATH/pkg. I describe what I did in the following a little bit clearer (I hope):

> I made a function and prompted "go install". This command generated a path and a package in my pkg-directory (only of the non-main-function. I am aware that I could just have installed the main function later on with the same result). I tested the function by using it in a main function, generated the .exe and everything worked just fine.

> After that, I wanted to see if I understood the concept of packages in Go correctly and deleted the source file of the function in the "src-directory" and deleted the "main .exe". I did not remove the package file in my pkg-directory. Then I tried to go install the main .exe again with the hope, that the program would use the package in pkg, but it didn't work: "package can not be found".

I obviously missunderstood the whole concept because I thought I could use the packages in pkg without the source files in src. If my conclusion was correct, why do I need the "pkg" directory at all?

You wrote:
> "go build" will put any intermediate compiled packages in GOPATH/pkg to speed up any further compilations.

That is exactly why I thought compiled packages are generated into pkg. But then again: Why am I not able to use the package in pkg without the source file in src? It seems that this function is compiled everytime again when I use this function in connection with a main function.
>>
>>62114061
you're useless
>>
File: go111.jpg (31KB, 841x311px) Image search: [Google]
go111.jpg
31KB, 841x311px
>>62114162
Take a look at this picture please.

in /bin is the binary code of the main function "hello". This main function also contains the function "reverse" of the "stringutil" package.

By generating the "hello.exe", Go also generates the package "stringutil" into pkg.

My question is: Should I not be able to delete "reverse.go" in src and still be able to use the same function because it was already put into pkg?
>>
how do I fix this

(define (flatten L)
(cond ((null? L) '())
((not (pair? L)) L)
((null? (car L)) (flatten (cdr L)))
((pair? (car L)) (cons (flatten (car (car L))) (cons (flatten (cdr (car L))) (flatten (cdr L)))))
(else (cons (car L) (flatten (cdr L))))))


it should take

((((1) 2) 3) 4)

and return
(1 2 3 4)

instead I get
((1 () 2) (3) 4)

which makes no sense
>>
>>62114061
https://www.youtube.com/watch?v=zBkNBP00wJE&t=27m
looks like its pretty useful (watch until 28:10)


>>62114301
as for why you can't use a pkg without the source:
(the answer is probably "no." you need the source. the pkg files are just to speed up compilation.)

I think its the way the AST works now that they've rewritten the compiler in go. it checks for GOPATH/src/**/.go when it parses your "imports" then when the linker (6g (I think its called go tool -link now that they aren't using plan9s compiler/linker/assembler)) goes to build the final binary, it'll go check pkg. so the I guess the compiler errors out first when trying to feed the ast to the assembler because of the incomplete source tree.

>>62114162
(I'm guessing you don't want to recover the pkg, but rather want to know whats happening..)
'main' (in package main) will be compiled to a platform binary, which'll be placed in GOBIN
if you're familiar with c or c++: the .a (not sure if they still use .a..) in the pkg directory is an object file (a .o/.obj file) which is used as "library code" to produce binaries with an entry point (main())

package main is unique because it tells the compiler that you want an entry point for your operating system. so it'll find any precompiled packages you're importing (and creating them if they don't exist) and link them in with your main package during compile.

as for reusing packages, uh, 4? years ago when I last used it you couldn't do it without some golang.org/pkg/build magic.
it recompiling it each time sounds like you don't have your GOPATH set up correctly. which means sometimes you need to do "go clean" to have it remove the packages. from my understanding, it should check the timestamp on any of the files in the package and compare it to the one on disk (probably more complicated/complete now) and recompile if needed.

if you run go build -v it'll tell you what its doing.
>>
>>62114376
> it checks for GOPATH/src/**/.go when it parses your "imports" then when the linker ....

That is exactly what it does:

test3/test3.go:6:2: cannot find package "libo" in any of:
/usr/local/go/src/libo (from $GOROOT)
/home/xxxxxx/go/src/libo (from $GOPATH)


Thank you very much for this response!
>>
File: git-lang.png (6KB, 1194x84px) Image search: [Google]
git-lang.png
6KB, 1194x84px
the patrician git project language properties
>>
how ready is HtDP 2nd edition, should I just use the first one?
>>
>>62114507
there might be a way to bypass that by using the 'go tool' subcommands. but I'd have to install go and read the manual. I'm not sure if I care enough to to do that.

but perhaps you can start with "go tool" to get a listing of the tools and "go tool $command -h"
also, as I mentioned before, the golang packages for the AST and all that will let you parse the .a-s to reconstruct the source.
(one of these: https://golang.org/pkg/go/ )
>>
>>62114639
I actually don't want to bypass it yet, I am just trying to understand how Go works. But if I would be able to bypass it, it would mean that all neccessary information are in the pkg-files, right?
>>
File: 2017-07-26-114742_1679x943_scrot.png (806KB, 1679x943px) Image search: [Google]
2017-07-26-114742_1679x943_scrot.png
806KB, 1679x943px
>When he calls himself a programmer but doesn't know Lisp.
>>
>>62114708
i think everyone ``knows'' lisp as in they get the syntax, but few people have the time to memorize the standard library of a particular implementation or to actually use it
>>
imagine using a language so shit that const doesn't actually declare a constant so you're forced to use text substitution """macros""" for constants.
>>
>>62108886
>Its reflection and metaprogramming facilities are unmatched as far as I'm aware.
Common Lisp
SmallTalk
Tcl
Perl
>>
>>62114682
I'd imagine so, but I think they aren't meant for users. Just like all the .obj files it produces in $TEMP. Its probably easier just to ignore them until your symbols are out of date and you're confused as to why things are happening. then a simple "go clean pkg" or a "go build -a" (force rebuild of packages)

https://github.com/golang/go/issues/2775 actually this is probably relevant.
>>
>>62114819
this actually became enough of an issue that I had to change languages
>>
Is std::allocator C++ malloc() like function?
>>
>>62114980
no, its a rather complex template that is described as a "strategy"

if you want a malloc like function, std::malloc :^)
(or with a serious answer: std::make_unique<T[]>() )
>>
>>62115064
>std::make_unique<T[]>()
C++ is such an ugly piece of shit

I have no shame writing C with Classes
>>
>>62115089
neither does your mom
>>
>>62111505

>why not just move a javascript interpreter into the kernel and forget native code entirely

The only time non-native languages have been able to be used in kernel space is by creating an even heavier dependency on assembly code. JavaScript does not have the necessary language semantics to perform kernel level work. There is no part of the JavaScript language that allows you to say "write these bytes to this specific physical address," making memory mapped I/O impossible without additional subroutines in assembly, or some native language like C (but that would be cheating, wouldn't it?). This is how most instruction set architectures do all I/O. The rest use dedicated instructions that necessitate assembly (or inline assembly in a language like C). To make things even worse, there is no such thing as a 64-bit integer in JavaScript, and so in order to pass around a 64-bit pointer to a procedure written in a native language to actually handle it, there would necessarily need to be stupid hacks employed to make the job possible. It would be an even worse choice than straight Java. And yes there is a Java OS, and it's supported by a fuckload of assembly to even make it functional, and no one uses it for anything serious. It's basically a toy.

>it's the most popular language with the most powerful modern oop opensource codebase.

C also has a very large open source codebase, and very little of it is usable in a kernel, despite the fact that C is the most popular language for kernels.

>portability would be solved forever and we can really do what we've been flirting with for years now, this is obviously what we need

Remember what I said about memory mapped I/O? Well, the addresses are different depending on your hardware. Otherwise porting the Linux kernel would be as simple as writing a new bootloader and recompiling the C source, and drivers would be the same across all architectures. Get fucking real.
>>
>>62109320
>resource, that can be duplicated, but shouldn't be shared
This is already how all values work in C++. Making something heap allocated for no reason is rarely ever something you'd want to do
>>
>>62115772
JS babbies will do anything to avoid learning another programming language
>>
>>62114320
(define (flatten L)
(cond
((null? L) '())
((pair? L) (append (flatten (car L))
(flatten (cdr L))))
(else (list L))))
>>
File: MVI_4614.MOV.converted.webm (2MB, 1280x720px) Image search: [Google]
MVI_4614.MOV.converted.webm
2MB, 1280x720px
I made a fizzbuzz with my raspberry. Also my cameras focus fucked up, but was too lazy to record again :D
What rating do I get?
>>
>>62115886
Here's using an auxillary function and no 'append'
(define (flatten+ L)
(define (aux L acc)
(cond
((null? L) acc)
((pair? L)
(aux (car L)
(aux (cdr L) acc)))
(else (cons L acc))))
(aux L '()))


Observe that if you switch 'car' and 'cdr', it reverses the output list
>>
>>62115992
embedded fizzbuzz/10
>>
>>62115992
>>62116025
Oh sorry, I forgot to mention that I identify as a transexual cis-male
>>
>>62115992
did you do it in arm assembly?
>>
>>62111887
>recursively
not the right tool bud
just use imperativity
>>
Is Go the future and do you guys think this course is a good intro?
>https://www.udemy.com/learn-how-to-code/
>>
>>62116045
You're hired.
Actually tho, that's pretty neat
>>
>>62116102
>static typing with no generics
Go is a brainlet's C.
>>
>>62116102
>the future
>no generics
>no tuples
>>
>>62116144
>>62116136
So what do i need to learn to future proof myself?
>>
>>62113903
No you need to use an auxillary function with an accumulator

(define (reverse L)
(define (aux L acc)
(if (null? L)
acc
(aux (cdr L)
(cons (car L) acc))))
(aux L '()))


>>62116163
Python, no matter how mediocre it is as a language, appears to be very useful in a lot of employable fields.
>>
>>62116046
no. Python, because I liek python.
Could have done it in C, but would be the same shit.
>>
>>62116163
Java
>>
>>62115863

User mode babbies don't understand a goddamn thing about operating systems and think that everything they know will transfer over.
>>
>>62115772
netbsd kernel is scriptable with lua
https://www.netbsd.org/~lneto/dls14.pdf
http://netbsd.gw.com/cgi-bin/man-cgi?lua+4+NetBSD-current
>>
>>62107950

Integrating a genetic algorithm into Conway's game of life
>>
>>62116290
Calm your horses.
>>
>>62116354
>Lua is cross-platform, since the interpreter is written in ANSI C,[2] and has a relatively simple C API.[3]
https://en.wikipedia.org/wiki/Lua_(programming_language)

stop being retarded
>>
>>62116423
>What is Duktape
>>
>>62116501
>Duktape
Embeddable Javascript WRITTEN IN C.
>>
>>62116354

So basically, they're just scripting a bunch of kernel APIs written in C with Lua. That's interesting, although I question their wisdom given the performance hit that can be expected. The paper does raise a valid point though, about not being able to use floating point numbers in the kernel due to the cost of context switches. Lua has native integers. JavaScript though...
>>
>>62111719
I II
II I_
>>
>>62116290
To be fair doing anything with typical modern desktop hardware is WAY harder than it needs to be, because of backward compatibility and legacy reasons. If you've never seen what goes on down there then I think you can be forgiven for thinking it's much nicer and more straightforward than it actually is.
>>
Hello /g/, i got an error while trying to make this program.. actually 2, at the same time.
Once i start the program, write 'yes' and give empty space answers for the 3 inputs, it gives me error after printing:
I'm sure that it has a length, please enter it.
Traceback (most recent call last):
File "pyt1.py", line 33, in <module>
start()
File "pyt1.py", line 16, in start
if int(second)>int(first) and int(second)>int(third):
ValueError: invalid literal for int() with base 10: ''
Kinda pic related, tried to explain inside the image as a tl;dr
>>
File: pyt err2.png (43KB, 646x507px) Image search: [Google]
pyt err2.png
43KB, 646x507px
>>62117411
forgot image fuck me
>>
>>62117428
It probably has a newline, i.e. 666\n
>>
how to call c function from asm?
int ctest()
{
return 0xc0ffe;
}

...
extern ctest
section .text
...
call ctest
...

I've got an error
>undefined reference to `ctest'
>>
>>62117792
how do you compile it
>>
>>62117792
you need the proper boilerplate. that's not right. go make a C program and use gcc to get the .s file
>>
File: 1495944033410.jpg (117KB, 1024x942px) Image search: [Google]
1495944033410.jpg
117KB, 1024x942px
>>62117812
gcc -c -ffreestanding  -Wall -Wextra ctest.c
nasm -felf64 a.asm
ld -n -T src/linker.ld -o output src/*.o
>>
ded
>>
>>62118045
Use GCC to link the program instead of calling the linker directly.
Your missing shit like libgcc that needs to get linked in, which GCC will handle for you.
>>
>tfw the /dpt/ discord is a bunch of sjw's triggered by someone having a different opinion

I guess I should have heed you guys' advice and stayed out, there really isn't any intelligent person in that place :/
>>
>>62118875
*heeded
*your
*an
>>
>>62118875
>/dpt/ discord
There is no such thing, you filthy /v/ cuck.
>>
>>62114320
What esoteric programming language is this?
>>
>>62118941
haskal
>>
>>62118875
/dpt/ is shit, it's a bunch of kids pretending that they're pros because they picked a couple of non mainstream languages for their hello worlds, just tell them to fuck off and forget about their existence
>>
>>62118920
hey thanks pal!
>>
>>62119017
np
>>
New thread:

>>62119052
>>62119052
>>62119052
>>
why is the golang dependency system such a dumpster fire?
>>
>>62113259
>>62113350
Right, here's the game:
https://pastebin.com/cPGCTu4S
The code is a bit messy, please keep in mind that I only started learning to program about a year and a half ago.
You'll need the Brandy basic interpreter to run it, which is available for most linux distros, It's also available for windows: https://sourceforge.net/projects/napoleonbrandy/
>>
>>62119445
I forgot to mention, the controls are z, x, and space. Make sure capslock is off - it only recognises lower case letters. I totally forgot to fix that, oh well
Thread posts: 314
Thread images: 33


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