/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

wiki.installgentoo.com/index.php/Programming_resources
wiki.installgentoo.com/index.php/Structure_and_Interpretation_of_Computer_Programs
youtube.com/watch?v=2Op3QLzMgSY&list=PLE18841CABEA24090&index=1
stackoverflow.blog/2017/10/31/disliked-programming-languages/
docs.racket-lang.org/
docs.racket-lang.org/guide/define-struct.html
amazon.com/Hands-Machine-Learning-Scikit-Learn-TensorFlow/dp/1491962291
twitter.com/AnonBabble

...

wow she's cute

First for retarded seeples compiler errors due to arbitrary language restrictions.

thx 4 the pic

>she

Kill yourself troglodyte. Being attracted to the concept of femininity is much more civilized than physical attraction to females. Stupid caveman.

I've got some bad news for you...

pls remove faggots
this is a programming thread, not leftist propaganda thread

Homosexuality is very manly and right wing though.

what does homosexuality have to do with the daily programming thread or op's post?

>those socks

She must be a great programmer.

>very manly

...

Defend this.

Started "Learn You a Haskell", I figured I would implement toUpper :: String -> String to test out what I learned. This feels kind of awkward though. My first idea was a list comprehension, which sort of worked, but was String -> [[Char]] and I wasn't sure how to cleanly convert it to a string.

import Data.List
let toLowercase ch = ['a'..'z'] !! (ch `elemIndices` ['A'..'Z'] !! 0)
let toLowercase2 str = map toLowercase str

>she

>Homosexuality is very manly and right wing
The ABSOLUTE state of Sup Forums

*toLower

there's a function in Data.Char that converts individual characters to uppercase or vice versa

also you could do it numerically, using toEnum and fromEnum to convert an Int to a Char and back

don't tell him, it's funnier if he doesn't know

suppose i'm so stupid there's drool on my shirt as i type this over 10 minutes. how can i learn programming? i want to get into stuff about ai

Ahhh, a numeric solution is smart. I'll try that, thanks :).

And yeah, I'm just implementing it as a learning exercise - I'll use the standard implementation for actual projects.

>I've got some good news for you!!
fixed

Just don't do it. Unless you're a turbo autist it is a waste of time.

Fucking commie heterosexuals
Shouldn't you be watching Tyrone fuck Stacy you imbecile left wing cuckolds
Homosexuality is absolutely patrician

>suppose i'm so stupid there's drool on my shirt
>i want to get into stuff about ai
You won't make it.

C would be more your speed, since that language seems to be quite popular among brainlets.

Learning ruby so i can hate life

you can't do ('c' - 'a') (well, you'd have to write a Num Char instance, dunno if you've done type classes yet), so it can be a bit inconvenient to do
toEnum (fromEnum a - fromEnum b)
and see all the explicit conversion

lmao fuck off retard.
Homosexuality (read: faggotry) is literally caused by too much estrogen.q

Doing the type classes intro section after I'm done with my actual classes tonight, so I'll give it a shot then. Thanks for the heads up.

i want to learn programming, but the only thing i want to make is statistical analysis stuff and ai. i suppose i am a turbo autist, but i'm just stupid at the beginning
i read that lisp and functional languages including python are more popular for ai. an article i read about it said that c is good for using hardware, but ai needs a language that can make prototypes quickly.

i read that lisp is a language that's used for this, but i want to know the Sup Forums recommended resources for brainlets

I'm going to need a citation on that. Some gays are very buff and masculine.

>thinking someone who writes about programing socks doesn't know

Be fair. K&R doesn't cover concurrency, STL or templates. And the range of topics is broader in these modern books. And I'm not confident but those Meyers books. Aren't those just different editions?

for( int i=0;i

basically it would let you give a meaning to -, +, * on Chars (or on any datatype you define)

in that case yeah.
variable scope baby.

also forgot in num.getNumber() there is also a random number parameter

CAN WE JUST IGNORE ANYTHING FAG RELATED AND TALK ABOUT ACTUAL PROGRAMMING
THANK YOU

Okay thank you will look variable scope up

Hello, please notice my DOF shader. Thank you.

Cute boys are always on-topic

>tfw you'll never be the girl (male)

Why is everything so blurry

it's a myopia simulator. you can know what it's like to be nearsighted

The spartans were notorious homosexuals.
Yep, THOSE spartans. Legendary warriors.

anyone know how to input text from VB.NET towards a bookmark in MSword?

i remembered the Sup Forums wiki and found some stuff
wiki.installgentoo.com/index.php/Programming_resources
wiki.installgentoo.com/index.php/Structure_and_Interpretation_of_Computer_Programs
finally
youtube.com/watch?v=2Op3QLzMgSY&list=PLE18841CABEA24090&index=1
i didn't even realize that sicp was exactly what i wanted unironically. there's also this guy talking about magic and spirts in computers. can't get more simple for us brainlets

Cute girl.

For statistical analysis, learn R. For AI, learn Python or C++. Since you're a newbie enthusiast, I recommend Python.

Any other recommendations are either not easily applicable, or are over your head.

i hadn't heard of R before so i'll record that for later. i wanted to get more into conceptual things instead of a specific language. that mit course talking about magic and spirits is really fitting for this

Seems like you have mixed goals then. If your goal is to actually learn CS, then I'd definitely find some classes. If your goal is to perform various statistics/data analysis tasks, there really isn't a good reason to learn any of it.

You can probably get by with a couple intro CS classes, then take some courses on machine learning or discrete math. If you're trying to do AI, a good intro is Andrew Ng's course on Coursera. I think it is free.

because i'm a brainlet i've got a specific way to learn things. stupid people have to do stupid things. i don't understand any programming so i need to learn the concepts of "it" and then after i understand "it" i'll then learn how to do it and find out more specifics from there.

your suggestions are really good though i'll look into it all of it

>tfw naming Linux binaries .exe

dumb frogposter

I have 18/20 vision, pretty sure I couldn't be able to read the harbour master sign if I was in the camera position

traps are gay

This just shows how limited C's usage/general interested has become these days

>myopia simulator.
You are fucking retarded if you think myopia feels like looking trough a shallow depth of field camera lens where everything becomes magically blurry after a certain distance.

stackoverflow.blog/2017/10/31/disliked-programming-languages/

is perl the new get a /comfy/-overpaying-job-for-life language? Think about it:

>Everyone hates it
>No one wants to learn it anymore
>Probably going to be used in enterprise for the next 100 years thanks to old, shitty codebases
>Hundreds of boomer perl devs starting to retire

>Everyone hates it
That's not true though. There are people out there who love it and would never leave it.

In Racket:

(define-struct leaf [n])
(define-struct branch [n left right])


I'm trying to build something that counts the number of "n" in a Binary Tree.

Here's what I have:


(define (count-tree BinaryTree)
(if (empty? BinaryTree)
0
(+ 1
(count-tree (something)))))


I can count the length of strings and lists, but not this weird new structure...

Racket documentation: docs.racket-lang.org/

Thanks guys

(define (count-tree BinaryTree)
(if (empty? BinaryTree)
0
(+ 1
(count-tree (something)))))

That's category 4. The devs that grew up with perl and love it are at the retirement stage now.

There's a small trickle of young devs discovering it in $CURRENT_YEAR.

it a simple recursive problem. You need to think of the problem recursively. For example, you have a leaf, what do you do? Now you have a branch, which has a left subtree and right subtree, how do you count those trees? What do you do after you counted them?

I understand the basics of solving these kinds of problems recursively, but I don't understand how to write a solution that handles the weird structures

If i have a leaf, I add 1 to whatever counter im using, and if I have a branch, I go to each subtree of the branch and return to the beginning, right?

this picture has nothing to do with programming

>I don't understand how to write a solution that handles the weird structures
Those structures are user defined types, you can read more about them at docs.racket-lang.org/guide/define-struct.html

>If i have a leaf, I add 1 to whatever counter im using,
No, you said
>I'm trying to build something that counts the number of "n" in a Binary Tree.
>number of "n"

>if I have a branch, I go to each subtree of the branch and return to the beginning, right?
You break the problem up, branch is an n, left tree, and a right tree. You want to count the left tree and right tree.

yes it is, every programmer is a trap

I don't really understand what you're hinting at...I am very new to programming and this way of thinking is still unfamiliar.

So in this code, you are not counting the length, you are adding up all the n.

(define-struct leaf [n])
(define-struct branch [n left right])

leaf and branch are now new types that get created. leaf is a type that holds an "n", This `define-struct` creates procedures for you to now interact with this new type, they include `leaf?` and `leaf-n`. You can think of it as similar to a list where `list?` or `empty?` tells you if it is a list or an empty list and `first` gets the first value of a list. branch is basically the same thing, you have `branch?`, `branch-n`, `branch-left`, `branch-right`.

Does this make more sense?

Yes!!

I didn't realize that I would now have procedures like "branch?" etc.

Let me get back to the problem. I hope you will be willing to help me out!

no problem, you just need to use these new procedures to figure stuff out. Know that left and right in the branch type are also considered trees (well I assume they are...). It kind of the same when in a list, when you use rest on a list, what is returned is also a list.

should i study machine learning before i study neural nets?

My plan:
1 - learn enough Java / C# / webdev to get my foot in the door somewhere
2 - work my ass off, work my way up so that I'm not considered a junior anymore
3 - whole time be learning functional programming on the side
4 - work somewhere that isnt' full of pajeets and bootcamp shitters

so basically

if the Tree is empty, return 0

if the tree is just a leaf, return 1

if the Tree is a branch, return 1, go to the left and right, run from the top

Right?
How do I say "go to the left and right"?

>if the tree is just a leaf, return 1
Don't you need to add up the "n"?

>How do I say "go to the left and right"?
Well how do you get a left? Now that you have the left tree, how do you count a tree? Repeat for the right. Now you have these counts? What do you do with them?

yes

Why wouldn't it?

Fuck me it's still not quite clicking

(define (count-tree BinaryTree)
(if (empty? BinaryTree)
0
(if (leaf? BinaryTree)
(+ 1)
(+ 1 (count-tree "left tree") (count-tree "right tree")))))


Is this what you're hinting at? It's not, is it?

you have the right shape now. just get the left tree and right tree.

C is the essential old man's language, get with the times grandpa.

how far along are you with java and webdev (read: what have you made so far)? Do you ever feel overwhelmed when trying to learn a new framework or library, since component based js is the future.

i have 0 idea how which is why they're strings
i can't

oh i see you alluded to it earlier

anime is programming related

My C textbook is probably thicker than that c++ stl book, it's like 1100 pages.

Why do people still learn k&r c? I thought that was like the first version, hasn't the language changed significantly since then?

God fuck R. Fuck R. Stay away. I hate it so much. R is a goddamn abomination. I minimize how much of that shit I use.

Stick with Scheme. SICP is a good course. Keep going with it.

You can write numerical shit in any language with floating point numbers. And there's so many libraries for statistical distributions. Really the only thing R has going for it is the graphing.

t. statistician.

Actual developer in the ML field here

Go with python. Python is pretty much THE language 90% of datascientists use. Specifically, after you've got the basics of python, you'll want to check out scikit-learn and this book (by FAR the best entry book on the entire topic - actually it's on of the best CS books I've ever read): amazon.com/Hands-Machine-Learning-Scikit-Learn-TensorFlow/dp/1491962291

After you've done some basic statistical machine learning go ahead and buy a gtx 1070 for deep learning

See you in 6 to 12 months

I got it. Thank you :)

Now, why does this code not work as it should...

(define (sum-tree BinaryTree)
(if (empty? BinaryTree)
0
(if (leaf? BinaryTree)
(leaf-n BinaryTree)
(+ (branch-n BinaryTree) (count-tree (branch-left BinaryTree)) (count-tree (branch-right BinaryTree))
)
)))


I'm trying to sum up all the "n" but I'm getting smaller values than expected - perhaps my program isn't going along the whole tree

how do I make a makefile for python that will run my program pythonfilename.py with these parameters?

pythonfilename -d dFile.txt -i iFile.txt -o output3.txt output5.txt

You are not going down the left or right subtree.

Yep called count-tree instead of sum-tree..
Guess I should have made myself rewrite it.

any pics of her boner?

Any opinions of udemy?

Best pajeet stuff are on Udemy.

imma blur ur depthmap