<lispmacs[work]>hi, when we use one of the bytevector ref functions, is the "index" the raw number of bytes into the bytevector, or bytes multiplied by the unit size (u16, etc.)? <lispmacs[work]>do we have some trick with macros or something to compile the results of a calculation into the definition of a word? E.g., to put (/ 1 180) into the source code but not have to recalculate that each time? ***Guest7621 is now known as chrislck
<lispmacs[work]>I'm thinking like in FORTH where you use brackets to go out of compiling mode temporarily and then afterwards compile the result into your definition <adhoc>you want to pre-compute to a constant ? <lispmacs[work]>like, e.g., if you had a function that made a bytevector of a certain length based on certain dimensions you had in mind <lispmacs[work]>you could do (make-bytevector (* 100 200)), since you had in mind 100 rows and 200 columns <lispmacs[work]>of course, you could just do (make-bytevector 20000), but then you would have to separately document why you picked that number <chrislck>I think wingo's compiler does some optimizing automagically <lispmacs[work]>yeah, but my question is, is there some kind of operator I can apply to (* 100 200) so that it explicitly is interpreted in some first pass compile phase or something <lispmacs[work]>yeah, like unquote in a quasiquote, but unquoting in a definition <lispmacs[work]>(define foo (eval `(lambda (n) (+ n (unquote (* 10 2)))) (interaction-environment))) <lispmacs[work]>so result of (* 10 2) is pre-calculated into the compiled definition <lispmacs[work]>maybe I just need a new syntax to make that look a little nicer, with a special operator. Sounds like something that would have been thought of already, though *lispmacs[work] goes home <flatwhatson>lispmacs[work]: that's a worse way to write (define foo (let ((c (* 10 2))) (lambda (n) (+ n c)))) <flatwhatson>neither are happening at "compile time" (ignoring optimizations which will definitely evaluate this at compile time) <flatwhatson>the multiplication would be evaluated on the first pass through the module when it is loaded <tohoyn>apteryx: In a module system where interfaces and implementations of modules are separate it is possible to the module bodies to import arbitrary interfaces. Theme-D has this kind of module system and AFAIK Turbo Pascal did that, too. <muradm>interesting i'm calling (http-request ...) from (web client), per docs return should be (values response . body) but what i get is (response? ret-val) => #t <muradm>i would expect (response? (car ret-val)) to be #t <muradm>(car above is to signify first of values, i don't remember how to fetch first and (let-values ...) is long to write) <muradm>looking at source i see (values ...) returned from (http-request ...) <muradm>yes and (call-with-values (http-request ...) (lambda (res body) ...)) fails with wrong type to apply <muradm>every character i use throws some error :) <muradm>why (regexp-substitute/global "<img*>" ...) throws error while (regexp-sustitute/global "<img*\\>" ...) does not? <muradm>can't find any place in manual saying that ">" is special <muradm>chrislck: thanks, i saw this.. :) yes i'm trying to use (xml->sxml ...) but it seems that html I get is not getting parsed due to not very compliant xml. like <img ...> is not closed with />, and there is some cryptic error which i still not understand, so i decided to pre-fix what i get from http result and then feed it to (xml->sxml ..) <pottsy>I think I may have asked this before, but how do I call guile procedures from c? <pottsy>the best I can find is gh_call0(SCM proc) and gh_call1(SCM proc, SCM arg0) etc. from guile 1.8 <pottsy>I can't find the equivalent in guile 3 <pottsy>ah I think it's just scm_apply_0 <pottsy>I think I've asked this before too, but one last time for good measure. Is there some way to pass userdata to scm_c_make_gsubr? <tohoyn>pottsy: add user data as an extra argument to the procedure and define a wrapper procedure in Scheme <muradm>chrislck: thanks, will try it some time, will require packaging effort from me.. nongnu and not in guix packages.. :) <pottsy>that's how I'm doing it now but it's suboptimal IMO :( ***chris is now known as Guest8595
***Guest8595 is now known as chrislck
<lloda>if i have (define a 'x), what is (??? a) that gives me (syntax 'x) ? <tohoyn>has anyone considered writing optimized versions of car and cdr in Guile JIT? <tohoyn>lloda: `(syntax ,a) gives (syntax x) <tohoyn>lloda: `(syntax (quote ,a)) gives (syntax (quote x)) <tohoyn>lloda: but (syntax 'x) is a different thing <lloda>i want to insert a value in a macro. maybe it doesn't make sense. The way i do it now is by having a list of - #'things #'to #'insert -. Instead I could look up a list that gives me - things to insert - instead. But I can insert the first with #,x and the second i don't know how. <dsmith-work>flatwhatson: Guile does do pretty good at compiling constant expresions. Happens even before the JIT compiler. <dsmith-work>flatwhatson: But there are times when you need to evaluate something at macro or load time or something. <dsmith-work>flatwhatson: But be careful with using that if you have a cat. <dsmith-work>flatwhatson: Doh! Sorry! That all was meant for lispmacs[work] <sneek>I've been running for 8 days <sneek>This system has been up 8 weeks, 1 hour, 11 minutes <sneek>Welcome back lispmacs[work], you have 1 message! <dsmith-work>lispmacs[work]: Looks like peval (partial evaluator), which does constant folding and other stuff, first appeared in 2.0.3 <dsmith-work>geex3: Yes, to a degree. It's a bobot++ with the guile extension. <dsmith-work>geex3: Original code was sarahbot in #scheme, mildly ported over. <sneek>Sneeky bot running on Guile version 3.0.3 using bobot++ release.2.3.1-6-a463-dirty