00:00:24 is the concept of pregret related to the concept of type II fun? <-- huh. i feel like i've never learned to do that. 00:04:31 -!- FreeFull has quit. 00:17:35 -!- Phantom_Hoover has quit (Read error: Connection reset by peer). 00:36:50 -!- imode has quit (Ping timeout: 240 seconds). 00:47:46 -!- tromp has quit (Remote host closed the connection). 00:48:19 -!- tromp has joined. 00:53:29 -!- tromp has quit (Ping timeout: 276 seconds). 00:54:08 -!- tromp has joined. 00:58:38 -!- tromp has quit (Ping timeout: 245 seconds). 01:07:39 -!- imode has joined. 01:12:12 -!- oerjan has quit (Quit: Nite). 01:22:50 -!- zzo38 has quit (Ping timeout: 240 seconds). 01:35:55 -!- tromp has joined. 01:40:56 -!- tromp has quit (Ping timeout: 276 seconds). 01:52:36 -!- Soni has joined. 01:52:53 1. make esoteric language month 2. publish pure-sed doom port 01:53:19 I'd do it. 01:53:24 (there is pure-sed tetris, after all) 01:54:46 what. 01:57:55 https://github.com/uuner/sedtris/blob/master/sedtris.sed 02:44:23 Wondering, if it's been generated using pack of scripts of written as is 02:50:42 She's got a career at Google: https://careers.google.com/stories/julia-on-growing-her-career-at-google/ 02:52:28 good. 03:24:08 -!- tromp has joined. 03:28:38 -!- tromp has quit (Ping timeout: 245 seconds). 04:42:27 -!- quintopia has joined. 05:10:59 -!- imode has quit (Quit: WeeChat 2.6). 05:11:16 -!- imode has joined. 05:12:27 -!- tromp has joined. 05:13:18 -!- imode has quit (Client Quit). 05:13:36 -!- imode has joined. 05:15:14 -!- imode has quit (Client Quit). 05:15:29 -!- imode has joined. 05:17:23 -!- tromp has quit (Ping timeout: 276 seconds). 05:35:46 -!- imode has quit (Quit: WeeChat 2.6). 05:36:04 -!- imode has joined. 05:38:11 -!- erdic has quit (Ping timeout: 276 seconds). 05:40:09 -!- erdic has joined. 06:02:28 -!- MDude has quit (Ping timeout: 268 seconds). 06:39:14 -!- tromp has joined. 06:43:38 -!- tromp has quit (Ping timeout: 245 seconds). 06:44:44 Soni: what are you doing here 07:02:36 -!- MDude has joined. 08:27:08 -!- tromp has joined. 08:31:25 -!- tromp has quit (Ping timeout: 252 seconds). 08:39:33 -!- tromp has joined. 09:22:26 -!- imode has quit (Ping timeout: 276 seconds). 09:46:16 -!- atslash has joined. 09:50:54 -!- arseniiv has joined. 09:53:26 -!- kspalaiologos has joined. 09:54:24 -!- kspalaiologos has quit (Client Quit). 09:54:36 -!- kspalaiologos has joined. 09:55:28 -!- kspalaiologos has quit (Client Quit). 09:55:42 -!- kspalaiologos has joined. 11:29:05 aji: who are you 11:29:32 (and, more importantly, why do you care) 11:49:08 [[User:CMinusMinus]] N https://esolangs.org/w/index.php?oldid=66902 * CMinusMinus * (+155) Created page with "Welcome to my Esolang-page! My name is Jonas, im 16 and from Germany (Yeah I know...). I already made some stuff, I am going to upload it here later... Bye" 11:49:27 [[User:CMinusMinus]] https://esolangs.org/w/index.php?diff=66903&oldid=66902 * CMinusMinus * (+24) 12:53:53 oh I get it! they're called a ket-tle because when you start to boil the water, they hiss like a cat 12:54:10 should have been spelled cat-tle but that's already used for a different word 13:06:53 `? kittegory 13:06:54 A kittegory is just a small category. 13:09:44 `mkx bin/just//grwp '\(is\|are\) just' | sed -e 's/:/ ::= /;s/$/\n/' > tmp/just && url tmp/just 13:09:46 bin/just 13:09:47 `just 13:09:48 https://hack.esolangs.org/tmp/just 13:32:56 `? char 13:32:57 Char is a prominent component of charcoal. 13:39:43 `? long 13:39:44 Long is the Chinese word for dragon. 13:40:10 the other type words of C don't seem to have a wisdom: int, short, float, double, bool, _Bool, complex, _Complex, atomic, _Atomic 13:40:26 we do have one for pointers though 13:40:31 oh, and 13:40:32 `? void 13:40:34 Nothing to see here 13:43:42 `? void * 13:43:43 void *? ¯\(°​_o)/¯ 13:43:59 `? punpckhqdq 13:44:00 punpckhqdq? ¯\(°​_o)/¯ 14:00:40 -!- aloril has quit (Ping timeout: 265 seconds). 14:57:23 What language would you guys use to implement something new, that will be supported for the next 50 years? 14:57:31 C? 14:57:56 Basically I want to write a virtual machine for unreal script, and want it to live until at least I'm dead 14:58:40 Fortran? Cobol? 14:58:53 C 14:59:01 c'mon, it's never going to die 14:59:23 it should, though 15:00:14 I was not objecting to C, I merely wanted to offer some alternatives. 15:01:05 -!- aloril has joined. 15:05:32 I don't want to use C because of bad type system, complex ecosystem, etc 15:05:38 I was thinking lisp would probably be better 15:05:56 you might end up like Reddit 15:06:18 lol 15:06:34 I want to use Rust, but Rust heavy as fuck. 15:06:44 So I keep coming back, staring at Zig from a distance. 15:07:00 I've actually used Rust for ~2 years now 15:07:03 Honestly though... take any established language and chances are good that you can still run it 50 years from now. It may involve two layers of emulation. 15:08:00 I should find a C with RAII and strong type system 15:08:04 Oh, let's add vendor-neutral to the criteria. 15:08:15 But in an adhoc fashion 15:08:26 So that it can all be removed to compile with C compiler 15:08:38 C 15:08:48 Swift, golang... such things might still disappear very quickly if the corresponding company ever goes under. 15:09:42 `? C 15:09:43 C is the language of��V�>WIד�.��Segmentation fault 15:11:28 (I don't really expect either of those two to disappear.) 15:12:00 int-e: thoughts on Zig? 15:12:09 The developed it in a year basically 15:12:13 The guy* 15:12:47 int-e: what about JavaScript :^))) 15:14:31 Lately I've been thinking more and more about interpreted languages 15:14:33 lf94: I actually thought of that but hoped that nobody else would. 15:14:49 lf94: Unfortunately I suspect it's here to stay as well. 15:15:04 Basically an interpreted language trade-offs memory 15:15:09 I don't know Zig. 15:15:22 A compiled language typically needs more memory 15:15:32 But you get way more control of the underlying system 15:15:40 lf94: That's not really true anymore because of JITs. 15:15:53 How complex is JIT 15:16:25 (And Javascript would not be as dominant if people hadn't gone crazy in JIT compilation for JS a decade ago.) 15:16:26 A compiled language, in the most basic case, is just turning language feature X into assembly Y 15:16:53 Now with LLVM, I think there is no reason NOT to make it compiled 15:17:41 Extrinsically JIT compilers use fairly crazy amounts of memory... they compile several versions of the same code, collect runtime profiling information to identify hot spots, require garbage collection... it adds up. 15:17:47 int-e: check out Zig, for me. Your opinion matters a lot. 15:17:59 I wouldn't trust javascript, because all the people who use javascript make programs that they throw away five or ten years ago, so you can't trust the language and its interpreters to be stable enough 15:18:26 (Hmm, should've used a full stop rather than an ellipsis... those two sentences were not logically connected.) 15:18:34 lf94: I really don't do requests. 15:18:47 I guess with emulation, you can emulate compilers 15:18:58 I recommend https://esolangs.org/wiki/UM-32 since it's based on like a thousand year old cult who made computers out of sand 15:19:19 It would be cool to have some sort of crazy optimizing lambda calculus compiler 15:19:31 int-e: Sorry, I didn't mean to offend 15:20:02 Oh I'm not offended. 15:21:59 that or MMIX, whose tagline is "a RISC computer for the third millennium", and people will be reading TAOCP fifty years from now so they'll also be interested to emulate MMIX 15:22:22 I was going to target subleq vm 15:22:27 as an alternative 15:22:32 but it'd probably be very very slow. 15:22:34 but C is pretty much the best option 15:23:04 I should bundle tiny C compiler source with the project 15:23:09 so someone can bootstrap 15:25:44 lf94: the hard part is not the compiler or core language, but then environment and system access 15:25:52 yeah... 15:25:58 and C makes that the easiest 15:26:39 C and unix together, yes 15:28:02 https://en.wikipedia.org/wiki/History_of_programming_languages 15:28:06 Man, this is pretty sad 15:28:17 After the 70s everyone's been making garbage collected languages 15:28:38 (Minus D, Swift and Rust) 15:29:38 just look at how we unix people run unix programs on windows. sure, they don't integrate well into the environment, because they can like only access files if all characters in their names are in the locale-dependent default codepage, and you have to patch system() statements to add two double-quotes before the name of the program and one double-quote after the name of the program that you execute, 15:30:22 and they can't printf floating-point numbers properly, but the end result is that with all that patching, you can usually run those programs, and windows libc supports them because there's a need for it 15:30:56 every future system will support C and unix basics, so you can easily port programs from it, even if the system looks so different that you can't access its native resources to the fullest 15:30:58 Is it difficult to re-implement C+ 15:30:59 ? 15:31:11 even if it has to run the whole C program in an emulated virtual 32-bit address space etc 15:31:25 it might be inefficient, but that doesn't matter when you're running old programs 15:31:53 -!- kritixilithos has joined. 15:35:18 Thoughts on Ada? 15:36:54 also document the parts of your program that may have to be ported in the future, like Knuth does in TeX/Metafont/SGB. these are the parts that access the system or do IO, the parts that make some assumption that need not be true in all C environments, and the parts that they may want to optimize in a nonportable way 15:37:23 that's what makes TeX/Metafont/SGB portable enough: you don't have to touch most of the code to port, just those specific parts 15:39:40 b_jonas: interesting 15:39:46 TeX is written in what? 15:39:54 I thought it was Knuth's own lang 15:43:03 I think it's written in WEB, yes. 15:45:43 it's written in CWEB 15:46:07 Is it? I thought it was just WEB, and used Web2C. 15:46:08 which lets you combine the core with local "patch files" that replace the system-dependent parts (or any parts you want really) of the C code 15:46:20 and then you compile the resulting code with a C compiler 15:46:26 fizzie: I dunno 15:46:35 fizzie: SGB is written in CWEB then 15:46:40 WEB is Pascal based. 15:46:48 I haven't really tried to look at how TeX is implemented 15:46:56 int-e: Right, but I think TeX systems use web2c instead. 15:47:05 https://ctan.org/pkg/web2c?lang=en 15:47:16 fizzie: I'm sure it has been ported to CWEB 15:47:44 Well, the principle is language agnostic, anyway. 15:49:44 I guess for portability we should count 6502 too. everyone will know how to emulate it with all its undocumented instructions and quirks of the NES and commodore 64 graphics and sound hardware, even 50 years from now. 15:50:21 https://www.linusakesson.net/games/stranded64/index.php argues for using the commodore 64 for future portability 15:50:58 -!- imode has joined. 15:53:59 so write the program in the form of an NES cart. just remove its battery if it has battery-backed SRAM, because it's easier to put a new battery in 50 years from now than to clean up the spilled battery acid and repair the PCB 15:54:01 Hmm, interesting. I was under the misconception that TeX had been ported to CWEB. Apparently not... (or maybe that happened and was abandoned). 15:56:17 target the NTSC version though, people might not be able to get a PAL NES so easily anymore that far into the future 15:57:37 oh yeah, writing the program _in_ TeX or Metafont (as opposed to _like_ TeX or Metafont) is an option too 15:57:53 people will be able to find interpreters for those 50 years from now too, even if they don't use them for their original purpose anymore 15:59:03 the problem is, writing a program in those languages is an exercise in masochism 15:59:27 they're not as useful for general-purpose programming as the NES, commodore 64, C and unix, or MMIX 16:00:18 lf94: Knuth's own languages are MIX with various extensions, MMIX, PL/MIX, and possibly PL/MMIX. TeX is written in none of those. 16:01:02 [[MIX (Knuth)]] https://esolangs.org/w/index.php?diff=66904&oldid=63414 * B jonas * (+4) 16:01:20 [[MMIX]] https://esolangs.org/w/index.php?diff=66905&oldid=52406 * B jonas * (+4) 16:01:34 [[Gb gates RISC]] https://esolangs.org/w/index.php?diff=66906&oldid=53641 * B jonas * (+4) 16:01:49 [[PL/MIX]] https://esolangs.org/w/index.php?diff=66907&oldid=66502 * B jonas * (+4) 16:02:38 I was almost expecting you were adding "TeX is not written in it." in each of those articles. 16:02:43 But maybe that's more of a `wisdom thing to do. 16:03:32 [[1.1]] https://esolangs.org/w/index.php?diff=66908&oldid=59206 * B jonas * (+4) 16:04:29 ``` cat wisdom/pe*taneb* # like that entry? 16:04:30 Taneb is not elliott, a rabbi, Mark Zuckerberg, James Bond, Queen Elizabeth the first, or anyone older than Queen Elizabeth the Second. Pending approval: Shigeru Miyamoto. 16:04:58 languages that TeX isn't implemented in? 16:05:43 lf94: you should get shachaf's opinion on Zig since it doesn't have exceptions 16:05:57 shachaf: opinion pls 16:06:05 That, and some other entries about inventions. 16:06:12 but other than that... nothing really exciting to me. and this competition on hello world program size is getting boring 16:07:07 I've been writing Go lately, and Zig's `errdefer` would've come in handy a couple of times. 16:08:01 I'm hoping for some serious consolidation in the near future. 16:08:33 Having dozens of C-like languages that all have their own minor innovation is stupid. 16:09:58 Maybe LLVM made writing compilers a bit too easy. 16:10:06 [[Gb gates RISC]] https://esolangs.org/w/index.php?diff=66909&oldid=66906 * B jonas * (-1) 16:10:34 I still recommend C++ and rust 16:10:58 not for the program that needs to be portable to 50 years from now 16:11:05 for more ordinary programs 16:11:08 rust has tempted me recently. I resist its temptation. 16:11:58 imode: C++ then 16:12:31 meh. 16:12:37 python, C, and Go for me. 16:13:53 imode: python is fine too for many purposes 16:27:44 -!- kritixilithos has quit (Ping timeout: 260 seconds). 16:30:19 -!- grumboo has changed nick to grumble. 16:51:24 forget C-likes 16:51:27 use sed 16:52:01 I tried. 16:52:11 -!- kritixil1thos has joined. 16:52:58 I tried rust but gave up on it after a while 16:53:59 rust .so's crash on reload 16:56:04 it does have good docs tho 17:09:42 -!- clog has quit (Ping timeout: 268 seconds). 17:22:58 simple yet functional Forth dialect? 17:23:06 with emphasis on ease of parsing 17:23:31 anything will suffice as long as you can perform basic stuff and it's not so hard to parse/implement 17:26:05 kspalaiologos: forth has "dialects" by way of definitions, not inherent language features. I have a forth-like that compiles to C and also has an interpreter. 17:26:22 how long is the interpreter? 17:26:46 369 lines of python. 17:27:13 the compile-to-C stuff is even shorter, summing at around 100 lines. 17:27:21 iirc, anyway. 17:27:25 Soni: how much of a compiler from a C-lke language can you implement in sed? 17:27:31 that'd be fun 17:27:34 compiling C with regexes 17:28:55 scratch that, the compile-to-C stuff is 230 lines, with the preprocessor being 88 lines of python. 17:29:21 I minimized it earlier. 17:32:23 kspalaiologos: the underlying language kind of looks and behaves like brainfuck. the interpreter implements 44 instructions, and that includes a semi-janky preprocessor. 17:32:38 75% of these instructions aren't really required. 17:32:50 the underlying language kind of looks and behaves like brainfuck - I blindly take it 17:32:59 open source? 17:33:35 https://repl.it/repls/ImpressiveMagentaDestination 17:33:41 here's the interpreter. 17:34:50 https://hatebin.com/manaefqdti here's a prefix expression evaluator. 17:35:07 complete with variables. 17:35:25 why did you bundle the macro preprocessor in 17:35:34 convenience. 17:35:42 the language looks way more fun than stinky macros 17:36:16 mainly because I didn't want to type ,$1,$?]:$~$[. over and over. 17:36:22 for `else`. 17:36:53 feel free to remove the macro system. 17:37:00 it's just an instruction. 17:37:06 you don't have to use it. 17:39:43 ok guys 17:39:50 where the frig do I start with language design 17:39:52 I'm adding concurrency to the language as well kspalaiologos. 17:40:03 Should I follow some online course? 17:40:07 lf94: think about the thing you want to write. figure out how to write it. 17:40:29 lf94, dragon book 17:40:37 look at some simple languages like B 17:40:48 and try writing a lexer, parser and a -O0 codegen for it 17:41:10 you may start out with lex + yacc 17:41:24 nothing needs to involve those tools. 17:41:29 sure 17:41:33 I want to learn proper language design 17:41:33 but it's a good idea to use them 17:41:38 Not just off-my-seat stuff 17:41:40 ^ doesn't matter at all 17:41:40 "proper language design". 17:41:46 hahaha. 17:41:48 when you write parser by hand 17:41:51 that's funny. 17:41:53 you are going to do it wrong 100% 17:42:02 just use the ready tools as you start off 17:42:04 Why is that kspalaiologos 17:42:08 cus you gonna die with painful death soon 17:42:17 I will use lex + yacc if that's what's typically doen. 17:42:18 I speak from my experience 17:42:19 no, please, write a parser. it's entertaining. 17:42:29 ^ he probably doesnt know all the theory 17:42:33 My goal is simple core + type system. 17:42:37 pardon me fuckboy? 17:42:48 he has no idea how to describe syntax, what is EBNF, what type of parsers there are 17:42:49 I 17:42:54 'm speaking about lf94, not you 17:43:03 lmao I'm just kidding. 17:43:19 You describe syntax with EBNF dont you? 17:43:27 sure 17:43:29 you can describe it, yeah. 17:43:35 single pass, multi pass, etc parsers 17:43:43 there's a pretty wide gradient with how complex language syntax can actually be. 17:43:58 some just require bare tokenization, like forths. 17:44:12 others are based on involved grammars. 17:44:32 all parts of the gradient are valid, it just depends on what you value. 17:45:06 starting in language design usually has someone ask "what do you value in a programming language?" 17:45:35 so, what do you value, lf94. 17:46:11 I value a language which can map to assembly nicely 17:46:30 It must have lambdas / anonymous functions 17:46:40 It must have first class for list operations 17:46:56 lisp x lambda calculus? 17:47:01 very easy one to lex and parse IMO 17:47:08 It must not be garbage collected 17:47:16 that can be anything from a forth to a C dialect to picolisp. 17:47:34 It will be more like APL 17:47:41 forth-like it is, then. 17:47:43 ah yes 17:47:49 the C dialect 17:48:00 I remember myself writing C89 compiler targeting brainfuck lol 17:48:35 when designing a language it's important to keep the "semantic gap" in mind. 17:48:53 i.e how far away on the abstraction hierarchy are you away from the bottom or the top. 17:49:01 I optimize for a small gap. 17:49:34 I want a systems level APL-like language. 17:49:44 Also: https://meta.stackexchange.com/questions/25840/can-we-stop-recommending-the-dragon-book-please lol 17:50:06 so when you're talking about anonymous functions, etc. that's a reasonably high level language feature. but you also want it to map to assembly.. 17:50:27 I mean it all boils down to assembly anyway, no matter the language. 17:51:01 I have anonymous functions. but because I value a small semantic gap as well as making multiple language features pull double duty, they're implemented as something more general: concurrently executing processes. 17:51:48 list comprehensions I think will be a prime piece of my language 17:51:48 and because of that small semantic gap, translating that to assembly is pretty trivial, involving minimal boilerplate. 17:51:59 why do you value list comprehensions. 17:52:13 Because they allow you to generate lists in a very precise way. 17:52:21 wait until you see dictionary comprehensions. :P 17:52:23 And all programming is just manipulating lists on some leel. 17:52:33 well there are monad comprehensions too. 17:52:36 It's all the same shit 17:52:54 But imagine...a byte, 0x39, is also just a list. 17:53:07 any language can have list comprehensions because list comprehensions aren't that 1. complex or 2. valuable in some scenarios. 17:53:21 [x & 0x1; x <- 0x39] 17:53:30 AND bitwise op on all bits of 0x39 17:55:02 It should be a language where everything is a list/string/sequence 17:55:05 wouldn't... that just be 0x39 & (~0) 17:55:17 yes, but in your case, you are specifically working with 8-bit byte 17:55:21 now how do you 9 bit? :) 17:55:28 it's an upcast. 17:55:32 you change nothing. 17:55:37 [x & 0x1; x <- 0b111011101] 17:55:43 ~0 = 111111..... 17:55:45 I just specify 9 bits 17:56:13 next 17:56:18 like I said, try it in C with various types. 17:56:26 imode: how do you split 101 out the middle? 17:56:30 you don't have to change anything. so I don't see your point. 17:56:38 1101 let's say (more unique) 17:56:40 what do you mean "split 101 out the middle". 17:56:47 111011101 17:56:55 X1101XXXX 17:56:57 that 17:57:04 what, you just want that section? 17:57:08 yea 17:57:36 > upcast 17:57:38 error: 17:57:38 • Variable not in scope: upcast 17:57:38 • Perhaps you meant one of these: 17:57:39 > and 17:57:40 <[Bool] -> Bool> 17:58:02 (0bX1101XXXX >> 4) results in 0bXXXXX1101. 17:58:12 But you cannot do that in C 17:58:19 uh, yeah. you can. 17:58:23 You can specify 9 bits? 17:58:37 I can't specify 9 bits. but I can use a 16 bit value. 17:58:55 Maybe that is better... 17:58:58 X) 17:59:25 like I get it, it'd be interesting if you could work per-bit. but you can easily build this kind of stuff in any given language. 18:00:14 I can build custom control flow structures for it in mode, for example. 18:00:40 $1234 for each-bit to-string display repeat 18:01:22 each-bit extracts a bit. to-string converts that bit to a string. display displays the string. 18:01:30 the `for` is just aliased to `begin`. 18:02:20 How would each-bit work 18:02:33 gets an index or somethnig? 18:03:11 Man maybe I should just start implementing a lisp 18:03:14 well, my language is a forth-like, and as such assumes some state that each word (function, if you like) takes as input, changes, and then returns as output. 18:03:37 Compiled lisp that targets LLVM IR 18:04:07 Then add ad hoc type system 18:04:08 so if we expect the source number to be on top of the stack/head of the queue, we can say at every iteration, we duplicate it and bitwise AND it with 1. 18:04:22 until the number is zero. 18:04:33 to me type system is so important these days, for anything sane 18:04:42 How would mode add a type system? 18:04:55 how would a forth add a type system? 18:05:11 there's a lot of ways you can do it. look at Factor for an example. it's statically typed iirc. 18:05:26 whoops, nope. it has strong dynamic typing. 18:05:34 https://en.wikipedia.org/wiki/Factor_(programming_language) 18:06:37 ah yes 18:06:47 clicking on stackexchange link showed me that my rep bumped by +200 18:07:23 https://codegolf.stackexchange.com/a/191482/61379 18:07:31 a lot of effort and processing power has been put here lol 18:09:23 imode: I've looked at Factor too. 18:09:31 Man plang theory is so fucky. 18:09:52 "forth is good" "NO FORTH IS BAD" "forth is bad..." "wait, no, this person is convincing me otherwise again" 18:10:52 oh also, 18:11:21 UM-32 and GML have a lot of independent implementations, but don't use that as a heuristic for what's going to be useful 50 years from now, 18:11:38 because most of them have already fallen off the web, and even the ones that haven't have probably bitrotten away 18:11:58 oh right, postscript 18:12:00 did we mention postscript? 18:12:09 that's also a candidate, though not a very good one 18:12:10 imode: can forth be compiled 18:12:18 lf94: sure. mine is. 18:12:24 directly to C. 18:15:42 lf94: wanna see the for each-bit thing in action. 18:16:22 Not right now :) 18:16:23 https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blob;f=extra/spheres/spheres.factor;hb=HEAD 18:16:35 This is like some C mix 18:18:17 https://hatebin.com/agluuirids 18:19:10 https://repl.it/repls/UnfoldedBaggyPiracy here it is, compiled and run. 18:19:42 lemon! 18:19:44 darn it 18:19:49 I knew I was forgetting to buy something 18:19:53 I should have bought lemons 18:19:58 for fresh lemon juice on the fish 18:22:38 did I just get the joke? 18:24:39 for any iteration, the queue looks like . you can do anything with the bit, including accumulate it, but at the next iteration, we expect the source-number to be at the head of the queue. 18:24:56 computing the sum of all the bits is pretty easy. 18:26:45 I've got an algorithmic question 18:27:10 i've got given a std::vector of two integers 18:27:22 the integers are aranged in pairs 18:27:32 std::vector> ? 18:27:36 yes. 18:27:39 neat. 18:28:06 now, I have to assign number to these integers, so the ones in pair have unique numbers whether it's possible. 18:28:33 what is the most efficient way of calculating how many ways are there to do that? 18:28:35 can't seem to parse that, can you rephrase. 18:28:49 calculating permutations of pairs? 18:28:58 let's do it the other way 18:29:05 let's assume the number is a person 18:29:11 we have a vector of couples 18:29:32 -!- FaeFly has changed nick to FireFly. 18:29:38 now, we have to assign some character trait to each of these 18:29:45 so the ones in couples have different character traits 18:30:06 let's assume all the people are polygamic so one person can have multiple partners 18:30:24 how many ways are there 18:30:46 to assign a different character trait for each person, so the people in couples have different character traits, when possible? 18:31:09 I don't know what "character traits" are but this is a permutation problem. 18:31:39 it's just a feature of a person 18:32:25 you're handed a set of pairs. form a set of people from those set of pairs. then calculate all possible pairings of two people. 18:32:53 n choose k. 18:33:08 https://stackoverflow.com/questions/18859430/how-do-i-get-the-total-number-of-unique-pairs-of-a-set-in-the-database 18:33:23 kspalaiologos: character traits? like that crazy template argument to std::string in the C++ standard library? 18:33:23 huh, I don't think this is the case 18:33:33 b_jonas, no lamo 18:33:35 *lmao 18:33:53 no ordering, no repeats means n choose k. 18:33:56 let's look at this example 18:34:03 assume the following couples 18:34:16 A B, B C, A C, C D 18:34:26 now, if we had three possible character traits for these 18:34:33 there are 12 ways to assign them to these people 18:34:50 so it's really a triple. 18:35:01 we can also have ten character traits 18:35:04 or twelve 18:35:11 also I should have fried the fish on a higher temperature 18:35:12 but it's a triple. where the third element is a list. 18:35:51 now I don't really understand 18:36:00 n!/k!(n - k)! 18:36:11 but segmented. kind of. 18:36:20 in which way segmented? 18:36:32 can you point me to a formula that can calculate the result of example I've given? 18:36:38 you want all possible triples of (X, Y, Z). 18:36:40 I'll figure out reest myself 18:36:50 X and Y are a couple, Z is a character trait. 18:36:59 each of these has a character trait 18:37:00 -!- kritixil1thos has quit (Ping timeout: 260 seconds). 18:37:09 and if there is a couple, its best when they have different traits 18:37:12 you are underspecifying your problem. 18:37:19 explain it in clear language. 18:37:20 I have specified it before 18:37:32 alright, again 18:37:43 I've got a set of pairs 18:38:00 I have to assign a number to each element of every single pair 18:38:20 i have to calculate, how many ways are there, to assign them 18:38:26 with a few gotchas 18:38:49 do you want duplicates. 18:38:56 a) in a pair, it would be the best, if every element has different number 18:39:01 b) pairs don't repeat 18:39:31 c) there is actually given upper limit for a number to assign 18:39:42 (with a set of pairs, obviously) 18:39:55 let's review these pairs 18:39:59 A and B is the first pair 18:40:04 B and C is the second pair 18:40:09 A and C is the third pair 18:40:09 so the possible combinations of n items arranged into k sets is n!/(k! * (n - k)!) 18:40:40 10 items arranged into pairs is 10!/(2! * (10 - 2)!) 18:40:43 ^ are you following the rule that items in a pair should get different numbers assigned? 18:40:52 also, you're given the number of pairs 18:40:54 I'm just presenting n choose k. 18:41:08 you just need to calculate how many ways are there to assign number to each element of pair 18:41:33 here's a better question: where did this come from. 18:41:43 is this some kind of programming challenge. 18:41:59 it sounds almost like a math puzzle. 18:42:05 not a programming challenge per se, I just need to get better algorithm on my hands 18:42:05 for undergrads. 18:42:12 because the one I've got isn't quite right 18:42:19 and takes way too long to execute 18:42:34 well whatever it is it's not so much an algorithm moreso an expression of the variables that make up your problem.. 18:43:12 so each pair has two people in it, and each person gets assigned a number, but the numbers have to be different. 18:43:24 both within the pair and outside the pair. 18:43:47 so A = 1 and B = 2 holds regardless of who A and B pair up with, right. 18:44:29 in which case you still have n-choose-k because A and B can just be labeled with unique numbers. changing the names of the items of each pair doesn't change the problem. 18:44:53 so how do I use this in my algorithm, because I'm pretty much lost now 18:45:42 four given pairs, AB BC AD CD, and I may assign to every leter a number from 1 to 3 18:45:51 kmc: as long as you limit yourself to ASCII x86 instructions, sure why not 18:46:05 how do I calculate how many ways are there to do that, given that people in pairs need to have different numbers 18:46:09 count the number of unique people in your vector of pairs (add them to a set and compute the count of elements in the set), then feed that into count!/(2! * (count - 2)!) 18:46:21 where ! is factorial. 18:46:21 ever heard of a certain "executable paper"? 18:46:28 alright 18:46:30 [[THCA]] N https://esolangs.org/w/index.php?oldid=66910 * Moon * (+421) Begin page. Need to build a few templates 18:47:58 it may be different but that's at least a starting point. 18:48:16 I'll think about it 18:48:32 because I'm still unsure as to the results you want. 18:48:39 -!- FreeFull has joined. 18:49:47 given AB,BC,AD,CD, assign a number to each letter such that, when each letter is substituted for its number, the pair is unique (i.e no pairs like (1, 1)). 18:49:53 is this closer to the thing you want. 18:50:00 yeah 18:50:12 and I need to calculate amount of ways a number can be assigned to them 18:50:17 alright, then what I gave you doesn't work. 18:50:38 and the maximum number to assign is given 18:50:57 so you have your set of labels, the set 1 to N, where N is your given. 18:51:03 and you have your set of pairs. 18:51:18 yes 18:51:39 can two letters have the same number but be in different pairs. 18:52:21 e.g. pairs: AB CD, then yes, A=C=1 B=D=2 is a valid solution 18:52:40 that complicates things a bit. 18:53:02 [[Template:TernTrue]] N https://esolangs.org/w/index.php?oldid=66911 * Moon * (+162) Ternary True 18:54:34 [[Template:TernUnkwn]] N https://esolangs.org/w/index.php?oldid=66912 * Moon * (+165) Ternary Unknown 18:54:44 the stupidest thing that could possibly work is brute force search. 18:54:53 have you tried that. 18:54:57 yes 18:55:04 unsatisfying results 18:55:04 can I see some code. 18:55:17 [[Template:TernFalse]] N https://esolangs.org/w/index.php?oldid=66913 * Moon * (+162) Ternary False 18:55:24 I'll send you over when I get to the PC I've been using 18:55:32 sure. 18:55:41 lf94: What sort of opinion do you want? 18:55:42 this problem has more than likely been solved somewhere before. 18:56:16 shachaf: Do you think Zig is a viable long term lang? 18:56:28 ^ heard about it 18:56:36 no. 18:56:39 yet can't help, I don't know zig 18:57:05 I think Zig is going in a promising direction? I like a lot of the things they're doing. 18:57:10 universal long-standing concepts need to be simple enough and popular enough to withstand erosion by time. 18:57:23 zig has none of those characteristics. but it is nice. 18:57:58 I don't know what the question means. Certainly Zig is (rightly) pretty volatile right now. 18:59:54 imode, any ideas? 19:00:05 if none, I'll just settle on my bruteforce probably 19:00:09 -!- kritixil1thos has joined. 19:00:32 kspalaiologos: let me get back to you on that. 19:01:01 yeah, sure 19:01:56 I'm sure this problem has a name somewhere. 19:02:12 wait. 19:02:17 isn't it just graph coloring. 19:02:40 it could be 19:02:42 https://en.wikipedia.org/wiki/Graph_coloring 19:02:50 yeah lol 19:02:52 thats it 19:02:54 draw out the pairs as a graph, change the numbers to colors. 19:03:07 thank god for doodle paper. 19:03:49 well there you are. you're looking for the possible colorings of a graph. 19:03:56 doodle paper? 19:04:00 what's this 19:04:06 yeah I have a notepad that I just sketched your problem out on. 19:04:59 -!- clog has joined. 19:06:26 [[Template:Tern2InLogicTable]] N https://esolangs.org/w/index.php?oldid=66914 * Moon * (+376) 2 Input Logic Table 19:10:19 [[THCA]] https://esolangs.org/w/index.php?diff=66915&oldid=66910 * Moon * (+177) AND table. 19:13:42 so I need to calculate chromatic polynomial. 19:13:51 I shouldn't have slept at math lessons 19:16:48 [[THCA]] https://esolangs.org/w/index.php?diff=66916&oldid=66915 * Moon * (+9) 19:19:27 -!- oerjan has joined. 19:28:40 -!- MDude has quit (Quit: Going offline, see ya! (www.adiirc.com)). 19:30:08 [[THCA]] https://esolangs.org/w/index.php?diff=66917&oldid=66916 * Moon * (+21) 19:33:03 -!- imode has quit (Ping timeout: 264 seconds). 20:07:45 -!- kspalaiologos has quit (Quit: Leaving). 20:12:19 -!- kritixil1thos has quit (Quit: leaving). 20:18:00 It must have lambdas / anonymous functions It must not be garbage collected <-- i have the impression combining those two features is particularly hard 20:19:06 because once anonymous functions are first class, deciding life time becomes undecidable without GC 20:23:05 oerjan: deciding the lifetime is undecidable period. garbage collector is just the generally accepted good approximation that we accept, in taht you have to write your program such that it doesn't take consume much memory if you keep everything that a mark-and-sweep garbage collector couldn't prove unused 20:24:10 what strategy C++ uses to work with lambdas’ lifetimes? 20:24:16 so now if you write programs in certain ways, you have to explicitly mark some references as weak or as weak-keyed for the gc to be able to free stuff up 20:25:18 -!- Phantom_Hoover has joined. 20:28:52 oerjan: GC is totally optional, you can run out of memory instead. 20:29:27 or require more help from the program than you need with a GC 20:29:29 thanks nitpickers 20:29:50 you're not wrong 20:31:15 but anyway, i think my point was that without GC it's going to need a far more technical solution to even get close, which lf94 probably doesn't want to implement 20:31:30 maybe lambdas are a mistake 20:31:32 :v 20:31:50 lambdas are good 20:33:50 named lambdas are just functions :v 20:35:48 sure, scoped function definitions and first-class functions are not much worse 20:42:06 (and still need GC) 20:44:04 how does C++ treat closures’ lifetime? 20:45:12 as it doesn’t have a default GC, does it try something else to leak memory in these cases less? 20:45:26 Why would it leak memory? 20:46:06 C++ lambdas are just a function together with an autogenerated struct. 20:46:22 The struct can either have copies of things you capture or pointers to them. 20:48:18 hm maybe I ask not what I mean to ask 20:49:03 ask not what you mean to ask, but what your ask means 20:49:09 let’s say, are lambdas in general different? 20:49:27 from the kind one has in C++ 20:51:47 s/lambdas/closures 20:52:26 hm I should logread that tomorrow 20:55:44 13:28 < int-e> oerjan: GC is totally optional, you can run out of memory instead. 20:55:47 https://groups.google.com/forum/message/raw?msg=comp.lang.ada/E9bNCvDQ12k/1tezW24ZxdAJ 20:56:37 arseniiv: at a broad conceptual level C++ lambdas (and Rust lambdas, which are very similar) are like lambdas in other languages 20:56:42 they can be called, they have captures 20:57:00 since these are languages with explicit memory management, things can be captured by value or by mutable or immutable reference 20:57:14 (by value meaning by move or copy, depending) 20:57:40 in Rust the lifetime of reference captures is checked by the compiler. so you cannot return a closure which refers to something on the stack of the function which made it 20:57:57 in C++ of course there is no such checking and that would be undefined behavior (perhaps the compiler can warn in some simple cases, but it's not guaranteed) 20:58:10 the unusual thing about lambdas in these languages is that they use static dispatch by default 20:58:25 a function that takes a closure will have a generic/templated type 20:58:44 template void use_closure(T closure) { ... closure(); ... } 20:59:05 when you call use_closure([]() { ... }) 20:59:46 it makes a struct type for the lambda, containing its captures (nothing in this case), implements operator() for that type, and instantiates the templated use_closure() at that type T 21:00:21 that struct type cannot be named, which is why 'auto' is not only a convenience in C++ but is essential 21:00:41 there are no function pointers involved in calling a lambda this way, and the lambda body can be inlined into the function it's passed to, and all sorts of optimizations performed 21:01:05 and that's why you can make a chain of higher order functions like map, filter, etc. and it compiles down to a flat loop (if the compiler is smart enough) 21:01:08 very cool 21:01:20 in Rust you'd do fn use_closure(closure: T) 21:01:33 which is basically the same except that Rust has a trait system so you can say that the type T must be a function taking and returning nothing 21:01:39 you could also have Fn(int) -> char 21:01:51 now there is another tricky thing 21:02:07 kmc: right. and the drawback is that, unless you write the both standard library and the compiler in tricky ways to optimize this, you'll end up with twenty copies of the red-black-tree rebalancing function compiled into your binary 21:02:15 and ten copies of a mergesort 21:02:27 when the closure is created, you can move non-copyable types into the closure 21:02:33 but when it's called, can you move them *out*? 21:02:38 this is why Rust has Fn, FnMut, and FnOnce 21:02:48 when called they take &self, &mut self, and self, respectively 21:03:02 so FnOnce can move out of its captures (and therefore such a closure can only be called once) 21:03:17 FnMut can mutate its captures, Fn can only read them 21:03:30 C++ has a similar thing but it's too arcane for me to remember 21:03:43 now this is all well and good but sometimes you *want* dynamic dispatch 21:04:01 fortunately this can be done using each language's respective dynamic dispatch features without anything particularly special to functions 21:04:43 in C++ every lambda's type is a subclass of std::function so you can upcast &my_unnameable_lambda_type to &std::function and pass that pointer around 21:04:50 in that case operator() is a virtual call 21:05:03 C++ has a similar thing but it's too arcane for me to remember => yeah I heard something about lambdas which could only read their arguments in C++ 21:05:03 kmc: no, that's not how std::function works I think 21:05:04 in Rust you use the "trait object" feature which, again, creates a vtable 21:05:11 in C++ 21:05:11 b_jonas: isn't it? 21:05:20 well, I'm not really sure 21:05:26 because I don't use std::function in C++ 21:05:33 okay 21:05:37 so why did you say that 21:05:49 Converting to std::function does a heap allocation, right? 21:06:00 shachaf: I think so, yes 21:06:08 but you can also use it by reference without that? 21:06:12 i'm not totally sure 21:06:15 I may be wrong with what I said above 21:06:20 Man, all this C++ nonsense is nonsense. 21:06:31 in Rust you can make heap-allocated trait objects as well as by-reference ones 21:06:39 also what's the benefit of writing map and filter instead of for and if 21:06:44 shachaf: no, not necessarily, in modern libstdc++ it has like one or two pointer of space reserved in the std::function itself, and if the function object fits there then it won't allocate 21:06:48 Box vs &dyn MyTrait 21:06:50 like how std::string is implemented these days 21:06:53 b_jonas: yeah 21:07:08 but without where std::string is now no longer trivially swappable 21:07:17 Box is like C++'s std::unique_ptr so it has automatic, deterministic deallocation but can't be copies 21:07:29 without the drawback where std::string is no longer trivially swappable or trivially move-assignable 21:07:43 it has to check if it has to rewrite a pointer that points inside itself 21:07:47 Rust also has refcounted types, the cool thing there is that there are both thread-local and multithreaded versions, the former is faster, and the compiler will error if you try to share them between threads 21:07:51 so that's pretty neat 21:08:05 whee 21:08:09 infodump 21:08:18 -!- myndzi has joined. 21:08:23 shachaf: if you want a real puzzle try making an exception-safe variants library in C++ without heap allocation 21:08:31 kmc: and they both work with heap-allocated arrays, with the help of some cleverly hidden magic 21:08:31 exceptions are scow 21:08:41 dynamic length arrays that is 21:08:46 -fno-exceptions 21:09:24 oh, I had a weird dream by the way 21:10:08 What are variants, and what's a variants library? 21:10:20 I dreamed that I found a case where using exception throwing and catching is actually useful, not because I have to interface with a preexisting library whose interface involves exceptions, but because that's intrinsically what the control flow was like 21:10:24 shachaf: sum types 21:10:25 shachaf: tagged unions 21:10:34 yeah, sum types 21:10:39 Why would that need heap allocation? 21:10:55 It's just some data. 21:11:32 kmc: can you take the C++ standard library route where if an exception is thrown then the variant can end up empty even if an empty branch isn't declared, or do you want a variant that does double-buffering? 21:11:42 b_jonas: that's one issue yes 21:11:50 kmc: and how exception safe do you want? can move assignment or swapping throw too? 21:11:59 shachaf: for one thing there is trickery when you change the type and the constructor of the new type throws 21:12:02 i don't know 21:12:10 chris was explaining why it's so tricky and he convinced me at the time, but i forgot the details 21:12:13 anyway, bbl 21:12:15 <3 21:12:16 this is why i use c 21:12:23 see you kmc 21:12:55 all the c++ trickery is a self-made problem 21:13:03 you gotta sfinae the recursive templates 21:13:48 shachaf: can you do that in constexpr land yet? 21:17:26 shachaf: anyway, C++ used to be hard, but it's almost solved now. we just need these few more language extensions into the standard and then it will be a very easy to program and versatile language where you can just write programs naturally 21:17:48 :D 21:17:57 Whew! 21:18:05 the essence of c++ is something like creating worse problems so you can pat yourself on the back for coming up with more complicated solutions 21:18:52 olsner: oh, as in "I know, I'll just use C++! Now he has two problems." 21:19:13 . o O ( plus 1 for every language revision ) 21:34:17 lol 21:42:55 -!- imode has joined. 21:45:15 * oerjan spots a myndzi 21:45:31 `? myndzi 21:45:32 myndzi used to keep us all on our feet. 21:45:37 ^celebrate 21:45:37 \o| c.c \o/ ಠ_ಠ \m/ \m/ \o_ c.c _o/ \m/ \m/ ಠ_ಠ \o/ c.c |o/ 21:45:47 looks a bit defunct, though 21:58:30 hmm, which bot went with that 21:58:50 oh 22:03:36 \o/ _o_ 22:06:50 -!- Phantom_Hoover has quit (Ping timeout: 276 seconds). 22:08:05 a thought just occurred to me. 22:09:28 to do iteration through something, all you have to do is 1. spawn a process and send your ID to it. 2. send your collection to the process. 3. drop the handle to the process. 4. `receive` in a loop. 22:09:52 the generating process can send you data, but you can't send data to it. 22:10:00 but you don't need to. 22:10:11 interesting. 22:47:50 `pbflist 22:47:51 pbflist: shachaf Sgeo quintopia ion b_jonas Cale kmc 22:48:34 lol 23:11:35 shachaf: please use an url with pbflist, because afterwards it's hard to tell which strip came out when and so hard to tell whether a strip has been listed yet 23:11:45 right now you probably mean https://pbfcomics.com/comics/the-treat/ 23:17:57 in fact... you could probably define a `bitvector` word that takes a number and, upon request, sends you back the next bit in the number... 23:18:50 I'd rather not, but I can refrain from pbflisting at all 23:46:07 eep, sub-zero forecast 23:46:28 @metar KOAK 23:46:28 KOAK 012253Z 30008KT 10SM CLR 22/M01 A3010 RMK AO2 SLP194 T02171011 23:52:25 . o O ( sub zero is a no-op ) 23:54:44 -!- b_jonas has quit (Remote host closed the connection).