IRC channel logs

2024-05-07.log

back to list of logs

<ArneBab>SRFI-251 is final! https://srfi.schemers.org/srfi-251/srfi-251.html ⇒ mixing expressions and definitions in procedure bodies is now semi-standardized.
<graywolf>I, I would like to write a procedure, with working name string-append-anything. Currently we have (string-append s1 s2 s2) right? I would like to write a new procedure that would allow me to write (string-append-anything num1 s1 #f), equivalent to (string-append (with-output-to-string (display num1)) s1 (with-output-to-string (display #f))). And I wonder, what is the most efficient way to do
<graywolf>this? There are two caveats: 1. I do need to support only booleans, numbers, symbols, strings and characters 2. Vast majority of time, the type (of the variable) will be string.
<graywolf>Should I just go for (cond ((string? var) string) ((number? var) ..what here?)) or is the with-output-to-string of the same speed?
<graywolf>s/I, I/Hi, I/
<dthompson>wakyct: I'm reasonably certain that no bindings to sdl2 gui libraries exist for guile. you'd want to use the ffi to write your own bindings for whatever you want to use.
<dthompson>graywolf: for the data types you listed, you shouldn't need to directly use with-output-to-string at all.
<dthompson>for numbers, call number->string (this will create a temporary string port under the hood, but you don't have to do it)
<dthompson>match #t and #f specially and return string literals "#t" and "#f" respectively
<dthompson>a char can be turned into a string of one characters like (string #\A)
<dthompson>character*
<graywolf>dthompson: ... right, that sounds good, thanks :)
<dthompson>graywolf: yw
<wakyct>dthompson, I found a guile binding to raylib, so perhaps I could extract raygui and use sdl? I haven't looked into it yet
<wakyct>mostly because I'm currently (and oddly?) into the idea of just using xcb
<wakyct>now that I think of it raygui probably isn't in the raylib src itself anyway
<dthompson>wakyct: probably you have to use all raylib stuff unless raylib has sdl integration or something
<dthompson>I haven't used raylib but I think it has its own renderer and stuff so I'm almost certain that you won't be able to compose it with sdl
<wakyct>yes that sounds right
<dcunit3d>is there any way to get the symbols for a procedure's arguments?
<dcunit3d>i found procedure-name, procedure-properties and procedure-minimum-arity, but the last two don't seem to provide me with what i'm looking for
<dcunit3d>hmmm maybe there's procedure-arguments in `ice-9 session`
<dthompson>dcunit3d: I'm not aware of anything
<dthompson>definitely not in procedure properties. it's possible that some information might be available by inspecting disassembled bytecode but idk
<mwette>try `program-code' -> `find-program-arities' -> `arity-arguments-alist'
<dthompson>mwette here to save the day!
<mwette>you may need to (@@ (system vm program) ..); I'm just looking at some old code
<mwette>but start with (use-modules (system vm program)) (program-code (lambda (foo x y) #f))
<dcunit3d>thanks dthompson mwette, i've got something to work, but i don't think procedure-arguments is the correct way to do it. i'll look at those