IRC channel logs
2024-01-27.log
back to list of logs
<lilyp>autotools would typically pull those from the system (or your guix shell, whichever matters), not sure how hall does it <apteryx>hm, guile 3.0.9 has reproducibility issues when building <apteryx>packages such as mumi or cuirass don't build reproducibly in Guix <endersending>I am trying to get guile working but I have no idea where to begin, how to use it. I have so many questions <endersending>I am using debian, and I did apt install guix, and then guix install guile-ncurses <endersending>when I run a test program I get this error: no code for module (ncurses curses) <endersending>is guile only a C/C++ thing? Can I run python-curses-guile? <rlb>sneek: later tell civodul it's actually hanging in the scm_spawn_thread for the signal_delivery_thread. Vaguely wondering if there might be some race when under load. <rlb>sneek: later tell civodul right wrt investigate -- note that this hang only occurs right now with the parallel test change, so it might or might not be a "real" bug. <lilyp>endersending: pretty much all modern-day FFI goes through C first. So you can bridge Python<->Guile if you want to, but it'll most likely not be a pleasant experience juggling two APIs claiming objects :) <lilyp>for ncurses, try `guix shell guile guile-ncurses -- guile` <lilyp>Guix requires you to specify the interpreter along with all other packages to get load paths rolling <lilyp>e.g. `guix shell python-numpy -- python3` might even give you a command not found <lilyp>whereas `guix shell python python-numpy` does what you'd expect <lilyp>(all the stuff that I wrote for guix shell also apply to guix install, with the difference that shells are transient) <natmeo>can i do anything to suppress the display of very long arguments (vectors) in error output? <lilyp>natmeo: ice-9 pretty-print has a function to print arguments in a truncated fashion <natmeo>lilyp: is there a printer for exceptions that I can hook it up to? <lilyp>natmeo: set-exception-printer! <natmeo>i have to say, now that i grok scheme a little i kinda enjoy it <natmeo>with some luck i will never have to write any php again <endersending>and it installed huile again and I think ncurses.. but I still get the same error running ./hello.scm <mwette>not sure what's in hello.scm. You might try adding `-L .` to the end of the `guix shell' command <mwette>or `guix shell ... -- guile -L . ./hello.scm' <endersending>thanks for the help. have to go for now. I will try some more later <mwette>and that script maybe should have first line #!/usr/bin/env guile <mwette>If you do that, and then type `guix shell guile guile-ncurses` you get a good environment; then you can do `user@host [env]$ ./hello.scm` <mwette>snook: later tell endersending, use `guix shell guile guile-ncurses` (no `-- guile') and change top line of `hello.scm' to `#!/usr/bin/env guile' and it should work <mwette>sneek: later tell endersending, use `guix shell guile guile-ncurses` <mwette> (no `-- guile') and change top line of `hello.scm' to `#!/usr/bin/env <ttz>Hi, all! I am wondering how to write a macro to cons `n` times a given form. I first tried using a procedure, but then the form gets evaluated all list elements point to the same object, which is not what I want. <ttz>When I try replacing `define` with `define-syntax-rule`, it seems that I create an infinite loop: <ttz>(define-syntax-rule (repeat-macro n expr) <ttz> (cons expr (repeat-macro (- n 1) expr)))) <mwette>You might need syntax-case. So you want (repeat-macro 20 ex) => (cons ex (cons ex ...))) <ttz>Thanks, I will have a look at syntax-case, then. <rlb>ttz: is the goal to write a macro, or rather, what's the top-level problem? <rlb>Was mostly just wondering whether say the scheme equivalent of clojure's (repeatedly n fn) would suffice. <ttz>No the goal is not to write a macro. But my first implementation unsing a procedure led all repetions to point to the same location. After calling (repeat 2 '(1 2)) => $1 = ((1 2) (1 2)), setting the car of the first element impacts them all: (set-car! (car $1) 0) then $1 = ((0 2) (0 2)) <rlb>(repeat 2 (lambda () (list 1 2)))? <lilyp>pro tip: avoid procedures with a ! <mwette>Do you want solution? I have something working. <lilyp>there's typically a non-destructive alternative <rlb>i.e. build a new one for each repition. <rlb>It's actually not iirc defined wrt set! on constant lists? <rlb>iirc with compilation guile may put those in a read only elf section, or am I completely misrembering? <ttz>what does iirc stand for? <ttz>mwette: sure if you have one <rlb>sorry -- "If I recall correctly" <ttz>rlb: about wrapping the argument in a lambda: I wanted a "cleaner" interface (one that does not rely on the caller to know what it's doing) <ttz>thanks for the code mwette <ttz>It works when passed (list 1 2) for example. Bur if I pass '(1 2) it still shares the same value accross repetitions... <ttz>Anyway, I still have a lot to learn about macros. Thanks for answering :) <ttz>Maybe a last newbie question: is there a standardized or usual way to represent dense matrices in scheme? (I initially tried to write the repeat procedure to initialize a matrix of arbitrary dimensions) <mwette>that's a differnt problem: you can't mutate literals <mwette>i.e., (set-car! '(1 2) 3) is invalid code <ttz>Yes, but one could want to allocate twice the same literal in a list, such that the resulting list elements do not point to the same location. When I create a list with (repeat 2 '(1 2)), I would have wanted to get a list ((1 2) (1 2)) such that the two sub-lists do not share data. <mwette>for kicks you could try starting guile, (use-modules (system base compile)) (default-optimization-level 0) then load and use repeat-macro ; maybe the CSE optmization will make separate instances <rlb>ttz: the key thing is that that modifying a constant isn't allowed by the language, so you can't assume anything in particular, i.e. guile could crash if you do that, ignore the modification, re-use the same storage, etc. <rlb>And whatever guile 3.0 does, 4.0 might do something different. <mwette>I could see that he would want non-atomic(?) literals to be not-`eq?' ((sxml xpath) depends on that, for example) If you know these are lists then one can use deep copy from (ice-9 copy-tree)