00:11:38 -!- asteriska has joined. 00:12:02 i died was there any developments 00:12:20 cant remember who it was i spoke to 00:15:53 wanted some help making a sane interpreter for hanoi love, or a way to run original quickbasic code in a browser 00:16:11 https://esolangs.org/wiki/Hanoi_Love is the link 00:17:17 any good base languages to start in? i see rust, cpp, java, and ruby fairly frequently used, along with javascript 00:17:47 realistically i havent really programmed before, want something to jump into and figure out, but also didnt want to doom myself 00:22:07 -!- oerjan has joined. 00:26:22 if you've dabbled with python, that's totally viable to make a small interpreter like that too 00:30:56 true, but id like to hear your opinions as well. what would you use, and why 00:34:28 hanoi love is stack based, and pretty close to the idealogy of brainfuck 00:34:40 simplistic and a small number of commands 00:35:08 well, sort of 00:42:35 Much of the computer programming I do is written in C 00:44:50 anything that draws you to c specifically? how long did it take you to learn? 00:46:40 About learning it, I don't remember. 00:47:14 About using it, well, it is common and also many other programming languages don't do some things as well 00:47:33 fair 00:48:22 what all do you tend to use it on? id like to know general use cases, from a real person instead of a broad spectrum on some wikipedia entry 00:51:04 Well, I wrote many programs (including some are incomplete), including NNTP client, picture processing, game, etc. 00:51:27 Sometimes I also use PostScript, and sometimes other programming languages, but mainly C 00:51:47 any experience with ruby? ive heard good things about it 00:52:41 I have not used Ruby (except maybe once to modify an existing program, although I don't really remember) 00:53:37 ah, i see 00:54:29 any opinion of java? 00:55:12 I don't really like Java, although I had used it once to read a Microsoft Compound file, although now 7-Zip does that so I can just use 7-Zip instead 00:55:51 any specific reason? ive heard java was indesirable elsewhere, but i dont remember why and whatfor 01:06:56 -!- asteriska has quit (Quit: Client closed). 01:21:34 [[Truth-machine]] https://esolangs.org/w/index.php?diff=88607&oldid=88569 * GoodCoderBBoy * (+319) /* Implementations */ added AutomataF 01:27:45 [[User:Dlosc]] https://esolangs.org/w/index.php?diff=88608&oldid=85384 * Dlosc * (-32) Changed Pip link to point to Esolangs page 01:46:07 -!- Sgeo has quit (Read error: Connection reset by peer). 01:48:41 -!- Sgeo has joined. 01:59:25 -!- scjosh has quit (Quit: The Lounge - https://thelounge.chat). 02:00:44 Python IMHO is a good first language to learn, unless you are specifically after low-level projects it's not suited for. lots of intro material, easy-ish to grok, tools and libraries for many different things. 02:07:00 -!- src has quit (Quit: Leaving). 02:11:52 -!- scjosh has joined. 02:28:44 -!- moony has changed nick to cd. 02:53:21 -!- dutch has quit (Quit: WeeChat 3.3). 03:27:40 -!- cd has quit (Quit: leaving). 04:15:38 [[Special:Log/newusers]] create * Asteriska * New user account 04:20:37 [[Esolang:Introduce yourself]] https://esolangs.org/w/index.php?diff=88609&oldid=88605 * Asteriska * (+374) exist - asteriska 04:23:37 -!- cd has joined. 04:29:17 [[User:Asteriska]] N https://esolangs.org/w/index.php?oldid=88610 * Asteriska * (+220) Created page with "'''Welcome!''' This is the user page for Asteriska ( That's me! Hi. :> ) I am currently venturing into the programming language Ruby, on a quest to make a modern interpreter f..." 05:26:11 -!- delta23 has quit (Quit: Leaving). 06:47:33 fizzie: re DOS VM bot, yes, that was my termbot. I never let it on #esolangs proper, but it was in #esolangs-blah . but it can't really run QBASIC – in theory it can, but the console i/o doesn't work, because QBASIC direct accesses the keyboard and video, while my bot uses serial console, so you can only use QBASIC programs if they read and write to regular files 06:47:52 or perhaps if you edit the program to read and write serial port 06:49:46 I agree with Python being a good first language to learn programming with, but also in its current form you can't write one-liners on it, and as such it's a bit hard to teach on IRC and especially with bots. 06:50:24 as for Java, I don't know too much about it, you'll have to ask ais523 about how suitable it is in principle, and someone might be able to tell how much learning material there is available 06:50:54 asteriska: it might help if you tell what kind of toy projects you want to try 06:51:57 -!- hendursaga has quit (Remote host closed the connection). 06:52:27 -!- hendursaga has joined. 07:06:27 -!- hendursaga has quit (Ping timeout: 276 seconds). 07:07:55 -!- oerjan has quit (Quit: Nite). 07:08:49 -!- hendursaga has joined. 07:26:30 -!- ais523 has joined. 07:27:51 asteriska (for when you get back): I've taught Java as a first language to students, there are good learning resources around and it's a good starting point if you're looking for a job in Java or C# (and might also help if you're planning to go into C++ eventually) 07:28:20 but, I don't think it's an ideal place to start with programming – it requires you to learn some concepts from Java-era object-oriented programming that won't be much use to you outside the three languages I listed 07:29:12 and they're a) fairly hard to figure out relative to certain other programming concepts, although not terrible; and b) not actually a good way to think about programming 07:29:50 I don't like Python, but it was invented as a teaching language and won't be horrible for that purpose; I'd recommend moving onto something else once you've got the basics figured out 07:30:04 -!- Sgeo has quit (Read error: Connection reset by peer). 07:30:37 Rust is kind-of a high-risk option: it really forces you to learn and get comfortable with a number of low-level programming concepts, so the learning curve is very steep, but if you do manage to learn it the knowledge will be helpful in other low-level languages 07:30:46 I didn't really understand C++ until after I learned Rust 07:31:43 but my recommendation is to a) work out what sort of programming paradigm you want to be programming with in future (e.g. the Java/C#ish languages are good for getting jobs at big companies with) 07:31:57 and b) work out what sort of knowledge about programming you want to gain 07:32:00 and then pick an appropriate language 07:32:32 if you want to be working fairly difficult or low-level languages, for example, you should probably pick one to start with – it'll be harder to learn but you'll have to learn that information anyway 07:33:01 I think I would recommend against starting with C or C++, though, because they don't give good feedback when you do something wrong and thus it's hard to learn what mistakes you're making 07:35:02 actually, now I'm wondering about good options for general-purpose languages which will help you get the basics of modern-ish programming down 07:35:48 maybe Lua? that seems to have all the features I'd want in a teaching language, and it's fairly small and simple, in addition to being easy to get started with and somewhat robust due to the situations where it's used 07:35:53 although I'm not sure what the teaching materials are like 07:36:36 that said, I've heard that Lua got worse since I last looked at it (although I heard this from a somewhat unreliable source so I'm not sure whether it's true) 07:45:06 ais523: about when (what year) have you last thought Java as a first language? 07:46:17 last taught? hmm, probably around 2014 07:46:44 it's been changing rapidly since then, with lots of new features added, although last time I checked most Java-based companies were wary of using them 07:46:50 but, programming doesn't change that much in small spans of time 07:47:02 thanks 07:47:17 and yes, that is a small timespan, I thought it might be more 07:47:55 it feels like longer 07:48:22 my most recent job was writing Java, though, so my Java skills are more recent than that 07:53:11 I personally like lua from the implementation perspective, they have a solid interpreter and are one of the very few interpreters with a moving garbage collector that defines a documented C API that lets you refer to objects in the language. (the other is mzscheme or PLT-scheme or whatever they renamed it now). but I hate it from the language user's perspective. Mostly hate it because of the 1-based 07:53:18 indexes; but also because of the syntax: the implicit semicolon lets you make mistakes, and the clumsy syntax makes you express easy things with long keywords. 07:53:47 so lua is decent for someone who wants to add a macro/modding language to their video game, but not for the people who write mods mostly in lua 07:54:27 Lua doesn't have implicit semicolons (in the JavaScript sense) – the syntax is unambiguous 07:54:42 like, you can shuffle around the whitespace and a program still has the same meaning 07:55:12 I actually used to write code like «x = x + dx y = y + dy» until someone told me it was legal to put a semicolon there to make it easier to read 07:55:51 x ;= dx y;= dy 07:56:07 I think the semicolons do have to go between statements if you use them 07:56:36 anyway, I agree that Lua doesn't really scale to large programs, but that isn't a property you need in a teaching language 07:56:36 ais523: yes, it's not the same as javascript where the newlines matter. but that and no semicolons exactly means you can make costly mistakes. 07:56:37 :;) 07:57:25 for a language I'm working on I'm considering a compromise, in which the language would be ambiguous without semicolons or newlines, but you still need to place a semicolon or a newline between statements anyway 07:57:31 * would be unambiguous 07:57:48 maybe even with a backslash when you split a statement across multiple lines 07:58:08 (and perhaps with an option to automatically fix files in which the whitespace has become mangled) 07:58:49 ais523: is it an alternate syntax for a yacc extension? 07:58:53 :-) 07:59:14 b_jonas: actually no; I *am* working on one of those, but the language I was talking about a few lines ago is a different one 07:59:47 or, not so much yacc extension 07:59:55 ok. I hope it's also not an alternate syntax for Analogia :-) 08:00:13 (the "x = x + dx" above reminded me of that) 08:00:17 I've been going through about 4 or 5 attempts at writing a good input language for parser generators recently 08:01:23 because I've become fed up with the existing parser generators, it's clearly possible to do better, yet people have mostly either a) dropped the idea entirely or b) moved onto combinator-based parsing which is a little nicer for the programmer but can produce very inefficient parsers 08:02:38 parser generators seem to be split into three groups nowadays: a) generalised parsers that handle any grammer, even ambiguous ones; b) LR-alikes where you need a grammar that the parser-generator can prove unambiguous; and c) PEG-based parsers, which use an input format in which all grammars are inherently unambiguous but often don't do what you meant them to 08:02:47 s/grammer/grammar/ 08:03:48 group a) is sort of the parser-generator equivalent of a scripting language; the language doesn't give you much help in debugging because anything is expected, but if you do write the program correctly you can write it very quickly, but the runtime performance is often bad 08:04:16 -!- imode has quit (Ping timeout: 245 seconds). 08:04:21 (most of these generators are O(n) best case and O(n³) or O(n⁴) worst case, and aim to hit the best case as often as possible but don't give you much guidance in doing that) 08:05:12 and group c) is universally O(n) worst case but often with a terrible constant factor, and *also* doesn't give you much help in writing correct programs because PEG is a language that makes subtle errors really easy to make (and basically only exists because it's guaranteed to be unambiguous and O(n)-parseable) 08:05:35 -!- hendursa1 has joined. 08:05:37 did you try ragel? I see it often recently 08:05:58 group b) is my favourite but it's been mostly abandoned at this point, so I was hoping to make something modern and widely usable that's more powerful than LR(1) and just as efficient 08:06:37 nakilon: that appears to be a lexer, rather than a parser? 08:06:43 idk 08:07:41 good lexers aren't as hard to find as good parsers because it's a fundamentally easier problem, there aren't tradeoffs to make between efficiency and generality 08:08:24 although, what I've really been focusing on is scannerless parsers that don't need a separate lexer 08:08:51 -!- hendursaga has quit (Ping timeout: 276 seconds). 08:09:13 I proved that LR(*) can be evaluated in O(n) time (i.e. LR but with regular-expression lookahead), and that's sufficient to write a scannerless LR parser, although I'm leaning towards a different algorithm 08:09:59 because my proof involves first running a state machine backwards across the input and recording the history of states, which is O(n) but likely to be quite slow in practice, especially if the state machine is very large 08:11:58 if anyone's interested, here's where I've got to so far: http://nethack4.org/pastebin/burlGaQaD3.html 08:12:30 the automaton is provably O(n), and capable of simulating the combined effect a lexer followed by an LR(k) parser for any k 08:12:36 but I haven't worked out how to calculate the states for the automaton yet 08:34:29 support says I'm being billed for an instance that utilizes >100% CPU core 24/7 08:34:38 but I only have one and it's at 20% 08:34:44 am I going crazy 08:38:06 will be funny if that's that glitched Chromium OS that is shown as disabled in my interface but is still running because of that lack of RAM 08:53:25 -!- brettgilio7 has joined. 08:54:27 -!- brettgilio has quit (Ping timeout: 240 seconds). 08:54:27 -!- brettgilio7 has changed nick to brettgilio. 08:55:39 -!- hendursa1 has quit (Ping timeout: 276 seconds). 08:56:17 -!- hendursa1 has joined. 09:06:58 -!- wib_jonas has joined. 09:08:23 "combinator-based parsing [...] can produce very inefficient parsers" => that, but I'm more worried that it can cause ambiguous grammars without anyone noticing, and then hard to debug problems when it parses an ambiguous input in the other of two possibilities 09:10:22 ais523: "LR(*) can be evaluated in O(n) time" => do you mean with the constant factor in the O independent of the lookahead length of the LR? 09:10:35 wait, "LR but with regular expression lookahead" 09:10:41 I didn't look ahead reading your statement apparently 09:12:14 as for the previous problem of parsers, LR(1) is a good start, but I think it can help a lot if you have extensions over the BNF-like grammar. yacc already provides one very useful one, for operators with precedence, but I was kind of thinking of other potential extensions. 09:13:40 by which I mean extensions for how to specify the grammar, the one that you'll then generate an LR(1) parser for 09:14:05 (or an optimized LR(1) parser) 09:14:16 -!- op_4 has quit (Ping timeout: 245 seconds). 09:14:37 -!- op_4 has joined. 09:16:37 I was wondering on an extension for when some rules have an optional terminator token. So in a rule, if the last symbol is a terminal, you could mark it as optional, claiming that this may cause LR(1) ambiguities, which you want to resolve against applying that rule without the terminator token, but importantly, you ask the parser generator to 09:16:37 prove you that if all those optional terminators were mandatory, then the grammar has no LR(1) ambiguities. 09:17:44 It seems like this could be done with a preprocessor that runs yacc twice, once with all the terminators mandatory to prove that the grammar has no ambiguities as yacc understands it (or at least only has a few ambiguities that you as the grammar writer know of), then generate the parser with those tokens optional. 09:18:00 but I'm not entirely sure if this makes sense. 09:19:52 plus I'm not sure if just making single terminals optional is enough, because rust has those weird syntax cases where it tries to find out which left brace after the "if" keyword ends the condition and starts the body, and you might want something to prove eg. that if you parenthisize the condition then it's unambiguous 09:20:23 to be clear I mean unambiguous as yacc understands it, not just theoretically unambiguous as a grammar, though in practice the difference rarely comes up. 09:22:29 "LR but with regular-expression lookahead [... is] sufficient to write a scannerless LR parser" => *sigh* not always. some languages like C++ allow custom multi-byte terminators for a string, where the lexer has to scan for the matching terminator sequence. 09:22:51 but I also agree that you usually want a separate lexer, even just for clarity 09:23:47 and then there's of course the classical C problem where you have to know if an identifier is a typename or not to parse 09:24:50 although I kind of wonder if that can be worked around by parsing with some modified yacc grammar despite that, then later fixing up the cases that involve a typename vs other identifier ambiguity, like (a)(b) and (a)*(b) 09:25:27 I'm not sure if C allows that, and if it does, does C++ too? 09:26:01 there are some weird cases with declarations and function type names and whatnot 09:26:13 "combinator-based parsing [...] can produce very inefficient parsers" => that, but I'm more worried that it can cause ambiguous grammars without anyone noticing, and then hard to debug problems when it parses an ambiguous input in the other of two possibilities ← I agree with this 09:26:56 in terms of precedence, I think it's an important feature to have but don't like the way that yacc does it – precedence can be implemented as sugar but yacc lets it affect the grammar directly, which can be confusing 09:27:05 err, affect the algorithm, rather than the grammar 09:28:07 re: C++'s custom multi-byte terminators, I don't consider those to have an effect on scannerless parsing because they can't be lexed with a normal lexer 09:28:50 so it has no impact on the difference between scannerless parsing and a parser+separate lexer (although, scannerless parsers should in theory be better at them, as they can do CFG-based lexing rather than regular expressions) 09:29:06 as much as I like rust's semantics, I think their syntax is terrible, though mostly not because of the parser ambiguities, but because of the terrible identifier scoping rules, and because of the ambiguity between constructors vs bindings in patterns. that latter would be really easy to improve if they just allowed empty parenthesis after any 09:29:06 0-argument constructor, because that let you disambiguate both ways. but there's hope, because they started to allow multiple incompatible syntaxes now in the same compiler, so they can improve some of the syntax later. 09:29:57 ais523: that depends on what you mean by "normal lexer". if you mean a regular expression lexer, then sure. but we're not limited to that when using yacc. 09:30:00 I agree that constructor vs. binding is a bad ambiguity (interestingly, you could mostly fix it using Rust's normal conventions for identifier case, but it only enforces them with warnings rather than at the syntax level) 09:30:10 wib_jonas: right, regular expression lexer 09:30:44 I don't know what you mean by the identifier scoping rules, though: do you have an example of what it does wrong there? 09:30:49 ais523: rust already enforces identifier case as warnings, but there are also lots of wrong-cased type names in the standard library, so that's not enough. 09:31:27 wait, why? 09:32:06 ais523: for the identifier scoping rules ... let me try to get an example, I think it was something about multiple identifiers of different kinds coming from different scopes, where the one closer to your scope should really shadow the other, but instead rust disambiguates based on which kind is valid when using it 09:32:17 ais523: mostly to match the name of C types 09:32:23 oh, u8 and friends 09:32:45 no, I can take `u8`, I actually thought that was a keyword 09:32:46 I guess i've internalised "u8" as being a keyword, and thus being able to use any case it wants, but it probably isn't 09:32:56 this isn't about u8 09:33:07 c_void and friends? 09:33:34 actually, that's really weird, why wouldn't it be called C_void? 09:33:45 the "c_" at the start isn't part of the name in C 09:33:54 those, and even worse ones in the libc crate IIRC 09:34:22 you can say that c_void is fine because the set of builtin types in C and C++ is growing slowly 09:34:36 (it's not closed; we have wchar16_t and wchar32_t as builtins now I think) 09:34:42 (and nullptr_t and more) 09:35:00 oddly, the _t suffix is reserved by POSIX but not, IIRC, by C itself 09:35:03 but I think the libc crates wraps types that are identifiers 09:35:18 at least libc isn't technically part of Rust itself 09:35:31 yes, it's not 09:39:21 u8 is not a keyword, I just looked it up 09:39:53 I know 09:39:59 I thoguht it was a keyword too 09:40:08 but later found it isn't 09:40:14 I wasn't sure until I checked 09:40:40 one thing that's been paining me with this parser generator work is trying to avoid clashes, in generated code, with keywords in the target language 09:40:48 namespacing can solve most problems, but not that one 09:41:12 my current hacky workaround is to append an underscore to identifiers, on the basis that most languages don't have keywords that end with an underscore but don't start with one 09:46:18 ais523: here's an example on what I don't like about the scoping rules: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=45fe7999658232760b1fd3ce7c578cf4 09:46:39 `factor 992654469589 09:46:40 992654469589: 993319 999331 09:47:04 note that if you define the outer struct K as a parenthisized struct rather than a braced struct, this no longer works, so it's not like structs and consts are in an entirely different namespace and you can always tell from usage which one to use 09:47:25 * ais523 looks 09:47:56 `factor 41758540882408627201 09:47:57 41758540882408627201: 479001599 87178291199 09:48:15 wib_jonas: I think that behaviour was probably borrowed from C? shadowing is separated into different lexical categories 09:48:42 but the "this isn't an entirely different namespace" is interesting 09:49:38 for posterity in the channel logs, pointed example was: #[derive(Debug)] struct K{ x: i32, } fn main() { const K: i32 = 20; println!("k = {:?}", K); let b: K = K{x: 13}; println!("b = {:?}", b); } 09:49:42 `factor 3858055874062761829426214599 09:49:43 3858055874062761829426214599: 5600748293801 688846502588399 09:50:14 ais523: yes, but in C you don't get things like parenthisized structs that apparently shadow multiple lexical kinds 09:50:30 and I'm not sure C is a good example in first place 09:50:45 I can't find the shadowing rules in the reference 09:50:48 Haskell might be better, that has three entirely separate lexical categories clear from the syntax 09:50:48 `factor 137438953490360560825792535807496799 09:51:00 or maybe just two 09:51:01 oh finally 09:51:04 137438953490360560825792535807496799: 59604644783353249 2305843009213693951 09:51:07 damn 09:51:52 nakilon: if you're just looking for primality or not, I recommend a primality tester rather than a factoriser, the numbers are starting to reach the range where factorisation is slow 09:51:56 but I'm not sure that HackEgo has one 09:52:49 I'm searching for its limits 09:52:57 let me try to see if there's an example that involves mod versus trait 09:53:03 `factor 928510396424831231988564183404743747335769 09:53:04 factor: ‘928510396424831231988564183404743747335769’ is too large 09:53:09 yeeeeee 09:53:13 `` perl -Mntheory -E 'say is_prime("137438953490360560825792535807496799")' 09:53:14 Can't locate ntheory.pm in @INC (you may need to install the ntheory module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base). \ BEGIN failed--compilation aborted. 09:53:53 \wa factorize 928510396424831231988564183404743747335769 09:53:55 Result: 68480406462161287469×13558774610046711780701 (2 distinct prime factors) 09:55:17 needs to be -Mntheory=is_prime, it seems (based on my local testing) 09:57:51 ais523: C++ has both a function and a variable named clog in the std namespace, and I still don't understand how it does that 09:58:24 complex logarithm and standard logging handle, respectively? 09:58:33 yes 09:58:41 but maybe the function is never in std, it's only in the global namespace? 09:58:44 I wonder if the function is actually a macro 09:58:46 I really don't understand 09:58:48 in ruby you have both and interpreter checks if you are appending the "()" to identifier to resolve the ambiguity 09:59:21 Perl has an ambiguity between function calls and string literals, which is a fun one 09:59:30 I think maybe the function is never in the std namespace 09:59:39 e.g. $x{shift} versus $x{+shift} 10:00:05 (works even under use strict) 10:02:32 on the other hand, I have to appreciate the rustc compiler, which is really well made and gives high quality warning/error messages that usually point you to the right issue 10:02:40 they clearly put a lot of work in that 10:03:02 well yes, perl has weird syntax 10:03:19 ``` ruby -rprime -e "p Prime.prime? 992654469589" 10:03:21 false 10:03:25 wib_jonas: in your Rust scoping example, you can actually give basically everything the same name: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=45fe7999658232760b1fd3ce7c578cf4 10:03:29 ``` ruby -rprime -e "p Prime.prime? 41758540882408627201" 10:03:39 ruby too but I gave up trying to understand that when they changed the syntax significantly between ruby 1.8 and 2.0 10:03:58 or, hmm, that somehow reverted to your version? 10:04:05 No output. 10:04:12 ais523: that looks like my version, yes. you have to click on the share button. 10:04:23 I did 10:04:33 but I basically just changed the struct field to K too, and used the const to initialise it 10:04:44 so it becomes let b: K = K{K: K}; 10:05:33 ais523: yes, but struct fields are clearly scoped, sort of like in C, so that doesn't matter as much 10:05:46 right, and scoped to the struct they belong to 10:05:53 ais523: also I think you can just write K{K} or K{...} instead of K{K: K} but I'm not certain 10:05:54 ``` ruby -rprime -e "p Prime.methods.grep /div/" 10:05:55 ​[:int_from_prime_division, :prime_division] 10:06:12 ``` ruby -rprime -e "p Prime.prime_division 992654469589" 10:06:14 ​[[993319, 1], [999331, 1]] 10:07:10 wib_jonas: you can write the former, at leats 10:07:14 * least 10:07:37 neither .. nor ... works though 10:08:09 anyway, when I define a tuple struct and brace struct with the same name, I get "note: `K` must be defined only once in the type namespace of this module" 10:08:31 which seems to be a big indication as to what Rust is doing 10:08:37 `factor -12 10:08:38 factor: invalid option -- '1' \ Try 'factor --help' for more information. 10:08:40 (that's in addition to an error) 10:08:42 haha 10:08:45 `factor -- -12 10:08:46 factor: unrecognized option '-- -12' \ Try 'factor --help' for more information. 10:08:51 `` factor -- -12 10:08:52 factor: ‘-12’ is not a valid positive integer 10:08:58 that looks better 10:09:04 ``` ruby -rprime -e "p Prime.prime_division -12" 10:09:06 ​[[-1, 1], [2, 2], [3, 1]] 10:09:23 …also, it's kind-of amazing that -- syntax works there, there's no reason for factor to be able to support it; probably the consequence of some library for command-line options parsing 10:09:37 ``` factor --help 10:09:38 Usage: factor [NUMBER]... \ or: factor OPTION \ Print the prime factors of each specified integer NUMBER. If none \ are specified on the command line, read them from standard input. \ \ --help display this help and exit \ --version output version information and exit \ \ GNU coreutils online help: \ Report factor translation bugs to \ Full documentation 10:10:14 ais523: it's in GNU coreutils, so it must support --help and --version , so it uses GNU getopt_long 10:10:15 \wa factorize -12 10:10:17 Result: -2^2×3 (3 prime factors, 2 distinct) 10:10:30 wib_jonas: I'm thinking about the semantics of non-hyphen-prefixed arguments 10:10:34 the -- convention only makes sense when those are filenames 10:10:46 or, hmm, maybe in cases like yes? 10:10:53 `` yes -- -yes | head 10:10:54 ​-yes \ -yes \ -yes \ -yes \ -yes \ -yes \ -yes \ -yes \ -yes \ -yes 10:11:01 right, so echo-alikes too 10:11:06 `` echo -- -test 10:11:06 but it doesn't hurt to just support the -- syntax everywhere 10:11:07 ​-- -test 10:11:14 (this is what I expected echo to do) 10:11:17 `` echo --help 10:11:18 ​--help 10:11:22 `` /usr/bin/echo --help 10:11:23 ​/hackenv/bin/`: line 5: /usr/bin/echo: No such file or directory 10:11:26 at least everywhere that takes options starting with a hyphen 10:11:29 `` /bin/echo --help 10:11:30 Usage: /bin/echo [SHORT-OPTION]... [STRING]... \ or: /bin/echo LONG-OPTION \ Echo the STRING(s) to standard output. \ \ -n do not output the trailing newline \ -e enable interpretation of backslash escapes \ -E disable interpretation of backslash escapes (default) \ --help display this help and exit \ --version output version information and exit \ \ If -e is in effect, the following sequences 10:11:35 ooh 10:11:42 `` /bin/echo -- --help 10:11:43 ​-- --help 10:11:52 hehe 10:11:57 `` /bin/echo -E --help 10:11:59 ​--help 10:12:10 `` /bin/echo -E -E 10:12:11 No output. 10:12:37 this isn't doing a great job as an echo command 10:13:06 also if REGEX may start with a minus, then it's (grep -e REGEX) but (grep -eREGEX) or (grep -- REGEX) also work, and so do workarounds like (grep -E "(REGEX)") if it's an egrep 10:13:17 I don't think there's any sequence of options that's guaranteed to echo the remaining arguments literally? 10:13:45 no idea about /bin/echo , I don't really use that. you'd have to look it up in the info documentation how that works. 10:14:08 `` POSIXLY_CORRECT=1 /bin/echo --help 10:14:09 ​--help 10:14:23 it's in coreutils too, so the syntax is probably documented 10:14:39 I know, I'm looking at the info page right now 10:14:40 so there are three ways to factorize numbers here: 1) factor can't negative 2) ruby is slower and harder to invoke 3) velik 10:14:57 nakilon: if you support negative inputs than the output is ambiguous 10:15:14 ais523: I think (/bin/printf %s "$yourstring") should work 10:15:18 is the factorisation of 6 (-2, 3) or (-3, 2)? (or (-1, 2, 3)?) 10:15:32 wib_jonas: yes, that's the workaround suggested on echo's info page 10:15:40 oh great 10:15:47 it's ambigous in \wa I would say 10:15:51 although the format string should actually be '%s\n' 10:15:58 but [-1, 1] is pretty much straight forward 10:16:09 though -1 isn't a prime 10:16:49 newline, right 10:17:36 \wp prime number 10:17:39 prime number -- positive integer with exactly two divisors, 1 and itself https://en.wikipedia.org/wiki/Prime_number 10:17:52 oh, man -s1posix echo suggests using printf too, and says that the only reason echo hasn't "been made obsolescent" is that it's widely used 10:18:26 (the spec allows -n to have implementation-defined behaviour) 10:18:45 printf "%s\n" isn't a drop-in replacement for echo though 10:18:51 `` echo 1 2 3 10:18:52 1 2 3 10:18:57 `` printf "%s\n" 1 2 3 10:18:58 1 \ 2 \ 3 10:19:28 and then of course there's all the workarounds like (perl -e'print"@ARGV\n"' "$yourstring") , the links of which I used on Windows 10:20:15 it being a drop-in replacement would be silly though, 'cause that would have to have all the same undefined behaviours :) 10:21:08 Riviera: well, the usual intended behaviour of `echo` is "join the arguments with spaces, then print them followed by a newline" 10:21:09 `` printf -----%s---- hehe 10:21:10 ​/hackenv/bin/`: line 5: printf: --: invalid option \ printf: usage: printf [-v var] format [arguments] 10:21:13 xD 10:21:38 and I'm not sure there's actually a standard POSIX command that does that exactly, not even echo or printf with options 10:21:51 (as wib_jonas posted above, perl can do it) 10:22:00 la () ( IFS=' '; printf '%s\n' "$*" ) 10:22:01 actually no 10:22:05 i guess, but meh 10:22:08 ais523: maybe a small shell script could do it? 10:22:13 `` perl -e'print"@ARGV\n"' -45 10:22:14 Unrecognized switch: -45 (-h will show valid options). 10:22:18 not quite sure what the problem is, you can't use the same syntax, but there's no actual problem 10:22:18 yeah, what Riviera says 10:22:20 `` perl -e'print"@ARGV\n"' -- -45 10:22:21 ​-45 10:22:31 I think Perl will treat that -- consistently though 10:22:36 huh 10:22:56 I thought perl treated -e as the last option. maybe not, because it accepts two -e strings? 10:23:00 (i'm not sure if function definitions with ( .. ) is posix, but then just nest () within {}) 10:23:05 ``` perl -e'print' -e' "hello"' 10:23:06 hello 10:23:09 yeah :( 10:23:13 that's worse 10:23:46 anyway, this is starting to convince me that -- makes sense with things other than filenames 10:27:34 `` /bin/true --version 10:27:35 true (GNU coreutils) 8.30 \ Copyright (C) 2018 Free Software Foundation, Inc. \ License GPLv3+: GNU GPL version 3 or later . \ This is free software: you are free to change and redistribute it. \ There is NO WARRANTY, to the extent permitted by law. \ \ Written by Jim Meyering. 10:27:37 `` /bin/true -- --version 10:27:38 No output. 10:27:42 there's another potential use 10:41:25 -!- velik has quit (Remote host closed the connection). 10:41:57 -!- velik has joined. 10:42:49 -!- velik has quit (Remote host closed the connection). 10:43:11 -!- velik has joined. 10:43:20 while we're at silly syntax. in HTML in the srcset attribute of an img element, given https://html.spec.whatwg.org/multipage/images.html#srcset-attribute , how are you supposed to quote an URL if its last character is comma? 10:43:56 [[BracketsLang]] https://esolangs.org/w/index.php?diff=88611&oldid=88603 * PoetLuchnik * (+13) block to subcode in c-like 10:45:32 wib_jonas: replace the comma with %2C? 10:46:12 is that guaranteed to never change the semantics actually? 10:48:37 maybe you could append a ? if there's no query segment, or a & if there is a query segment. that's not perfect either, but might work better. 10:49:23 "URIs that differ in the replacement of an unreserved character with its corresponding percent-encoded US-ASCII octet are equivalent: they identify the same resource." (RFC 3986) 10:50:19 fizzie: is comma one of those unreserved characters? 10:50:21 oh wow, I think that might answer a question I've been stuck on for a while 10:50:47 wib_jonas: appending an & isn't safe, there are multiple possible encodings for query segments and & can be semantically important with some of them 10:51:09 -!- velik has quit (Remote host closed the connection). 10:51:15 (although it's a no-op in the most common encoding, that isn't the only one in use and isn't enforced by the standard) 10:51:27 -!- velik has joined. 10:51:43 Actually, the comma is not in the set of entirely unreserved characters; that's only ALPHA / DIGIT / "-" / "." / "_" / "~". 10:51:56 ais523: yes, I know, plus I'm not even sure if all schemes of URI allow a query part when there's no question mark 10:52:08 Comma is in the "sub-delims" set, which means it depends on where the comma is, I guess. 10:53:56 who-ever invented that syntax for srcset should get a swift kick in the hindside. they could have chosen the vertical bar as a separator or something 10:54:02 \wa random 20 digit prime number 10:54:04 Result: 92847417466922372783 | Scientific notation: 9.2847417466922372783 × 10^19 | Properties: 92847417466922372783 is an odd number., 92847417466922372783 is a number that cannot be written as a sum of 3 squares. | Number length: 20 decimal digits | Number names: 92 quintillion ..., 92 billion billion ... | Prime factorization: 92847417466922372783 is a prime number. | Comparison: ≈ 2.1 × the number of arrangements of a 3×3×3 Rubik's cube (... 10:54:11 no awit, vertical bar might not be good 10:54:27 hmm 10:55:07 gotta make a shorter variant of the \wa, maybe \was 10:55:12 I guess what the RFC means is, it's possible a specific URI scheme uses ',' as a component delimiter, which means it cannot necessarily be always percent-encoded without changing the meaning. 10:55:13 though it sounds cryptic 11:02:10 I wonder if that could occur in a data: URI, with an escaped comma occuring in one of the key-value parameters after the media type 11:02:58 although that wouldn't matter for the srcset thing, where you only escape the *last* comma, since that last comma must be part of the data proper 11:04:21 data:text/html,a%2C appears to be an HTML document consisting of "a," 11:04:48 whereas data:text/html%2Ca%2C is a bad URL 11:05:00 so this does appear to be an inescapable comma 11:05:15 Actually, I'm not 100% sure whether that spec allows for an unescaped comma at all. 11:05:17 The description is: "one or more image candidate strings, each separated from the next by a U+002C COMMA character (,). If an image candidate string contains no descriptors and no ASCII whitespace after the URL, the following image candidate string, if there is one, must begin with one or more ASCII whitespace." 11:05:20 Which you *could* read to mean "if there's a comma not surrounded by whitespace, it's not actually separating two strings", but you could *also* read as saying "a comma *always* separates two strings, and it's just invalid to not have whitespace there". 11:05:57 fizzie: huh 11:06:05 that's even more scary 11:06:22 it makes more sense to check the parsing algorithm rather than the description of valid syntax for this sort of thing, IMO 11:06:57 Wouldn't that only work if there is a canonical algorithm? 11:07:21 Oh, there is one, I see. 11:08:19 Yeah, an embedded comma with no surrounding whitespace will be just collected as part of the URL. 11:09:18 fizzie: how about a comma before (the separator comma after an URL)? 11:09:19 there's always a canonical algorithm in HTML5 11:09:40 I found the spec really creepy the first time I read it 11:09:45 although that won't help 11:09:50 it's basically an entire web browser implementation in pseudocode 11:10:10 because you usually want a scale thingy between the URL and the separator comma 11:10:36 ais523: yep. 11:10:45 the HTML5 spec is like that 11:10:54 and it has an entire javascript API in it too 11:10:54 -!- velik has quit (Remote host closed the connection). 11:11:22 -!- velik has joined. 11:11:36 as in an api from (the javascript running client-side in the webpage) to the webpage content 11:12:20 \was pi 11:12:24 Decimal approximation: 3.1415926535897932384626433832795028841971693993751058209749445923... 11:14:31 ``` ruby -e "p Math::PI" 11:14:32 3.141592653589793 11:14:57 somewhat difficult Prolog question: is there a way to write a predicate for which, e.g., p(f(A,B,C), [A,C], X, Y) on input becomes p(f(A,B,C), [A,C], f(D,B,E), [D,E]) on output? 11:15:09 i.e. I want something like copy_term, but it only copies some of the variables, not all of them 11:15:23 I was hoping it would be a builtin, but I can't find one 11:15:42 so either there's some way to abuse a degenerate case of bagof, or else I'll have to write it manually 11:18:35 ais523: didn't one of the prolog implementations have a builtin for either that, or for when you specify the compliment set of variables? 11:19:18 I guess I'll have to write it manually, by iterating over it to find the free variables, then doing copy_term(f(A,B,C)-[A,C]-[B], f(D,B,E)-[A,C]-[B])) as the final step (with the [B]s unified earlier) 11:19:38 err, copy_term(f(A,B,C)-[A,C]-[B], f(D,B,E)-[D,E]-[B])), obviously 11:20:01 wib_jonas: bag_of is close but doesn't seem to be close enough 11:20:49 -!- arseniiv_ has joined. 11:20:59 -!- Thelie has joined. 11:23:05 hmm, I don't find such a builtin at a quick look 11:23:49 I think I looked for something like that when I made olvashato, and perhaps even before, to implement functions with upvalues, but then just decided I'll use copy_term and say that the upvalues must be ground terms 11:24:35 not quite ground terms, but terms with no free variables -- bound variables that are used only inside them, such as in referenced functions with upvalues, those are fine, they're renamed harmlessly by copy_term 11:25:03 right 11:26:06 can you do something like temporarily define a perdicate with asserta, with variables that you don't want to copy mentioned in the head? 11:26:42 -!- dutch has joined. 11:27:21 the iterate-to-find-free-variables approach is almost working 11:27:40 the main difficulty is just that call/9 doesn't exist, so I'm needing to create temporary structures to hold some of my arguments 11:28:34 (I'm already iterating over the structure anyway so I threw in some free variable extraction while I was there) 11:31:53 -!- velik has quit (Remote host closed the connection). 11:32:20 -!- velik has joined. 11:33:09 \wa e 11:33:13 Upper case: E (U+0045) | Name: Latin small letter E | Phonetic alphabet: Echo (ECK·OH) | "e" on a US English keyboard: (left middle finger) | Similar characters: ℮ (estimated symbol) | ℯ (script small E) 11:33:19 \was e constant 11:33:22 Decimal approximation: 2.7182818284590452353602874713526624977572470936999595749669676277... 11:33:27 \wa ꙮ 11:33:28 Name: Cyrillic letter multiocular O | Unicode block: Cyrillic Extended-B (42560 through 42655) (96 characters) 11:34:45 weird that it said it's upper case e, anyway 11:36:33 velik ꙮ 11:36:57 scared 11:37:31 It doesn't really say it's uppercase, it tells you what the uppercase equivalent is. 11:37:58 The wobsite goes "Input interpretation: e (character)", "Name: Latin small letter E", "Upper case: E", "Similar characters: ..." and so on. 11:38:11 oh indeed 11:40:47 \was random 100 digit prime number 11:40:49 Decimal approximation: 6.97799599080530032728805445398475807079187919778470343445802... × 10^99 | Result: 6977995990805300327288054453984758070791879197784703434458023173697519646764322440809193108195240417 11:42:37 \was factorize random 100 digit prime number 11:42:46 thread error 11:43:25 (parser fault) 11:45:48 ah, nope, it's because of the trailing space in my message, gotta fix 11:49:06 -!- velik has quit (Remote host closed the connection). 11:49:35 -!- velik has joined. 11:54:59 -!- velik has quit (Remote host closed the connection). 11:55:24 -!- velik has joined. 13:04:23 -!- Thelie has quit (Remote host closed the connection). 13:10:40 twitch is now opensource /s 14:13:14 -!- Sgeo has joined. 14:13:44 -!- ais523 has quit (Quit: quit). 14:34:35 yeah, the terrible kind where you can see the code but not touch it with a ten foot pole 14:35:19 (except for the 80% (I suppose) that are free software) 15:16:58 -!- Thelie has joined. 15:23:49 -!- InfiniteDonuts has joined. 15:24:32 -!- InfiniteDonuts has quit (Client Quit). 15:30:47 -!- delta23 has joined. 15:45:25 -!- Thelie has quit (Remote host closed the connection). 15:45:33 -!- arseniiv_ has quit (Ping timeout: 265 seconds). 15:58:34 -!- wib_jonas has quit (Quit: Client closed). 16:07:17 [[FlipJump]] https://esolangs.org/w/index.php?diff=88612&oldid=88579 * Tomhe * (+38) /* The Standard Library */ 16:10:23 -!- arseniiv_ has joined. 16:19:36 -!- chiselfuse has quit (Ping timeout: 276 seconds). 16:20:01 -!- benji_ has joined. 16:20:09 -!- chiselfuse has joined. 16:20:56 -!- benji has quit (Ping timeout: 246 seconds). 16:20:56 -!- benji_ has changed nick to benji. 16:21:56 -!- xylochoron[m] has quit (Ping timeout: 260 seconds). 16:21:57 -!- craigo[m] has quit (Ping timeout: 260 seconds). 16:22:57 [[Talk:Hanoi Love]] N https://esolangs.org/w/index.php?oldid=88613 * Asteriska * (+227) Created page with "I am working on an interpreter for this language in ruby. Any news on it will go here. ~~~~" 16:31:43 [[OISC]] M https://esolangs.org/w/index.php?diff=88614&oldid=87268 * Tomhe * (+86) more info on FlipJump 16:34:51 -!- src has joined. 16:38:38 -!- src has quit (Client Quit). 16:38:49 -!- src has joined. 16:44:35 -!- xylochoron[m] has joined. 16:45:39 -!- craigo[m] has joined. 16:48:52 -!- arseniiv_ has quit (Quit: gone too far). 16:51:34 -!- sprock has quit (Ping timeout: 245 seconds). 16:52:57 -!- arseniiv has joined. 17:05:56 -!- imode has joined. 17:24:46 ais523: probably doesn't help you but just in case: there's a built-in predicate term_variables/2 that gives you a list of all variables in a term. 17:28:51 Google keeps disappointing me 17:30:17 dude says I have exceeded the 720 hours month CPU quota 17:30:40 I show him CPU graph in their GUI that shows I'm <25% for at least a months already 17:30:48 and guess what 17:31:14 he says "yes, 720 = 24 * 30 but some months have more days" 17:31:37 *more than 30 17:32:10 so I've already paid for two 120 days long months in some alternative reality 17:43:24 > 360/365.2422 -- uptime 17:43:26 0.9856473320990837 17:43:34 hmm, not true actually 17:43:56 > 358.2422/365.2422 -- uptime, corrected for february always having fewer than 30 days 17:43:57 0.9808346352091845 17:46:55 So how does that really work... you buy a CPU-month of computation? And the fine print says that if you use a CPU in a particular minute, they will bill you for that minute? :P 17:47:52 (That 25% number is great but is that really what they bill you for? If you keep the VM busy it'll mean more hot data in memory which is a real cost.) 17:48:19 Or the CPU may be idle while data for your VM is swapped in. 17:48:38 Lots of reasons why this might actually end up with you being billed for 100% of that time. 17:48:53 <3 speculation 17:50:39 in the Billing interface when I chose the time span of the last half of the month I see that it applies a "360 hours discount" 17:51:09 but I'm already exceeding it because in some freaking way I've used 470 hours 17:51:41 -!- delta23_ has joined. 17:51:49 -!- delta23 has quit (Killed (NickServ (GHOST command used by delta23_))). 17:51:49 and so it already has few dollars to bill to the time of the next invoice, and the prediction is even higher for this month than for the previous one 17:51:53 -!- delta23_ has changed nick to delta23. 17:52:40 so I've migrated half of the services to another cloud and switrched the machine type to pay ZERO but in fact I've got billed in August even more than usually, even more in September and even MORE in October according to the current extrapolation 17:56:18 their Free Tier does not separate CPU from RAM -- it says "one e2-micro instance per month" 17:57:47 [[Scroll]] https://esolangs.org/w/index.php?diff=88615&oldid=87568 * MathR * (+118) 18:00:51 I'm 80% sure they are billing me for the instance that has glitched and isn't under my control 18:00:58 -!- sprock has joined. 18:01:24 so I've provided screenshot of my Compute Engine panel 18:05:51 but it would explain only a September anyway, but I was billed for August for no reason too... 18:06:12 I haven't heard of a virtual server provider that charges extra for CPU usage yet. only ones that charge extra for the amount of data through net connection. it's how they can offer such a low base price then catch you unaware. more honest model would just limit the net access (or CPU respectively) to very slow when you exceed the quota, with an option to pay for more, rather than charge you 18:06:18 automatically. 18:06:30 but the providers with the more honest models seem to have higher base prices. no surprise there. 18:06:57 GCP instead does not have charges for traffic 18:07:47 [[Scroll]] https://esolangs.org/w/index.php?diff=88616&oldid=88615 * MathR * (+4) 18:07:52 the same distinction exists for mobile internet service too. slow your internet access when you exceed the quota, versus automatically charge a horrendous price for each byte that you go over the quota. 18:09:04 there are only some bucket storage traffic limits that I won't ever exceed even if I try 18:09:52 you'd rather reach the limits of operations count if doing it carelessly 18:12:30 in fact I guess it's even impossible to utilize 720 for me because https://cloud.google.com/compute/vm-instance-pricing according to this e2-micro is limited to 25% load 18:12:57 it's another reason why it all makes no sense 18:24:26 I guess an even more evil virtual server provider could charge you extra if you accidentally allocate more hard disk capacity than is in the base price, or have more hard disk access traffic, or allocate more RAM. 18:24:32 So what's that context, this? https://cloud.google.com/free/docs/gcp-free-tier#compute 18:26:09 which is different in that 1) it sounds like 0.25 CPU-hours per hour because that's what the e2-micro instance gives you and 2) it takes the actual length of the month into account. so... weird 18:26:58 love how the egress excludes China and Australia, I wonder why. 18:27:56 int-e: probably because those have slow internet connections to the outside world 18:28:06 b_jonas: this is the difference between cloud and vps providers ;) 18:28:22 "this" being the resource-use-centric billing 19:05:59 [[Category:Stack-based]] https://esolangs.org/w/index.php?diff=88617&oldid=7904 * AceKiron * (+29) 19:06:05 [[Category:Queue-based]] https://esolangs.org/w/index.php?diff=88618&oldid=7927 * AceKiron * (+29) 19:11:12 there are websites with popular language runtimes working via webasm or smth like that 19:11:29 and there are websites to edit the code in coop, for job interviews, etc. 19:11:43 why the hell there is no website with coop editing AND the runtime? 19:13:25 Apple has "Uniform Type Identifier", I had my own idea of "Structured Type Identifier" which allows specifying multiple types and also allows parameters (e.g. to specify code page). It is not fully defined and may be changed later or abandoned, but for example "text:postscript:paged:document", "text:postscript:program", "postscript:paged:document", and "postscript:program" are distinguished. (Terms can be in any order.) 19:13:30 -!- hendursa1 has quit (Quit: hendursa1). 19:14:01 -!- hendursaga has joined. 19:14:51 It is a similar idea but I think that UTI has a few problems, such as I think it is unable to describe things like this example 19:51:17 oh wait, people say repl.it has both things at the same time 19:58:48 -!- earendel has joined. 20:26:35 -!- dutch has quit (Quit: WeeChat 3.3). 20:30:54 -!- dutch has joined. 20:57:34 -!- src has quit (Quit: Leaving). 20:58:46 -!- sprout_ has joined. 21:02:17 -!- sprout has quit (Ping timeout: 265 seconds). 21:20:31 -!- Lord_of_Life has quit (Ping timeout: 245 seconds). 21:23:01 -!- earendel has quit (Ping timeout: 252 seconds). 21:23:36 -!- Lord_of_Life has joined. 21:24:08 -!- ProofTechnique has quit (Ping timeout: 250 seconds). 21:24:08 -!- integral has quit (Ping timeout: 250 seconds). 21:24:13 -!- yuu_ has quit (Ping timeout: 252 seconds). 21:24:15 -!- j4cbo has quit (Ping timeout: 250 seconds). 21:24:32 -!- Argorok has quit (Ping timeout: 268 seconds). 21:24:32 -!- pikhq has quit (Ping timeout: 268 seconds). 21:24:46 -!- dnm has quit (Ping timeout: 260 seconds). 21:24:56 -!- mich181189 has quit (Ping timeout: 268 seconds). 21:25:05 -!- mich181189_ has joined. 21:25:09 -!- aarchi has quit (Ping timeout: 268 seconds). 21:25:33 -!- earendel has joined. 21:25:37 -!- dnm has joined. 21:26:32 -!- Argorok has joined. 21:27:38 -!- j4cbo has joined. 21:27:55 -!- yuu_ has joined. 21:28:42 -!- pikhq has joined. 21:29:18 -!- ProofTechnique has joined. 21:29:58 -!- integral has joined. 21:30:20 -!- aarchi has joined. 21:33:14 -!- sprock has quit (Ping timeout: 245 seconds). 22:37:46 -!- Asteriska has joined. 22:38:04 hello esolangs irc 22:38:18 oops i pinged the bot 22:39:44 im trying to make an interpreter for hanoi love, in ruby, on replit.com, and im running into a point where i have no clue how to get it working 22:41:21 Cool. 22:41:32 this is the spec sheet http://kidsquid.com:443/files/hanoilove/hanoi.txt 22:42:12 and this is what ive got so far https://replit.com/@foxsouns/HanoiL-Intp 22:42:33 just trying to wrap my head around it is hurting 22:42:55 this is my first project 22:44:13 maybe not the easiest haha 22:44:42 anybody have any experience to give me a hand? 22:46:46 Asteriska what does stop you? 22:47:42 logic, i guess: i cant think of a way to handle and express the stacks 22:52:45 woah, basic 22:53:23 i know: wanted to bring it to a modern lang when i first saw it 22:54:12 quickbasic runs on dos only, afaik: nobody wants to port it to js or anything haha 22:54:21 what is cleaned? 22:54:40 quick basic worked fine on Win XP at least 22:54:57 pretty sure it's supported even today, just named diffrently maybe 22:55:03 its just the proper instructions, with all else removed 22:56:01 basically i take out these: . ' , ; ` " : ! 22:56:02 so cleaned is the code? 22:56:06 yeah 22:56:23 how does stack D work? 22:56:30 *supposed to work 22:56:56 its something like the code being ran? im lost on it tbh 22:56:58 I guses you don't need \ in lines 41 and 45 22:57:52 and line 58 of reference.txt explains stack d 22:58:37 its a weird self-editing clusterfuck thing, supposedly what loops are based upon 22:59:05 I guess D is like addresses of call stack 22:59:45 but you control it manually... 23:00:45 yeah: i was hoping it'd be one of those things where its easy to implement, but hard to use, but that is not the case 23:00:54 its just hard all around 23:01:14 and basic isnt very legible, so i dont really know how he pulled it off 23:01:18 so D is like a storage of addresses for manual GOTO 23:02:06 that would make sense; if it helps ive got some of the sample programs i found in the progs/ folder 23:03:06 as I understood you ahve to store indices in D but you assign cleaned to it that is wrong 23:03:53 dang, now i have to refigure out how arrays work 23:05:27 QuickBasic works on DOSBOX on Linux 23:05:30 I don't see where is the instruction of goto, how does it loop? 23:05:39 supposedly d 23:09:24 \wa ascii 34 23:09:27 Name: quotation mark | Similar characters: ʺ (modifier letter double prime) | ̋ (combining double acute accent) | ̎ (combining double vertical line above) | ״ (Hebrew punctuation Gershayim) | , , (double prime) | 〃 (ditto mark) 23:11:19 ? 23:11:36 oh 23:11:43 thats a bot, duh 23:12:48 zzo38: i dont always have access to a linux system, and dont want a programming language's only implementation to be via a vm 23:13:04 from the basic code I suppose that , isn't fully described I don't see it 23:13:12 Using WolframAlpha to look up an ASCII character feels a little like using an to do an . 23:13:28 , is goto when we are on stack D 23:13:32 I suppose 23:13:52 That's under the "stacks" part of the spec. 23:13:59 fizzie how would you look up ascii with HackEso? 23:15:06 oh indeed 23:16:52 im figuring, have sd set to an array from 0 to the code length - 1, and go from there 23:17:45 aren't all stacks emotry from start? 23:17:49 *empty 23:18:38 excluding d, and when stacks abc are empty, they pop 1,0,0 respectively 23:19:43 one sec ive got an idea 23:19:46 Re the ASCII lookup, that's actually surprisingly nontrivial when it's a decimal number. There's many many ways to do it by hex or octal because those are available as escape sequences, but decimal usually isn't. 23:19:50 `` unidecode $(printf '\x'$(printf %02x 34)) # silly but works 23:19:51 ​[U+0022 QUOTATION MARK] 23:20:34 Of course shelling out to some oneliner-friendly programming language (awk, perl, ...) is probably the way to go on HackEso. 23:20:46 `forth 34 emit 23:20:47 ​" 23:23:43 according to the spec, the following should be equivalent to bf .[+.] 23:23:47 . , ' " ' . . . . . . ' . . , ' . . . : , . ; ' . . . . , ' " ' . . . . . . , ! . . . ; . 23:24:15 that means theres a loop there, somehow 23:25:00 let me cut it down a bit 23:25:38 . , ' " ' . . ' . . , ' . . . : , . ; ' , ' " ' . . , ! . . . ; . 23:26:49 You could say the loop part is the ..., right before the !. 23:27:54 what does it do when it reaches the last character? the . 23:28:17 thats unneeded, but it switches stacks 23:28:23 forgot to take it out 23:28:42 i just took out the bits that had 4 .'s in a row because thats redundant 23:29:36 Yeah, that trailing . would be just a leftover from the BF translation, so that the next translated instruction would have a predictable stack (A). 23:31:27 it moves to B, pops to the register, copies to stack b, pops to stdout, modes to D, copies to D, moves to B, pops to register, copies reg to b, moves to a, starts "loop", (cont soon) 23:33:39 fuck this is confusing to keep ahold of 23:34:05 The loop really started from the "copies to D" instruction. 23:34:10 yeah 23:34:33 and i assume next read from d is the goto 23:35:57 I don't understand what does ` do in Echo program 23:37:39 i assume its a part of the check for the "end at 255" claim it makes 23:38:09 because ` is sub current stack from register 23:38:25 I thought : is check for \x00 23:38:52 makes sense 23:39:16 "If a stack is empty when asked to pop a value, the value returned will be 1 for A, --" 23:39:45 for b and c, it pops 0, and d never pops 23:39:48 So the initial , from A will give 1, and then the "; will *add* the input character to that 1. 23:40:05 omg 23:40:05 So the : will be a check for 255 or -1, whichever way you want to look at it. 23:41:13 And then the ` subtracts that 1 back out so you get to print the original character. 23:41:31 in the reference, this is the comment "Echo: (Outputs back any input received. Enter char 255 to end) " 23:41:44 (The 1 is still on the stack at that point, because the ,' pushed it on there.) 23:42:25 and the program stacks only store 8bit 23:42:28 oh so ` subtracts -1 after the exit check 23:42:29 ok 23:42:35 *1 23:43:08 im assuming that the default behaviour should be loop back to 0 from 255, and vice versa 23:43:18 at least, thats the way i would make it 23:44:16 im going to stare at the basic code for a while 23:45:25 so you have sa, sb, sc, sd = [], [], [], []; instead of storing a number in it you can do something like.... st = [sa, sb, sc, sd] and then st.rotate!(1) and st.rotate!(-1) and then access the current stack as st[0] 23:45:41 its settled: i dont understand basic 23:45:57 nakilon: thats smart, im going to impliment that rq 23:46:28 -!- arseniiv has quit (Ping timeout: 265 seconds). 23:46:47 Here's an annotated echo: https://0x0.st/-EsA.txt 23:47:02 though it becomes harder to check which stack you are on to implement those different behaviours for a, b, c, d...; you would need .eql? or .equal? instead of == I suppose 23:48:08 -!- oerjan has joined. 23:49:04 or you could even store the whole instruction handler lambda attached to the stack object as the "OOP style" would suggest 23:49:32 but it would make your code deeper into ruby though 23:50:13 I imagine the choice of .',;`":! as instructions must've been a deliberate choice to be as non-mnemonic as possible. 23:50:42 I mean imagine classes A, B, C, D that are all inherited from something the same for all instrucitions but those few that are different for D are declared additionally for it 23:51:54 fizzie do you have an idea why does A pop 1? 23:52:12 So that the echo program could be so short and sweet? ;) 23:52:33 yeah that's the only eplanation I see so far 23:52:39 naikilon: theres no other way to get a 1 other than from user input 23:52:42 Oh, maybe more seriously, so that you have *something* nonzero other than the isntruction offsets. 23:52:44 that it's somehow ralated 23:53:09 oh 23:53:11 Right, you can't pop from D to the register either. 23:53:13 indeed, no literals 23:53:54 theres basically an add, a minus, a pop, a push, a switch, a modifier, and start skip and end skip 23:54:36 Asteriska forget about the rotate(), I guess it does not give a profit 23:56:14 nakilon i meant that with the "switch" term 23:56:15 line 40 will be: when ?. then st = (st + 1) % 4 23:57:16 and declare some ss = [sa, sb, sc, sd] so ss[st] will be current stack 23:59:00 nakilon: refresh, i think youre looking at an older version 23:59:09 because as it sits, 40 is a comment 23:59:25 you can take a look at RASEL implementation -- it has tests; if you throw out 99% of code ..) you could reuse it to put those ./progs into test.rb and see when they'll start passing 23:59:45 oops