IRC channel logs

2016-11-10.log

back to list of logs

***nyah is now known as Carborane
***DeeEff_ is now known as DeeEff
<amz3>héllo guilers
<Bobbejaantje>amz3, I can't sleep.
<Bobbejaantje>And I still don't know whether guile has a way to access prctl on Linux
<amz3>sorry I don't know prctl. What is it?
<Bobbejaantje>amz3, it's a Linux-specific syscall I guess that manipulates the state of the current procss or thread.
<Bobbejaantje>Does things like drop capabilities, sets child subreaper and stuff like that
<civodul>Hello Guilers!
<janneke>Hi civodul!
<gregoire>Hi. I'm completely new to guile, so please forgive me if what I'm asking is obvious.
<gregoire>I'm trying to use it in a make file and I'd like to use strftime to format file modification time
<gregoire>I tried the following: (strptime "%Y%m%d" (stat:mtime (stat "output.pdf"))))
<gregoire>no sorry, (strftime "%Y%m%d" (stat:mtime (stat "output.pdf"))))
<gregoire>but it seems that whatever stat:mtime returns is not a date?
<gregoire>I'm guessing it's an integer, how do I convert it to a proper time value?
<OrangeShark>gregoire: with the procedure localtime
<gregoire>OrangeShark: That worked, thanks!
<OrangeShark>np :)
<gregoire>Is there any fancy shell for guile? like python has ipython and such? With history and tab completion?
<jmarciano>I have put: (use-modules (ice-9 readline)) (activate-readline) and it becomes fancy.
<civodul>quizz: find out what's changed at https://www.gnu.org/software/guile/
<civodul>wingo: ↑
<wingo>is it haunt? :)
<civodul>yup!
<civodul>look at the news page!
<civodul>i figured i'd rather do it while the details of haunt, savannah, etc. are still fresh in my mind
<wingo>nice :)
<gregoire>jmarciano: nice ,thanks!
<alezost>gregoire: I think jmarciano means he puts that in ~/.guile file. Also if you use emacs, you may look at Geiser
<gregoire>alezost: Yes, I did the same ;-) Vim user here I'm afraid :-D
<mvdw>There's no need to be afraid.
<jmarciano>yes I put that in Emacs, and I get readline, history, completion.
<jmarciano>and I use Nalaginrut's colorize: https://github.com/NalaGinrut/guile-colorized
<jmarciano>can somebody explain me, why is this working in REPL: (define dir "/tmp")(add-to-load-path dir) and not working if I run it as script alone? ERROR: Unbound variable: dir
***holomorp1 is now known as holomorph
<civodul>jmarciano: at expansion time, 'dir' is undefined
<civodul>and add-to-load-path is a macro that also has an effect at expansion time
<jmarciano>you mean expansion of a macro? How do I call it with a variable then? It works in REPL.
<civodul>the variable would have to exist both at run time and at expansion time
<civodul>so your best bet would be to use a macro for 'dir' instead of a variable
<civodul>like: (define-syntax-rule dir (identifier-syntax "some/dir"))
<civodul>er, rather: (define-syntax dir (identifier-syntax "some/dir"))
<jmarciano>I don't get 100%, but I get mostly. I will review that in info guile. And now it works, thanks. So it means, I need to take care when using variables with macros, and need to know which is macro, meaning, reviewing the documentation.
<jmarciano>When it says "Scheme Syntax" does it mean it is macro? In info.
<civodul>yes
<jmarciano>Thank you, I will put attention.
<avoine>what would be the way to only have the returned value to stdout when I do something like: echo "(+ 1 1)" | guile ?
<jmarciano>I am beginner. I would do the pipe to script, which in turn runs guile -c "(display (your expression))"
<jmarciano>then echo "(+ 1 1)" | some-script, would give me the output like that.
<ArneBab_>wingo: I have guile 2.1.4 mutating a let-bound list when a list with the same content is modified:
<ArneBab_>(let ((x '(1 2 3)))
<ArneBab_> (display x)(newline)
<ArneBab_> (list-set! '(1 2 3) 0 0)
<ArneBab_> (display x)(newline))
<ArneBab_>⇒ (1 2 3)
<ArneBab_>⇒ (0 2 3)
<ArneBab_>note that I use list-set! on '(1 2 3) but display x.
<ArneBab_>…hm, I also get this in 2.0.12
<ArneBab_>but not in 1.8
<ArneBab_>(there the second display shows (1 2 3)
<ArneBab_>)
<wingo>yes, well-known problem with literals
<wingo>(list-set! '(1 2 3) 0 0) should error
<avoine>I found that: echo "(+ 1 1)" | guile -c "(display (primitive-eval (read (current-input-port))))"
<avoine>but I'm not sure what would be the limitations here
<jmarciano>avoine: oh that is simple, nice
<dsmith-work>Thursday Greetings, Guilers
***karswell` is now known as karswell
<wingo>meep
<OrangeShark>hi
<daviid>hello wingo, hello guilers!
<wingo>heya :)
<ArneBab_>wingo: why should it error? I thought it should just not change the let-bound x.
<ArneBab_>it would be pretty surprising if there were some lists for which list-set! does not work
<wingo>mutating constant literals is an error
<wingo>guile doesn't signal it yet tho
<jmd>wingo: It's also a contradiction in terms.
<taylan>IIRC sometimes it "signals" that with a segfault :P
<zv>Does anyone know if there is a way to get guile records to 'inherit' fields?
<zv>Also - is there more information beyond the 'Guile Internal' docs on the implementation of the Guile VM and particularly 'assembly.scm' and tree-il stuff?
<civodul>zv: 'inherit' in the sense of "class inheritance"?
<zv>My goal is to have a bunch of 'opcodes' like 'assignment', 'goto', 'push' ... etc. Each of these will have a 'text' field (the mnemonics) and a 'function' field (with the lambda that encodes their operation). *Individually* however they will each have different fields beyond those two (destination for assignment vs. source register and so on)
<zv>and then disassembly of the bytecode will be as simply as (match inst ($ assign text ... => disassemble(...) )
<amz3>zv: check the dev docs there is more to read
<zv>In summary, in an 'assembler' for a bytecode I'm transforming an assembly language into a list of records that represent 'instructions', many of these instruction records share some fundamental fields and I was wondering if I can do inheritance or something else for that.
<zv>amz3: I'm particularly interested in where things like 'check-const' or 'make-const' are implemented. I grepped for them and couldn't find anything.
<zv>Or how it all 'fits together' (forgive me as I"m a total newbie working through SICP)
<amz3>zv: FWIW i created a very simple oop system https://framagit.org/snippets/317
<zv>amz3: An important thing to me here is that I *need* these to be fairly performant. Constant time access to actually get to the instruction - I can't be looking up the definition of the instruction live
<zv>although it looks like yours uses records :)
<amz3>hmm
<amz3>it's not meant to be performant but simple
<zv>amz3: Which argument is the 'parent' class in SOOPS?