Functional programming isn't just using maps and filters edition.
What are you working on, Jow Forums?
Previous thread:
Functional programming isn't just using maps and filters edition.
What are you working on, Jow Forums?
Previous thread:
Other urls found in this thread:
doc.rust-lang.org
github.com
github.com
bartoszmilewski.com
doc.rust-lang.org
youtube.com
twitter.com
What are C#, VB.Net and F# alignments?
Second for Haskell
>C#, VB.Net, F#
Evil
writing the new gui for my cute image ranking and tagger
also it ranks sets of tags against eachother using halo 2 matchmaking algorithm
>Finally starting to get a good grasp on Haskell
>In an hour, write a program that rips all the images from a Jow Forums thread and saves them off
>In another hour, add capability to watch several different threads
>In another hour, add capability to rip the images from a subreddit
>All in ~200 lines of code, mostly data definitions for the JSON format
All this in a compiled language! Why do people shit on Haskell? I'm finally having fun programming again after years of C++ / Python / JavaScript bullshit.
>Why do people shit on Haskell?
fox and grapes
You forgot to introduce a type parameter on that Rust function.
Lawful, Neutral or Chaotic?
Want to strip all non-letter characters from a string, found this solution online:
"".join(x for x in key if x.isalpha())
Works perfectly, but what's with the syntax? Why do I have to join my string to another empty string?
Is Haskell expensive or something?
C# is neutral
VB.Net is chaotic
F# is lawful
the join function joins its arguments with the given string as a separator. So, e.g., another useful idiom is
','.join(...)
to separate with commas
I'll agree that the syntax is shitty and I'd prefer something like join(*strings, sep='')
in c++ this is just
ListRange(string) | Filter( isAlpha) | collecList();
nope
x for x in key creates a generator
don't know if there is a built-in, but you can also do it like
doIf' :: (a -> b) -> (a -> b) -> (a -> Bool) -> a -> b
doIf' f g p = bool f g p
based and redpilled reader-applicative user
Dear OP. Do you know what a Bean is in Javaspeak? What it's supposed to do? What its basic definition is, and what separates it from a POJO?
Sure, Spring fucking mangles the definition a bit, because Spring uses "Bean" to mean any object that is lifecycle handled by Spring, but Spring is wrong.
A bean in Java is basically a wannabe struct. Because sometimes you just need to pass around some data. That's it! That's all a bean is. It has setters and getters (If it's immutable, it's typically referred to as a value object), and that's about it. It does *nothing* intelligent, because complexity and mutable state goes together like HIV and positive.
If you wanted to have some absurd name, use one of the classic Springisms we've all been laughing about since forever, like "AbstractSingletonProxyFactoryBean". That's an abstract class representing a factory that produces singleton scoped proxies, and it's injectable so you can use @Inject or @Autowire to have Spring handle inserting said object for you. It's a silly name, but it's straightforward to understand.
what compiler and c++ standard do you need for that ?
github.com
c++17 with a library
in c++20 rangesv3 will be in the standard
you could probably do it in c++11 too
Also why the fuck don't you generalise this to an arbitrary applicative?
in Haskell this is just
filter isAlpha
Or you could do this
doIf = (ap .) . liftM2 bool
noice
>ap
>liftM2
Use liftA3
>change part of the underlying core assumptions in my absolutely spaghetti piece of shit
>do it in one go
>everything still works
Holy fuck I almost came
How long have you been working on your cutegrab thing?
I made the original version which uses embedded iptc data like 1 year ago and didn't work on it for ages because of some fundamental problems
this new version is a scratch rewrite and like a week or 2 on it so far
is it worth switching from java to kotlin for android dev?
yes
>Do you know what a Bean is in Javaspeak?
No, and I don't care to.
>monads are a design pattern
why do OOPsies say this?
what exactly ARE monads?
implementations of some functions satisfying some laws governing their behavior for a type constructor
Monads are like burritos.
Honestly wish more OO programmers embraced and understood monads. It would help prevent embarrassing situations like this travesty:
github.com
Are you saying monads are not general or reusable?
if you are familiar with futures, this might help you understand
bartoszmilewski.com
doc.rust-lang.org
>reading russel & norvig's artificial intelligence: a modern approach
>so far so good
>get to like page 30 and suddenly don't understand anything because it's all in dyslexia-inducing mathematical notation instead of the pseudocode presented before
fucking compsci niggers
Honestly, they're just monoids in a category of endofunctors.
the burrito metaphor is a dumb non-answer given to people who don't understand FP. it resembles the 'what' of monads, but not the 'why'.
i'm not good at FP myself, but here's the gist of what i do understand.
monads are based on functors, which are values embedded in a structure, either a container for values or a mechanism for generating values.
monads are also endowed with a monoid, that allows these structures to be composed together, transparently.
>not understanding math
code monkey nigger
Just some PLT word wankery about things people have been doing since punch card days.
i understand maths just fine, thank you. it's the appearance of arbitrary glyphs that causes sudden meaninglessness. it's just obfuscation. might as well stick some kanji in your algorithms and then moan that brainlets have difficulty understanding them.
Any recommendations for getting my Linear Algebra up to scratch? Also, what other math should I learn? I know single variable calculus fairly well if that gives you an idea of my level.
job security for those who specialize in category theory in academia
no
>muh DESIGN PATTERNS
so is this an admission that the term is meaningless?
(defun differentiate (poly
&optional (df) (coef 0))
(if (null poly) (cdr (reverse df))
(differentiate
(cdr poly)
(cons (* coef (car poly)) df)
(+ coef 1))))
Is there a language capable of a more elegant solution?
What's a good development environment for C/C++ in Windows that doesn't require or involve Visual Studio? I'm currently using Windows at home (reasons) and can't be fucked to do my programming in a VM.
Push through the book for now. You don't have to understand everything immediately. When you're done, read up on some calculus and linear algebra, and then return to the difficult parts of the book.
Why don't you want to use the best IDE available?
>that link
holy shit
Qt Creator with MinGW I guess. I like VS though.
Because I'm looking for an alternative to Visual Studio.
you mean emacs, right?
My prof thought it wise to says he only reads C code on the very first day of the semester instead of sending out a mass email 3 months ago, he further went on a rant about how much he hates other languages that are not C. Luckily we are off for the next 2 weeks so someone rec me a good book that I can finish in that timespan that will have me be at least proficient in C, I already know Java and Ruby.
Your prof is a brainlet
Just use a VM.
I have read "The C Programming Language" was fine, but I don't think you need a book. I would just watch some tutorials and write some code. I learnt C after Java too, all the books had too many things that I already knew.
K&R, its really the only answer.
>monads
functional programming peaked with scheme
codelite or codeblocks or qt creator. probably should install TDM-GCC and msys2 first.
if you're using only C then pelles C is really nice, as i recall.
calculus and linear algebra are no problem... again i'm just irritated by pointless obfuscatory presentation of algorithms
If you don't have the book Linear algebra and its applications, get it! While you read the book, try to make some quick and dirty programs that solve some of the problems that are in the book. It's an excellent opportunity to learn some Python or Julia while you're at it.
Write a Ruby to C transpiler
kernighan & pike - the practice of programming
kochan - programming in c
kernighan & pike - the unix programming environment (a chunk of it is a fantastic tutorial on C)
Ah! Okay I get that. There's a lot of obfuscation with fancy formulas when a ten word sentence would suffice in a lot of CompSci books. To bad they don't have a formula that properly defines their own field.
I get that from some papers I've read and I agree, some like to overcomplicate shit or explain sloppily so that it creates a sensation that they're doing something groundbreaking and that they're so smart. Norvig's book is fairly well written tho, Im surprised you hate it.
Use docker, setup an image from debian stretch and install all the shit you need. Write a small bash script that runs whatever you use to build your project and run all that shit inside docker.
i'm bending the truth a LITTLE BIT though because i'm not reading it now, i was reading it four years ago. that's just how i remember it: full of search algorithms presented in esoteric ethiopian runes. and they were doing so well at the start...
A megalithic kernel operating system
OS-Dev is a god send
>A megalithic kernel operating system
y tho
he likes 'em thicc
>youtube.com
>programmers in china work from 9am to 9ps 6 days a week
>are faster and make better stuff than west
How do we compete with this shit? I feel like becoming a plumber is a better option at this point
I have the Norvig AI book too, used it in uni and don't remember anything near as bad as what you describe.
work smart not hard. there's no way 99% of people can be more productive 12 hours a day 6 days a week than working a standard 40 hour week
microkernels are a mega meme.
My googlefu is apparently weak as fuck because I can't figure out how to make calls to git commands automatically add options in the gitconfig.
Like git log = git log --pretty=oneline
don't get into programming, it is a pernicious meme. ESPECIALLY don't get into programming if you aren't in some place of opportunity like shenzhen or ??dallas?? or something
Don't listen to the dumbass above.
Get into what you enjoy.
If you don't enjoy programming then obviously fuck right off.
This. I program due to autism. I don't think you can do plumbing due to autism.
just list processing tool with pathos
avalable for retarded people
In Rust, this is just
fn remove_non_letter Cow
(define (transpose M) (apply map list M))
beautiful
Everyone keeps talking about Rust and how amazing it is, and I'm sure they're right in many ways, but god DAMN that is some ugly syntax
Easiest to implement
My original goal was embedded systems
But making it a learning machine seems a lot cooler
The OS is just one big binary with a cli that can switch between all the rings so I can learn about them and be a god on my machine
I was actually going to try to make it overly generic and even more hideous, but I couldn't be fucked trying to get the slice bit (&s[..i]) working with that.
I'd show you a screenshot of what I'm working on, but it's a Windows service. It's a tool for syndicating rental data to Internet listing services.
"a1b2c3d4e5".chars()
.filter(|c| c.is_alphabetic())
.collect::()
// came to ask help with problem
// figured it out as I was asking
thanks /dpt/
No problem
Do it then.
daily reminder that INT_MAX is one of only four known double Mersenne primes
daily reminder that INT_MAX is implementation defined you dumbass fucking retard.
daily reminder that nobody gives a fuck about your quaint limited-precision arithmetic
why would there ever be a need to not have it be 32 bits
also why would CHAR_BIT ever not be 8
Wow it looks like an esoteric language.
Seriuosly who thought the concrete syntax?
>why would there ever be a need to not have it be 32 bits
Shut the fuck up retard, no one cares about your arbitrary ideals.
The standard is the standard, and sizeof(int) generally isn't 4.
Thanks for the rec, user
>Makes a copy
It's shit. Mine will not copy the string if there were no non-alpha characters.
Pearson shill. Everybody knows the best linear algebra book is Introduction to Linear Algebra by Strang.