< 1567123239 979251 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It would be nice if languages helped you write this kind of coroutine. < 1567123252 995880 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Of course you can do it yourself easily enough in a case like this. < 1567123285 314575 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :async (of async/await) does something quite similar to this, but not quite the same as it doesn't handle the memory allocation < 1567123308 333098 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :What do you mean? < 1567123324 8744 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :(Also which language's async/await? There are many languages that assign slightly different meanings to those names.) < 1567123345 150528 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :well, the general idea of what async does is that it makes a function into a state machine that can be suspended < 1567123376 559095 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :although it's tied to await to choose the timing of that < 1567123394 412148 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I guess generators more generally are the general case of that < 1567123396 128702 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :await is about one state machine waiting for another state machine, right? < 1567123436 610953 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Ping timeout: 272 seconds < 1567123439 706895 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :sort-of, it basically continues the other state machine while suspending itself, and continues itself if that state machine returns, or blocks if that state machine blocks < 1567123455 476023 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :so allocating memory in this scenario is basically "await memory" < 1567123518 116604 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I think malloc is probably one of the less interesting/more extreme use cases of this sort of thing. < 1567123527 590443 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Anyway in the simple version of this allocation is just handled explicitly by the caller. < 1567123530 611879 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :What would it be like? < 1567123548 568024 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :no, I mean, say you need more memory < 1567123559 526631 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :you do "await memory" which basically tries to allocate memory from the slice of memory you already have < 1567123571 151899 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :if you don't have enough that causes a yield, with "not enough memory" as the reason < 1567123575 665796 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :then the caller can resize the slice and continue from there < 1567123594 711990 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :if you do have enough, then the allocation (i.e. used-length from capacity) succeeds, so you continue < 1567123636 945975 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Sure, that's an option. < 1567123732 509420 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :A simple API would be something like < 1567123762 437541 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :char buf[100]; SprintfState state; sprintf_init(&state, "test %d %s\n", 123, some_string); while (!state.done) { sprintf_chunk(&state); write(1, buf, state.chunk_size); } < 1567123815 601548 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :not quite, you never told sprintf_init where the buffer was < 1567123825 381799 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :but that's easily fixable I think < 1567123826 816241 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Oh, right, that's another argument. < 1567123839 426158 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It would either be part of sprintf_chunk or sprintf_init < 1567123842 117592 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Probably sprintf_chunk < 1567123862 898137 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Certainly sprintf_chunk < 1567123939 102660 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It'd just be sprintf_chunk(&state, buf, sizeof buf); in this case, since it never needs to refer to old memory or anything like that. < 1567123958 682628 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Hmm, this post -- https://gist.github.com/pervognsen/d57cdc165e79a21637fe5a721375afba -- and the one it links to talk about these state-machine-style APIs. < 1567123966 93685 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I was thinking of a much more radical API than this < 1567123988 792137 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :yes, your API doesn't work because of this: < 1567124004 558608 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Sure, I was trying to think of the simplest case where this is useful. < 1567124004 842151 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :char buf[100]; SprintfState state; sprintf_init(&state, "%s", "some really really really … really long string"); < 1567124013 486500 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :string needs to go into state, but it has a fixed size < 1567124021 823474 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Why does string need to go into state? < 1567124033 918401 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Only the maximum number of varargs needs to fit in state. < 1567124035 980166 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it's the only out parameter of sprintf_init < 1567124062 34233 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :or are you assuming that the caller-provided string remains allocated from sprintf_init to sprintf_chunk? < 1567124065 142521 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :But state only needs to store a pointer to its arguments. < 1567124070 439234 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Yes, I'm assuming that. < 1567124085 682470 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :oh, OK; that's kind-of a mentally abhorrent assumption to me < 1567124104 860683 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :because it's a memory usage assumption that a) isn't documented, and b) might not be true from all calling languages < 1567124112 767030 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Really? It seems pretty reasonable to me. < 1567124119 747176 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :You can enforce it with a language like Rust if you want. < 1567124134 853467 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it took me a moment to check if it was even expressible in Rust < 1567124138 684674 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I would certainly document it if I was writing documentation for this. < 1567124180 474414 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :What's the more radical API you were thinking of? < 1567124190 414993 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it is, but SprintfState needs to be generic over a lifetime parameter that says how long the parameters to sprintf_init are alive for < 1567124200 59663 :sparr!~sparr@2604:a880:800:10::103:f001 QUIT :Changing host < 1567124200 97856 :sparr!~sparr@pdpc/supporter/active/sparr JOIN :#esoteric < 1567124260 398831 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I think copying the erally really long string is surely more abhorrent than ensuring its lifetime is correct. < 1567124263 825018 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :OK, so my idea was that you have a buffer that can be any size you like, you give that to sprintf_init and it stores as much as it can in the buffer, internal state, output characters, everything < 1567124294 514413 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :if it doesn't have enough memory to do what it wants to do it stops and returns an out-of-memory, you can then realloc the buffer to be larger and rerun, it'll continue from where it left off < 1567124321 199291 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :you can also dump out the characters written so far (one at a time, as many as possible, or whatever), perhaps shrinking the amount of state that's in use < 1567124327 771430 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :If you think of this as a coroutine, it makes sense: A routine's arguments are presumably guaranteed to stay alive until the function returns. A coroutine's "arguments" (the arguments to _init) can reasonably be subject to the same assumption. < 1567124338 613797 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :the basic idea is just that you tell it to go as far as possible, then it tells you when it stopped < 1567124348 261451 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :presumably you'd have to give the same arguments with every call in this API < 1567124411 306300 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :If you do that you'll presumably have to copy the string out of the internal buffer into the place you want it when you're done? < 1567124446 855361 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :well, yes, but that's the same as in your example (you're copying out of buf after calling sprintf_chunk) < 1567124467 46915 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Well, I can just give it a buf that points where I want. < 1567124491 915098 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :the only real difference between your and my versions is that buf and state are the same variable and state can thus steal from buf to record as much as it needs to < 1567124500 404915 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :In this case it's stack-allocated but there's no reason for that in general. < 1567124518 709182 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :For example if stdout is buffered I can pass my output buffer directly to sprintf_chunk. < 1567124547 54666 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :hmm… perhaps this suggests some general model involving coroutines communicating with streams < 1567124548 923380 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Or if I'm writing to a C++ std::string or whatever else I can just pass a pointer to that memory. Then if I need to resize it I can pass a pointer to the new memory to keep writing. < 1567124566 965146 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it feels like fputs (i.e. the buffered version of write) is a coroutine in its own right < 1567124587 214025 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :In the sense that it does a blocking write or something else? < 1567124602 226562 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :in the sense that it gathers up input into an internal state buffer < 1567124617 33074 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :across repeated calls < 1567124653 700597 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I guess. < 1567124663 28685 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Ugh, I always forget that fputs doesn't include a \n < 1567124674 58790 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :that's why I said fputs not puts :-) < 1567124710 813951 :webpack!iczero@hellomouse/dev/iczero NICK :iczero < 1567124746 107650 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Hmm, I should just write a sprintf with this API. < 1567124760 586370 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It's obviously much better than the regular API, which is pretty bad. < 1567124779 758433 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I should go to bed, have to go to work early tomorrow < 1567124781 508662 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :night everyone < 1567124784 302134 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :(There's no way to implement printf out of sprintf or vice versa, without arbitrary allocation.) < 1567124788 493918 :ais523!~ais523@unaffiliated/ais523 QUIT :Quit: quit < 1567124791 824792 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Good nais523. < 1567125015 739699 :zzo38!~zzo38@24-207-15-213.eastlink.ca PRIVMSG #esoteric :Now I wrote on a paper, a Scrabble variant, which is Go-Scrabble, which is using Go stones in addition to Scrabble. < 1567125261 95406 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :ais523: I think the kind of API you're talking about is more reasonable in other cases where you have more computation going on. < 1567125291 318241 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Maybe I'd characterize it as passing an arena to your coroutine. < 1567125561 113859 :Sgeo!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567125712 586814 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567125877 178930 :Sgeo!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Ping timeout: 245 seconds > 1567126210 472923 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65779&oldid=65776 5* 03A 5* (+438) 10 < 1567126480 794913 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :`5 w < 1567126482 721897 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :1/2:tall//A Tall proof is a proof with a small hole, which can only be filled by another Tall proof. \ eol//EOL stands for End Of Lawn. It's often found past the wabe. oerjan requests your presence there immediately. \ hovercraft//a-é-ro-g-liss-e-ur. If you mention eels, you'll get smacked with one of them in a most unappropriate manner. \ fisdom//Fisdom is the domination by the federal inspection station. \ operation//Operation is the opposite < 1567126486 866978 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :`n < 1567126487 375390 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :2/2: of cooperation. < 1567126527 615994 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :`cwlprits eol < 1567126529 269505 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :shachäf Zarutiän Zarutiän Zarutiän > 1567126825 842738 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65780&oldid=65779 5* 03A 5* (+605) 10/* Arrays */ < 1567127875 229380 :arseniiv!~arseniiv@95.105.14.70.dynamic.ufanet.ru QUIT :Ping timeout: 246 seconds < 1567131235 588348 :xkapastel!uid17782@gateway/web/irccloud.com/x-utfiwapcuqlbsssj QUIT :Quit: Connection closed for inactivity > 1567132691 380936 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65781&oldid=65780 5* 03JonoCode9374 5* (+0) 10/* Sets */ fixed a formatting error > 1567138346 66794 PRIVMSG #esoteric :14[[07Truth-machine14]]4 10 02https://esolangs.org/w/index.php?diff=65782&oldid=65616 5* 03Dtuser1337 5* (+190) 10/* Madbrain */ mailbox truth machine by me. < 1567139898 324464 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :`quote kmc < 1567139898 810925 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :579) COCKS [...] truly cocks \ 609) You should get kmc in this channel. kmc has good quotes. `quote kmc 686) COCKS [...] truly cocks Well, in theory. \ 679) damn i should make a quasiquoter for inline FORTRAN \ 682) has there been any work towards designing programming languages specifically for stoned people \ 712) the problem with PHP is that anyone halfway competent giv < 1567139906 962698 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :`quote kmc < 1567139907 436269 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :579) COCKS [...] truly cocks \ 609) You should get kmc in this channel. kmc has good quotes. `quote kmc 686) COCKS [...] truly cocks Well, in theory. \ 679) damn i should make a quasiquoter for inline FORTRAN \ 682) has there been any work towards designing programming languages specifically for stoned people \ 712) the problem with PHP is that anyone halfway competent giv < 1567139911 264219 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :boring < 1567139915 402948 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :`quote shachaf < 1567139915 900960 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :839) GreyKnight, shachaf is like a high-level Forth \ 1059) <@elliott> well, I think if you don't think figuring out who the opposite of shachaf is requires thought, then you don't know shachaf very well < 1567139950 48087 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net PRIVMSG #esoteric :....what was the context for that? < 1567140004 919628 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net PRIVMSG #esoteric :Apparently I tried to autocomplete Factor, which as we all know begins with s. < 1567140307 231458 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :hi Sgeo_ < 1567140331 92453 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net PRIVMSG #esoteric :Hi < 1567140666 682687 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :kmc: himc < 1567140726 437979 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :earlier i was going to send you a link to https://www.youtube.com/watch?v=_gKhM8gqbD8 although i don't remember why < 1567141251 409252 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :lol wow < 1567141698 526704 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :isn't it the cutest though < 1567141705 852352 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :other than cats obviously < 1567145459 48374 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :yeah < 1567145461 580623 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :we saw a cat today < 1567145468 485391 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :on the way back from thai food < 1567145469 386840 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :standing in someone's driveway < 1567145482 514175 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :did you know the government of thailand made a smartphone app that will tell you where the nearest thai restaurant is < 1567145496 150498 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :they have a huge program to promote thai cuisine < 1567145632 842047 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :cats are tg < 1567145655 48054 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :my friend showed me a bunch of cute cat pictures he took the other day < 1567145657 137156 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :it was great > 1567145958 830265 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65783&oldid=65781 5* 03A 5* (+271) 10 > 1567146184 895887 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65784&oldid=65783 5* 03A 5* (+182) 10/* Miscellaneous */ < 1567147945 866280 :pikhq_!~pikhq@97-118-196-215.hlrn.qwest.net JOIN :#esoteric < 1567148102 207211 :pikhq!~pikhq@97-118-196-215.hlrn.qwest.net QUIT :Ping timeout: 252 seconds < 1567148727 968878 :AnotherTest!~turingcom@ptr-82l26zcdc6imrwoapg3.18120a2.ip6.access.telenet.be JOIN :#esoteric < 1567151766 89070 :tromp!~tromp@2a02:a210:1585:3200:7c7e:6916:e395:5fa4 QUIT :Remote host closed the connection < 1567152204 519936 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567152807 500246 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT : < 1567152825 995762 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567153183 88576 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :kmc: "void SHA1_str(Str str, U8 output[static SHA1_HASH_BYTES]);" < 1567153186 967686 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :p. fancy use of static, huh > 1567153692 143768 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65785&oldid=65784 5* 03A 5* (+77) 10Dumb 11-line transpiler < 1567154293 271743 :Lord_of_Life!~Lord@unaffiliated/lord-of-life/x-0885362 QUIT :Ping timeout: 246 seconds < 1567154476 471606 :Lord_of_Life!~Lord@unaffiliated/lord-of-life/x-0885362 JOIN :#esoteric < 1567154578 403392 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 JOIN :#esoteric < 1567154669 107574 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf, ais523: re memory allocation with coroutines, this is usually done with memory alloc callbacks instead of coroutines. many libraries allow you to set a callback to allocate more memory, and some even allow you to pass a cookie to it so it can be a closure different for each state. < 1567154694 409515 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :for writing to streams, a callback to do the underlying write (flush) or read (fill) from buffer is mostly already what happens: > 1567154729 867278 PRIVMSG #esoteric :14[[07Bitwise Trance14]]4 10 02https://esolangs.org/w/index.php?diff=65786&oldid=65704 5* 03Hakerh400 5* (-109) 10That sentence did not make much sense. In the "I/O format" paragraph it says that the program can be terminated from outside based on the output and it does not affect the computational class < 1567154740 303524 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :C++ streams explicitly work that way, and C FILE effectively works that way these days, possibly with optimizations for common cases, though only glibc exposes the interface to make a FILE with custom read/write functions < 1567154824 598548 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :the streams usually don't allocate extra memory, but either write to a file or a fixed-size buffer, but there are versions like asprintf that do allocate < 1567154899 359777 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :mind you, in many cases you use sprintf to format a number in formats other than %f, in which case you can give a bound for the number of characters output, similarly with strftime with numeric formats, so sometimes using a fixed size buffer is reasonable < 1567154932 558910 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :it's just that when you get the buffer size wrong, you get programs that mysteriously fail in months that have a long name, or some such < 1567154991 331792 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :the exception is kernel interfaces, because those usually don't want to call back the user, so those are indeed implemented as coroutines that stop when they passed as much data to the process that it's allocated < 1567155029 335472 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :the most common case is the read call, to which you give a buffer, and you can call it again if the kernel has more input for you < 1567155062 599326 :Sgeo__!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567155064 943206 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Isn't the interface I specified more general and easier than an allocation callback? < 1567155070 462898 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but there's also other stuff like readlink and getsockopt where the kernel can tell you how long buffer you need, though often you can guess correctly < 1567155093 528157 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :in particular, for readlink, lstat _usually_ tells you how much of a buffer you need, but that fails for /proc files < 1567155101 806918 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: usually no < 1567155132 555954 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: some functions like interpreters are complicated, and may need to allocate way deep in the call stack < 1567155140 682673 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Oh, sure. < 1567155141 230195 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :so arranging to save the state and return in that case is hard < 1567155158 47968 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :the kernel has to do it anyway for syscalls, like I said < 1567155174 668140 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I meant easier to use, not easier to implement. < 1567155178 796498 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :and some network interfaces have to as well < 1567155263 144219 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: even that is not clear to me. with something like the lua interpreter or the gmp/mpir arbitrary precision integer functions, it's more convenient to set the allocation function once rather than to have to check the return value of almost every call and call it again if it's out of memory < 1567155280 585493 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Ping timeout: 272 seconds < 1567155299 789360 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I don't think you should try to have exactly the same interface for a programming language interpreter and sprintf. < 1567155305 122907 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :That's kind of silly. < 1567155317 577222 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: well sure < 1567155449 491012 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :a more typical case when coroutines may help is where you're communicating through network through a protocol that requires lots of back and forth stuff, which you do often want to write as a state machine that returns each time it wants to select < 1567155453 805438 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :which is how libcurl works < 1567155596 953925 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I'm also interested in how compiler support can help you make these things. < 1567155622 26581 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Anyway I wonder whether there's an implementation of sprintf specifically that behaves the way I said? < 1567155644 106864 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :You can't implement either printf or sprintf in terms of the other one efficiently, which is unfortunate. < 1567155761 645099 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Hmm, does anyone use glibc obstacks? < 1567155772 471180 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: behaves as a state machine that can continue the same sprintf call? I don't think there's one, but it would be sort of unnecessary: you just do separate parts of sprintf individually anyway, and for a single one, redoing the work like you need with snprintf now is not much extra overhead to what printf already has < 1567155804 209355 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: no, but subversion uses apache's own implementation from libapr that is similar to them < 1567155807 9880 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :If you have a large string output with sprintf, you need a large allocation as well. < 1567155820 299650 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Whereas printf can just use a constant-size buffer. < 1567155833 920476 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :allocates everything in whatever they call the equivalent of obstacks, and then free everything at once later < 1567155842 331244 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Yes, it's probably right that you should just have your own implementation rather than relying on glibc. < 1567155852 837904 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I wrote my own and it's only a few lines anyway. < 1567155860 110597 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :they can't use obstacks from glibc because glibc is rather nonportable to non-linux systems < 1567155894 100774 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I brought this up because I thought obstack had a printf function, but maybe it doesn't. < 1567155924 105981 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: either it has one, or if not, you can make one with the custom stream glibc interface, I don't recall which < 1567155937 646670 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :I don't recall what APR has instead < 1567155951 845596 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :let me see < 1567156002 183180 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :https://www.gnu.org/software/libc/manual/html_mono/libc.html#Custom-Streams glibc C FILE streams with custom read/write callbacks; C++ streams and rust streams and python streams and perl streams have their own variants (perl has like three different mechanisms I think) < 1567156059 822378 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :https://www.gnu.org/software/libc/manual/html_mono/libc.html#Dynamic-Output has obstack_printf < 1567156080 470552 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Oh, right. < 1567156172 369386 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :glibc scanf has an "a" modifier that does malloc, as in "%as" or "%a[...]", which is why I think it's a mistake for C99 to have specified "%a" as equivalent to "%g" in scanf, because the glibc use is way older, < 1567156194 515037 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :so in practice you can't actually use "%a" on glibc because glibc interprets it the old way, but I don't think anyone uses it anyway < 1567156209 686824 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :it's just silly of C99, they are usually more careful avoiding clashes < 1567156232 711211 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :it's different with clashes where neither clearly precedes the other of course, such as the two uses of "clog" < 1567156303 480038 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :"remove" also clashes, but that's the same problem that the Unhinged Erase card parodies, we basically have only a few synonyms (remove, erase, delete) and a ton of functions that you try to name that way < 1567156333 299344 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :One of the nice things about Xlib is that it knows three property formats: 8, which is chars, 16, which is shorts, and 32, which is longs. < 1567156354 427270 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Even if your long is 64-bit, you get an actual_format integer equal to 32. < 1567156635 503003 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :I know very little about Xlib, and don't expect to have to learn more either, luckily < 1567156646 331372 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :I just use higher-level libraries or programs abstracting it way deep < 1567156663 727578 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :there was one case when I wanted to find out whether a certain functionality is available from Xlib, but I found a workaround instead < 1567156710 528563 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :namely asking the X server to change the current virtual terminal to a different one (from the one where X lives), which X can do because it does so for keyboard shortcuts, and it's one ioctl for them anyway, but I wanted to know how to ask it to do so programmatically < 1567157674 865824 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567157892 568952 :Sgeo__!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Ping timeout: 248 seconds > 1567158092 285166 PRIVMSG #esoteric :14[[07Talk:Uyjhmn n14]]4 M10 02https://esolangs.org/w/index.php?diff=65787&oldid=61934 5* 03Dtuser1337 5* (-12) 10OH NOOOOOOOOOO!!! THIS MUST BE THE WORK OF AN ENEMY STAND! D: > 1567158359 363571 PRIVMSG #esoteric :14[[07Uyjhmn n14]]4 10 02https://esolangs.org/w/index.php?diff=65788&oldid=54422 5* 03Dtuser1337 5* (+66) 10Adding category because truttle1 forgot to add categories. > 1567158659 920509 PRIVMSG #esoteric :14[[07User:Dtuser1337/sandbox14]]4 N10 02https://esolangs.org/w/index.php?oldid=65789 5* 03Dtuser1337 5* (+106) 10Created page with "this is my sandbox page in which i use to draft some w.i.p stuff and experiment with these. ==some stuff==" < 1567158694 336338 :Sgeo__!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567158885 852479 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Ping timeout: 258 seconds > 1567158983 252592 PRIVMSG #esoteric :14[[07Talk:AAAAAAAAAAAAAA!!!!14]]4 10 02https://esolangs.org/w/index.php?diff=65790&oldid=14574 5* 03YamTokTpaFa 5* (+249) 10/* I'd like to implement, but isn't it pretty difficult to implement its parse? */ new section > 1567159569 42128 PRIVMSG #esoteric :14[[07Salt14]]4 M10 02https://esolangs.org/w/index.php?diff=65791&oldid=65785 5* 03A 5* (+273) 10/* Sets */ < 1567160045 481858 :Frater_EST!~adrianbib@wsip-68-15-198-210.ok.ok.cox.net JOIN :#esoteric > 1567160091 113844 PRIVMSG #esoteric :14[[07Point14]]4 M10 02https://esolangs.org/w/index.php?diff=65792&oldid=62914 5* 03Dtuser1337 5* (-1) 10/* Point */ > 1567160169 565409 PRIVMSG #esoteric :14[[07Point14]]4 M10 02https://esolangs.org/w/index.php?diff=65793&oldid=65792 5* 03Dtuser1337 5* (-1) 10moving the infobox to the top, yare yare daze. > 1567160217 426168 PRIVMSG #esoteric :14[[07Esolang:Sandbox14]]4 10 02https://esolangs.org/w/index.php?diff=65794&oldid=65595 5* 03Dtuser1337 5* (-4137) 10Do i have any reason to blank this page!? > 1567160460 434895 PRIVMSG #esoteric :14[[07Esolang:Sandbox14]]4 10 02https://esolangs.org/w/index.php?diff=65795&oldid=65794 5* 03Dtuser1337 5* (+5646) 10testing the ASCII art. joseph joestar picture and quotes are used. > 1567160511 156973 PRIVMSG #esoteric :14[[07Esolang:Sandbox14]]4 10 02https://esolangs.org/w/index.php?diff=65796&oldid=65795 5* 03Dtuser1337 5* (+907) 10 > 1567160538 253913 PRIVMSG #esoteric :14[[07Esolang:Sandbox14]]4 M10 02https://esolangs.org/w/index.php?diff=65797&oldid=65796 5* 03Dtuser1337 5* (-6553) 10blanking. Arigato, Gyro. < 1567160624 825481 :ineiros!ineiros@kapsi.fi QUIT :*.net *.split < 1567160625 118403 :sprocklem!~sprocklem@unaffiliated/sprocklem QUIT :*.net *.split < 1567160625 232293 :Hooloovo0!Hooloovoo@sorunome.de QUIT :*.net *.split < 1567160625 385461 :Guest77811!~quintopia@74.117.159.204 QUIT :*.net *.split < 1567160625 649834 :GeekDude!~G33kDude@unaffiliated/g33kdude QUIT :*.net *.split < 1567160625 707087 :LBPHacker!lbphacker@trigraph.net QUIT :*.net *.split < 1567160629 112021 :HackEso!~h@techne.zem.fi QUIT :*.net *.split < 1567160629 259669 :Melvar!~melvar@dslb-188-106-184-179.188.106.pools.vodafone-ip.de QUIT :*.net *.split < 1567160629 575810 :zzo38!~zzo38@24-207-15-213.eastlink.ca QUIT :*.net *.split < 1567160629 575855 :lifthrasiir!~lifthrasi@ec2-52-79-98-81.ap-northeast-2.compute.amazonaws.com QUIT :*.net *.split < 1567160629 833525 :jix!~jix@209.250.235.106 QUIT :*.net *.split < 1567160630 111527 :shachaf!~shachaf@unaffiliated/shachaf QUIT :*.net *.split < 1567160644 253646 :LBPHacker!lbphacker@trigraph.net JOIN :#esoteric > 1567160660 475052 PRIVMSG #esoteric :14[[07User:Dtuser1337/sandbox14]]4 10 02https://esolangs.org/w/index.php?diff=65798&oldid=65789 5* 03Dtuser1337 5* (+19) 10/* some stuff */ < 1567160667 813316 :Melvar!~melvar@dslb-188-106-184-179.188.106.pools.vodafone-ip.de JOIN :#esoteric < 1567160688 151077 :HackEso!~h@techne.zem.fi JOIN :#esoteric < 1567160736 832103 :GeekDude!~G33kDude@c-174-53-70-27.hsd1.wv.comcast.net JOIN :#esoteric < 1567160739 236226 :GeekDude!~G33kDude@c-174-53-70-27.hsd1.wv.comcast.net NICK :Guest24768 < 1567160745 848159 :sftp!~sftp@unaffiliated/sftp QUIT :Excess Flood > 1567160766 347897 PRIVMSG #esoteric :14[[07Point14]]4 10 02https://esolangs.org/w/index.php?diff=65799&oldid=65793 5* 03Dtuser1337 5* (+18) 10NANI!? A year category!?!? < 1567160784 112787 :sftp_!~sftp@unaffiliated/sftp JOIN :#esoteric < 1567160826 772188 :Hooloovo0!Hooloovoo@sorunome.de JOIN :#esoteric < 1567160835 185264 :sftp_!~sftp@unaffiliated/sftp NICK :sftp < 1567160899 416484 :lifthrasiir!~lifthrasi@ec2-52-79-98-81.ap-northeast-2.compute.amazonaws.com JOIN :#esoteric < 1567160934 283253 :ineiros!ineiros@kapsi.fi JOIN :#esoteric < 1567160962 346989 :jix!~jix@209.250.235.106 JOIN :#esoteric < 1567160963 336827 :quintopia!~quintopia@unaffiliated/quintopia JOIN :#esoteric < 1567160974 692232 :sprocklem!~sprocklem@unaffiliated/sprocklem JOIN :#esoteric < 1567160992 401483 :shachaf!~shachaf@unaffiliated/shachaf JOIN :#esoteric > 1567160999 142082 PRIVMSG #esoteric :14[[07User:Dtuser1337/sandbox14]]4 10 02https://esolangs.org/w/index.php?diff=65800&oldid=65798 5* 03Dtuser1337 5* (+109) 10Yare yare daze > 1567161013 549875 PRIVMSG #esoteric :14[[07User:Dtuser1337/sandbox14]]4 10 02https://esolangs.org/w/index.php?diff=65801&oldid=65800 5* 03Dtuser1337 5* (+1) 10 < 1567161046 597634 :xkapastel!uid17782@gateway/web/irccloud.com/x-jpffqrshvbcalhfv JOIN :#esoteric < 1567161342 999875 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I heard that Objective C implements "blocks" with operating system support for some reason. < 1567161353 505562 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Is that true? What's the thing they need it for? < 1567161406 824593 :int-e!~noone@int-e.eu PRIVMSG #esoteric :huh < 1567161493 918724 :int-e!~noone@int-e.eu PRIVMSG #esoteric :are they connected to some user-space threading mechanism? < 1567161544 403888 :int-e!~noone@int-e.eu PRIVMSG #esoteric :If not I don't really see why OS support would be needed... or helpful. But who knows what Apple's doing. < 1567161628 542926 :int-e!~noone@int-e.eu PRIVMSG #esoteric :It could be something comparatively trivial like a hot zone. < 1567161751 871292 :int-e!~noone@int-e.eu PRIVMSG #esoteric :. o O ( I've heard that INTERCAL implements 'come from' with OS support... ) < 1567161776 338083 :int-e!~noone@int-e.eu PRIVMSG #esoteric :It's so easy to make up rumors. < 1567161806 806837 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It's certainly possible I misunderstood. < 1567161907 631761 :int-e!~noone@int-e.eu PRIVMSG #esoteric :Meh the thing with these claims is that they require serious research to refute, unlikely as they seem. < 1567161982 674761 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :shachaf: do you mean like by allocating executable areas or using an executable stacks to make closure stubs? < 1567162024 400303 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I don't know. < 1567162070 271746 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :int-e: the intercal one is easier to believe < 1567162091 940709 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :it's an esoteric language, so it may have esoteric implementation strategies < 1567162103 690851 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I was wondering whether someone would already know, not asking people to do research for me, of course. < 1567162179 871267 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :I do know a few things that are surprisingly implemented with OS support: < 1567162208 206249 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :one of libcoro's backend uses sigaltstack to set up stacks for newly created contexts in a somewhat portable way; < 1567162274 704416 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Windows has some neat OS support for userspace threading (though I think it doesn't go far enough). < 1567162305 900978 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It lets you transfer control to your scheduler when a thread blocks on a system call or page fault. < 1567162341 670691 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :there is OS support to implement some atomic stuff, in the form of asking the OS set set some user-space flag if the OS context switches the process when some other user-space flag says that you're in some critical instruction sequence; this helps for single-processor systems on certain old processors that don't have cpu-supported atomic instructio < 1567162342 64620 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :ns, < 1567162354 475140 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but these days I think they found a new modern use for it, I don't really recall what < 1567162626 800097 :int-e!~noone@int-e.eu PRIVMSG #esoteric :shachaf: Sorry for all the negativity though. I'm mostly trying to convince myself that I shouldn't spend time going down this particular rabbit hole. < 1567162699 332101 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I thought I saw this claim repeated a bunch of times in the past but now I can't find any references to it. < 1567162734 812671 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Maybe it's the multi-core scheduling ("Dispatch") that I'm thinking of, though that seems like a different feature. < 1567162779 395700 :int-e!~noone@int-e.eu PRIVMSG #esoteric :It's just too open-ended a question. There's a wide range of "OS support" ranging from a trivial system call (say something that fuses two other system calls that happen to occur together a lot) to special scheduler and memory system support for who-knows-what. < 1567162841 3612 :int-e!~noone@int-e.eu PRIVMSG #esoteric :Your best bet is to find somebody who knows and I'm not that person :) < 1567162844 904836 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I know! I'm not asking you to invent or research plausible answers. < 1567162850 41591 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I wasn't even asking you at all. < 1567162869 280165 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I thought maybe typing the question in this channel would be a way to find somebody who knows. < 1567162887 440634 :int-e!~noone@int-e.eu PRIVMSG #esoteric :Yeah, as I tried to explain, I'm susceptible to going down those trails... wasting a lot of time. < 1567162901 986457 :int-e!~noone@int-e.eu PRIVMSG #esoteric :My fault really, not yours. You're just a fairly effective trigger. < 1567162971 181747 :int-e!~noone@int-e.eu PRIVMSG #esoteric :(Without trying to be, I believe.) < 1567162978 401984 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Aha, I see. < 1567163083 501020 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Anyway I'm in the int-e fan club. < 1567164486 223940 :cpressey!~cpressey@5.133.242.4 JOIN :#esoteric < 1567164931 92707 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567165053 454382 :int-e!~noone@int-e.eu PRIVMSG #esoteric :shachaf: speaking of wasting time, did you ever finish any of those pillars in The Witless? < 1567165089 613066 :int-e!~noone@int-e.eu PRIVMSG #esoteric :(I've had the misfortune of starting that game up again last weekend. But no, no completed pillar yet.) < 1567165153 350090 :Sgeo__!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Ping timeout: 245 seconds < 1567165964 391465 :Frater_EST!~adrianbib@wsip-68-15-198-210.ok.ok.cox.net QUIT :Ping timeout: 244 seconds < 1567167504 828420 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :Functors adhere to a set of equational laws, so I have to imagine that they're algebraic structures in the sense of universal algebra. I also have to imagine that if I ask #haskell if they're ever studied this way, category theory will immediately come up, and won't go away. < 1567167559 315697 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :cpressey: category theory may come up if you ask here as well < 1567167565 424670 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :`? monad < 1567167566 682919 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :Monads are just monoids in the category of endofunctors. < 1567167797 949360 :ais523!~ais523@unaffiliated/ais523 JOIN :#esoteric < 1567167829 942159 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :C-INTERCAL doesn't make use of any particular OS support, and I don't think CLC-INTERCAL does either (and am more certain that J-INTERCAL doesn't) < 1567167923 325452 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: functors are one of the building blocks of category theory; arguably the entire reason category theory was invented was to rigorously define "natural transformation" and those have functors as inputs and outputs, thus functors are kind-of a big deal in category theory < 1567167965 353301 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :futexes are a good example of something that benefits from OS support, but they're only really of use in multithreaded programs < 1567167967 22410 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but what's the relationship to haskell Functors? < 1567167989 674969 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric ::k Functor < 1567167991 509722 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :(* -> *) -> Constraint < 1567168007 444201 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I'm not sure how Haskell functors work < 1567168025 800244 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :@src Functor < 1567168026 123523 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :class Functor f where < 1567168026 159705 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric : fmap :: (a -> b) -> f a -> f b < 1567168028 870991 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :@info Functor < 1567168029 149924 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :Functor < 1567168122 435200 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :if you pass a category-theoretic functor through curry-howard, you basically end up with a function f from types to types, that lets you map from an expression that takes type A and has a free variable list of type B, to an expressioin that takes type f(A) andd has a free variable list of type f(B) < 1567168138 695089 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :the Haskell definition seems very close to that, it's just using lambdas rather than free variables < 1567168172 778725 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :(the only reason the category-theoretic definition uses free variables is that there's no guarantee that function types actually exist in any given category, and in fact the input and output of a functor can belong to different categories) < 1567168394 360813 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :hmm… different categories correspond to different programming languages under curry-howard < 1567168411 75606 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :so that means that in theory, an fmap should be able to lift a function from one programming language into another < 1567168435 286052 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :you can imagine a Haskell Functor such that f a is a Haskell type when a is, say, a Perl type < 1567168440 458181 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :then fmap takes a Perl function and compiles it into the corresponding Haskell function < 1567168482 764306 :ais523!~ais523@unaffiliated/ais523 QUIT :Remote host closed the connection < 1567168495 866189 :ais523!~ais523@unaffiliated/ais523 JOIN :#esoteric < 1567168497 952127 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :`? monad < 1567168499 235729 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :Monads are just monoids in the category of endofunctors. < 1567168546 245632 :hppavilion[1]!~omegasome@172.98.86.92 JOIN :#esoteric < 1567168825 590345 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :If I look at it purely algebraically, a functor is a unary operation on a monoid that preserves identity and distributes over composition. < 1567168941 579442 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :So, like, ... toupper(string) is a functor? < 1567168986 849586 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :toupper("H" .. "i") = toupper("H") .. toupper("i") < 1567169076 747947 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :and of course, toupper("") = "" > 1567169123 853680 PRIVMSG #esoteric :14[[07Esolang:Community portal14]]4 10 02https://esolangs.org/w/index.php?diff=65802&oldid=63833 5* 03LyricLy 5* (+0) 10 < 1567169302 581587 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :By the same token, monads must be algebraic structures of some kind, but their laws involve more machinery, so I thought I'd take a stab at functors first. < 1567169403 290668 :hppavilion[1]!~omegasome@172.98.86.92 QUIT :Ping timeout: 245 seconds < 1567169413 507816 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: something that confuses me when doing this, and confuses a lot of other people too, is that there are more levels of abstraction here than intuitively seems reasonable and it's easy to pick the wrong one < 1567169466 91298 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :toupper isn't a functor because functors act at the type level (they operate on types, and lift functions between those types in a map-like way) < 1567169472 48917 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :whereas toupper is a function that acts at the value level < 1567169484 371578 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :the reason it's confusing is that all these various levels of abstraction look much the same, despite having subtle differences < 1567169582 43935 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I get annoyed doing category theory because my intuition nearly always ends up picking the wrong level of abstraction < 1567169598 535650 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :There are no "types" in universal algebra, though. < 1567169618 104923 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :I mean, there can be, you can introduce "sorts", but you're not required to. < 1567169643 722787 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :Nothing in the algebraic definition of a functor seems to require sorts. < 1567169771 881757 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :how do you declare what's a valid input to your functor, then? < 1567169775 683730 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :toupper(6) isn't valid < 1567169822 502698 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :If you're working with group theory, how do you declare what's a valid element of your group? < 1567169823 978930 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :what? toupper(6) is totally valid, and its result is usually 6, depending on the locale < 1567169849 496891 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: this is the sort of problem that category theory is actually designed to solve < 1567169873 53572 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it takes all these "how do we define the domain of this?" problems and makes them explicit < 1567169889 726529 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :so in the case of groups as seen by category theory, a group is a category with one object < 1567169895 133596 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :wait... toupper acts on a string? no way, that directly contradicts to the C standard. it acts on a character. < 1567169904 110688 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: cpressey's toupper apparently does < 1567169953 417438 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :the objects in category theory basically act as types for the arrows < 1567169959 695562 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :so category theory says that in group theory, all values have the same type < 1567169962 196040 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :(which makes sense) < 1567169993 857354 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: I'm completely confused. I can't see how it's a "problem" to be solved. < 1567170004 22415 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :anyway, functors can act on any type that exists in the language, by definition; I guess toupper on a group of strings under concatenation therefore actually is a functor, because there's only one type to map and it supports that type < 1567170118 329829 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :Pick a monoid, you can define a functor on that monoid. In the toupper example, I picked a monoid of strings. Didn't give details, assumed people would understand strings, like you'd find in formal language theory and such. < 1567170119 832649 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: I guess my issue here is the "on a monoid" within "If I look at it purely algebraically, a functor is a unary operation on a monoid that preserves identity and distributes over composition." < 1567170129 83035 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :functor are more general than that, you can define them even on things that aren't monoids < 1567170134 893583 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :*functors < 1567170149 32788 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :``` set -e; >tmp/a.c echo $'#include\n#include\n''int main(void) { printf("toupper(8) = %d\n", toupper(8)); return 0; }'; gcc -Wall -O -o tmp/a.out tmp/a.c; tmp/a.out < 1567170150 346437 :HackEso!~h@techne.zem.fi PRIVMSG #esoteric :toupper(8) = 8 < 1567170168 525567 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: You might be able to define them on semigroups. That seems to be hair-splitting a bit though? < 1567170184 240882 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :You do need to define them on something that has a concept of composition. < 1567170188 70069 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: it's not hair-splitting at all; Functor in Haskell us /usually/ defined on things that are much more general than either monoids or semigroups < 1567170209 140572 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :e.g. List is a functor in Haskell < 1567170217 577862 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: A list is a monoid < 1567170243 985951 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: a specific /type/ of list is a monoid < 1567170254 224547 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :but you can't do, say, [1] ++ ["a"] < 1567170276 263102 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :List, the actual concept devoid of any specific/concrete element type, is a functor < 1567170336 724644 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: Every kind of list you can define in Haskell is a monoid. < 1567170399 593216 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :yes, but that isn't relelvant here; your definition of "a functor is a unary operation on a monoid that preserves identity and distributes over composition." doesn't apply to any specific type of list because the type of list is a monoid in its own right, not a unary operation on a monoid < 1567170456 824171 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :perhaps less confusing as an example: Haskell's Maybe is a functor, but as far as I can tell it isn't a monoid and neither is a typical concrete type of Maybe such as Maybe Bool < 1567170499 847855 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: How is fmap defined for Maybe? < 1567170533 360265 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: fmap f Nothing = Nothing; fmap f (Just x) = Just (f x) < 1567170628 365694 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :(this operation is actually called "map" in both Java's and Rust's versions of Maybe) < 1567170743 258565 :arseniiv!~arseniiv@95.105.3.214.dynamic.ufanet.ru JOIN :#esoteric < 1567170790 180196 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: OK, I don't know what to say. I don't agree that what I'm talking about has anything to do with Haskell, but your objections seem to be based on that my statements don't make sense in the context of Haskell < 1567170815 196830 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :@src Maybe Functor < 1567170815 459917 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :Source not found. It can only be attributed to human error. < 1567170818 328761 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :@src Functor Maybe < 1567170818 683313 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :Source not found. Have you considered trying to match wits with a rutabaga? < 1567170822 63105 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :@src fmap Maybe < 1567170822 364653 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :Source not found. Sorry about this, I know it's a bit silly. < 1567170825 642596 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :@src Maybe fmap < 1567170826 119763 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :fmap _ Nothing = Nothing < 1567170826 242248 :lambdabot!~lambdabot@haskell/bot/lambdabot PRIVMSG #esoteric :fmap f (Just a) = Just (f a) < 1567170873 132788 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: I don't think your definition of a functor is remotely related to my definition of a functor < 1567170885 741769 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it may be an extreme special case but it's missing the general case < 1567170896 995435 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :and the general case requires category theory to define < 1567170926 524419 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :I'll note that Haskell's Maybe *is* a Semigroup < 1567170932 548188 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :Haskell doesn't actually get all that close to the general case, but its version is more general than yours and so it makes for easy examples < 1567170951 26426 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :My version doesn't have types, and this makes it *less* general somehow? < 1567171003 858901 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :If my version is less general, it's because I went with monoid instead of semigroup. I'm happy to backpedal on that. < 1567171007 838524 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: yes, because you're requiring everything that your functors apply to everything that exists in the universe of discussion, which is a major restriction < 1567171066 704968 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :the existence of types makes things more general because it allows functors to specify how they behave when multiple different types are in use < 1567171079 977451 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :"Types are useful when you have types" < 1567171144 283451 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :I don't know, are you assuming I'm talking about programming? I'm not. < 1567171158 368459 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :um < 1567171170 324124 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :no, I'm using programming terminology though because I assumed that category-theoretic terminology wouldn't be understood < 1567171190 143718 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :to the extent that things other than programming are interesting, types are useful outside of programming too < 1567171343 387334 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :hmm… if we restrict ourself to one category and one object, we end up with a semigroup (as you say), and then the category-theoretical definition of "functor" collapses to "function on semigroup elements that preserves identity and preserves composition", which is your definition < 1567171347 59036 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :without types, you end up trying to less-than compare a set of points to a 3xn matrix of complex numbers, or water your < 1567171355 920599 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :or microwave a kitten, < 1567171374 801739 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :and you won't notice that you shouldn't do those things until you get a runtime exception such as the cat dying < 1567171384 767411 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: I don't think microwaving a kitten is a type error, it's a bad idea for other reasons though < 1567171401 307263 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :hmm < 1567171454 686209 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: let me see if I can explain why functors are more general than the semigroup definition: suppose you have two /different/, unrelated, semigroups; but it's possible to define a map from one to the other which preserves identity and preserves composition < 1567171473 164101 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :that's still a functor < 1567171495 77421 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :(there are two generalisations from your definition to the full category-theoretical definition; Haskell generalises it in one dimension, the above example is the generalisation along the other dimensioin) < 1567171501 49482 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :can you give a more concrete example for that? < 1567171525 169341 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: the simplest example is the degenerate map which maps everything from the first semigroup to the identity element of the second semigroup < 1567171565 504316 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :ok but... that doesn't really answer cpressey's question < 1567171609 150920 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: I'm trying to answer the question "My version doesn't have types, and this makes it *less* general somehow?", by explaining one way in which the category-theoretical definition is more general than cpressey's is < 1567171642 498834 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :you can think of more useful examples, e.g. there's a functor from the integers-plus-addition to the (integers mod 7)-plus-addition < 1567171645 22331 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :that simply takes the value mod 7 < 1567171660 990578 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :preserves identity, preserves composition, it's useful to have a name for this sort of operation < 1567171676 179167 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :isn't that called a monomorphism? < 1567171679 455161 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :no < 1567171682 984715 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :a homomorphism < 1567171687 105241 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :make it a homomorphism < 1567171695 815735 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but I thought functor was something other than that < 1567171740 576294 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: well, yes, a functor is more general < 1567171747 389349 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :or, hmm < 1567171752 541541 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :I don't mean more general < 1567171754 47673 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :a homomorphism /between semigroups/ is a type of functor < 1567171758 728595 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :this isn't true for things other than semigroups, though < 1567171763 300475 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :I thought homomorphisms just weren't functors < 1567171784 889441 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but I don't think I understand what a functor is < 1567171832 302844 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :let's see… in a category, you have objects and arrows (with each object having an identity arrow, and arrows composing) < 1567171861 474023 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :for example, in the category representing a semigroup, there's only one object, its identity arrow is the semigroup's identity, and more generally arrows are elements < 1567171904 683128 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: I am still at a loss why your "more general" definition of functor, rejects that toupper() is a functor, while my "less general" defintion accepts that toupper() is a functor, as well as accepting all of your examples are functors as well. < 1567171917 756529 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but aren't the categories with arrows between supposed to be a generalization of algebraic structures with homomorphisms between? < 1567171931 952663 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :a functor is a map between categories from objects to objects and arrows to arrows that preserves identity and composition < 1567171932 690727 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :what is a "category representing a semigroup" then? < 1567171981 373558 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: it turns out that it doesn't reject that toupper is a functor, as long as your source and target categories are very limited (specifically they both have to be the semigroup category of strings under concatenation) < 1567171991 671279 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: a category with one object is equivalent to a semigroup < 1567172016 445255 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: I just hadn't realised you were considering such a limited universeof objects < 1567172019 4535 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: Yeah, *I'm not thinking in category theory terms*. < 1567172044 793699 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :hmm < 1567172070 683064 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :so there's one object, plus an arrow for each element of the semigroup, and the arrows compose by the semigroup operation? < 1567172078 699167 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :wob_jonas: right < 1567172100 991054 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :so that's like the object with the internal morphisms < 1567172105 359482 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :that makes sense < 1567172122 57111 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :hmm no < 1567172123 220854 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :not quite < 1567172140 840828 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :but ok < 1567172148 853203 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: in this case I guess you have a valid definition of a special case of a functor (specifically, the case when you're only considering a single semigroup); and if you were working in other settings, the same more general definition could be used to provide a special-case definition for those settings too < 1567172185 72954 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :ais523: I think that is more or less how abstract algebra works? The thing I said about group theory, remember. < 1567172215 735014 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :There is usually no assumption that there are multiple kinds of objects you have to distinguish < 1567172235 717243 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric : Algebraic structures, with their associated homomorphisms, form mathematical categories. Category theory is a formalism that allows a unified way for expressing properties and constructions that are similar for various structures. < 1567172258 782676 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :And therefore we *must* analyze them with the tools of category theory < 1567172263 564550 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :No thanks. < 1567172282 994895 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it's more, category theory is the tool that mathematicians use to specify how the various algebraic structures of abstract algebra relate to each other < 1567172379 641151 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :It is *the* paradigm, can't escape it, huh. < 1567172387 746752 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :my experience with category theory is that it's more or less impossible to do anything in abstract algebra that doesn't have a category-theoretical interpretation, and that is typically the most general possible interpretation; whether you actually want to think on that level or not is up to you, and it often isn't useful to do so < 1567172404 934115 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it's mostly only useful when you use it to take a proof from one area of mathematics and use it to prove a theorem in another < 1567172493 692963 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :I hope I didn't give the impression that that was what I was aiming to do, because it wasn't. < 1567172624 768805 :Frater_EST!~adrianbib@wsip-68-15-198-210.ok.ok.cox.net JOIN :#esoteric < 1567172646 238169 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :well, I thought you were interested in learning about what functors were in general < 1567172720 149190 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :"Functors adhere to a set of equational laws, so I have to imagine that they're algebraic structures in the sense of universal algebra. I also have to imagine that if I ask #haskell if they're ever studied this way, category theory will immediately come up, and won't go away." < 1567172739 478966 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :in particular, I had no way of knowing that you were thinking of the definition as specialised to semigroups as the specific definition you were concentrating on, as opposed to merely being an example of the general definition > 1567172754 66074 PRIVMSG #esoteric :14[[07MUSYS14]]4 10 02https://esolangs.org/w/index.php?diff=65803&oldid=65330 5* 03Salpynx 5* (+189) 10Some new examples for an old language. I've started working on a simulator. < 1567172761 962495 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :I'm not sure how you got "in general" from "in universal algebra". < 1567172793 793053 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :Or even what "in general" means, in this context, to you. < 1567172820 954835 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I didn't realise you were considering a special case; "functor", to me, refers only to the general case < 1567172835 411752 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :there's nothing in your statement that suggests that you have a specific special case of functors in mind < 1567172849 126233 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :This is rather frustrating. < 1567172858 847013 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :and the mention of #haskell increased the chance that you were thinking of a definition that's at least as general as Haskell's < 1567172899 687088 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :fmap id = id; fmap (f . g) = (fmap f) . (fmap g) < 1567172964 592394 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :I pointed out toupper() conforms to these laws; you said it's not a functor; then later you admitted, okay, it can be a functor. < 1567172980 191363 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :there are /three/ Functor laws in Haskell < 1567173018 920802 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :Better update https://wiki.haskell.org/Functor then < 1567173019 53630 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it doesn't comply with the third, which is fmap :: forall a b. (a -> b) -> f a -> f b < 1567173074 306059 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :it's just that Haskell enforces that one by the compiler rather than making the user check that it applies manually, so it doesn't have to be written in a comment < 1567173138 489003 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :now, the reason toupper is a functor on the semigroup of strings, even though it isn't a functor in Haskell, is that the semigroup of strings only has one type – strings – and we have f String = String and forall a b. a = String && b = String < 1567173175 612495 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :but in Haskell, "f" has to be a type constructor and there's no type constructor f for which f String = String, also it's not true that forall a. a = String because Haskell has other types < 1567173223 164375 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :Haskell has types. It sure does. < 1567173249 642277 :cpressey!~cpressey@5.133.242.4 PRIVMSG #esoteric :It has kinds, too! < 1567173305 374676 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :I'm tempted to go correct that wiki page anyway; Haskell's Functor is not a general representation of mathematical functors, it is specialised to the case in which the type-level mapping is a type-level constructor (rather than a type-level function that isn't a type constructor) < 1567173392 514911 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :(it's also specialised to categories whose objects are Haskell types, but given that it's being imlpemented in Haskell, that's forgivable) < 1567173867 768674 :ais523!~ais523@unaffiliated/ais523 PRIVMSG #esoteric :cpressey: sorry if I annoyed you by the way; I'm really tired at the moment and that makes it harder for me to predict how my actions will affect other people emotionally < 1567174041 586252 :Sgeo_!~Sgeo@ool-18b98995.dyn.optonline.net QUIT :Read error: Connection reset by peer < 1567174107 308345 :Sgeo!~Sgeo@ool-18b98995.dyn.optonline.net JOIN :#esoteric < 1567175564 312989 :Frater_EST!~adrianbib@wsip-68-15-198-210.ok.ok.cox.net PART :#esoteric < 1567175644 683129 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 PRIVMSG #esoteric :ais523: but isn't that limitation solved in a ghc extension, as in type families? < 1567175664 570371 :wob_jonas!25bf3cd1@gateway/web/cgi-irc/kiwiirc.com/ip.37.191.60.209 QUIT :Remote host closed the connection < 1567176846 367094 :ais523!~ais523@unaffiliated/ais523 QUIT :Quit: quit > 1567178132 741249 PRIVMSG #esoteric :14[[07User:YamTokTpaFa14]]4 10 02https://esolangs.org/w/index.php?diff=65804&oldid=65163 5* 03YamTokTpaFa 5* (+106) 10 > 1567178190 205239 PRIVMSG #esoteric :14[[07ArrowFuck14]]4 10 02https://esolangs.org/w/index.php?diff=65805&oldid=62003 5* 03YamTokTpaFa 5* (+60) 10+CATs < 1567179061 346938 :cpressey!~cpressey@5.133.242.4 QUIT :Quit: WeeChat 1.4 > 1567179858 381695 PRIVMSG #esoteric :14[[07Special:Log/newusers14]]4 create10 02 5* 03Ntrupin 5* 10New user account < 1567179944 860300 :zzo38!~zzo38@24-207-15-213.eastlink.ca JOIN :#esoteric > 1567180504 572403 PRIVMSG #esoteric :14[[07Special:Log/newusers14]]4 create10 02 5* 03EdgyNerd 5* 10New user account < 1567180860 777492 :b_jonas!~x@catv-176-63-25-10.catv.broadband.hu JOIN :#esoteric < 1567182064 773496 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT :Remote host closed the connection < 1567182173 598241 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567182385 211975 :Phantom_Hoover!~phantomho@unaffiliated/phantom-hoover JOIN :#esoteric < 1567184926 235692 :FreeFull!~freefull@defocus/sausage-lover JOIN :#esoteric < 1567185257 68082 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT :Remote host closed the connection < 1567185906 534624 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567186303 569673 :palaiologos!b0dd7a47@176.221.122.71 JOIN :#esoteric < 1567186460 558341 :palaiologos!b0dd7a47@176.221.122.71 QUIT :Remote host closed the connection < 1567186475 739029 :kspalaiologos!b0dd7a47@176.221.122.71 JOIN :#esoteric < 1567186865 365382 :kspalaiologos!b0dd7a47@176.221.122.71 QUIT :Remote host closed the connection < 1567187798 678788 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT :Remote host closed the connection < 1567189544 984079 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567190546 206917 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT :Remote host closed the connection < 1567190570 993005 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567191087 770991 :choochter!choochter@nat/ibm/x-doeoartqzajuugyf JOIN :#esoteric < 1567191469 677294 :choochter!choochter@nat/ibm/x-doeoartqzajuugyf QUIT :Quit: Leaving < 1567191642 465814 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :int-e: I haven't played that game in a long time. < 1567191652 165327 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I don't think I completed any pillars? I don't remember. < 1567192412 59991 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT :Remote host closed the connection < 1567193988 510497 :MDude!~MDude@76.5.108.106 QUIT :Ping timeout: 244 seconds < 1567194506 603060 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb JOIN :#esoteric < 1567194751 846048 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Wow, long conversation about functors. < 1567194764 440235 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :It looks like mostly people talking past each other? < 1567194785 597211 :tromp!~tromp@2a02:a210:1585:3200:d9ea:bffd:bcdc:d7fb QUIT :Ping timeout: 250 seconds < 1567194921 586647 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :A monoid homomorphism is clearly a special case of a functor, and so is Haskell's Functor class. < 1567194941 865517 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :What's all the argumentationing about? < 1567195343 981104 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Maybe *is* a functor, but it's a functor "on" Haskell functions, in the usage above. < 1567195373 753696 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :The reason the "on a monoid" isn't general enough is that Haskell functions aren't a monoid because you have different types so you can't compose any arbitrary functions. < 1567195439 401878 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :Whereas «[1] ++ ["a"]» is a red herring because that's not the functor operation that's being discussed ([Int] and [String] are both monoids, separately, and there are no type issues there). < 1567195453 430951 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :I don't know whether cpressey logreads. < 1567196013 773495 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :ACTION is back from surgery and feeling good. < 1567196165 972903 :tromp!~tromp@2a02:a210:1585:3200:cd1b:9f20:11cb:75b JOIN :#esoteric < 1567196289 427085 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :higan mchelloister < 1567196300 975394 :tromp_!~tromp@2a02:a210:1585:3200:11f0:b98e:d29b:84d8 JOIN :#esoteric < 1567196357 989242 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :hi < 1567196394 91160 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :hichaf ben-kikello < 1567196437 995113 :tromp!~tromp@2a02:a210:1585:3200:cd1b:9f20:11cb:75b QUIT :Ping timeout: 252 seconds < 1567196569 992556 :tromp_!~tromp@2a02:a210:1585:3200:11f0:b98e:d29b:84d8 QUIT :Ping timeout: 252 seconds < 1567197443 719078 :Lord_of_Life_!~Lord@unaffiliated/lord-of-life/x-0885362 JOIN :#esoteric < 1567197580 684841 :tromp!~tromp@2a02:a210:1585:3200:11f0:b98e:d29b:84d8 JOIN :#esoteric < 1567197603 708848 :Lord_of_Life!~Lord@unaffiliated/lord-of-life/x-0885362 QUIT :Ping timeout: 245 seconds < 1567197616 73774 :Lord_of_Life_!~Lord@unaffiliated/lord-of-life/x-0885362 NICK :Lord_of_Life < 1567200732 258685 :pikhq_!~pikhq@97-118-196-215.hlrn.qwest.net PRIVMSG #esoteric :kmc: congrats on surgery < 1567200811 28441 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :ty < 1567201057 968889 :AnotherTest!~turingcom@ptr-82l26zcdc6imrwoapg3.18120a2.ip6.access.telenet.be QUIT :Ping timeout: 252 seconds < 1567201155 970505 :xkapastel!uid17782@gateway/web/irccloud.com/x-jpffqrshvbcalhfv QUIT :Quit: Connection closed for inactivity < 1567201821 43354 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :kmc is now a surgically-enhanced superhuman < 1567201906 407235 :kmc!~beehive@li521-214.members.linode.com PRIVMSG #esoteric :something like that < 1567201972 19399 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :do you do double damage now < 1567201973 944622 :shachaf!~shachaf@unaffiliated/shachaf PRIVMSG #esoteric :https://www.supermegacomics.com/index.php?i=333 < 1567202471 489081 :int-e!~noone@int-e.eu PRIVMSG #esoteric :hmm glowing blue and quad damage < 1567204503 876779 :FreeFull!~freefull@defocus/sausage-lover QUIT : < 1567208746 211743 :arseniiv!~arseniiv@95.105.3.214.dynamic.ufanet.ru QUIT :Ping timeout: 246 seconds