IRC channel logs


back to list of logs

***catonano_ is now known as catonano
<d4ryus>to implement a binary protocol i need to be able to track and reset the current position in a port (socket for example). Is there a way to do this? If not, how would i do this besides wraping reads/writes?
<weinholt>d4ryus, seems very unusual since sockets don't have positions, you should probably look for a different approach, but you could maybe fake positions with custom ports
<weinholt>d4ryus, are the positions relative to an index in a packet? because then you can use bytevector ports as temporary storage
<d4ryus>weinholt: Yes, i need to be able to get the position relative to some initial position to tell how much padding is required
<weinholt>sounds like bytevector ports will do the job
<d4ryus>would require another copy, but i guess thats ok for a first shot, thank you very much!
***Server sets mode: +nt
<Josh_2>Hi, does guile work on rasp pi w, I think It's arm32?
<d4ryus>Josh_2: yes is does.
<Josh_2>d4ryus: thanks :)
<d4ryus>Josh_2: oh wait, rasp pi w => rasp pi zero w, right?
<Josh_2>sorry that was my mistake
<d4ryus>Josh_2: ok, yes, it does :)
<Josh_2>awesome thanks :) I'll write my app in guile then :D
<Josh_2>is there an irc channel like #guileschool or somethin? A channel for guile noobs
***apteryx_ is now known as apteryx
<davexunit>Josh_2: just this channel. :)
<davexunit>when I was a noob I got a lot of help here.
<Josh_2>okay sweet :)
<d4ryus>damn, once one calls the second value returned from open-bytevector-output-port to retrieve the bytevector, it gets reset :/
<Josh_2>Is there a simple list of all guile functions?
<Josh_2>I am reading the R6RS which is helpful but I complete list of just the function names would also be helpful
***dsmith is now known as dsmith-work
<dsmith-work>Happy Friday, Guilers!!
<nisstyre>I've noticed there are some C API functions that are called a certain thing in the docs but then either named slightly different in the actual header files, or don't exist at all in the latest guile 2.2
<nisstyre>I wonder if the docs just need to be updated
<dsmith-work>nisstyre: Have you looked at the NEWS file?
<nisstyre>dsmith-work: no, why?
<dsmith-work>Changes are supposed to show up in there. Should reveal if an API old or has been renamed.
<nisstyre>ah ok
<nisstyre>yeah I will check it later and see if I can find anything
<Josh_2>amz3: thanks :)
<dongcarl>Hi all, is there documentation on the specifics of truthy and falsy values in guile?
<dongcarl>E.g. are all things truthy except `#f`?
<dongcarl>(in the context of conditionals like `if`)
<Josh_2>I don't know the specifics, but if you do (if "a" "t" "f") it'll eval to "t" so I guess so
<Josh_2>It's the same in CL but like I said, I don't know the specifics
<chrislck>guile commandment: "thou shalt read thy manual"
<amz3>dongcarl: only #f is false, otherwise you must use a predicate like null?
<davexunit>dongcarl: that is correct, #f is the only falsy thing.
<dongcarl>Ah! That's great... very clear
<davexunit>it's kind of refreshing when compared to some other languages
<dongcarl>Oh for sure...
<davexunit>even Ruby can be annoying because both nil and false are falsy
<dongcarl>The power of clarity!
<jcowan>Well, almost. #nil is falsy too, but you aren't likely to run up against it just doing Scheme.
<davexunit>I try to avoid discussing #nil :)
*jcowan chortles
<heisenberg-25>How do you evaluate a function from its name? that is how can I run a procedure named add from the string "add"?
<Josh_2>wouldn't you be better of storing string function pairs like ("add" . (λ () <do some stuff>))?
<Josh_2>then you can search a list for a string like "add" and then execute the function stored in the cdr of that cons
<Josh_2>just spitballin
<heisenberg-25>Josh_2: the functions have keyed arguments
<rekado_>heisenberg-25: you could do something like this: (variable-ref (module-variable (current-module) the-procedure-name-as-a-symbol))
<rekado_>(let* ((args '(10 20 30))
<rekado_> (proc-name '+)
<rekado_> (variable (module-variable (current-module) proc-name))
<rekado_> (procedure (variable-ref variable)))
<rekado_> (apply procedure args))
<heisenberg-25>rekado_: okay. Let me try that
<heisenberg-25>But to make my question clear, I am parsing an json and executing functions based on that
<heisenberg-25>Imagine I have this JSON {"func_name": "add"args: [{"name": "x", "value": 1}, {"name": "y", "value": 2 } ] }. I want to call (add #:x 2 :y ) based on the above JSON
<Josh_2>hey that's exactly what I did recently haha
<Josh_2>not in scheme though :P
<rekado_>if the JSON is static you could go through the compiler tower and compile this directly to Scheme.
<rekado_>doing this dynamically works just the way I outlined above. It’s up to you how you convert the JSON to a keyword list.
<heisenberg-25>rekado_: Yeah your method works for converting the string function names to functions and parsing the json an easy task. But the tricky part is converting a string into a keyword argument i.e converting "#:x 1 #:y 3" into #:x 1 #:y 3
<heisenberg-25>Josh_2: :)
<heisenberg-25>Btw what is the best way to share scheme code snippet in this channel?
<heisenberg-25>I was hoping (eval-string "#:x 1 #:y 2") would do the job but it just returns 2
<rekado_>this needs more code to match on and iterate over the json data structure
<Josh_2>just a question, but do you actually need to use keywords? can't you just have for example (add a b) and then pass (add 1 3)? instead of (add #:x 1 #:y 3) if that's what you are doing
<heisenberg-25>rekado_: actually (apply procedure non-key-arg (list key-arg)) works :)
<heisenberg-25>Josh_2: the reason I am using keyword arguments is that I want the function to be also called as (add 1) and will use the default value for y or vice-versa for x
<dsmith-work>Is current master supposed to build in mere seconds instead of hours?
<dsmith-work>Maybe I had .go files already there?
<dsmith-work>Must have. Now it's back to it's lovable old slow self
<dsmith-work>real 34m5.382s
<dsmith-work>user 93m58.208s
<dsmith-work>sys 1m37.823s