***karswell` is now known as karswell
<SamanthaD>Hello, is it possible to tweak how Guile displays numbers by default? I'd like it to display all numbers in engineering notation (like scientific notation but only powers of three) and to display complex numbers in polar notation <davexunit>SamanthaD: I think the answer is "yes", but I'm not sure how, sorry. <adhoc>seems to cover the display of Exponential floats <adhoc>i've seen it done, just don't remember how <SamanthaD>now all I need to do is figure out how to tell it to default to a certain format <SamanthaD>If you haven't figured it out, I'm abusing the REPL as a desktop calculator ;) <adhoc>SamanthaD: thats what its for =) <SamanthaD>the complex numbers with polar output is for working with AC and the engineering output is to line up the numbers with the SI prefixes <SamanthaD>I've been using my TI-86 but the thing has some really frustrating output formatting 'peculiarities' when it comes to complex numbers <adhoc>all that fun with inductave and capacitive reactances huh? *adhoc has done a little of that with antenna matching <mark_weaver>SamanthaD: you can set a custom printer in the REPL like this: ,option print (lambda (repl val) (if (number? val) (format #t "~g" val) (write val)) (newline)) <mark_weaver>you probably want something different than "~g" there though. <mark_weaver>you can set it back to the default behavior with ,option print #f <mark_weaver>basically, the thing after the ",option print " should be a procedure that takes two arguments: the repl and the value, and it should print the value followed by a newline. the code that uses it in 'repl-print' in module/system/repl/common.scm if you're curious. ***Sgeo is now known as BillCipher
***BillCipher is now known as Sgeo
<naboo>does anybody could show me some examples of using guile-curl to connect with ftp? <naboo>i need to list files in directory and upload <ArneBab>SamanthaD: could you share your adaptions? Engineering notation sounds pretty useful to have. <ArneBab>(I’m also using the Guile REPL as calculator ☺) <SamanthaD>ArneBab: I'm still working on it. So far I've only found how to do normal and scientific. <SamanthaD>I have a feeling I'm actually going to have to write some kind of conditional <ArneBab>SamanthaD: you could use something else than format. <SamanthaD>since I don't think engineering notation is built into the format function <ArneBab>(explicit string formatting by hand) <ArneBab>for example figuring out the exponent with log, then multiplying up to [0.01..100). <SamanthaD>I also need to make sure it works with complex numbers <ArneBab>and showing (format #t "~fe~s" number exponent) <ArneBab>that sounds like it would be really cool to have in guile! <ArneBab>I’d guess that when you get it working for the REPL it shouldn’t be so hard to get it into guile core. <ArneBab>SamanthaD: from my experience, folks here are really helpful <SamanthaD>the same can be said for pretty much any GNU project <SamanthaD>but I haven't had a chance to really address the problem <ArneBab>(I’m not the best schemer myself, but thanks to folks here I was able to get a quite complex idea off the ground and working well enough that I can now code with it) <SamanthaD>when I realized it'd probably be non-trivial I went back to my little calculator so I could just get my work done <SamanthaD>but I definitely want to phase out that calculator. It has some /really/ annoying quirks <SamanthaD>oh yeah, that's the other annoying thing. I need to figure out how to gt guile to display complex numbers in polar notation by default <SamanthaD>I wonder if Chicken can do it. (I could peek at their code) <ArneBab>if you adjust the printer anyway, you should be able to reuse that. <ArneBab>Wikipedia says that you’d need a 6-element conditional for the angle <SamanthaD>I feel like whatever I come up with is going to be a total bodge >.< <SamanthaD>Yeah, I really like how my calculator does it except that when you throw it into engineering notation mode it engineering-notations the angle, too <SamanthaD>... nevermind that there's not a scenario in hell where exponentiating a number between 1-360 makes any sense whatsoever <ArneBab>you need three functions: one which does engineering notation, one which gets the magnitude of a complex number and one which gets the angle. Then just to string formatting, adding the angle only if it isn’t 0. <SamanthaD>... and the screen is just narrow enough where you have to scroll it to see the end with the little exponent <ArneBab>then plug that into what mark_weaver showed. <SamanthaD>(by the way, if you want to know what sent me over the edge, it's when I recorded on my work that a particular electrical signal had a phase of 250 or so degrees when in reality it was 0.250 degrees >.> <SamanthaD>and I had to backtrack to figure out what was wrong <ArneBab>I’d suggest just doing it, even if the code isn’t perfect. When I showed folks here some code I had written, the result were some improvements which made it 100x faster - but the initial code also solved the problem and without it, the later code would never have manifested. <SamanthaD>I saw the little angle glyph and 250.57 or whatever it was and said to myself "I do not care about the decimal" and never scrolled over to see the 'E-3' at the end >.> <ArneBab>intuitive notation is important, yes… <ArneBab>SamanthaD: it would be cool if you could highlight me when you got something which roughly works! <ArneBab>SamanthaD: what I found as starting points: (real-part number) and (imag-part number) <SamanthaD>I wish these calculator manufactures would release their firmware as free software so I could fix these quirks <ArneBab>having free software firmware would be awesome, yes! <SamanthaD>... besides, the stupid thing uses its own programming language which is nothing short of dreadful <SamanthaD>is it just me or does every single time anyone tries to make a programming language for non-programmers it ends up borderline unusable <gjanssens>Since I hade to leave yesterday evening before seeing an answer to my question, I'll be so free to ask it again: <gjanssens>Assume a future version of guile uses an incompatible ABI <gjanssens>For example let's assume guile 2.0 compiles scm files in a way that is incompatible with guile 2.2 <gjanssens>And I have a set of files compiled with guile 2.0 and I now install guile 2.2 <gjanssens>Will it properly detect that compiled files are no longer compatible and trigger an autocompile ? ***SamanthaD_ is now known as SamanthaD
<ArneBab>SamanthaD: well, python is pretty good at being useful for non-programmers. Though that wasn’t intended to be for non-programmers… <SamanthaD>I suppose... I've also seen Python being horribly abused ;) <ArneBab>gjanssens: I think 2.2 would have a different directory for the compiled files. The version is part of the cache dir: .cache/guile/ccache/2.0-LE-8-2.0/home/arne/wisp/1.go <SamanthaD>... actually, I'm not really a fan of its orthodox semantic style <ArneBab>I am, but I started using Guile to escape the limitations of Python :) <SamanthaD>ArneBab: By the way... are you familiar with Hy? <ArneBab>not really familiar, though I looked it. My impression was: So now I get the limitations of Python with the syntax of Lisp ☺ <gjanssens>ArneBab: thanks. It looks to me though that's only true for autocompiled files <gjanssens>I'm approaching this from the point of view of a distro maintainer <SamanthaD>ArneBab: I don't know how much Python's limitations extend to Hy. I mean... it is a lisp and as far as I can tell it has all the Scheme goodies save for tail-call optimization. <gjanssens>Where one package is shipped with self compiled scheme files and at some point the guile package gets updated <gjanssens>That could be done by to totally different maintainer, so I may not even know this has happened <gjanssens>But I would be interested to know whether such a situation would break my package <gjanssens>Or whether the new version of guile just detects the old self-compiled files are no longer compatible <SamanthaD>ArneBab: I don't know about the exact math but there's nothing stopping you from using tail-call recursion in Hy, you just have to use a special syntax like you do in Clojure. <SamanthaD>... in other words, annoying and kinda ugly but it's not a deal breaker <SamanthaD>I mean, when you really get down to it, tail-call optimization is just a compiler trick <davexunit>maybe you're right, I don't know. it just doesn't feel like the same thing. <SamanthaD>and yeah, I agree that it feels less elegant <davexunit>it's transparent in scheme, but you have to use a special macro in hy and clojure. <SamanthaD>I mean, technically you can do tail calls in C but you'll blow your stack <SamanthaD>I wish I understood why Clojure can't do transparent tail-calls <davexunit>on an unrelated note: I see a lot of news about companies using clojure these days, which is cool... but it's a shame that we had to settle for the JVM. <davexunit>I could maybe get paid to write Clojure some day, but I'll be wishing it was Scheme the whole time. <SamanthaD>I can see why they're doing it. One word: Libraries <SamanthaD>I'm actually pretty excited about Chicken, currently <davexunit>I've heard of a some companies using chicken. <SamanthaD>second is the possibility that maybe I could get it to run on microcontrollers ;) <davexunit>I just stick with guile, racket/chicken/etc. look cool, too, but I'm partial to guile. <mario-goulart>SamanthaD: I have a feeling the JVM is _why_ companies pick Clojure. :-) <mario-goulart>Wrt CHICKEN: yes there are some companies using it (the one I work for uses it). On microcontrollers: not sure if running it on microcontrollers is feasible. CHICKEN depends quite heavily on a "POSIX" environment. <mario-goulart>There is BONES, by Felix (the author of CHICKEN), which compiles Scheme -> assembly. I read it can be tweaked to generate code independent of any libc. <SamanthaD>I just did a search and Bigloo has apparently been used on micros <ArneBab>SamanthaD: yes, tail call optimization is just a compiler trick - syntactic sugar - but as the Pythonista in Schemeland wrote: When it comes down to it, everything that differenciates any Turing complete language is just syntactic sugar. <dsmith-work>Bah! I hate the term "tail call optimization". It the *normal* way of doing things. There are some cases where you need to add extra overhead. ;^) <SamanthaD>It really is an optimization though. You're performing a function call which normally involves pushing another layer onto the stack but since it's in the tail position it pops first before pushing <dsmith-work>No. It's just a goto with agurments. But sometimes you have to pass extra stuff. ***dsmith-work is now known as daletroll
***daletroll is now known as dsmith-work
<dsmith-work>sneek: later tell pallagun Did you ever get your .so issue resolved? <SamanthaD>ERROR: /home/samantha/guile:45:24: unknown character name ∠ <dsmith-work>mark_weaver: I sure wish more things supported engineering notation. <mark_weaver>SamanthaD: ah, I assumed you were using a UTF-8 locale. otherwise, you can change that to some other character. <SamanthaD>mark_weaver: That's weird... I should be using a UTF-8 locale <mark_weaver>anyway, you can just use an ASCII character or string for now, <mark_weaver>if you're running a guile script (not the REPL), then you need to set the locale at the top of the script using (setlocale LC_ALL "") <mark_weaver>are you seeing it as a single character, the angle sign? <mark_weaver>right, I remember something about that. IMO, a bogus claim :-P <SamanthaD>yup... getting flashbacks of why I started using Chicken instead of focusing on Guile a few months ago >.< <SamanthaD>"Ugh... this is a PITA, screw it. I'm gonna use this other Scheme" <SamanthaD>alright. I'll unmask it then and see if anything explodes <mark_weaver>lilypond and texmacs still need guile 1.8. otherwise you should be fine. <davexunit>so gentoo has guile 2, but doesn't allow its installation by default? <mark_weaver>any gentoo folks here that could spearhead the effort? <mark_weaver>gentoo may be the last major distro to update. so much for being on the cutting edge :-P <SamanthaD>Gentoo is the Debian of rolling releases, I find <davexunit>didn't gentoo also build guile without threads for awhile? <SamanthaD>davexunit: it still does unless you tell it otherwise <mark_weaver>and it's practically in the stone age compared with where we are now. <SamanthaD>Yes... the situation with Gentoo and Guile really is unacceptable <SamanthaD>I had to implement a custom package into a local overlay to get it installed <SamanthaD>well... Racket and Gentoo-Hardened is broken <SamanthaD>but the problem is well understood and it could be patched but it's not <Ulrar>Yeah, had to use the funtoo-overlay to install guile <SamanthaD>I just unmasked the guile package and marked it ~amd64 *SamanthaD emerges guile-2.0.0 <davexunit>guile-2.0.11 is the latest release. I highly recommend using that version. <SamanthaD>problem is that my computer is in a perpetual state of rebuild :/ <Ulrar>yeah, funtoo is the only overlay where I found the 2.0.11 ebuild, but I copied it, don't want to use their other ebuilds <Ulrar>really not stable sometimes :) <SamanthaD>Just grab the ebuild from the Gentoo repositories and bump the version number <SamanthaD>99.9% of the time if it's just a minor version bump it'll work just fine <ArneBab>Gentoo and Guile 2.0 is really hard: I switched to 2.0, but that mean that I can no longer build lilypoint, graphviz and one more I forgot. <ArneBab>I decided it was worth it, but it still hurts. <ArneBab>“(One can simply report minor issues on the #gentoo-lisp IRC channel or on the gentoo-lisp mailing list)” <ArneBab>and https://bugs.gentoo.org/show_bug.cgi?id=436400 (texmacs) “TeXmacs cannot be compiled with guile-2, and there are no plans to change this (upstreem even considers switching to some other scheme implementation, but not to guile-2). Therefore, I have >=scheme-2 masked on my system. As long as 1.8 remains in the tree, slotting should be OK for TeXmacs.” <SamanthaD>I mean, it's supposed to support slots but for some reason it doesn't <davexunit>ArneBab: is texmacs really going to abandon guile? :( <ArneBab>To summarize: graphviz does not build with 2.0, greg does not run correctly with 2.0, texmacs does not build with 2.0 and the developers don’t want to change that, weechat does not build, because it needs at least guile 2.0.4 and the tree only has 2.0.0 and guile 2.0.11 is not in the tree. <ArneBab>that’s what’s written in the gentoo bug report. <ArneBab>in 2012 they were discussing switching to racket <SamanthaD>any particular reason for switching to Racket? <ArneBab>“we took a look, it looks nice and has libraries and ” ← actually none. <ArneBab>anubis, beast, drgeo, freetalk, g-wrap, guile-cairo, guile-gnome-platform, gwave, lilypond, texmacs, trackballs, graphviz <ArneBab>which is a really bad situation, because these are obviously adopters of Guile. <ArneBab>→ to make Guile spread, it needs success stories - but even more: avoid failure stories. To get success stories, these packages need all the help they can be given to migrate to guile 2.0 <ArneBab>anubis uses guile-based email filters. <ArneBab>which is really cool, so it’s horrible that it has problems. <gjanssens>Will guile 2.2's compiled files be compatible with guile 2.0 ? <gjanssens>To test I'd first need to have two versions of guile that have incompatible ABI's <ArneBab>it seems civodul tried to help someone to port texmacs to guile 2.0 in 2012, <davexunit>gjanssens: no, the compiled file format changes. <gjanssens>Guile 1.8 doesn't compile its scm files, so it doesn't count <gjanssens>Ok, so what will guile 2.2 do when it encounters a *.go file compiled by guile 2.0 ? <ArneBab>gjanssens: so you would ship the *.go files? <gjanssens>It doesn't make sense that each user of gnucash has to wait for autocompilation to finish on startup ***dje is now known as xdje
<ArneBab>gjanssens: if the file comes with gnucash, I think you should be able to slot it. <gjanssens>Sorry my English is not well enough to understand "to slot" <davexunit>gjanssens: a binary package would ship the .go files compiled for 2.2 <gjanssens>Except if the binary package was created when guile 2.0 was the stable guile version and sometime later a guile 2.2 update is pushed <ArneBab>that looks like an important useful bugreport. <ArneBab>gjanssens: that should then trigger an install of a new gnucash package. <davexunit>yeah, there would be a new gnucash package with a guile 2.2 dependency <gjanssens>Just to go to the bottom of it: if the gnucash maintainer forgets to re-release gnucash in that situation <gjanssens>Will guile 2.2 then autocompile the gnucash scm files due to the incompatible ABI or will it choke on the *.go files ? <davexunit>you'd get a more comprehensive, correct answer from one of the guile maintainers, so just be aware that I could be wrong. :) <gjanssens>Can I expect that ABI to remain unchanged for all 2.0.x versions of guile ? <gjanssens>In other words, will ABI changes be limited to major updates (like 2.0 to 2.2) ? ***fangism-hongry is now known as fangism
<mark_weaver>SamanthaD: guile 2.0.0? ugh. is that the latest version in gentoo? it gets worse and worse :-( *mark_weaver catches up on the backlog <SamanthaD>mark_weaver: It's no big deal. minor version bumps are easy to overlay <ArneBab>mark_weaver: here’s the short version: graphviz does not build with 2.0, greg does not run correctly with 2.0, texmacs does not build with 2.0 and the developers don’t want to change that, weechat does not build, because it needs at least guile 2.0.4 and the tree only has 2.0.0 and guile 2.0.11 is not in the tree. <ArneBab>“(One can simply report minor issues on the #gentoo-lisp IRC channel or on the gentoo-lisp mailing list)” <mark_weaver>gjanssens: I haven't read the entire backlog yet, but we break ABI compatibility between major versions. So we remain ABI compatible within 2.0.x, but 2.2.x will be different. different .go files and different ABI. <gjanssens>The rest of my long thread was mostly about what guile 2.2 would do if it encountered a *.go file compiled by guile 2.0 <mark_weaver>gjanssens: (effective-version) returns a string (e.g. "2.0") that could be included in a directory name. <gjanssens>Will it reject it and resort to autocompiling a new one ? <mark_weaver>gjanssens: but I think you should include the (effective-version) string in the directory name that includes the .go files. we do that with our site directory, for example. <gjanssens>I understand, but that wouldn't help in the case of distro packages <gjanssens>Suppose we have gnucash packaged on Fedora while guile 2.0 is the stable guile version <gjanssens>We release with precompiled scheme files for various reasons <mark_weaver>gjanssens: well, I think the solution is that each build of gnucash will expect a specific version of guile. <gjanssens>Ok, that confirms what others suggested as well <mark_weaver>gjanssens: so once it's been compiled, it is stuck to use 2.0, until it is later recompiled to use 2.2. <mark_weaver>our shared library includes 2.0 in the name, so they are parallel installable. <gjanssens>And still, what if the gnucash maintainer for some reason hasn't noticed fedora now ships with guile 2.2 <mark_weaver>and the directory names that include our .go files also have 2.0 in the name. <gjanssens>It would still be nice if gnucash then continues to work because guile 2.2 detects the incompatible *.go files and resorts to autocompilation <mark_weaver>gjanssens: it can't work anyway, because our representation of SCM values will change, so all the C files that use libguile will have to be recompiled. <mark_weaver>if you have any C code at all, there's no getting around the fact that a given build is tied to a specific major version of guile. <mark_weaver>a pure scheme program could work with multiple versions, though. <mark_weaver>gjanssens: from scheme, (effective-version) returns "2.0", and from the build system, guile.m4 marks GUILE_EFFECTIVE_VERSION for substitution. <mark_weaver>gjanssens: you're welcome, thanks for working on keeping gnucash up to date with guile 2! <gjanssens>Good info on the GUILE_EFFECTIVE_VERSION macro ! ***SamanthaD_ is now known as SamnathaD
<jmd>Is there a module to write cgi in guile? <mark_weaver>jmd: guile 2 has it's own mini web server, which is better than CGI. <mark_weaver>you can configure your main web server to "reverse proxy" to guile's web server running on a separate port. <mark_weaver>it should also be fairly trivial to make a guile script into a CGI script, but I wouldn't bother. it's an inferior method. <mark_weaver>ArneBab: looking at your list of "problem packages" from debian: g-wrap, guile-cairo, and guile-gnome-platform all support guile 2, and have for many years. it's just that the debian maintainer of those packages is MIA. <mark_weaver>most of the others should be fairly easy to upgrade, if someone just did the work. <mark_weaver>lilypond and texmacs are the only non-trivial ones that I know of. <mark_weaver>and texmacs probably wouldn't be hard to upgrade, if they wanted to. <mark_weaver>SamnathaD: as dsmith-work wrote: in scheme, tail calls are gotos with arguments. it is a matter of semantics, _not_ an optimization. *mark_weaver catches up on the backlog <dsmith-work>mark_weaver: I think the reason that "TCO" bugs me so much is that "optimization" seems to imply that it's optional. It's greast if it happens, but Ok if not. <mark_weaver>SamnathaD: guaranteed tail calls have a huge effect on the way we write programs in scheme. we write loops and state machines using recursion. <mark_weaver>dsmith-work: I agree with you 100%, and am in the habit of correcting people who call it TCO in the context of scheme. <turbofail>what was clinger's terminology? "safe-for-space" i think? <turbofail>well anyway i like the idea of specifying it in terms of space-safety <mark_weaver>turbofail: sure, that makes sense. section 3.5 of the R5RS says "Implementations of Scheme are required to be _properly tail-recursive_. Procedure calls that occur in certain syntactic contexts defined below are 'tail calls'. A Scheme implementation is properly tail-recursive if it supports an unbounded number of active tail calls. A call is _active_ if the called procedure may still return." <mark_weaver>and in section 1.1, it says "Implementations of Scheme are required to be properly tail-recursive. This allows the execution of an iterative computation in constant space, even if the iterative computation is described by a syntactically recursive procedure. Thus with a properly tail-recursive implementation, iteration can be expressed using the ordinary procedure-call mechanics, so that special iteration constructs are useful only as <dsmith-work>Implementing a state machine as a set of mutual calling procedures is mind expanading. <dsmith-work>It can also cause you to emit senseless giggles of pure joy. *dsmith-work sighs and goes back to implementing a bootloader for a pic 24H... <jxself>Thanks for listening. I trust appropriate actions will be taken in that regard. :) <turbofail>a link to the logs in the topic would probably be a nice thing to have anyway <dsmith-work>rotty used to have some really nice logs. You conditionally show joins/parts. Was searchable too IIRC. <dsmith-work>mark_weaver: Not dissing yor logs, btw. Thank you Muchly. <mark_weaver>dsmith-work: they aren't mine, but I did ask the gnunet folks to keep them. ***ChanServ changes topic to 'Welcome to #guile. See http://gnu.org/s/guile for more information. This channel is logged, see <https://gnunet.org/bot/log/guile>.'
<mark_weaver>rlb, wingo: would one of you be so kind as to type "/msg chanserv FLAGS #guile mark_weaver +AFRfiorstv" ? :) <mark_weaver>(it gives me the same set of privileges as you both have) <wingo>mark_weaver: i did it; no reponse that i see <wingo>i just did the same without the +AF... whatever and no response either <wingo>i'll do it again with the flags to be sure i didn't undo it <mark_weaver>wingo: fyi, "/msg chanserv access #guile list" to list the privs of ops <mark_weaver>(this allowed me to set the entry message to remind people that this channel is logged.) <wingo>i'll set the same privs on civodul <mark_weaver>yeah, I was just about to, but you already have it in your history I suppose :) <wingo>ok done. with that, zzz :) happy hacking *rlb forgets how you make the operators permanent, but I think it's /msg ChanServ ...? ***SamanthaD_ is now known as SamanthaD