IRC channel logs
2022-06-01.log
back to list of logs
<rekado>I have a guile script (with shebang) that accesses (command-line). <rekado>when I launch the script directly the (command-line) contains arguments to the script <rekado>when I launch the script via /bin/sh -c the-script.scm arg1 arg2 arg3, however, the (command-line) value is empty <rekado>is there a way to access the arguments in both situations? <lampilelo>rekado: /bin/sh -c "the-script.scm arg1 arg2" <lampilelo>arg1 and arg2 weren't the part of the -c argument, so they don't get passed further <lloda>we should just remove master tbh <lechner>Hi, is it possible to load a module dynamically with use-modules? Can I catch when it was not found? <chrislck>lechner: (module-public-interface (resolve-module '(srfi srfi-1) #t #f)) <chrislck>lechner: (module-public-interface (resolve-module '(srfi srfi-bozo) #t #f)) <chrislck>(module-use! (module-public-interface (current-module)) (resolve-interface '(srfi srfi-1))) <chrislck> ((module-public-interface (resolve-module mod)) <chrislck> (module-use! (module-public-interface (current-module)) (resolve-interface mod))) <chrislck>this works until the srfi editors create a srfi-bozo <lechner>Hi, can the symbol part of a prefixed procedure call, as in prefix:parameter, be parametrized, i.e passed-in to the caller? <amirouche>lechner: yes, and no. What are you trying to achieve? <amirouche>you want to name or the prefix of the name of the called procedure? <amirouche>by the way 'parameter' is its own idiom, that is: parameter ! argument <amirouche>I never seen a parameter passed as procedure argument. <lechner>amirouche: i'd like to reuse the code in 'identify' in the other five entry points. one good way seemed to parameterize the 'legacy:identify' and 'service:identify' http://ix.io/3Z8A <lechner>sorry if that looks unpofessional. i'm a scheme newbie <amirouche>I think what you look for a generics, but I do not have practical experience with it <amirouche>lechner: are you familiar with single dispatch? <amirouche>well, the generics in scheme I know about, will dispatch based of the value of the arguments, it looks like oop, but there is less ceremony <amirouche>so you can have a record <legacy-pam> and another <new-pam>, then in downstream code you can just call (manage-credential handle ...) and depending on the type of handle, it will call the intended procedure <amirouche>I am not the best person to explain that with guile. <amirouche>There is another approach that is even less sofisticated, that you can build with records, and instance of records that have procedures as fields <lechner>mwette: thanks again for the quick fix for linux-pam! now compile-ffi warns for pamc (in the compile phase) ;;; <unknown-location>: warning: possibly unbound variable `pamc_handle_t*' the typedef in C is somewhat unusual in that it includes the asterisk. is that something to worry about? <lechner>Hi, should I use < or <? when comparing integers, please? <lechner>Hi, can strings be used in a case expression? What does this error mean, please? warning: datum "service" cannot be meaningfully compared using `eqv?' in clause (("service") (begin (display "hello") (newline))) of case expression (case mode (("service") (begin (display "hello") (newline))) (else (ffi-pam-symbol-val (quote PAM_SYMBOL_ERR)))) <linas>I'm working with a developer who seems to have compiled guile-2.2 for armv7 (android) ... but ... <linas>When calling guile from C++ for the first time, it crashes in the GC, trying to access bogus RAM not far from the guile mempool ... <linas>searching for "guile on android" on duckduckgo gives only a 2018 blog entry on guix from civodul ... <lampilelo>you can use match from (ice-9 match) instead, e.g: <lechner>lampilelo: thanks! unfortunately, i have several strings <lampilelo>you can define more patterns for match, but sure, you can use cond, you'd use string= in the clauses <daviid>lechner: use (case (string->symbol mode) ((service) ...)) <lampilelo>a mode for something should probably be a symbol instead of a string anyway <lechner>daviid: very clever indeed (and as a newbie, i'll remember) but i think i'll stick to cond for now <lechner>what is the difference between string= and string=? please? <lampilelo>string=? can compare more than 2 strings, string= can compare parts of 2 given strings <lechner>Hi, what is the 'name' argument to resolve-interface supposed to look like, please? None of my plain or quoted attempts is working. <civodul>linas: that blog post is actually by roptat :-) <civodul>Guix could be helpful to get Guile on Android i guess <civodul>you could "guix pack guile", move the tarball to the Android device, and run it from there <linas>civodul: thank you! The developer seems comfortable compiling straight from source; I will ask him to create a pure, guile-only system ... <civodul>lampilelo: yes, either through cross-compilation or native compilation (with transparent emulation or offloading) <apteryx>lampilelo: I think I've done this in the past (run guile on android via a guix pack) <apteryx>the hassle is you need root on the phone just to get started <apteryx>(relocatable packs with PRoot was not working on android when I tried) <apteryx>Another need for root is because on the extension media, it probably uses exfat or something that doesn't even support the executable bit, needed to execute your binary! <lechner>lampilelo: thanks! i also use quasiquote, but where do i put the #:prefix, please? <lechner>Hi, how may I prefix the symbols imported by this call with #:prefix, please? (resolve-interface (quasiquote (pam service (unquote (string->symbol subordinate)))))