Does anybody ever actually ask Haskell questions in these threads or is it pure shitposting and memes?
Chase Young
the fuck is this shit we already have a
Wyatt Brooks
>Enter thread >See Elixir >See Elm >See Erlang >Leave thread
Bye.
Colton Lopez
Pure and immutable shitposting and memes.
Anthony Peterson
Last thread we had: >2 posts with blocks of Clojure code >1 post with psuedocode
And that was it.
Matthew Wood
also, next time you create a general, make sure you put general in the subject so the filters can work boards.Sup Forums.org/g/catalog#s=dpt|wdg|sqt|general
Michael Parker
I guess complaining won't help so: /fpt/, what's your favorite trick or tool in your language of choice?
Jackson Lee
/dpt/ doesn't have General in subject.
Ethan Mitchell
because I already know that there's a /dpt/ >implying i want to scour the entire catalog everytime sage
Carson Barnes
>favorite trick using the codensity monad to improve any free monad construction by right-associating all binds via use of the yoneda isomorphism
Christian Young
Kill yourself you worthless triple bigger
What fucking difference does it make to you that this thread exists
Aaron Bailey
Who is this newfag trying to tell people what they are allowed to post?
Kill yourself underage faggot
Has anybody experience with Scala? Is it harder or easier than Haskell?
Aiden Rogers
Scala is harder to learn functional principles in because it is also fully oop. It also has pretty much every language feature ever. People don't actually know that Scala is technically a fully fledged dynamic Lang. You just have to add an import (it's heavily frowned upon to do this mind). The plus side is that it is more pragmatic and there are more jobs.
Haskell is more sound and will teach you fp easier (as you can't back out) but can be really unforgiving if you don't understand certain concepts.
They are both fine Langs.
Connor Sanchez
Feel free to
Aaron Lee
I want to answer Haskell questions, not ask them - I know a lot about Haskell already, and can't think of any open questions I'd have
David Ortiz
I'm new to functional field, so overall concepts of FP do amuse me.
Adam Price
When will this meme die?
Andrew Foster
>one will land a good job, but you will be called pajeet forever >the other will not land you a job, and you will be called hipster faggot forever
Logan Ortiz
What's the best basic math book?
Kevin Bell
...
Jackson Thomas
Too advanced, i can't even add yet
Juan Sanchez
Scala Circe.
JSON serialisation and deserialisation in a completely type safe way. Code generated at compile time , no reflection or macros.
All you need to do is an import.
Elijah Rogers
Get out of here, you reddit tourist.
Alexander Richardson
Haskell has Generics for this, and Aeson does JSON
instance ToJSON MyDataType instance FromJSON MyDataType -- no implementation needed
Hudson Adams
This is how it's implemented in Scala as far as I know.
Carson Long
Haskell has classes. What went wrong?
Bentley Nelson
I'm currently learning Haskell as my first programming language (not strictly true, I programmed when I was younger and dabbled in things ranging from C++ to our old favorite, Visual basic 2006, but it has been long enough that I only know programming concepts and not languages anymore) and am enjoying it so far, but I'm wondering if it is the best functional programming language to learn, or if there is one that has significant advantages over it for general use and better lasting impact on me in terms of teaching me programming skills that will translate into other languages.
For reference it won't have much application with my job, and will mostly be a resume booster and fun hobby.
Lucas Rivera
What do you mean?
Austin Powell
just started learning haskell today how to fix this? import System.Random
comp n rand = if n < rand then print "too small" else if n > rand then print "too big" else return ()
main = do xxx
Daniel Cruz
He means type classes without actually knowing they are completely different from oop classes.
Adam Barnes
comp takes a regular integer (or anything that can be ordered)
readLn isn't an int, it's an IO int So you need to "extract" the int in do-notation
n
Noah Edwards
>le useless academic meme thread
Next we'll have an esoteric programming thread.
Sage, hide and report.
Isaac Foster
This isn't even the worse bait I've seen today
David Baker
You mean this thread?
Christian Clark
No, I mean the part where you said you had a job, a life and a girlfriend.
Jeremiah Green
My favourite functional programming language is JavaScript.
James Scott
If you call that college undergrad research grant a "job", fine.
Jaxon Wood
Ha ha very funny. You can go now.
Eli Garcia
So can you. This board is about technology, not fringe academic theories that have no practical purposes. Technology implies practicality.
Carter Davis
No, honestly, you aren't funny. You're just spamming and shitposting. Fuck off already.
Caleb Watson
Seconding this. I want to make sure Haskell is the one worth getting into, and if not, what is?
Matthew Garcia
comp n rand = if n < rand then print "too small" else if n > rand then print "too big" else return ()
guard syntax would be much better for this kind of multi-way-if construction
comp n rand | n < rand = putStrLn "too small" | n > rand = putStrLn "too big" | otherwise = return ()
Or another way you could do this is via pattern matching, e.g.
main = do target putStrLn "too big" EQ -> return ()
Sebastian Nguyen
Pretty sure you meant to quote instead.
Ethan Johnson
This thread is cancer. Sage and report.
John Sanders
Please stop posting this shit.
Nobody cares about muh functional meme.
Blake Brooks
What's the deal with functional programming?
It's not programming and it's not functional!
Christopher Edwards
>functional programming
That's a funny way to say "esoteric programming".
Carson Brown
Any good Common Lisp books? Currently reading Practical Common Lisp (gigamonkeys.com/book/), but I wonder if there are any better alternatives...
Levi Allen
Please take a screenshot of this post, I want to see how many (You)s there are
Logan Gomez
No, leave Sup Forums.
Sure. Here you go.
Christian Lopez
Stop.
Ian Edwards
Go away already, OP. You're not fooling anyone by samefagging in your own thread.
Matthew Nguyen
Fuck off.
Blake Harris
What psyop tactic did I accidentally stumble into here?
I mean the goal is pretty clear, but I wonder what the motivation is? Who would possibly gain anything from censoring knowledge? Presumably, people who want to prevent it from spreading.
The most astonishing thing is that it's not just one guy, it seems to be some form of collective effort at the very least. Has Oracle started hiring people to ensure Java job security by preventing progress? Seems a bit weird to be doing that on Sup Forums, of all places.
Another possible motive would be somebody bitter and angry that he couldn't figure something out, trying to eliminate all mentions of it / belittle it to make himself feel better about it; but that wouldn't explain the high degree of organization.
Anybody else have an idea? Genuinely interested now
Connor Howard
Love you too guys! Not OP, by the way
Levi Moore
Have you programmed in Mathematica today?
Brandon Kelly
It's literally just someone with autism who thinks he's funny. He was probably bullied as a child. Sad, really.
Jose Gomez
been dicking around with clojure recently (rorfag here. yeah yeah but it pays the rent and leaves me with an extra 8 hours a day for jerking off)
anyway I got the joy of clojure since I like that guy's blog and honestly I think it's one of the only "how to $LANG" book I've liked
it goes fast and assumes you know how to google, but it has been pretty useful for coming up to speed
anyway if you can't stand most intro books but want a nice tour I recommend it
Joseph Perez
thanks, so I have this. Is there something I should change or this is acceptable?
import System.Random import Control.Monad.Cont
comp n rand | n < rand = print "too small" | n > rand = print "too big" | otherwise = print "yep"
main = do xxx do a
William Hall
If you don't care about the number (or the result), you can use replicateM_ from Control.Monad (it might be in Cont)
If you want to do it forever, you can use forever (also from Control.Monad) e.g. forever $ do a rand = "too big" | otherwise = "yep"
and then
print (comp a xxx)
Ayden Myers
1. ‘print’ does not do what you think it does. The function for printing a string to stdout is putStr / putStrLn. ‘print’ is defined as print = putStrLn . show, which for strings means you'd end up with a source-code representation (including quotes and escaping)
2. If you're going to be printing the result in all cases, you could just do something like this:
comp n rand = print $ case compare n rand of LT -> "too small" GT -> "too big" EQ -> "yep"
3. you could swap comp's arguments and use something like forever $ readLn >>= comp
Ryder Turner
>forever $ readLn >>= comp xxx fixed
Ryan Nguyen
>I'm bullied even on Sup Forums
Michael Hill
bump
Matthew Flores
What would be the best way to implement finite states machine in Haskell ?
Am I an idiot if I tough of that ? : data States = States [Int] data Transitions = Transitions [(Int, Char, Int)] data InitStates = InitStates [Int] data FinalStates = FinalStates [Int]
data Automate = Automate (States, Transitions, InitStates, FinalStates)
Nicholas Hernandez
Depends how crazy you wanna go
Dylan Long
I'm looking for something basic/naive.
And shit this is some trve power level here
James Lewis
you can represent the states as a data type and the state transitions as functions
Ian Rivera
I just though about the transitions as functions yeah.
Shit gets messy with tuples
Hunter Young
F# active patterns are a super-useful construct. It's nice to be able to generate my own pattern-matching forms and have that act-on-data-then-match it form. Definitely feels like an F# "killer feature".
Alexander Morris
active patterns are good and it would be nice to see higher order patterns in haskell
Julian Moore
roll and post your results in your favorite functional language
Camden Howard
Here's a simple DFA implementation I made as part of a DFA->regex thing
data DFA = DFA { alphabet :: [Char], states :: Int, start :: Int, finals :: [Int], fun :: Int -> Char -> Int }
checkD :: DFA -> String -> Bool checkD d s = go (start d) s `elem` finals d where go !n [] = n go !n (x:xs) = go (fun d n x) xs
Use it like this:
goal :: DFA goal = DFA { alphabet = "01", states = 4, start = 1, finals = [1], fun = f } where f n '0' = case n of 1 -> 2; 2 -> 1; 3 -> 4; 4 -> 3 f n '1' = case n of 1 -> 3; 3 -> 1; 2 -> 4; 4 -> 2
test :: DFA test = DFA { alphabet = "01", states = 2, start = 1, finals = [2], fun = f } where f 1 _ = 2 f 2 _ = 1
Here's the full code, if you're interested: 0x0.st/9y4.hs
It's not 100% correct, there are still some bugs in my O(n*m) regex matching algorithm. (I had an exponential version which was correct, but too slow). Can't be bothered to waste more time on it though.
Nathaniel Evans
Can you provide a quick example in F#? I want to see how close I can get in Haskell
David Walker
in Haskell you'd use ViewPatterns or PatternSynonyms
Levi Harris
Tell me why i should switch over from c++
Dylan Gomez
C++ is one of the worst languages ever designed
Noah Hill
Oh and it's gradually trying to adopt FP features but it's far, FAR too late
Chase Diaz
Yeah but I mean, what do active patterns provide on top of ViewPatterns + PatternSynonyms?
Robert Powell
c++ is a huge mess, it has a ton of oddities and quirks, and hacks to get around them.
and it will only get worse as it tries to add new features while keeping backwards compatibility (aka mistakes)
Levi Peterson
ViewPatterns + PatternSynonyms are pretty much equal to active patterns
But there are things Haskell is missing, e.g. or-patterns:
case x of 0 || 1 -> "got 0 or 1" -- trivial example a 'c' x || b 0 x False -> show x -- bind the same variables, so we can combine them
and-patterns
case x of (0, y) & (_, (_, z, _)) (in this case you can use an as pattern)
as patterns are generally a subset of and-patterns
lifting a -> Maybe b case list of safeHead x -> ... (use viewpatterns)
case list of safeHead -> Just x
patterns are kind of second class citizens and guards are another example
Joshua Green
If C++ drops C heritage, it would be better.
Camden Edwards
If you want to have patterns as a first-class-citizen in Haskell, you should look into Prisms (from the lens library). There's sadly no built-in syntax for them, but you can define whatever prism you want and then wrap a pattern synonym around it.
Prisms can trivially do or/and/view patterns, as well as stuff like prism composition.
David Long
if languages don't dress up as C '''CS majors''' can't understand them
Elijah Richardson
C++ is never going to be good
Hunter Edwards
What's a less retarded way of doing this? I'm just starting out. operation :: String -> Float -> Float -> Float operation op x y -- op, x and y are user input | op == "+" = doAdd x y | op == "-" = doSub x y | op == "/" = doDiv x y | op == "*" = doMul x y | otherwise = 0
Grayson Wood
for example, the problem im having right now is its "uniform" initialization syntax being not very uniform at all. so i have to figure out all sorts of exception cases to get it to work properly.
its C stuff is mostly fine, the biggest problem it gets from it is headers. hopefully we get to use modules soon.
I am a program engineering student and we don't see functional programming, but from what i read functional programming is all about having no state
Mason Evans
Land of Lisp was really good. By the time you get to the end of the book, you have done something actually kind of crazy, and you don't realize what it is until you get 90% of the way there. (Which is why I am not specifying what "it" is, because it's a really cool realization.)
It's also a fun book.
I highly recommend it.
Anthony Peterson
Jesus, thank you user
Adrian Kelly
Puzzle-oriented programming
Austin Diaz
Thanks user, I'll check it out
Henry Wright
Should I get better at imperative programming in general before learning something like Haskell? The only thing I've done so far is C.
Parker Perry
You should do whatever interests you and you enjoy doing.
Camden Long
roll
Hudson Price
Hmm, I'm undecided as to how much effort I want to put into this
From easy to difficult: >trivially embedding data into the low bits of a lossless file format >making the embedded data match a real-world noise distribution more accurately >embedding data into lossy images (e.g. JPEG) by perturbing the highest-frequency DCT bits, then recompressing the result losslessly