[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: 342
Thread images: 31

File: haskell on suicide watch.png (7KB, 234x119px) Image search: [Google]
haskell on suicide watch.png
7KB, 234x119px
What are you working on, /g/?

Sorry for not using an anime image.

Previous thread: >>58453794
>>
Can you get a job with assembly??
>>
>>58460686
if programmer = true {
return virgin;
else {
return chad;
}
>>
first for common lisp
>>
>>58460790
(l (i (s p)))
>>
>>58460643
>Given a list of numbers, find the arithmetic mean of the numbers
That's what >>58460630 does
>reading the list only once
Except if you consider using length "reading the list twice", it does.
>and using O(1) memory
I'm just reducing a list with foldr, why would I need to use more memory than the list passed in argument of the function ?
>>
>>58460736

return ((Programmer) programmer.findProgrammer(programmerId).isNullOrEmpty());

>>
>>58460802
I'm sorry you're so dumb anon
>>
File: lena_effect.png (1MB, 1024x1024px) Image search: [Google]
lena_effect.png
1MB, 1024x1024px
Say nice things about my filter!
>>
>>58460802
in Haskell this is just
average = (/) <$> sum <*> genericLength


but it's neither one-read nor O(1)
>>
>>58460686
I've been learning to program, anywhere I can find little projects to practice on?
>>
>>58460837
It's better at programming than you.
>>
>>58460837
Do sjws dislike the use of a porn girl for image processing?
>>
>>58460844
This seems like something loop fusion should be able to handle.
>>
>>58460882
list fusion isn't going to combine sum and length
>>
>>58460859

Okay.

>>58460875

Yes.
>>
>>58460736
programmer ? virgin : chad
>>
>>58460837
Is that wave form based on the contours of the image, or is that just a coincedence?
>>
>>58460716
is it java? no, you can't get a job with assembly.
>>
>>58460829
Not an argument.
>>
>>58460929

Purely a coincidence.
>>
>>58460900
That makes me irate.
>>
>>58460716
Depends. What else do you know?

>>58460844
Then it is not a solution to the problem.
>>
File: Capture.png (6KB, 528x85px) Image search: [Google]
Capture.png
6KB, 528x85px
what do they mean by this?
>>
>>58460991
we've established that

you could of course use the stack monad or IO or an embedded AST
>>
>>58460999
checked
>>
>>58460999
Exactly what it says.
>>
>>58460999
they're hiring people to test torture devices
>>
>>58460736
>>>/reddit/
>>
>>58460736
>>58460928
Idk about that. I was a beta virgin when I wasn't a programmer. Now that I'm a programmer I'm still a beta virgin, but at least I make good money.
>>
>>58461001

There is no need for any stateful monads or whatnot. Just recurse down the list.

(define (arithmetic-average lst)
(define (helper remaining length sum)
(if (null? remaining)
(/ sum length)
(helper (cdr remaining) (+ length 1) (+ sum (car remaining)))))
(helper lst 0 0))
>>
>>58461106

average = uncurry (/) . foldl' (\(s,c) e -> (s + e, c + 1)) (0, 0)
>>
File: 1441653046183.jpg (394KB, 1050x1400px) Image search: [Google]
1441653046183.jpg
394KB, 1050x1400px
Does any CS graduate know anything more than java, python and a few algorithms? 99% of them come into interviews with the attitude: "I've spent years getting drunk with my friends at uni, where's that 100k starting I was promised?".

I'm having really hard time finding talent in this part of the world.
>>
>>58461096
>>58460928
>>58460736

;AmIAChadOrProgrammer.exe
.586
.MODEL FLAT
.STACK 512
.DATA
chad BYTE "CHAD"
prog BYTE "PROG"
outcomeChad BYTE "You are a chad",0
ourcomeProg BYTE "You are a programmer",0
.CODE
__main__ PROC
mov eax, chad
mov ebx, prog
cmp eax,ebx
jnl userIsProgrammer
cout outcomeChad
jmp exit
userIsProgrammer:
cout outcomeProg
exit:
xor 0,eax
ret
__main__ ENDP
END


[jreeves@tachikoma ~] $ ./AmIAChadOrProgrammer.exe
You are a programmer
>>
>>58461165

Yeah, that should work. Although I must admit, it took a little bit of thinking to realize that your one letter variable names stood for sum, count, and element respectively.
>>
>>58461198
If they actually like the subject (Like I do) they'd be learning new programming languages and frameworks in their leisure time
>>
>>58461198
Im not even in uni yet. Python, Java, C/C++, SQL, and x86 assembly.
I get bored and work in assembly. see:
>>58461229
Of course, school is slow AF. its for stupid people. sadly, its the only way the work force takes you seriously
>>
>>58461198
Pretty much so in NA and Western EU. Which part of the world you in?
>>
>>58460736
return True if programmer else chad
>>
>>58460736
>>58461289
lol fucked it up, meant

return virgin if programmer else chad
>>
>>58461198

I know C, C++, Ruby, and can get by in Java and Python. I've dipped around in a ton of other languages, but don't consider myself to be an expert in them. I have a BS in Computer Science, am set to graduate with an MS in the spring, so long as my research pulls through. My knowledge of algorithms is decent, at least enough to get into the 95th percentile on a Major Field Exam when I finished my Bachelors.

But right now I'm looking to get a PhD.

>>58461229

cout isn't a 586 instruction.
>>
>>58460643
The 'right answer' is iteratees. The quick one is a strict left fold with length accumulator.
>>
>>58461165
Needs more bang patterns.
>>
>>58461353
>But right now I'm looking to get a PhD.
>Dr. Horsefucker
>>
>>58461353
it isnt but lets just say Ive linked the correct c header file to the executable... Its really not worth it having to copy and paste a cout function in assembly for a stupid chad/programmer program i typed up ina few mins
>>
File: 1451851403327.jpg (51KB, 500x500px)
1451851403327.jpg
51KB, 500x500px
Hey daily /adv/ thread, I'm basically a wage slave at a manual labor job, started learning programming because it has always seemed interesting, let's pretend I'm actually smart enough to be above average. How do I get a job with no cuck degree and no formal experience?
>>
>>58461385
Your mom needs a bang pattern
>>
>>58461452
I could use a bang pattern desu..
>>
>>58461385
Your mom needs more bang patterns.
>>
>>58460686
dpt is full of fgts
p p
t t

i i
s s

f f
u u
l l
l l

o o
f f

f f
g g
t t
s s
>>
>>58460971
you could combine them in the Fold data structure of the foldl package to guarantee such fusion
>>
https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

this looks promising. has anyone read it?
>>
Is ruby a smart guy?
>>
File: imrs.jpg (212KB, 1484x1029px) Image search: [Google]
imrs.jpg
212KB, 1484x1029px
>>58461452
Whereas I fulfil all your mom's banging needs.
>>
>>58461534
No. He's a defender of C++, so we can conclude that he's retarded.
>>
>>58460643
mean :: [Double] -> Double
mean = go 0 0
where
go s l [] = s / fromIntegral l
go s l (x:xs) = s `seq` l `seq`
go (s+x) (l+1) xs
>>
>>58461446
Narrow the field you want to work: embedded systems, webdev, enterprise, whatever you want. Then build a portfolio showing that you know your shit, and then start looking for jobs.
I don't have a degree either, and now I'm sending CV to companies. Good luck!
>>
>>58461444

First of all, you don't link header files.

Second of all, cout is part of C++, not C.

Third of all, cout is an object, not a function. The function being used is the ostream operator overload of <<. Since it is a method call, you are using two arguments at the assembly level. The first is a pointer to the cout object itself, the second is the string.

Honestly, you could have just pushed the string onto the stack and then did a call puts. Then all you have to do is toss up an extern for puts and link against libc (or msvcrt.dll in Windows).
>>
>>58461551
That sounds like something a smart guy would do, tho
>>
>>58461551

C++ is a convoluted mess of a language, but it gives an extreme amount of control to its users. Scope based resource management is a damn good idea too, and I'll be looking to see how other languages that use it (i.e. Rust) progress over the next several years.
>>
File: apu.jpg (34KB, 655x527px)
apu.jpg
34KB, 655x527px
>>58459955

val (sum, n) = ((.0, .0) /: xs)((λ, µ) => (λ._1 + µ, λ._2 + 1.0))
sum/n


fails on empty list, YOLO :---DDd
>>
File: dff.jpg (35KB, 837x736px) Image search: [Google]
dff.jpg
35KB, 837x736px
Wew, just found out you can have two separate HTML5 canvases overlapping each other so you don't have to keep rendering the background over and over.

I know /dpt/ gets autistic about JavaScript but I thought this was pretty comfy.
>>
>>58460790
thank you, how advanced are you in it?
>>
>>58461249
That's a nice combo, It's more than any of my interviewees know.

>>58461261
Queensland, Australia. The universities in this country are FUBAR and spend more money on advertising to overseas students than they do on teaching Australian student's. The only good CS grads I've ever met went to uni elsewhere because education standards in this country are absolutely abysmal.

>>58461353
Can you do functional? If so, I have $100k starting waiting for you here.
>>
started back up on my poker engine.

i'm really a terrible programmer :(

8
['Ks', '8s']
7
['9d', 'Qc']
9
['9h', '8h']
['6d', '4h', '5c', '3d', '7s']
>>
File: java.jpg (1MB, 2695x1309px) Image search: [Google]
java.jpg
1MB, 2695x1309px
How many layers of abstraction are you on?
>>
>>58461770

I know Scheme, could probably learn other languages if necessary... but again, I'm going for a PhD. Also, you're in Aussieland. I'd rather be away from the land of spiders, spiders, and of course, the dreaded Kidney Huntsman.

https://www.youtube.com/watch?v=rDk9FPZVMDQ
>>
>>58461810
Well past zygohistomorphic prepromorphisms.
>>
File: 1423322005784.jpg (82KB, 902x713px)
1423322005784.jpg
82KB, 902x713px
>What are you working on, /g/?

Nothing, because I'm frustrated with living and I just can't bring myself to work on anything.
>>
>>58461818
Don't forget the spiders.
>>
File: 3235325235235.png (867KB, 950x608px) Image search: [Google]
3235325235235.png
867KB, 950x608px
>>58461818
>vegan shirt
>looks like hes a gay man that smokes meth and has hiv
>complaining about spiders
>australian

yep everything adds up perfectly thanks for the video.
>>
>>58461810
atleast two, but I don't won't to get QPU misaligned.
>>
>>58461770
>The universities in this country are FUBAR and spend more money on advertising to overseas students than they do on teaching Australian student's.

This is true, but also, I think if you don't program for fun and just do it as a job you're going to be a shit programmer
>>
>>58461830
>just can't bring myself to work on anything.
do the littlest subproblem you can fanthom
>>
>>58461833
In case it was not clear, I dislike arachnids.

>>58461853
Yeah, that video is good for a laugh. Aussies are pretty funny people.

https://www.youtube.com/watch?v=g_U6yOM3pnw
>>
Could anyone help me with regex? How can I get the info hash and filename (only one file name) on a string like this?

kinda trying to get this working on ruby for a weird webtorrent site

btshowmetainfo 20030621 - decode BitTorrent metainfo files

metainfo file.: amd64cd-5.1.2.iso.torrent
info hash.....: e30c05f2330ba4869eefb90bf5978a505303b235
file name.....: amd64cd-5.1.2.iso
file size.....: 253325312 (966 * 262144 + 94208)
announce url..: http://tracker.netbsd.org:6969/announce
>>
>>58461818
Shame, I need someone like you.

Most spiders here are tame except for the dreaded redback on the toilet seat:
https://youtu.be/TjDAiq2-xeU
>>
>can NEVER think of things to code
Guess I'm waiting until my next easy as fuck school assignment
>>
>>58461966
just parse the bencoded torrent file manually

otherwise use grouping
info hash regex: /info hash\.{5}: (.+)/
file name regex: /file name\.{5}: (.+)/

and use the 1st reference group to get the desired info
>>
>>
>>58461984

>redback on the toilet seat
https://www.youtube.com/watch?v=rbqSwE_tHjs
>>
>>58461198
I'm two courses shy of an MS and nope, that's pretty much me. I didn't spend the years getting drunk, though; I've never actually been drunk. I just always find it hard to want to work on personal projects and stuff when I'm home.
>>
>>58461999
>can NEVER think of things to code

write a mini-compiler for any language you like

write a game using 3D graphics

this should keep you occupied for a couple months
>>
>>58461966
>Could anyone help me with regex?

Yeah, ditch them and use peg's instead. They're easier to read/write and iirc they work on stuff higher on the Chomsky hierarchy.
>>
>>58462037
>write a mini-compiler for any language you like
I don't know what this means or how to do it or if it would even be useful
>write a game using 3D graphics
I've tried learning openGL stuff before but it really doesn't interest me
>>
>>58462053
do something that interests you. if you literally cant think of anything, but are a competent programmer, go work for a company where htey literally tell you what you need to make.
>>
>>58461446
Just do it. So long as you're professional about it and never stop learning you'll be better than most.
>>
File: Selection_145.png (852KB, 1175x987px)
Selection_145.png
852KB, 1175x987px
>>
>>58461810
final class Pull[+F[_],+O,+R] private (private val get: Free[AlgebraF[F,O]#f,Option[Attempt[R]]])
>>
>>58462116
not enough effort put in / 10
>>
File: 1483424808054 (1).jpg (810KB, 1200x900px)
1483424808054 (1).jpg
810KB, 1200x900px
>>58462116
Employed Haskell programmer, reporting in.
>>
>>58461691
>Rust
Please. It'll be dead in a year.
>>
>>58462147
why do you want Rust to die? what do you have against it? I'm just curious to why you view it as a personal grievance
>>
>>58461999
Why not dig into some technical computing or numerics? When I have free time I focus on math and numerical methods because it helps me solve problems no matter what programming language I use.
>>
>>58461198
The competent ones stay in academia
>>
>>58462185
Just stating the facts, anon.
>>
File: umaru happy ending - no sound.webm (511KB, 1280x720px) Image search: [Google]
umaru happy ending - no sound.webm
511KB, 1280x720px
>>58462140
die umaru
>>
>>58462185
I don't like the ideology behind it's creation, nor do I like the personal beliefs of it's developers.

It's ownership system is also stupidly complicated and you end up putting everything in unsafe blocks to do anything useful.

The keyword "unsafe" also rubs me the wrong way because I know that most of their developers use this term incorrectly to mean "i feel uncomfortable".
They feel uncomfortable writing low level code... in a systems programming language.

Fuck them.
>>
>>58462147

Maybe. Maybe not. It certainly has some interesting potential. It's probably one of the very few languages released in ages that could legitimately serve as an alternative to C and C++ for what they are used for. Sure it's not as fast as them today, but there is nothing within the language specification that would make fast implementations difficult.
>>
File: golang hamster.png (139KB, 340x422px) Image search: [Google]
golang hamster.png
139KB, 340x422px
>>58462274
>>
>>58462388
This.

I really hate the mental load of the borrow checker, though. I'd rather sit down and learn how to prove memory safety with dependent types than invest in learning it.
>>
>>58462397

Indeed. I won't say it's a perfect alternative to C++. It's just that it's a viable alternative. It still is a pain in the ass to think too much about. At least until someone writes a super intuitive tutorial on borrowing in Rust, that is.

Maybe one of these days I'll make my own systems language. Something that suggests that it is close to the metal, but which does not suggest from its very name that it is corroded and will hurt you if you rub it against your skin the wrong way.
>>
File: akarin ambiguous.jpg (450KB, 1000x900px)
akarin ambiguous.jpg
450KB, 1000x900px
What is so important about the JSON format and why is it necessary? I've first learnt this in school through python3 but the datastructure was introduced as a "Python dictionary", e.g
example_1 = {"Bobby":2, "Sally":5"}

However im confused as I keep seeing everywhere the same type of format except shown a little differently like so:
example_2 = {
"Bobby":2,
"Sally":3
}

What is JSON?
>>
What does /dpt/ think of eta?

http://eta-lang.org/
>>
>>58462447
Whitespace is irrelevant (outside strings and object keys) in JSON.
>>
>>58462447
JavaScript Object Notation
>>
>>58462447
JSON != Python dictionary syntax

http://json.org/example.html
http://www.json.org/
>>
>>58462455
>
quicksort (x:xs) = quicksort left ++ [x] ++ quicksort right

ewww
>>
>>58462397
If you use it for a little while it's stops being an issue. I really don't even think about it directly. I have an intuition to how it works.

It only really becomes an issue when you want to make a complicated data structure from scratch, but at that point you'd be worrying about those kinds of things anyway if you didn't want it to be bugged out of the ass.

My biggest complaint with rust is the designers decided to make string literals only interpreted as &'static str, instead of String. The compiler can make 17 a i32 or a u8, but for some reason it can't figure out let s: String = "hello";

Stupid.
>>
>>58462433
>hurt you if you rub it against your skin the wrong way
You're so thin-skinned, Ruby.
>>
What's a good language for a literal nigger?
>>
>>58462575
Java
>>
>>58462575
anything really because we're all the same on the inside
>>
>>58462585
Speak for yourself, mammal.
>>
>>58462581
How long will it take to learn it? I want him to be able to start working as soon as possible.
>>58462585
Uh... Not really?
>>
>>58462588
stupid fucking fish
>>
>>58462468
>>58462474
>>58462503
Oh I see, I just read a little bit of JSON.org, so its mainly used to exchange XML information in an easily readible format?

Dont really understand the point though
>>
>>58462565

Do you like it when the red water comes out, Anon?
>>
>>58462614
It's almost orgasmic.
>>
>>58462455
>What does /dpt/ think of Haskell?
>>
>>58462614
>Anon
No, use his nickname. this isn't an anonymous subreddit.
>>
>>58462244
Producing worthless research on the backs of taxpayers.
>>
>>58462605
It's a data exchange format. You can exchange anything you want using JSON as long as you agree on a way to encode it in JSON and decode it again.
>>
>>58462594
>him
>working

You must have missed the memo. CIS males have been deprecated.
>>
>>58462632
>CIS
more like CSA. Don't worry, he'll work. I just need a language for him to learn. Something suitable for his kind.
>>
>>58462631
Neato. I haven't missed anything if I already understand python dictionaries right? I mean they look like basically the same thing and use the same notation
>>
>>58462621
>use his nickname.
He doesn't have one. He's literally just another Anon.
>>
>>58462654
>I haven't missed anything if I already understand python dictionaries right? I mean they look like basically the same thing and use the same notation
I don't know Python, but I'd be very wary of making assumptions like that, if they're incorrect they have a habit of biting you on the ass later.
>>
>>58462656
Did you seriously just assume my species?
>>
>>58462656
The problem is, Ruby, that you probably aren't seeing all the posts. If you are just viewing /dpt/ through the /g/ board, you don't see the green posts, the posts with letters in their ids, or anything numberless. Together, those make up about 40-70 percent of /dpt/, depending on the day. So conversation will appear disjointed and spastic, because you won't be getting the full picture.
>>
Ok, I have an array with a lot of file names in it, how can I delete any item in the array that does not include certain extensions?

like the opposite of
result=a.reject { |e| b.include?(e.first) or b.include?(e.last) }


like, out of a hundred files, i'd want to keep only the .txt+.iso+.zip files and remove everything else
>>
>>58462675
>using an addon to get namefags
>>
>>58462690
filter
>>
>>58462694
I actually just flipped over to the /g/ interface to make this post, and it's pretty funny how unintelligible /dpt/ is like this.
>>
>>58462690

Assuming a is an array of filenames and exts is an array of legal file extensions,

a.select { |filename| exts.include? File.extname filename }
>>
If evolution is real, then why does Java still exist? Checkmate atheists!
>>
>>58462904
>if evolution is real, then why do we have an appendix?
>>
>>58463020
MODS = JIDF
>>
>>58462433
>Something that suggests that it is close to the metal, but which does not suggest from its very name that it is corroded and will hurt you if you rub it against your skin the wrong way.
OK, let's brainstorm right now
>paint
>grip
>plug
>twist
>wedge
>hinge
>steel
>spike
>truss
>rivet
>drive
>thrust
>nozzle
I'll think of more later
>>
File: Nozzle.png (163KB, 481x270px) Image search: [Google]
Nozzle.png
163KB, 481x270px
>>58463097
>>nozzle
>>
>>58460716
>Can you get a job with $(language)
People won't hire you just because you know some language. Or did you mean "In what kind of a job is $(language) used?"
>>
>>58462140

I believe you. (I don't)
>>
>>58460686
>tfw too stupid to program
>>
File: puke_girl_warp.jpg (378KB, 1024x1024px)
puke_girl_warp.jpg
378KB, 1024x1024px
This is fun.
>>
Can someone explain this to a newfag? Learning C and one of the exercises requires me to count letters in a word. Note that my book has not covered isspace, which is why my code looks like this.


while ((c = getchar()) != EOF)
{
if (c != ' ' && c != '\n' && c != '\t')
{
state = IN;
++nc;
}
else
{
state = OUT;
++wordlen[nc];
nc = 0;
}
}



My question is, why does my first if argument need the && operator for it to work? Shouldn't it work with the || operator as well? Because the way I read the argument is that if c is neither a space, new line, NOR a tab, then start counting the letters. It doesn't necessarily have to satisfy all of the arguments.
>>
>>58463446
&& and || do the exact opposite.
a && b
reads as "if a is true, return b".
a || b reads as "if a is false, return b"
>>
>>58463446

As it is impossible for c to be both a space and a new line at the same time, using the or operator rather than and would result in a conditional that is universally true.
>>
>>58463446
You COULD rewrite the if statement to use or instead of and, but you'd have to flip if and else bodies and turn the !='s into =='s

tl;dr de morgan's law
>>
>>58461353
>Phd
Somebody wants to kill his career before it started.
>>
>>58462037
>this should keep you occupied for a couple months

>implying I have the attention span to focus on one project for months on end
>>
>>58463527

I'm going into research, not regular old software development. Research pretty much requires a PhD.
>>
>>58461198
No, the good coders are getting hired by companies who invest in better HR than you

>me and my friends partied our way through uni
>all have jobs from 60k to 95k
>most of us still didnt graduate, doing school part time

Number of competent coders < number of jobs makes it harder to find coders
>>
Is there a way to see the code for built-in controls in Visual Studio? Like if I wanted to see how Microsoft programmed the Paint function of a Button?
>>
Is there a C++ function to change filetype?

>create .txt file
>write to .txt file
>change .txt extension to .c
>>
>>58463784
No.
>>
Is this code acceptable or too convoluted? My professor bitched at how this is not how we're supposed to write code.
/* strend:  returns 1 if the string t occurs at the end of the string s,
* and zero otherwise */
bool strend(char *s, char *t)
{
while (*s != '\0' && *s != *t)
s++;
while (*t != '\0')
if (*s++ != *t++)
return false;

return !*s;
}
>>
>>58463840
Where are your braces, man?
>>
>>58463446
It can't be a space, AND it can't be a linefeed, AND it can't be a tab.
All three of these must be satisfied, for if any single one is not satisfied (e.g. c is a tab) then c is white space.
>>
>>58463870
Why? They're all single statements so braces are not necessary.
>>
>>58463793
Not that I know of, but if in less that 2 minutes (being generous) you can't write a function that does that then give up programming altogether.
>>
What's the best way to implement HM type inference?
Should I infer into a list of constraints and then solve that seperately? Should I go for a imperative approach to avoid substitutions?
>>
Interesting article from a very divisive figure

Rust severely disappoints me
By Eric Raymond
http://esr.ibiblio.org/?p=7294
>>
>>58463567
I'm not looking for coders, I'm looking for programmers. There's a BIG difference. If I ask HR for a programmer, they'll give me a coder like you. Which is bad because I need someone intelligent who actually deserves over 100k.
>>
>>58463840
It's incorrect, for starters.
>>
>>58464086

One of the first times I've ever actually agreed with ESR.
>>
>>58463793

http://en.cppreference.com/w/c/io/rename
>>
>>58461562
(loop for i in xs
count i into c
sum i into s
finally (return (/ s c 1.0)))
>>
>>58463840
This is bait, right?
>>
>>58464103
How so?
>>58464249
Very helpful.
>>
>>58463840
don't know c, but , s and t are the original arrays, right?
why not make some internal variables, and use them for exploring the strings
>>
>>58463840

This function fails to produce a correct solution when the first character in t appears early in s, but before the occurance of the whole string of t. For instance, strend("t-test", "test");

Also, both strings should ideally be constant, as neither is modified.
>>
>>58464319
They're pointers; when passed as an arguments C creates a local copy for use inside the function much like with integers. So this code doesn't modify the original values of s and t.
>>
>>58464349
Hmmm! I didn't catch that before. Thanks.
>>
>he doesn't write his network services in go
>>
>>58464363
It also fails if the entirely of t is contained in s but not at the end
>>
>>58464370
post code faggot
>>
When did you realize learning Common Lisp was a mistake?
>>
>>58460802
>>58460844
That's worse than in Java.
Arrays.stream(list).average().orElse(0.0);

The orElse is because it returns the equivalent of a Maybe double, so you have to deal with the Nothing case.
>>
I believe the problem is solvable in a purely functional manner:

#include <string.h>
#include <stdbool.h>

bool strend(const char *s, const char *t)
{
size_t slen = strlen(s);
size_t tlen = strlen(t);

if (tlen > slen) return false;
else return !strcmp(s + (slen - tlen), t);
}
>>
>>58464425
how portable is this code
>>
>>58464425

Portable to each and every C99 and/or C11 compiler. If you remove the bool type and return int instead, it will be portable to every C89 compiler as well.

I am only using standard library functions.
>>
>>58464454
Meant for
>>58464444

Woops.
>>
>>58464454
Can it be re-implemented using a ternary? My mum says ternaries are more dynamic and impressive.
>>
>>58461198
IDK, I had Haskell, Common Lisp, R, Prolog, SQL, FUCKING XML DATABASES, as well as Java.
>>
>>58464425
Pretty. I will finish implementing an imperative solution just because, though.
>>
>>58461198
Yeah it's crazy. Worst is when a guy comes in with 10 years of experience that looks great on his resume, but then you find out this poor fuck's been doing some really specific relatively boring brain-atrophying crap for those 10 years and now can't even answer or discuss simple programming concepts.
>>
anyone know how effective python3 is at multithreading? Could it essentially be as fast as java or other languages if you exploit multithreading
>>
>>58464779
>GIL
Nope.
>>
>>58463840
>>58464425
>>58464556
I believe it works now, and is simpler than before.

/* 
* strend: returns 1 if string t occurs at the end of string s,
* zero otherwise.
*/
int strend(char *s, char *t)
{
char *s2;
char *t2;

for (s2 = s; *s2 != '\0'; s2++)
;
for (t2 = t; *t2 != '\0'; t2++)
;
while (t2 >= t)
if ((s2 < s) || (*s2-- != *t2--))
return 0;

return 1;
}
>>
I need some bash scripting help.

find . -name "*.wav" -exec fdkaac -p5 -b64 {} \;

This works albeit with ERROR: unsupported input file
find . -name "*.wav" -exec opusenc --comp 10 --bitrate 64 {} \;

This doesn't work at all and spits back -h
- can be used for stdin/stdout, but no matter what configuration I try to use it fails.
What am I missing here?
>>
>>58464796
What do you mean GIL >Nope? What is GIL?
>>
>>58464849
The opus one doesn't work because you haven't specified an output file.
>>
>>58464872
https://en.wikipedia.org/wiki/Global_interpreter_lock
>>
>>58464380
But learning common lisp means that I already know how to use everything new in Java, except for monads. Which I learned from Haskell.

With the new package management coming in Java 9, it will be even more worthwile to know CL, because it takes a lot of inspiration from ASDF.
>>
>>58463567
>>58464098 is right, the best coder is actually the compiler/assembler.

Nonetheless, the fact that the labor market in IT starving for devs is getting a bigger and bigger problem.
Actually, IT doesn't really need that much workforce, but the thing is, when all you have in hand are mediocre devs who don't have the mindset nor the competences of an engineer and programmers wannabes coming from other fields than CS and IT, it's no wonder shit is never getting done, or even worse, done is such a partial and buggy way that it's satisfying enough for clients in the first place.
But then, it quickly becomes unusable and unmaintainable, hence giving both managers and HRs the impression they need more people to solve these problems, while what they'd actually need are the competent people in the right place, which is more costly at first but is more rewarding on the long term. Quality over quantity. It's always the same fucking problem in every industry and it's not going away tomorrow, since devs are the new proles and it helps keeping the unemployment low.
>>
>>58464956
so, is CLOS superior to Java
>>
>>58463414
Now do it with a gif and post results here
>>
Java cripples the mind and teaching it should be a criminal offence punishable by slow, painful, agonising death.
>>
>>58464913
-type f got rid of that error using fdkaac.
Okay sweet. This seems to work. :)
find . -type f -name "*.wav" -exec opusenc --comp 10 --bitrate 64 {} {}.opus \;
>>
>>58465018
That's naming the output files "filename.wav.opus".
>>
>>58465026
True, but it's encoding them now. Is there a cleaner way?
>>
>go to uni, computer science with more "push" on programming

>AFTER 5 FUCKING MONTHS we finały start WITH php, the most basic shit you can imagine
>90% of the class does not understand shit

Why the FUCK do such people even go there? What is the fucking point of they are complete retarda and dont even know what programming is about? I dont expect them to be experts but come the FUCK on
>>
>>58464949
>https://en.wikipedia.org/wiki/Global_interpreter_lock
So, python has a GIL and therefore cannot multithread regardless of multithread library? wtf? makes no sense
>>
File: primer.jpg (31KB, 600x791px) Image search: [Google]
primer.jpg
31KB, 600x791px
Has anyone read this book?

Any recommendations for a good noob friendly cpp book?
>>
>>58464516
return (tlen > slen) ? false : !strcmp(s + (slen - tlen), t);
>>
>>58465041
for f in *.wav; do opusenc --comp 10 --bitrate 64 "$f" "${f%.wav}.opus"; done

This won't do it recursively like find will though.
There is probably a way to do it recursively with "read" or something, and make these all happen in parallel, but I can't be bothered writing it.
>>
>>58464991
To Java's object system?
Yes and no.

It's kinda complicated.

Just as an example, Java is written with the assumption that EVERYTHING is inside a class.

This is both a good thing and a bad thing.
It's a good thing, because there is less variation. Everything has a place. You don't have free floating functions running around.
But it's also a bad thing, because there are legitimate reasons to keep some things outside a class.

And you'll fine that sort of trade-off for every choice they both made.

For example, a CL fixnum, which is both a primitive and a class, uses 29 bits for the value of the int, and 3 bits for class information. This completely BTFOs Java's ints when it comes to putting things in containers. But Java was to be used by C programmers and they demand int to be 32 bits.

And so on.

I prefer CLOS to Java's object system, but that's merely my subjective opinion.
>>
>>58465041
-exec a shit for that, since you can't directly use the {} inside shell expansion
>>58465102 is right, you should use read in conjunction with find if you want all the files in the subdirectories.
>>
>>58465138
Forgot the code
find . -type f -name "*.wav" | while read -d '' -r in; do
opusenc --comp 10 --bitrate 64 "$in" "${in%.wav}".opus
done
>>
>>58465138
>>58465102
Okay thanks guys. I wish opusenc operated like fdkaac. It would make things a bit easier doing recursive encodes.
>>
>>58465185
Aw shit, find needs -print0 for read to read the filenames with whitespaces correctly.
>>
>>58465185
>>58465244
Dude u r a superstar :D Thanks again!
>>
File: 1466363120412.png (62KB, 650x310px) Image search: [Google]
1466363120412.png
62KB, 650x310px
>>58460686
>What are you working on, /g/?
Just finished v1.1 of my skyrim saves manager :)
>>
Whats the best documentation to read to get familiar with python3's tkinter? Looking an official documentation they just seem to list the methods and classes available but dont really provide any context or good examples, I'm decent at programming but when it comes to GUI implementation I just get lost cause random classes are just passed around and I have no idea whats going on unless its like making a GUI with C# in visual studios (drag and drop lol)

Any tips?
>>
>>58460716
Malware Analysis
>>
>>58465318
Yes actually.
http://mcsp.wartburg.edu/zelle/python/graphics.py - a nice example package/module using tkinter
http://mcsp.wartburg.edu/zelle/python/graphics/graphics.pdf - docs on said package
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.111.6062&rep=rep1&type=pdf
- book, chapter 5 I believe touches on writing some simple programs which make use of the package
>>
>>58460686
class cuck
{
string bull = Tyrone;
string gf = Stacy;
}
class program
{
cuck Carl = new cuck();
}
>>
>>58465105
where did you learn oop?
was thinking buying the CLOS book on amazon
>>
I'm bored af, at a point where even vidya is not enough. Does anyone have the image with a huge list of mini-projects ?
>>
File: deep contemplation.png (392KB, 451x619px) Image search: [Google]
deep contemplation.png
392KB, 451x619px
General question:
For a final year CS student, what should I be capable of now generally speaking? I'm asking this because although I go to the best University in my country (which doesn't really amount to much honestly (New Zealand)) they don't actually teach us much "programming" so to speak, a lot of classes are purely theoretical based and focus on computational logic rather than writing code...Now although this has its percs it means that even after 2 years as a CS student I'm pretty uninformed about a lot of packages, programming practice and just general knowledge with specific languages, we have done C#, Java, C, Python, Assembly but we hardly did anything or use any packages...We practically just used programming languages for simple tasks in assignments and didn't really do anything to be honest

Should I be worried? Trying to focus on Python at the moment since it should be the simplest language to create something neat for a project

>>58465358
I think these references are extremely outdated, not only from the appearance of the websites and packages they use (Is graphWin even used anymore?) apart from the obvious stuff like drawing shapes with graphics

I was speaking more like, shown sample code how to integrate button objects into the master frame, how all the calls and that interact, how to create multiple children frames from the master frame etc, more useful stuff with pictures of before/after results too (tkinter)
>>
>>58465361
public class Cuck {
public final String bull, gf;
public Cuck(String bull, String gf) {
this.bull = bull;
this.gf = gf;
}
}

public class Program {
cuck Carl = new Cuck("Tyrone", "Stacy");
}
>>
>>58465419
>best University in my country
>New Zealand
And what would that be by the way?
I just finished my third year at Waikato and I thought the CS papers were pretty good.
Anyway, a CS degrees is not code monkey training camp.
>>
>>58465430
is there any tldr java books?
I already know what ints, for/while loops are
>>
File: file.png (44KB, 411x719px) Image search: [Google]
file.png
44KB, 411x719px
what the fug

>>58465441
Not him but it's probably Massey University
>>
>>58465314
Neat. Keep up the good work anon.
>>
>>58465430
I never understood the point of the final keyword in Java, is it basically C's version of constant strings?

>>58465441
>And what would that be by the way?
Auckland Uni, according to their website they are still 1st in NZ for a lot of fields, Cs, medicine, engineering, etc

Not exactly sure how its ranked though but its pretty much common knowledge everywhere else is a meme I think

>I just finished my third year at Waikato and I thought the CS papers were pretty good.
What did you guys do mainly?

>Anyway, a CS degrees is not code monkey training camp.
Yea but its good to also have some knowledge on programming languages themselves, how specific ones work and just be informed about them.

Its kind of silly me knowing how a high level programming language translates into machine code and how the adders work in microarchitecture but me not figure out how to make a hello world GUI (exaggerating but thats how I feel, I couldn't cook up a simple program that fetches stock quotes and historic data and model it in a GUI program, that would probably take me a month to figure out lol)
>>
>>58465387
University, reading the literature on the subject, programming professionally...

The same things as everyone.
If you want to learn CLOS, I suggest figuring out how to use the HyperSpec, because it's pretty good.

I haven't read the CLOS-book. I've just read the CLOS documentation for what I needed to do in order to model the domain I was working on. (a compiler with front end and back end that compiled stuff (CSV, images, markdown) into a presentation (PDF via LaTeX, HTML ,etc.)
>>
>>58460686
how do I become a leet ebin haxor?
>>
>>58465419
>I think these references are extremely outdated,
Shit lol you might be right, the most recent edition of that book is 2003.
My apologies for wasting your time.
>>
>>58465468
Final means that the value will never change. So yes, pretty similar to const in C/C++.

It's useful because it allows compiler and JVM to heavily optimize values. For example all final primitives are automatically inlined to the compile phase and all final or effectively final calculations/comparisons are done during compiling. JVM does some advanced runtime magic too, such as hardcoding object references to certain memory addresses and whatnot.
>>
>>58465486
actually learn C
actually learn assembly
actually learn kernel development
actually learn to program embedded systems
you'll figure it out at some point in there
>>
>>58465525
>the most recent edition of that book is 2003.
Actually the publishers site says it was published in 2016, amazon must have been telling me the date for the first ed.
Anyway I don't know if it's out of date really but gl either way.
>>
File: 1401490437015.png (48KB, 1517x722px) Image search: [Google]
1401490437015.png
48KB, 1517x722px
IS THERE ANY NOTICEABLE DIFFERENCE BETWEEN GCC AND MICROSOFT COMPILER?

maybe I install windox
>>
>>58465468
>Auckland Uni, according to their website they are still 1st in NZ for a lot of fields, Cs, medicine, engineering, etc
>Not exactly sure how its ranked though but its pretty much common knowledge everywhere else is a meme I think
I'm pretty sure most New Zealand universities are ranked quite high globally for CS, so I doubt many of the courses are complete trash.
>What did you guys do mainly?
It branches out quite a bit at the 300 level, so there are all sorts of shit you can do, based on what interests you.
I personally did "lower level" stuff: operating systems (using MINIX), system architecture. But I also did some of the more "hard" CS: Programming languages (mainly about FP and Haskell), reasoning about programs, algorithms.
Waikato also has a strong network research group, so I did some advanced networking papers.

Really, when it comes to most "real world" shit, you will be learning most of it in your own time. They usually don't go into excruciating detail about any particular piece of technology, because that's not what they're trying to teach.
>>
>>58465526
Hmm, what I dont understand is that lower leveld languages such as C pride themselves of their compiler abilities to heavily optimize, if a variable is a string and not being changed throughout the course of the program, wouldn't the compiler recognize that anyways and set the variable to be a const? Seems like the thing itd do, making const a useless primitive type

>>58465529
A serious question to this joke though, I actually have faced this dilemma, whether to stay at high level and separate myself from the implementation to achieve a higher abstraction and find the big picture or to spend my time trying to optimize the last bit of information or feel superior in some way because C is much more complicated than a scripting language..

I was actually considering x86 because it felt more "real" that I knew what is happening in the actual hardware but I soon realized I somehow ended up wanting to compete with being "superior" rather than actually being a good programming student.

Anyone have an answer on what language you should "Main"?

>>58465562
>I'm pretty sure most New Zealand universities are ranked quite high globally for CS, so I doubt many of the courses are complete trash.
I don't know man, I'm smart by any means but I've found everything to be pretty much trivial so far, nothing really pushed me to learn more in school (only a few classes really made me love some stuff, assembly and microarchitecture in specific), but most of the algorithms classes and such are all dumbed down and are a joke in my opinion

>Really, when it comes to most "real world" shit, you will be learning most of it in your own time. They usually don't go into excruciating detail about any particular piece of technology, because that's not what they're trying to teach.
Its strange saying this but I guess youre right that I shouldnt be expecting much from uni, I really need to get some professional level experience, havent been in an internship or any job yet.
>>
File: THE-MATRIX.jpg (383KB, 1536x826px) Image search: [Google]
THE-MATRIX.jpg
383KB, 1536x826px
>>58465449
You will never understand, anon. It's only for those who have been enlightened
>>
>>58465588
whichever most of the classes are in.
>>
>>58465588
>Im not smart by any means*

>>58465556
I believe the CPP compiler provided by visual studios is not completely backwards compatible for C programming, so somethings will work on GCC while CPP visual studios will not.

Linux is a programming environment meant for C, so obviously GCC is better.

>>58465588
I don't even think I'm going to be doing any programming this year, looking at all my papers they seem to be theory based (again)
>>
>>58465616
whoops read >>58465625
>>
>>58465588
>I'm smart by any means
I'm assuming you meant "not smart by any means" otherwise that doesn't really make sense and you're really vain.
I don't know exactly what it's like at Auckland, but most of the 200 level papers here were piss easy. The sort of shit where if you even has a basic understanding about Computer science and programming, and then actually went to class, you would probably get at least an A without much effort.
300 level and beyond is where things got slightly harder and much more interesting.
>>
>>58465625
>Linux is a programming environment meant for C, so obviously GCC is better.
Meh.
I guess then switching back to windows is no option for me. Okay.
>>
>>58465065
Welcome to uni. Hope you'll survive the shitshow that is to work with people that can't grasp programming logic. It's killing me at this very moment.
>>
>>58465637
>I'm assuming you meant "not smart by any means"
yes typo

>I don't know exactly what it's like at Auckland, but most of the 200 level papers here were piss easy. The sort of shit where if you even has a basic understanding about Computer science and programming, and then actually went to class, you would probably get at least an A without much effort.
Hmm, although I do say its trivial I didn't mean you can just sleep at home and watch anime and come walking out with an A.

Although my experience for me was this: I go to class every day, do my assignments, all free time on 4chan/anime/ and since I go to class every day I do not need to study for exams -> a- general on average.

But that definitely is trivial in my opinion, when I first came to university I had the impression I'd have to study every day after I got home from school and be serious about things, quite unfortunate really

>300 level and beyond is where things got slightly harder and much more interesting.
I'm interested to see if its like that for me, I do hope so, so I feel compelled to learn. Although I am not looking to go into academia or post grad study I just hope I can get a job lol, by the way, do you know if professional level experience before you graduate is a must if you want to get a job?

Been hearing in the past few days its very crucial and I'm a bit worried.

>>58465670
Your best option is to do your programming through putty connecting to a server which hosts VIM + Linux servers that you can code in, while running a Windows operating system for easy stress free tasks.
>>
>>58465065
kek, programming isn't common sense to normies like everything else in life is to them. If they don't do homework or read ahead they're fucked in CS.
>>
>>58465670
Yeah, C programming on windows is a maze of either M$ obscure stuff centered around Visual Studio or of some tools that try to simulate a Linux environment (MSYS, MinGW, Cygwin and stuff). In the end, you take several hours to configure your project, that would have been seconds on Linux because it just works there.

tl;dr windows is hard, linux just works.
>>
>>58465707
>I go to class every day, do my assignments, all free time on 4chan/anime/ and since I go to class every day I do not need to study for exams -> a- general on average.
I had the exact same experience. Actually going to lectures and paying attention is already most of the work, and the rest is assignments.
>I had the impression I'd have to study every day after I got home from school and be serious about things
Yeah, University isn't actually very difficult in general.
Although I did a 400 level networking paper last year, and it was really fucking hard. A lot of shit to remember, assignments with extremely vague requirements, assignments with very little supporting information (e.g. configure this switch to do some shit, go find out how to do it in the 700+ page Juniper docs).
I was surprised that I was actually able to get a good result in the paper. I worked my ass off on those assignments and had no idea if I was even doing it properly.
>do you know if professional level experience before you graduate is a must if you want to get a job?
I'm still attending university and haven't got a "real" job, so I don't really know.
As long as you're not a complete retard and actually know how to program, I can't imagine that it would be that difficult to get a job.
>>
Started learning Haskell after a long time with C++, it's joyful so far.
>>
>>58465838
just wait until you need to do real work
the basics are enticing, but when you find out you need to go out your way to decode a json string, you'll want to die

also, have fun with zippers
>>
>>58465853
aeson is quite good at dealing with most aspects of JSON, not as easy as Python or Golang but still quite painless
Haskell's pain points for me are how so many libraries have to have their bespoke monads. Really upsets my chakras.
>>
i made a thing :---D
https://github.com/majestrate/nntpchan/
well... reimplemented a thing that started in mid 2013
it's faster tho
>>
File: 1482964666901.png (305KB, 1920x1080px) Image search: [Google]
1482964666901.png
305KB, 1920x1080px
>>58460849
>>
so is c++ the final answer
>>
>>58465920
More like the final solution.
>>
>>58465879
Why does every github project have lots of textfiles and random files and stuff? Also whats the deal with the licensing stuff? Is that something github provides you with and you choose what type of legal rights you want? I am very new to version control and the whole legal thing about publishing on git.

I am looking forward to publish something but I dont really understand any of this, any easy tutorial or explanation I can find?
>>
Anyone have a good idea thats fun and can be implemented with a GUI that shows employers I care about programming? I wanna have at least one quality project that I'd like to show if I'm asked in an interview or something
>>
>>58466035
>README.md
markdown formatted project description/info thing that displays when in a folder with one
>README
plain text version of the above
>.gitignore
used to prevent files from being added to the repository
like object files, binaries, building temp files, and more
>package.json or similar
something that is used to describe the project for a packaging system
>LICENSE.md or LICENSE
the main project license file

licenses are mostly politics and deal with software "freedom" and code attribution

want to prevent companies from reusing your code in their proprietary (source-code isn't released or it's "non-free" software) then you can do that with the right license

some licenses conflict so some projects are not permitted to be built together

and most licenses require that the project and coders be attributed for their work in that project if it is used within another project

here's something that can help you choose
http://choosealicense.com/
>>
>>58465460
Thanks :)
>>
>>58466035
>Also whats the deal with the licensing stuff?
Software licensing is very important. It dictates how people can use what you put out there.
Lawsuits happen over licenses. Entire new operating systems and other massive projects are made, just because of licenses.
The entire free and open source software movement is about licensing.
>Is that something github provides you with and you choose what type of legal rights you want? I
It's been convention to have a LICENSE or COPYING file in your project for a very long time.
>any easy tutorial or explanation I can find?
GNU has several resources on software licensing, but I can't really see an article catered towards beginners.
>>
>non-anime images on the anime site
you sick fucks
>>
>>58466047
>make yourself a bitch for some corporations
>not make programs you like as a hobby
>>
>>58466157
I enjoy dealing with computers.
Ideally I want to be some sort of financial analyst, not someone implementing solutions all day, the guy who thinks of them.

Coding is fun but thinking and designing the solutions is funner
>>
What is the proper name for data structures which store/retrieve data from files instead of RAM?

i.e. the structure internally only holds file handles and positions of the various elements and reads/writes them from files but externally behaves like a normal list/map/tree/whatever
>>
Anyone here dealt with database normalization before? I need a simple sqlite database for music (only tags and paths) and I'm not sure whether it's worth to have several tables like songs, artists, albums or just dump everything into one table
>>
>all that Hasklel posting
I thought guys you got own general or something
>>
>>58466206
/fpt is ded
>>
>>58466111
Oh I see, does it matter what country youre in or are these licenses international?
>>
>>58466200
I don't believe there is a special term for that.
I know some algorithms that work using files are called external memory algorithms or out-of-core algorithms, but I don't think they apply that term to data structures.
Even then, you could just map the file into RAM, and then do it with pointers instead.
>>
>>58460686
>Go has pointers
>Doesn't have pointer math
Tell me, what is the point of having pointers without pointer math again?
>>
>>58466220
they're valid everywhere if that's what you're asking

people can ignore licenses though and it's up to the licensors of the project to protect their copyright (by suing them in court pretty much)

99% of people follow licenses though
>>
>>58466264
To pretend that you're like C.
>>
>>58466264
dropping pointer math isn't a big problem and it helps with safety
>>
>>58466311
Might as well just go ahead and call it a reference than, no?
>>
>>58466319
not if they're not references, no?
>>
test
>>
>>58466226
I'd use mmap but I'm working on files much larger than the amount of RAM I have available.
>>
What is a good book/tool (good, as in not made for retards) on learning SQL?
>>
>>58466200
'dumb'
>>
>>58466400
NoSQL > SQL
>>
>>58460999
The ultimate pajeet lang, java php
>>
Why are C programmers so prone to using very short, uninformative variable names?
>>
>>58466739
horshoe theory
>>
>>58466750
so c and webdevs use very short variables?
>>
>>58460686
Any good video to learn C structures and linked list from?
I've been trying for two days now and still haven't figured it out.
>>
>>58466739
To compensate for their enormous penises.
>>
File: haskell..png (7KB, 397x131px) Image search: [Google]
haskell..png
7KB, 397x131px
>>58466758
>>
>>58466739
Fitting in 79 columns is MUCH more important than code readability.
>>
>>58466739
Probably because the standard library traditionally uses short names.
But really, using short variable names is a skill.
It's about cramming as much useful context into as few characters as possible.

Have a function which primarily works on a "struct object"?
Why not call the argument "obj", or even simply "o"?
Reading through it, it's pretty obvious that "o" refers to the object.

When it comes to things with much wider scopes, such as function names in the global scope, it would pay to be a lot more descriptive.
>>
>>58466822
average = foldr (\e (s,c) -> (s + e, c + 1)) (0,0)


-- e = ?
-- s = ?
-- c = ?
>>
>>58466844
whoops, should be
average = uncurry (/) $ foldr ...

all that bit does is actually do the division
>>
>>58466844
>>58466854
Haskell rules are one-letter data names and
longAndDescriptiveFunctionNames
>>
>>58466844
Wow, someone used undescriptive variable names one time.
That means all programmers are terrible at doing this!
It's all about context, and that code is not using its context well.

Even then, wasn't this supposed to be about C programmers?
Why are you posting Haskell code?
>>
>>58466874
Functions are regular first class values, often you'll need to be doing something where it's easier to do
myFunc = go 0 x
where go n x y z = ...


>>58466876
e is element
s is sum
c is count
>>
>>58466879
>Functions are regular first class values
Hence the word 'data' rather than 'value'.
>>
>>58466739
It's perfectly fine as long as the abbreviation is explained next to its declaration
>int avwavln; // aVariableWithAVeryLongName
unless they are just some temporary helper variables that don't have any particular meaning by itself
>>
>>58466400
I'd also like to know some recommendations. Not just plain SQL, but also about DB modeling and all of those related design things.
>>
>>58466400
>>58466932
If you go out of your way to study for and get your MCSA for SQL Server, you'll get a really good background for querying/managing/building on pretty much any DBMS.

Plus, you'll have a nice cert that will land you well-paying jobs easily, but that's only if you actually want to do DBA things.

Median salary for someone MCSA certified is mid $80k, if I remember right.
>>
>>58466902
Except that's the polar opposite of self-documenting code, gives you lots more things to remember as you read through the code, and can only be said to make sense (in principle) for local variables whereas C code uses them liberally everywhere.
>>
>>58466960
Sure, but I don't intend to go all the way in. Pareto principle.
>>
File: comey 2.jpg (39KB, 615x410px) Image search: [Google]
comey 2.jpg
39KB, 615x410px
What's your favourite/the best PYTHON RESOURCE ? ? ?

Can be a book or a webpage!
>>
>>58467009
The python documentation
>>
>>58466987
writing self-documenting code is like asking for yourself to be replaced.
>>
>>58466999
Well, what are you actually trying to learn?

There are oodles of great single-page websites that would give anyone a basic understanding of SQL and how to form
SELECT FROM JOIN WHERE GROUP BY HAVING ORDER BY
queries to grab information.

Are you just trying to tell an interviewer that you "know SQL" or do you have a goal? Building databases? Reading information only? Performing basic update/insert/delete? System-versioning? Performance tuning?
>>
>>58466987
You sure are making a lot of generalisations about a lot of code.
Just because it's called strlen and not getTheLengthOfAConstNullTerminatedString, it doesn't mean that the variable names are too short.
>>
>>58467036
>single-page websites
I suspect the "20%" in this case is a little more than that. By analogy - what I want to learn is enough math to do calculus, not to get a phd in math.
>>
>>58467036
>do you have a goal?
I feel like I'm lacking in the building/design part, not to mention the performance.
>>
I'm writing a 4chan client for iOS. FOSS so you can compile it without jail breaking. :)
>>
Aside from English, what languages are helpful for programming?
>>
>>58467097
Assembly.
>>
>>58467097
chinese so you have more characters for variable names
>>
>>58467115
>tfw that would solve the whole short vs long variable names problem. You'd just need to memorize a gazillion of abstract pictures
>>
New thread:

>>58467161
>>58467161
>>58467161
>>
>>58467158
found APL's creator
>>
>>58467078
Nigga, I'm trying to understand what you want to use a database for.

There are many different ways to attack a database, and different people use them in different ways. People dedicate entire careers in the effort to properly architect and maintain them to suit specific business needs. On the other hand, learning how to query information to read in your application can be done in an afternoon.

>>58467088
Now we're getting somewhere. Some things to look up and understand:
>clustered/nonclustered indexes
>database design best practices(including normalization[3NF; 4/5NF are almost always superfluous], when to use a many-to-many linking table, and the myriad of constraints including foreign key constraints)
>query performance tuning (depending on your DBMS, use a Query Plan tool; you should understand the difference between index scan and seek and where good candidate indexes should go)

This goofy looking fuck has some really great articles on various SQL-related things:
https://blog.sqlauthority.com/

I'll try to find the book I used for database architecture, because I remember it being pretty good.
>>
>>58466778
>Fitting in 79 columns is MUCH more important than code readability.
Wait what? Why? We have ultrawide displays now...
>>
>>58467214
Even a screen only 960 pixels wide comfortably fits over 100 text column width.

>>58466778
Wrong.
>>
>>58467231
>Even a screen only 960 pixels wide comfortably fits over 100 text column width.
I just checked and my text editor fits 244 at the current font & size which is not overly small.

Is there a reason for the short lines or is it just retardation?
>>
>>58467253
In ye olde times, terminal displays were only 40 or 80 columns wide.

In modern times, if you have a lot of lines that are all 244 columns wide, it's annoying to read. Also, a column that wide probably indicates bad variable naming sense or convoluted logic that should be refactored.

The 80 column thing is more of a guideline these days, though. Nobody cares if you violate it now and then, unless it's strictly forbidden by a company or project's style guide.
>>
>>58467253
Unless those faggots are posting here from 1994, there's LITERALLY no reason to limit yourself to some arbitrary small number like 79 characters.
>>
>>58467188
>including normalization[3NF; 4/5NF are almost always superfluous],
During my internship I worked with the database for the company CRM. Jesus, what a mess that was. 3NF? You wish.

Thanks. I'd really appreciate it if you found the book.
>>
>>58467314
128 is perfectly acceptable, as it can fit in a text editor with meta information on both sides, displayed on a 1080x1920 screen positioned vertically.
>>
>>58467314
>In modern times, if you have a lot of lines that are all 244 columns wide, it's annoying to read.
Arguably, but setting a hard limit on 80 chars is retarded and just sounds like "But anon how will I read your code on my VT100 I got back in college if you go over 80 characters?"

I agree that long lines can be a pain in the ass but come on, man.
>>
>>58467317
unless you work on a file with multiple views in your editor
>>
>>58467350
Yes, I tile three documents stacked vertically all the time, and there's plenty of space for each one to have 140-180 characters wide.
>>
>>58467329
>>58467338
Like I said, nobody's going to cry if you go over 80 columns now and then. But seriously, if your code is habitually approaching or exceeding 80 columns and you don't have any special reason why, you should reevaluate what you're doing because you're probably doing something stupid.

Like, seriously, you say 128 columns is fine. Yeah, it is, if it's some special case where you're forced to do a lot of conditional logic or something and don't have a choice. But if 128 column wide lines are normal for you, what the literal fuck are you doing?
>>
>>58467314
If you have 244 columns, you should split them into three terminals.
>>
>>58467412
Even in terminal days, in the event that you had a line that had to exceed 80 characters, a line could continue on to the next display line. I'm sure you've seen that in vim.
>>
File: Fish-eye-apps-for-iPhone.jpg (165KB, 1000x600px) Image search: [Google]
Fish-eye-apps-for-iPhone.jpg
165KB, 1000x600px
>tfw arguing with people with fish eyes
>>
>>58467427
Yeah, but with three terminals I can see ALL THE CODE.

Actually, what I usually do is:
Column 1: editor
Column 2: REPL
Column 3: filesystem, man pages, notes
>>
>>58467454
>Column 4: animu
>>
>limiting yourself to 80 columns

pssssh, some of my variable names are 80 characters just by themselves

it's called being descriptive, kid
>>
>>58467471
Ew groce.

>>58467495
How many layers of abstraction are you on now?
>>
>>58467508
lets just say that the recursive function to count the elements in my abstraction layer array results in a stack overflow
>>
>>58467495
are you an OGL developer?
>>
>>58467533
Impressive. Have you reached zygohistomorphic prepromorphisms yet?
>>
File: comey.jpg (50KB, 1200x800px) Image search: [Google]
comey.jpg
50KB, 1200x800px
>>58467009
up
>>
>>58467406
>Like, seriously, you say 128 columns is fine. Yeah, it is, if it's some special case where you're forced to do a lot of conditional logic or something and don't have a choice. But if 128 column wide lines are normal for you, what the literal fuck are you doing?
This line is 262 characters long.
>>
File: 1483930295515.jpg (5KB, 228x221px) Image search: [Google]
1483930295515.jpg
5KB, 228x221px
>>58467778
>prose = code
>>
>>58467808
Code should read like prose :(
>>
>>58467778
Yeah, and it's made up of multiple statements.
>>
>>58463446
>What are De Morgan's laws?
>>
>>58467837
Like my lines of code :')
>>
>>58465896
Get
Thread posts: 342
Thread images: 31


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