Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lgas
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
30 ms
·
421.
▲
by
lgas
6y ago
Sure, if you consider precise mathematical terminology to be complicated neologisms.
422.
▲
by
lgas
6y ago
There's probably a lot more than two ways too, eg. mylist = map(lambda x: x * 2, range(1, 10))
423.
▲
by
lgas
6y ago
I thought HolyC was God's own programming language.
424.
▲
by
lgas
6y ago
I would recommend Gödel, Escher, Bach by Douglas Hofstadter if you haven't already read it.
425.
▲
by
lgas
6y ago
If your goal in implementing rotation and balancing of binary trees is to better understand a poorly understood idea then you're probably better off using a language like Haskell that is garbaged collected and doesn't have nulls s
426.
▲
by
lgas
6y ago
I revisit my generalized monoidal FizzBuzz implementation on occasion. It's hard not to given it's elegance and beauty. :) https://gist.github.com/lgastako/d4fa392cbe85cbfae7dfa5e18c1...
427.
▲
by
lgas
6y ago
In Haskell your code doesn't "do IO", you write (and compose) IO actions which describe what IO will be done at runtime. Only at runtime do the side effects occur. The code itself is still pure and referentially transparent
428.
▲
by
lgas
7y ago
Actually `main` in Haskell can be an IO action returning any type, eg this is a perfectly valid main: main :: IO Int main = print "10" >> pure 10 the return value is just ignored when it's actually invoked
429.
▲
by
lgas
7y ago
Interos, Inc. | Haskell Engineer | ONSITE Arlington, VA | Full-Time My team at Interos is hiring Haskell engineers. Feel free to contact me at jevans at interos.ai with any questions. NB. While this is ultimately an on-site position we ar
430.
▲
by
lgas
7y ago
There's also another option in the middle which is a version that takes a value to return when the list is empty headOr :: a -> [a] -> a which is similar to the Maybe solution but forces the caller to discharge the Maybe
431.
▲
by
lgas
7y ago
It's flip ($)
432.
▲
by
lgas
7y ago
That's not a particularly great example though because 99 bottles of beer is not a particularly stateful computation. You could easily do it without state at all like this: https://gist.github.com/lgastako/2e7dfd6
433.
▲
by
lgas
7y ago
In actual Haskell I would write it as sum [ n^2 | n <- [1..5], n % 3 == 1 ] which seems to express the idea fairly directly and I'm fairly sure has a close analog in python.
434.
▲
by
lgas
7y ago
There's also Haskell's "bracket" ( https://wiki.haskell.org/Bracket_pattern ) which is similar to python's "with" statement but with plain functions instead of context managers.
435.
▲
by
lgas
7y ago
Here's the link, FWIW: https://www.youtube.com/watch?v=vK1DazRK_a0
436.
▲
by
lgas
7y ago
I think category theory generalizes pretty much everything, so that may be tough.
437.
▲
by
lgas
7y ago
If it's move (the noun) rather than move (the verb) then wouldn't it be more accurate to say it means being in a situation where one's move is forced ? (ie. the specific move is forced, rather than just being forced to ma
438.
▲
by
lgas
7y ago
neither "do" nor "let" impact laziness.
439.
▲
by
lgas
7y ago
This stackoverflow answer from the creator of Wordle links to a free chapter from a book that describes the way Wordle does it: https://stackoverflow.com/questions/342687/algorithm-to-impl...
440.
▲
by
lgas
7y ago
I always liked the elegance of this definition of the power set function in Haskell: powerSet = filterM (const [True, False])
441.
▲
by
lgas
7y ago
Yes, but the point is you can forget the check in python but not in Elm.
442.
▲
by
lgas
7y ago
That's surprising since it's fairly straightforward. The type of `3` gets inferred as `Num a => a` because there's nothing to constrain it further. The type of `div 6 2` gets inferred as `Integral a => a` because the ty
443.
▲
by
lgas
7y ago
It doesn't have to be a finite grid. Here is another comonadic implementation of Life with an infinite board: https://github.com/BartoszMilewski/GameOfLife/blob/master/Li... Either version would de
444.
▲
by
lgas
7y ago
If you use a the right representation of the board in Haskell then you don't have to write a function to calculate the next generation at all, you can just use Comanadic extend, as Chris Penner does here: https://github.com&
445.
▲
by
lgas
7y ago
If it helps, a category is just a monad in the bicategory of spans.
446.
▲
by
lgas
7y ago
Using the reserved separator characters wouldn't change that.
447.
▲
by
lgas
7y ago
Interos Solutions, Inc. | Full Stack Sr. Software Engineer (Haskell) | Full-Time | ONSITE | Arlington, VA or Menlo Park CA Interos Solutions, Inc. is a fast-growing venture backed company with an AI-driven SaaS application that delivers our
448.
▲
by
lgas
7y ago
What is the difference you're referring to? As I understand it they are the same.
449.
▲
by
lgas
7y ago
In addition to Agda and Coq (and Idris) you might be interested in djinn ( https://hackage.haskell.org/package/djinn ) and ghc-justdoit ( https://github.com/nomeata/ghc-justdoit ) for Haskell. The gh
450.
▲
by
lgas
7y ago
Can you get "poor man's typed holes" in F# by using inserting unit where you would normally insert a hole and get an error message like "Couldn't match type () with type Foo"?
More ›