IRC channel logs

2022-06-05.log

back to list of logs

<ArneBab>unmatched-paren: this is SRFI-105, wisp just re-uses that because it neatly solves a problem without having to do any non-standard stuff :-)
<chrislck>sneek: botsnack
<sneek>:)
<lechner>Hi, both resolve-module and resolve-interface raise exceptions when a named module cannot be found. (They do not return #false as documented.) How may I test whether a module is available before using it, please? Thanks! https://www.gnu.org/software/guile/manual/html_node/Module-System-Reflection.html#Module-System-Reflection
<lampilelo>lechner: you can do (false-if-exception (resolve-interface ...))
<lampilelo>or this if you don't want to discard all errors: (and=> (resolve-module '(srfi goo) #:ensure #f) module-public-interface)
<lechner>lampilelo: thanks!
<lechner>Hi, should 'end' in substring be strictly less than string-length, due to zero-start indexing? https://www.gnu.org/software/guile/manual/html_node/String-Selection.html#String-Selection
<lampilelo>substring doc addresses that: 0 <= START <= END <= ‘(string-length STR)’
<lampilelo>or am i misunderstanding something?
<lechner>lampilelo: actually, i think i misread. end is exclusive
<lechner>a bit of a misnomer, perhaps. it could be called 'discard-start'
<lechner>but the 'exclusive' part works well when stripping comments with string-index
<lampilelo>isn't it a convention to call it 'end'? it's the same in c++ for example
<lechner>lampilelo: dunno, i have never used c++ in earnest
<lechner>lampilelo: C's strncpy and c++'s string::substr seem to take a length, leaving the arithmetic to the caller https://www.cplusplus.com/reference/string/string/substr/
<lechner>but i like guile's interface
<lampilelo>in c++ std::end gives you a pointer/iterator to the element past the end of data, so basically outside the container, and other functions that expect it as input also call it 'end'
<lampilelo>i think this is the first time i mentioned c++ on #guile, lol
<lechner>they seem so different
<lechner>Hi, does Guile have a string-split with limit, akin to Perl's split(regex, string, max-terms) or a lazy language's 'take max-terms' ?
<lampilelo>lechner: not to my knowledge, you can use take and drop (and others) from srfi-1 to remove unwanted stuff from the result
<lilyp>lechner: w.r.t. std::end, if you use iterators in c++, the end item is also excluded, just like the end position in guile's substring
<lilyp>you never dereference the std::end iterator, that'd be UB
<lilyp>same in Guile, you don't do (string-ref s (string-length s)), because string-ref is only valid on 0 <= K < END.
***chris is now known as Guest7457
***Guest7457 is now known as chrislck
<chrislck>sneek: botsnack
<sneek>:)
<lechner>Hi, is the init file ~/.guile is ever called when Guile starts from C via scm_with_guile()? What about scm_shell() ? Thanks!
<stis>Hello guilers!
<lampilelo>lechner: afaik it is loaded only when you're opening a repl with `guile` command
<lechner>lampilelo: thanks!
<lechner>Hi, is there a "not equal" comparison predicate for integers, please? https://www.gnu.org/software/guile/manual/html_node/Comparison.html#Comparison
<lilyp>lechner: (negate =)?
<lechner>lilyp: thanks!
***wklew_lurk is now known as wklew
***wklew is now known as wklew_lurk
<lechner>Hi, how does one interpret an error message like this one, please? http://ix.io/3ZtS
<lechner>i get the wrong type part, but which file, function or line number, please?
<lilyp>you're in the interpreter, there's no debug info