/dpt/ - Daily Programming Thread

Functional edition

Previous thread: Resources͟:
Functional Programming Language Concepts
>Structure and Interpretation of Computer Programs
>mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html

Erlang
>Learn You Some Erlang for Great Good
>learnyousomeerlang.com/content

Haskell
>Learn A Haskell for Great Good
>learnyouahaskell.com/chapters
>Real World Haskell
>book.realworldhaskell.org/read/

Ocaml
>Real World OCaml
>v1.realworldocaml.org/v1/en/html/index.html

What are you working on Jow Forums?

Attached: idolmaster_sicp.png (1165x1740, 2.49M)

Other urls found in this thread:

mostly-adequate.gitbooks.io/mostly-adequate-guide
github.com/stoeffel/awesome-fp-js
leanpub.com/composingsoftware
wukix.com/mocl
twitter.com/AnonBabble

Currently learning python as I want to rebrand to backend in the near future

how do I check an array of random integers for duplicates and place in a new random replacement in java? These duplicates are throwing off my array searcher

current code for loading the array is just this.

for (int i = 0; i < numbers.length; i++)
numbers[i] = randomNum.nextInt(100) + 1;

I assume i will need another loop or two to go through the array again and check if a given random number is already in the array but I have no idea how to go about doing that

Attached: eclipse_2019-09-23_19-39-54.png (1024x941, 46K)

Posting here because fuck Lisp.

>I assume i will need another loop
that's O(N^2), you don't want that.
>but I have no idea how to go about doing that
what? what do you mean? you just fucking said what you'd have to do. You'd have to loop over the array again. What the hell user. Go ahead and implement this O(N^2) solution so you can at least be sure you can do stuff.
And then use a set. Java's a big boy language. It's got a set you can use.

The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't appreciate what a powerful language is. Once you learn Lisp you will see what is missing in most other languages.

Lisp is the most powerful programming language.

>And then use a set. Java's a big boy language. It's got a set you can use.

I haven't gotten to that stuff yet. If it wasn't already obvious I'm just starting out. taking a course at college and we haven't even gotten to calling methods from other classes yet. we are just beginning to play around with 1d arrays.

accounting for duplicates wasn't part of the assignment though, I just wanted to see how it might be done.

Functional JavaScript :D
>mostly-adequate.gitbooks.io/mostly-adequate-guide
>github.com/stoeffel/awesome-fp-js
>leanpub.com/composingsoftware

working through sicp using lisp

install Elm

i wanna nakadashi chihaya

Why

It's like Haskell but for Javascript.

That's great and all but I don't know Haskell, and besides, are there any jobs with it?

reinventing some wheels.

totality verified front-ends
no more RTEs

All this brain power and talent and yet not a single one of you is perfecting a AI waifu.

What a waste.

Attached: ligma.jpg (720x540, 53K)

>is perfecting a AI waifu.
my dream programming lang comes first
which means exploring the field of langs, learning type theory, math, compilers and so on.

I've been working with vue.js for a while but now i am out of a job. Most companies in my region only want react.js programmers. Can anyone recommend a decent but quick crash course on react.js that i can do in a week or so? I have a few interviews lined up next week and i dont want to fuck it up.

Attached: 1546733416397.png (1000x1534, 343K)

What does O(n) mean?

The opposite of O(ff)

Attached: 1415224363566.jpg (304x295, 8K)

you've got an ordered collection with n members. in the worst case, how many steps does it take to get the nth member of this collection?
arrays: O(1). it's one step, regardless of the index. You calculate an offset into the array and dereference it
linked lists: O(n): it's as many as n steps, because you have to start at the beginning of the list, then get the next cell from that, then the next cell from that.
now suppose you want to print out any members of the collection are present in the collection more than once.
One way to do this is to loop over the array, and within your loop, once per each member of the array, loop over the array again, to look for other members of the array that match the member you're looking at currently in the outer loop. this whole process takes N steps for the outer array and N steps in the inner array, or N*N altogether, or N^2. So this algorithm is O(N^2). Which tells you very quickly that if you've get an array of 100 elements that your innermost loop is going to spin up to 10k times. This gets expensive fast.

for a better explanation, get an algo book.

>finished the in-class assignment
>also finished the extra in-class assignment if we finished that one
>also finished the chapter project if we finished both
>checked email and worked on my math homework for the last 40 minutes of class
So this is the power of Java...

>bragging about babys first CS101 assignment
oof

>bragging
I'm not bragging. The class is easy as fuck. Too easy.

A month in and we're "learning" about if/else/else if.

I should've tested out but I already skipped 3 pre-req classes (this is supposed to be a second year class) and they wouldnt let me try

Thanks user

How do i get started making artificial intelligence? Any good books/tutorials you reccommend?(anything not made by pajeets is good at this point)

youtube

So i'm reading SICP and doing the exercises in scheme, should i continue doing that or is using common lisp better?

I cant find anything, just trash made by poos which is why i asked here. I really want to make one so i can build robots but i dont know where to start

upgrade to a modern language like python 4

What framework should I learn for graphical programs on linux using python?

Qt

r8 my sepples
#include
#include

using namespace std;

string operator % (string src, string insert) {
if (src.length()

I hope I die soon.

do it fa git

>using namespace std;
fail
>no constexpr
fail
>no friend
please at least pretend to have friends in your code, loser
>this horrible idea again
scanning a string at runtime to find its {}, and to possibly throw an exception about it, is dynamic language shit. You are writing C++, son. What's wrong with you?
>hey x dude 42
gj on not fixing the "hey x} dude 42" bug.
>int main() {
>not: auto main() -> int
YOU FAIL, SIR
YOU FAIL

>not fixing
I mean to say "fixing", without the not.
it was a good job, to fix that.

How do you do it at compile time, douchebag?

I'm gonna start applying to Erlang jobs this week.

>being this rude
I'm not going to tell you.

Also the 2nd argument and onward aren't necessarily known at compile time in its intended use case, you despicable piece of nigger shit.

Good luck convincing people to use your shitty program when it's hardcoded to one language.
std::cout

>args aren't known
and? How does this excuse you looping over the constant format string at runtime again?
>despicable piece of nigger shit
this is a whole lot of nasty words for "my code is slow and I'm pretending to not feel bad"

That would be nice if I were just printing to stdout but unfortunately I'll need to use the formatted string in the program when I use format for real.

>he cares about catering to notEnglish speakers
disgusting.

have sex

thank you for posting Chihaya

Will SPARK revive Ada? Should I learn the lang?

Anyone have experience with interviewing for a new job after 4+ years of experience? I'm getting bored with my job but I've forgotten most of the finer points of data structures+algos, wondering how important it is to brush up on this stuff in comparison to a new grad for interviews.

I wanna paizuri Chihaya.

>are there any jobs with it?
Nope, it's a shitty hipster language.

SPARK has been a thing for over a decade. Just like Ada it fills a niche and it's used with Ada since SPARK 2014. You're not going to use SPARK unless you're in an industry that requires it. It's like writing Ada, but with more restrictions on what you can and the next SPARK revision is getting a BC. HAHAHAH.

So, is there any decent way to make a bit of part-time/side money programming? I don't want to do it as a full-time job because I'd burn out on it and not want to work on my own projects, but I could also use a little extra income.

No, Ada is a meme only used in niche industries for regulatory reasons.

Yes but you'll be a webshitter.

user, please, he asked for a DECENT way.

i want to nakadashi chihaya

Use Common Lisp.

everyone asks this shit now,
just read the first few chapters dasgupta's algorithms book and work through the basic questions in epi or some leet code. you can get back up to speed in a month or so

Working through the little schemer in JavaScript

Why did C never adopt RAII?

You should be using MIT Scheme. The entire fucking reason the language was chosen for the book was for its simplicity. That it doesn't have all the bells and whistles of other languages is a GOOD thing.

When you read SICP, you're not learning a programming language. If you want to learn a programming language, just go pick up Java for Dummies. No, SICP teaches PROGRAMMING. After you've read SICP, go ahead and start using a different language, like Common Lisp. But that's not the point of SICP.

Attached: ___02_20190922_203941.bmp.png (187x181, 81K)

SICP just teaches you recursion and ((((((((brackets))))))))))

Because it doesn't follow C's design principles and what C programmers are looking for out of the language.

that book is a waste of time.
t. lithpfag

>you're not learning a programming language
correct, it doesn't matter what language you use
so just use (common) lisp

>what C programmers are looking for out of the language.
memory leaks? RAII would be an optional feature. I don't get why you people are so stubborn in your ways.

>Safety is bloat!
t. cniles

Attached: 1535369798486.jpg (731x720, 106K)

oy vey

You don't seem to understand C at its core.
I don't want your invisible state changing bullshit, and I don't want seemingly simple operations to generate an explosion of object code.
Complaining about C being too simple and not doing enough shit for you behind your back is completely missing the point of C.

Alright thanks, i'll just finish the book using scheme and learn common lisp later then.

>C at its core.
Nobody understands C at its core. Here's a fun exercise (you can google for the source and solution): write a C function that returns an integer to the caller, with the following constraints:

1. the function source code text is self-contained (no access to external code, including the standard library) and is shorter than 700 characters;

2. the function has no state and no input whatsoever (no static variables, no parameters, no access to globals, no access to the environment);

3. the function uses only the features of the C language specified in any version of the ISO C standard, its output does not depend on unspecified or undefined behavior, and its code does not exceed any minimum implementation limit;

4. the function can be compiled in more than 700 different ways, each corresponding to a single invocation of GCC/x86 64 (version 8 or later), so that it returns more than 700 different values;

5. the used GCC command lines do not include any -D or -U options (including synonyms, i.e., no explicit fiddling with macros), use no assembler options (i.e., no fiddling with assembly code), no linker options (i.e., no fiddling with object files and libraries), and no directory options (i.e., tools, header files and libraries will only be searched in standard places).

>picture of a fractal
>"it basically looks like a pair of lakes"
>OH YEAH MOTHERFUCKER
>YOU THINK YOU KNOW WHAT THIS FRACTAL LOOKS LIKE
>ZOOM IN 6000x ON THIS SPOT RIGHT HERE
>DIDN'T EXPECT THAT DID YA
wow C is so hard and yet people get so much done in it. very mysterious.

I'm learning Kotlin

Huh?

waste

I'm reading a book on how to implement a compiler/interpreter so I don't feel bad for dropping out of college and ending up in a level 1 helpdesk nightmare.

y tho

Learn Lisp.

Can I use Lisp to make an Android app?

Just learn how to do networking and you'll be okay.

yes just use ECL

This, but social networking if you want a good job.

yikes

do both and while you're at it, some cybersecurity bullshit

Do I need a iq above 100 to learn programming?

wukix.com/mocl is a product for it, but you still write the GUI in in a platform-specific language.
Mobile development sucks desu. If you want to involve Lisp, do it server-side and just write a little mobile frontend.

You need an IQ above 100 if you wish to become an expert programmer. If you wish to code apps, then 80 is probably more than enough.

No. You just need to stick to it, get past the learning curve, and after you spend at least 100 hundred hours and have a grasp of what programming actually is then you can decide if it's something you want to keep doing or not.

See

How are you anons preparing for ICPC? I only solve problems on Codeforces. So any specific tips?

I don't think I can make it to this year's Insane Clown Posse Conference. Gonna miss getting down with the clowns :-(

That's fine, more girls for me.

What the fuck are you going on about, you delusional sepplescuck?

I'm writing a text editor with PureScript to erlang compiler and no one can stop me.

sounds esoteric

In java, what's better to use with setters when instantiating and object with user input: Console or Scanner?