What I know about stack vs cabal is that stack is best for noobs.
I say this because I button-holed a guy who's not a supporter of stack for his day-job on the subject, and he did agree that it would be best for noobs.
@Code-Apprentice I'm only 1/3 of the way through the official tutorial, so I'm quite a noob as well.
To provide more context, I'm a coorganizer of the Python meetup group and we (at least, I) direct new people to install Anaconda, which usually makes them immediately productive.
and I gave that same context to the guy I'm referencing who's a coorganizer of the Haskell meetup.
I presume that MetaFight has taken a vow of silence on StackOverflow chat, but that he'll continue rounding out our roster in perpetuity. And, really, that's just fine by me.
from itertools import tee
def fib():
yield 0
yield 1
# tee required, else with two fib()'s algorithm becomes quadratic
f, tf = tee(fib())
next(tf)
for a, b in zip(f, tf):
yield a + b
Hi! I'm trying to get better at strictly functional programming (my functional background has been mostly Scala and outside that I use java and ruby mainly) taking on haskell and elixir (maybe I'll also learn ocaml), I've been using Hackerrank's "functional programming only" problems set but it doesn't have good support for elixir (have to handle input / output) myself, anyone know of good exercise sites targetted for FP?
if true then a += 1 end is the same as a += 1 if true
also for while, until, and do+end -> {}
ruby has a lot of functional components and it's really efficient coding in it, but it doesn't help me think functionally enough
Elm is another thing I want to learn (functional programming for the web!) but reading its docs makes me feel like I'm not at that level yet, gotta climb there!
And that's why I don't recommend anything but the documentation. If you want to make elegant use of the language as it was intended, you have to take your own notes and understand the possibility space.
I had some trouble with some AoC problems that I tried to solve in Haskell. The description was given in terms of a mutable data structure like a python list or a C array. I have no idea how to do the same thing efficiently in Haskell.
I take the word choice in the description of the problem as a bias of the author towards languages with mutable structures and my own inability to translate it into the correct functional structure.
Who knew you could do let declarations in a list comprehension?
> take 20 [(i,j) | i <- [1..], let k = i*i, j <- [1..k]]
[(1,1),(2,1),(2,2),(2,3),(2,4),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),(3,7),(3,8),(3,9),(4,1),(4,2),(4,3),(4,4),(4,5),(4,6)]