IRC channel logs

2019-09-20.log

back to list of logs

<rlb>So I would have imagined that extending equal? to handle new types was common, but it doesn't appear to work even if you're adding a whole new arity:
<rlb>scheme@(guile-user)> (use-modules (oop goops))
<rlb>scheme@(guile-user)> (define-method (equal? x y z) 13)
<rlb>scheme@(guile-user)> equal?
<rlb>$1 = #<procedure equal? (#:optional _ _ . _)>
<rlb>
<rlb>Maybe it works if you're just adding a new pair of types?
<rlb>Suppose I can test that.
<rlb>(Same thing -- no effect.)
<daviid>rlb: not exactly answering your question, but you'd be on the safe side to do the 'conversion' 'by hand', as does guile-gnome,for example, for existing guile core procedures like connect - see http://git.savannah.gnu.org/cgit/guile-gnome.git/tree/glib/gnome/gobject/generics.scm line 142 and below ...
<sneek>daviid, you have 1 message.
<sneek>daviid, str1ngs says: thanks. It works for me I'm using my own typelib where I can connect the signasl on class initialization. it's unrelated to nomad. something else I'm working on
<daviid>str1ngs: ok
<daviid>rlb: note that for core procedures, guile-gnome uses #:replace i the module definition, like #:replace (connect)
<rlb>daviid: thanks much -- though I think here replace: (and export:) crashed with an undefined var error, even though I could see the (define (equal? ...) ...) in the module. Maybe something else was wrong.
<daviid>rlb: ok, i don't know exactly, but you could try to look in the oop goops module, it is easy to read, what is being done for those core procedures that are converted to primitive-generics (iirc) and try to figure out from there ...
<rlb>yeah, I saw that, though what it does specifically doesn't work (at least what it does for g-equals), or rather, it works within the module, but I haven't figured out any way to export the binding for the "promoted to generic" so that it overrides the same primitive in the module "using" the module that promoted the primitive.
<rlb>i.e. I can definitely promote equal? to a generic in a module, but I can't figure out how to let anyone else "see" it.
<rlb>And so far, not sure if that's a bug or my misunderstanding somewhere.
***ng0_ is now known as ng0
<heisenberg-25>Hi. are there libraries for using python code in scheme (guile)?
<ilyaigpetrov>> Quoting is used to obtain a literal symbol (instead of a variable reference) <- What is "a literal symbol", does it mean "string"?
<ilyaigpetrov>I guess I should read this: https://en.wikipedia.org/wiki/Symbol_(programming)
<str1ngs>ilyaigpetrov: symbol does not mean string. this is a string "foo" this is a symbol foo
<str1ngs>ilyaigpetrov: without a quote a symbol with evaluate. usually it's a variable. eg (define foo 1) (symbol? foo) (symbol? 'foo) notice the last call is #t and the first call is #f
<str1ngs>s/with/will
<ilyaigpetrov>thanks, I hope I will get used to it, symbols are not very common in js code from where I come
<str1ngs>ilyaigpetrov: https://www.gnu.org/software/guile/manual/html_node/Symbols.html might help
<str1ngs>in the context of guile atleast
<ilyaigpetrov>yes, very handy
<heisenberg-25>Any guile libraries to run python on scheme code?
<rlb>heisenberg-25: a quick search returns the pyguile project, but it looks like it's no longer maintained -- if I needed to use python libs from guile and the granularity were coarse enough, I might consider running python as a subprocess and communicating over a pipe, say via xml, or even edn (edn is close enough to elisp that it worked fine for me, communicating between emacs and clojure -- suspect that might be true for python and
<rlb>scheme too, if you're careful).
<civodul>rlb: there's also https://gitlab.com/python-on-guile/python-on-guile/
<civodul>it's quite recent and ambitious
<civodul>maybe not "production-ready"
<heisenberg-25>civodul: Is it documented?
<civodul>i don't think so
<heisenberg-25>rlb: Yeah, I also came across pyguile and was looking if there were other alternatives
<rlb>Interesting - though if that's just for python code, I suppose it might not help if you really wanted to use the python libs.
<civodul>oh indeed, i had missed that part
<rlb>Oh, I'm not sure what's wanted -- just wondering.
<rlb>i.e. imagine it might depend on exactly what heisenberg-25 wants to do.
<heisenberg-25>rlb: there is a code in python that parses scheme (specifically atomese) to csv and I wanted to port that to my scheme app. So instead of writing the whole thing from scratch I was wondering if I could find a library that I can use to run that part of the code within my scheme modules
*rlb looks up atomese...
<amz3>why not interop via json?
<jcowan>It's called sexpdata, and I'm glad to have found out about it.
***jao is now known as Guest8617
<amz3> https://github.com/jd-boyd/sexpdata
<ArneBab>civodul: I like the long #true and #false a lot — they make it much easier to show code to non-schemers
<civodul>yup