|
You mean ((->) r).
|
# ¿ May 9, 2015 00:35 |
|
|
# ¿ Apr 28, 2024 08:23 |
|
Category theory is a waste of time.
|
# ¿ May 15, 2015 05:59 |
|
I've used both, Haskell is faster because it has good syntax, static typing, and is advanced enough that it doesn't need to resort to a macro system to do basic programming tasks.
|
# ¿ May 19, 2015 00:43 |
|
Smoke_Max posted:Hi, Haskell newbie here. I was wondering why main doesn't have a [String] -> IO () type signature like other programming languages, like C/C++ or Java. It would be pretty cool, thanks to pattern matching, to be able to do things like this: That's a relatively arbitrary standardization of C -- main can actually take three arguments on some platforms: code:
It's a trendy way to make platform-specific stuff be in a platform-specific library, instead of having it be something that's in the "language". Other languages do it this way too. In Windows the command line is actually a single string, which you'll see if you use WinMain as the entry point, and you have to call GetCommandLineW to get the Unicode version. sarehu fucked around with this message at 00:49 on Jun 4, 2015 |
# ¿ Jun 4, 2015 00:43 |
|
gonadic io posted:- (^^) raises a float to an integer power. Huh. It's a shame that they reappropriated the logical xor operator for this.
|
# ¿ Jun 21, 2015 15:04 |
|
Yeah but those aren't short-circuiting.
|
# ¿ Jun 21, 2015 22:52 |
|
At any rate, there are certain abstractions you just can't use with functional programming without a performance slowdown.
|
# ¿ Aug 3, 2015 08:16 |
|
I thought Okasaki's book was an exceptionally nice book to read from cover to cover.
|
# ¿ Aug 4, 2015 22:13 |
|
checkS takes an expression and the list of variables that are in scope. If you want to know whether a variable's in scope, see if it's in that list.
|
# ¿ Nov 14, 2015 05:03 |
|
Well, they're saying "add it to the list," but that's speaking in functional programmer codetalk for "put it in the list you return/pass to some other function."
|
# ¿ Nov 14, 2015 05:52 |
|
I don't know Elm but I'll bet you a zillion bucks it's that the type of "::" is a -> List a -> List a and also by the way it's probably right-associative. flatten left returns a List a, and (value :: flatten right) evaluates to a List a. You need to append the lists using an append function, you're trying to cons them together. Edit: Edited to pretend more convincingly that I didn't check the Elm docs before writing parts of this reply.
|
# ¿ Dec 30, 2015 21:44 |
|
If you're making an interesting programming language these days it's become a requirement to scare off the functional programming morons. Avoiding type classes helps them establish their market position.
|
# ¿ Dec 31, 2015 02:33 |
|
You're finding compiler bugs but your code won't typecheck anyway. Your general traversal strategy isn't going to work. You only have func which is of type a -> b -> b. Thus there's no way you can combine the results of (partial left) and (partial right), because they both have type b. You'd need some sort of b -> b -> b function to do that. sarehu fucked around with this message at 20:59 on Dec 31, 2015 |
# ¿ Dec 31, 2015 20:55 |
|
My favorite functional language is Python. It has lambdas and list comprehensions.
|
# ¿ Mar 1, 2016 01:27 |
|
Jarl posted:Bought the book Learn You a Haskell for Great Good. I like both the language and the book and have just finished Applicative Functors leaving only Monoids, Monads and Zippers. What errors? Jarl posted:I get applicative functors now, but it sure took some effort. With that in mind should I prepare myself for a long haul with monoids and monads, or am I already almost there conceptually having understood applicative functors? Monoids are very easy -- an associative operator with an identity element. For example, adding integers, multiplying integers, matrix multiplication, string concatenation. Monads are a generalization of the only sane API for constructing I/O actions in a "pure" functional manner -- and another associative law that makes sense.
|
# ¿ Apr 19, 2016 15:33 |
|
rjmccall posted:Local mutation has basically none of the disadvantages of shared/global mutation and eliminates a lot of local data-flow headaches. You should not feel bad about using it. Yeah, the main benefit of functional programming is in having immutable data structures (that can be efficiently used). You can connect them together and use them more versatilely than otherwise, and are harder to screw up. It's generally a good style of software architecture. A rather nice pure functional programming language would be a version of Rust without RefCell, Cell, or other stuff that uses UnsafeCell, that lets you freeze objects onto a garbage collected heap. So you get local mutation and build arrays and can do mutable borrows. But it would also benefit from not having horrendous "let mut _:_" bullogna and also some goto statements to scare off undesirables.
|
# ¿ Oct 11, 2016 00:45 |
|
xtal posted:Is local mutation necessary with sufficiently advanced COW and GC? Depends what you're building and how important performance is? And convenience? When some people got me to do a Goog Code Jam, I first tried using Haskell, and... ick. It's much nicer to develop code rapidly with for loops, with pushing stuff onto vectors, with being able to turn a map into a fold with a variable declaration, and without having to janitor values into and out of functions into the right kind of tuple. But also imagine doing stuff where performance is important. In C++, people often disable copy constructors on a type for that reason that copies are too expensive, and they don't want to get one accidentally. If you're setting a vector element, it's relatively easy to have an accidental extra pointer to it. I mean, let's say it's in a variable and you're appending to it. v = push(v, x). Well, you'd need some semantic defined there that moves v into the parameter list of push and moves v out without bumping a refcount. That's what Rust has -- only instead of reasoning in your head about what the refcount should be, and hoping the code never evolves into something that has to copy, it's enforced by the language. sarehu fucked around with this message at 01:45 on Oct 11, 2016 |
# ¿ Oct 11, 2016 01:43 |
|
xtal posted:With those criteria I would say that GC and mutability are two sides of one coin. If you're using immutable structures you need good GC. If your performance needs are such that you can't afford immutability, you can't afford a GC either. Not true at all. You can benefit immensely from improving absolute performance. Not all performance requirements are low-latency/low-memory-usage. You also benefit from the convenience of mutable local variables without creeping performance risk.
|
# ¿ Oct 11, 2016 02:03 |
|
|
# ¿ Apr 28, 2024 08:23 |
|
Shinku ABOOKEN posted:What *is* OTP anyway? Outlaw Techno Psychobitch.
|
# ¿ Jan 19, 2017 19:22 |