2024/05/12

Newest at the top

2024-05-12 11:02:53 +0200 <mauke> or even just \x -> f x 42
2024-05-12 11:02:44 +0200 <sandbag> yeah
2024-05-12 11:02:21 +0200 <mauke> here we use the argument x not just as the last argument to some other function
2024-05-12 11:02:00 +0200 <mauke> consider \x -> f x x
2024-05-12 11:01:46 +0200 <mauke> not completely
2024-05-12 11:01:27 +0200 <mauke> \x -> (... anything here ...) x
2024-05-12 11:01:27 +0200 <sandbag> in that manner, doesn't that eliminate the need of arguments then?
2024-05-12 11:01:20 +0200 <mauke> well, and the thing it's applying the (inner) function to is the argument of the (outer) function
2024-05-12 11:01:00 +0200 <mauke> any time you have a function whose outermost expression (in the function body) is a function application
2024-05-12 11:00:43 +0200 <sandbag> oh, could be any function?
2024-05-12 11:00:12 +0200 <mauke> doesn't even have to be "middle" or "top"
2024-05-12 11:00:05 +0200tzh(~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz)
2024-05-12 10:59:44 +0200 <sandbag> ah, that makes sense. so i can get away by not passing arguments to some middle function which points to a top function which has the same argument
2024-05-12 10:58:17 +0200 <mauke> just as in 'f x = g x' you can "cancel" the x on both sides, so in 'html_ content = (el "html") content' you can cancel the content on both sides
2024-05-12 10:57:58 +0200 <sandbag> im new to functional programming. forgive me for any kind of silly questions :)
2024-05-12 10:57:09 +0200 <sandbag> your snippet makes sense. so the one I sent is similar?
2024-05-12 10:56:57 +0200 <mauke> it comes to the same thing
2024-05-12 10:56:54 +0200 <mauke> fundamentally, it's like writing 'f = g' instead of 'f x = g x'
2024-05-12 10:56:30 +0200 <mauke> because all it does is forward its argument to another function
2024-05-12 10:56:18 +0200 <mauke> which means it is functionally equivalent to just el "html"
2024-05-12 10:56:06 +0200 <mauke> which says: html_ is defined as a function (of one argument, content) that applies (el "html") to that argument
2024-05-12 10:55:48 +0200 <sandbag> i meant html_ = el "html"
2024-05-12 10:55:16 +0200 <mauke> html_ = \content -> (el "html") content
2024-05-12 10:55:07 +0200 <mauke> html_ content = el "html" content -- the original definition, is the same as:
2024-05-12 10:55:00 +0200tromp(~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2024-05-12 10:54:37 +0200 <sandbag> alright, but how does el function know where to get "content" if I did not pass it?
2024-05-12 10:54:23 +0200 <mauke> it is the function you get from f x applied to an argument, y
2024-05-12 10:53:53 +0200 <mauke> f x y really means (f x) y
2024-05-12 10:53:47 +0200 <sandbag> but it still combines 2 arguments into one right? so initially it was 2 arguments
2024-05-12 10:53:14 +0200 <mauke> a "two-argument function" is a function (of one argument) that returns another function (of one argument)
2024-05-12 10:52:54 +0200 <mauke> all haskell functions really only take 1 argument
2024-05-12 10:52:45 +0200 <mauke> 2-argument functions are a scam
2024-05-12 10:52:28 +0200 <sandbag> el needs 2 arguments, and I have given it only one
2024-05-12 10:52:05 +0200 <sandbag> that works as well, I got confused. but if you remove the variable, that will work too
2024-05-12 10:51:29 +0200 <sandbag> oh yes, sorr
2024-05-12 10:51:13 +0200 <mauke> did you mean: html_ content = el "html" content
2024-05-12 10:50:49 +0200 <mauke> which makes sense to me. 'content' is not defined anywhere
2024-05-12 10:50:47 +0200 <sandbag> that's what I get
2024-05-12 10:50:37 +0200 <sandbag> yeah
2024-05-12 10:50:23 +0200euleritian(~euleritia@ip-185-104-138-28.ptr.icomera.net) (Ping timeout: 264 seconds)
2024-05-12 10:50:07 +0200 <mauke> in the playground, I get: Main.hs:5:19: error: Variable not in scope: content :: String
2024-05-12 10:48:57 +0200 <mauke> what's the error message?
2024-05-12 10:47:58 +0200Square(~Square@user/square) (Ping timeout: 268 seconds)
2024-05-12 10:47:38 +0200 <sandbag> https://paste.tomsmeding.com/CFWXtmFm, when i define 'html_ = el "html" content', it gives me an error. why? shouldn't el take 2 arguments?
2024-05-12 10:42:46 +0200 <sandbag> mauke: nice :)
2024-05-12 10:36:18 +0200tromp(~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
2024-05-12 10:29:43 +0200tromp(~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2024-05-12 10:29:08 +0200euleritian(~euleritia@ip-185-104-138-28.ptr.icomera.net)
2024-05-12 10:28:53 +0200euleritian(~euleritia@ip-185-104-138-28.ptr.icomera.net) (Ping timeout: 240 seconds)
2024-05-12 10:21:06 +0200 <mauke> it's 03super green