|
LordSaturn posted:what does this notation mean. is this a lambda? assume I am OOP with C# and Python experience, because I am yes it is a lambda
|
# ? Jul 1, 2016 18:29 |
|
|
# ? May 23, 2024 15:36 |
|
gonadic io posted:yes it is a lambda so you have a class with a member that basically says "do stuff to my private members which I will pass to your lambda as arguments, return a new thing for me to be"? and then... somebody... changes the order in which the "do stuff" arguments are evaluated? who changes the order? to what end? does monad.next() actually change internal state or do the monadic return values mean you're operating on a "branch" from the base?
|
# ? Jul 1, 2016 18:41 |
|
All detail about the monad is hidden within the monad, so whether it changes internal state or not is not really a coherent question - in the language where monads are really a "thing", Haskell, there isn't an internal state to change. Think of LINQ - it doesn't matter if .Select actually modifies some internal collection or just aggregates the operation as long as the collection at the end is what you expect it to be. If you want to see a real instance of 'a member that basically says "do stuff to my private members which I will pass to your lambda as arguments, return a new thing for me to be"', just look at LINQ's .SelectMany, a good example of a bind function.
|
# ? Jul 1, 2016 19:25 |
|
monads are types that satisfy a bunch of weird rules that allow you to do cool things with said type.
|
# ? Jul 1, 2016 19:35 |
|
Plorkyeran posted:why does it matter? i'm sometimes annoyed when things are written in java because ugh now i need to install a jvm but go's problems are mostly just things that effect programming in it and not using programs written in it i'm not really excited to use them, i'm excited to contribute to them except for the go thing
|
# ? Jul 1, 2016 19:35 |
|
the only thing i don't get is i was told a thing is a monad if and only if it implements flatmap when i asked here earlier someone said that was sorta true, but then didn't elaborate i don't get how plain map doesn't count
|
# ? Jul 1, 2016 19:37 |
|
HoboMan posted:the only thing i don't get is i was told a thing is a monad if and only if it implements flatmap it's just by definition. a thing is called a monad if it implements flatmap (and singleton for lists), whereas just implementing map is called a functor. the reason why it's flatmap and not just map, is (if you excuse the pseudo-haskell): map: (A -> B) -> List<A> -> List<B> flatMap: (A -> List<B>) -> List<A> -> List<B> the function in flatMap can interact with the container (monad) and so choose how many elements it can return (none, or 1, or a million) but the function in map can only ever return one element. think if they were futures instead of maps - flatmap's function is free to start it's own future to chain operations asynchronously but map's function can only return immediately and can't return a future else you'll end up with Future<Future<B>> which isn't what you want (and you a function of type Future<Future<B>> -> Future<B> which is the alternate definition of a monad)
|
# ? Jul 1, 2016 19:55 |
|
So they do different things based on the type that they are. So in haskell for lists, they work like a weird non deterministic map function but for other types they can do different things. The >>= bind function allows you do take a monadic value and pass it into another function that takes a normal value and returns another monadic value. code:
|
# ? Jul 1, 2016 19:55 |
HoboMan posted:the only thing i don't get is i was told a thing is a monad if and only if it implements flatmap The function given to the monad has to return the same type of monad. So in the case of a list, the function being applied has to return a list. This function is applied to every element in the first list, giving a list of lists, and then these are concatenated (this is flatmap). If we remove the constraint that the applied function's return type has to be the same type of monad (so in this case if we let it return anything, not just a list), then we have something different called a functor. That's also useful, and lots of things are both (in fact every monad is also a functor, but let's not get into that). Lists are an example of something which is both: they are monads (via flatmap) and functors (via map).
|
|
# ? Jul 1, 2016 19:58 |
Mahatma Goonsay posted:So they do different things based on the type that they are. So in haskell for lists, they work like a weird non deterministic map function I've never really liked this description of how the list monad works. It's perfectly deterministic (it's just flatmap). Flatmap can be used to model nondeterminism, but it doesn't need to be. (Not bashing you in this post, I just think that introducing the list monad as being linked to nondeterminism leads to misconceptions)
|
|
# ? Jul 1, 2016 20:02 |
|
yeah, i think that is how they talk about them in lyah which i was reading through last week, hah.
|
# ? Jul 1, 2016 20:14 |
|
VikingofRock posted:The function given to the monad has to return the same type of monad. So in the case of a list, the function being applied has to return a list. This function is applied to every element in the first list, giving a list of lists, and then these are concatenated (this is flatmap). If we remove the constraint that the applied function's return type has to be the same type of monad (so in this case if we let it return anything, not just a list), then we have something different called a functor. That's also useful, and lots of things are both (in fact every monad is also a functor, but let's not get into that). Lists are an example of something which is both: they are monads (via flatmap) and functors (via map). thank you for explaining without getting haskell involved
|
# ? Jul 1, 2016 20:16 |
|
monads and strife
|
# ? Jul 1, 2016 20:40 |
|
backAsymmetrikon posted:Think of LINQ - it doesn't matter if .Select actually modifies some internal collection or just aggregates the operation as long as the collection at the end is what you expect it to be. I think it absolutely matters whether calling .Select repeatedly on the same list can change the list, because it might change the results of the later calls. I'll look at .SelectMany when I get home, because I've never used/seen it before. (I have grievous mistrust of LINQ due to production code I've seen, but LINQ is probably cool and good in C# and I should get over it) also I'm still confounded by this LordSaturn posted:and then... somebody... changes the order in which the "do stuff" arguments are evaluated? who changes the order? to what end?
|
# ? Jul 1, 2016 20:46 |
|
while we're on the subject of 3D graphics here's an old SIGGRAPH paper from Owen Rubin about vector graphics games from the 1980s https://www.siggraph.org/publications/newsletter/v32n2/contributions/rubin.html quote:For several games, Atari used a thing called a "math box" to do some 3D calculations. This was originally created by hardware engineer Jed Margolin for a game I was working on with Ed Logg called Malibu Grand Prix. Malibu was a first-person driving simulator with a point of view from inside the car. Unlike other driving games of the time, you could drive anywhere and were not limited to staying on a fixed track. Unfortunately, because of the limited capacity of the hardware and the limited amount of displayed information, it was hard to tell where you were actually driving much of the time. This game was quickly junked.
|
# ? Jul 1, 2016 20:53 |
|
LordSaturn posted:I think it absolutely matters whether calling .Select repeatedly on the same list can change the list, because it might change the results of the later calls. I'll look at .SelectMany when I get home, because I've never used/seen it before. (I have grievous mistrust of LINQ due to production code I've seen, but LINQ is probably cool and good in C# and I should get over it) linq is definitely cool and good
|
# ? Jul 1, 2016 21:26 |
|
MALE SHOEGAZE posted:i've been one of go's major detractors ITT but i've been using it seriously / heavily for the last 2 months and I've really enjoyed it. idk what to say. but yah i think it's hard to argue that it's not better than most dynamically typed langs, but that's mostly b/c dynamic typing is that horrendous of an idea
|
# ? Jul 1, 2016 22:54 |
|
the most generous description of golang is probably it's a better python
|
# ? Jul 1, 2016 22:59 |
|
comedyblissoption posted:it's a downgrade from any other statically typed language not willfully stuck in the 70s yeah, wait'll you try one of the ml-family languages.
|
# ? Jul 1, 2016 23:42 |
|
Progressive JPEG posted:monads and strife I/O in the lightning! In the lightning! WHEEEEEEEEEEE
|
# ? Jul 2, 2016 01:37 |
|
There seems to be a porblem perspective projection introduces rounding errors into the triangles' screen coordinates that i haven't worked out yet
|
# ? Jul 2, 2016 02:46 |
what's the deal with people throwing up 219 plugins on top of vim to make an ide "replacement" out of it
|
|
# ? Jul 2, 2016 03:15 |
|
kalstrams posted:what's the deal with people throwing up 219 plugins on top of vim to make an ide "replacement" out of it they haven't heard of spacemacs
|
# ? Jul 2, 2016 03:27 |
|
notepad++ suits my needs
|
# ? Jul 2, 2016 03:42 |
|
LordSaturn posted:also I'm still confounded by this so if a monad looks like code:
code:
code:
|
# ? Jul 2, 2016 03:54 |
kalstrams posted:what's the deal with people throwing up 219 plugins on top of vim to make an ide "replacement" out of it I spend a lot of time in various headless environments. Vim and git are usually already installed, and my .vimrc is on github, so a quick git pull is all I really need to get set up and coding on a new machine (it's really nice to have the IDE features and write-time static analysis when writing bash and python janitoring scripts). The other reasons are (1) vim is language independent and I often code in a few different languages, and (2) I like to stay on command line and avoid using the mouse when possible, and vim lets me accomplish that. VikingofRock fucked around with this message at 05:42 on Jul 2, 2016 |
|
# ? Jul 2, 2016 05:40 |
|
kalstrams posted:what's the deal with people throwing up 219 plugins on top of vim to make an ide "replacement" out of it they read about how using vi was "more efficient" in some post on Hacker News and are cargo-culting that because they're hipsters but they're trying to turn it into an IDE so they can get actual work done in a text editor designed as a hack atop a line-oriented editor for teletypes before modeless editing was a thing, because such an editor isn't actually all that efficient for just basic editing
|
# ? Jul 2, 2016 06:00 |
|
i stopped using vim when i started using typescript and needed ide features, turns out atom's vim mode is the first vim emulation in any editor that's actually any good so it works out
|
# ? Jul 2, 2016 06:28 |
|
abraham linksys posted:i stopped using vim when i started using typescript and needed ide features, turns out atom's vim mode is the first vim emulation in any editor that's actually any good so it works out evil mode man, it's miles ahead of atom
|
# ? Jul 2, 2016 15:18 |
|
the whole reason I'm not just using vim is that I want an editor with a real GUI for IDE features and emacs ain't that
|
# ? Jul 2, 2016 15:21 |
makes some sense for people already familiar with it, i guess, and tunneling elsewhere etc
|
|
# ? Jul 2, 2016 15:27 |
|
abraham linksys posted:the whole reason I'm not just using vim is that I want an editor with a real GUI for IDE features and emacs ain't that emacs is an ide with a gui
|
# ? Jul 2, 2016 15:43 |
|
MALE SHOEGAZE posted:emacs is an ide with a gui that's nice, dear
|
# ? Jul 2, 2016 15:49 |
|
Pycharm is ownage
|
# ? Jul 2, 2016 15:50 |
|
It's version control integration is terrible though
|
# ? Jul 2, 2016 15:52 |
|
Wheany posted:that's nice, dear he's already a vim user, if he was happy with vim and needs and ide, evil emacs is such a clear choice. im not telling someone who prefers guis to switch to emacs
|
# ? Jul 2, 2016 15:55 |
|
what's the benefit of emacs/evil over something like vim + YouCompleteMe? i've never used emacs
|
# ? Jul 2, 2016 16:01 |
Valeyard posted:It's version control integration is terrible though
|
|
# ? Jul 2, 2016 16:12 |
|
Asymmetrikon posted:what's the benefit of emacs/evil over something like vim + YouCompleteMe? i've never used emacs emacs is an ide.
|
# ? Jul 2, 2016 16:29 |
|
|
# ? May 23, 2024 15:36 |
|
emacs is not an ide. emacs is a text editor
|
# ? Jul 2, 2016 16:44 |