IRC channel logs

2015-10-29.log

back to list of logs

<bubu^>mark_weaver, thx, was looking at the manual andtrying (wrongly...) to do something like that !
<bubu^>gn
<some_no_one>hello!
<some_no_one>i'm having difficulty incorporating guile into a c++ program
<some_no_one>i have an sdl rect moving around on the screen. i want to expose a fly-displace function to guile to control this rect. like, (fly-displace 3 -4) would displace the x coordinate by 3 and y by -4
<some_no_one>i created a fly_displace(SCM x, SCM y) C function. but i wonder how to now proceed and set the rect's coordinates. like, how can the function access other parts of the program
<some_no_one>in terms of design
<some_no_one>how do you go about this?
<nalaginrut>amz3: I think IOCCC may lost its value, since we have JS now... https://pbs.twimg.com/media/CSdFDQXUEAAr0kC.jpg
<amz3>nalaginrut: It can not happen ;)
<nalaginrut>amz3: maybe the tutorial should be written with gitbook
<amz3>ACTION looking at gitbook
<amz3>How would you convert it to texinfo?
<amz3>How will you convert it to texinfo? nalaginrut ?
<nalaginrut>amz3: why convert it to texinfo? texinfo is required by GNU document standard, we're not going to put the tutorial in manual
<nalaginrut>but anyway, the tutorial will be written in Markdown
<nalaginrut>gitbook could convert it to various format
<amz3>sure gitbook is appealing, but I think one can do the same using org-mode
<amz3>sneek_: botsnak
<amz3>sneek: botsnak
<amz3>sneek: botsnack
<sneek_>:)
***karswell` is now known as karswell
<nalaginrut>amz3: but gitbook provide good way to maintain
<amz3>nalaginrut: it will be better to have one way to contribute I think
<nalaginrut>amz3: it's based on git, so seems fine
<amz3>I'm tried to create a router library, but... it's more difficult that what I though
<amz3>nalaginrut: what approach do you take for url routing, regex?
<nalaginrut>amz3: at present, yes
<amz3>well, I think the issue I have is the same in both regex and match approach
<nalaginrut>I don't understand
<amz3>I'll make a paste
<nalaginrut>you want to use regex in match? there's way
<amz3>thanks :)
<amz3>I did not know that
<amz3>but it's not the issue
<nalaginrut>a bug?
<amz3>I want to show you my idea :)
<nalaginrut>;-P can't wait
<amz3>almost done
<amz3>I making the code idea, more readable
<amz3>nalaginrut: https://friendpaste.com/6aQdNeCCB8At7XGT7a8ive
<amz3>I was under the impression that I could write call-only-if-match using ice-9 match, but seems like complicated macro stuff
<amz3>the difference with the regular routes I know of, is that the dispatching is done by the views themselfs without relying on OOP
<amz3>Python Pyramid does OO dispatch IIRC
<amz3>and Django, does some nasty stuff with a global mutable url table called URLConf
<amz3>ah yes, there is an issue, one can one reverse urls with the above approach
<amz3>*one can not reverse urls
<nalaginrut>amz3: well, s-expr as rule?
<amz3>nalaginrut: really?
<amz3>where?
<nalaginrut>amz3: your idea
<amz3>yes, for matching path and sub-path
<amz3>oh
<nalaginrut>(get '(article show) ...)
<amz3>my idea is the use of `delegate` and `call-only-if-match` to build hierarchical apps
<amz3>nalaginrut: that's how you do it?
<amz3>in artanis
<nalaginrut>well, similar approach appears in tekuti from wingo, but Artanis URL remapping is based on string and regex
<nalaginrut>anyway, it's possible to add such feature without breaking anything IMO
<amz3>there is a delegate and call-only-if-match thing?
<amz3>I did not problably invent it, sure.
<amz3>(the first to invent it :p)
<nalaginrut>of course, an unified interface and matching
<nalaginrut>you may call it delegate
<nalaginrut>but how many people want to use s-expr rule
<amz3>if you ask me, it looks the same as regex, except the rules are simpler and simpler to write for scheme person
<amz3>that's really the delegate/only-call-if-match that I like
<nalaginrut>hmm...and we still need a syntax for binding
<nalaginrut>say, "/hello/:who", => '(hello (: who))
<amz3>also the s-expr is easy to inspect, compared to the regex. In python when I had to do something similar I had to reverse the regex which is doable but nasty
<amz3>or use an intermediate representation
<amz3>There is a python project that does reverse regex, let me check
<nalaginrut>I'm glad Artanis will become a monster platform including compiler/DB/actors... (then I'll flee)
<nalaginrut>amz3: actually, one may use SRE as well, which is special regex in s-expr
<nalaginrut>since Artanis takes advantage of irregex
<amz3>don't call it monster please ;)
<amz3>my baby is not a monster
<nalaginrut>;-D
<amz3>I don't know regex that well in guile, but happy (and not suprised) to see there is a scheme version of regex
<nalaginrut>(get '(hello (=> who [^/]+)) ...) maybe work
<nalaginrut>without any change of current Artanis
<nalaginrut>(get '(hello (=> who "[^/]+")) ...) maybe work
<amz3>tekuti is down, it would be nice if wingo or some else makes it available online again.
<nalaginrut>amz3: I recommend you use irregex, it's powerful
<nalaginrut>and faster, supports unicode well
<amz3>nalaginrut: where is it?
<amz3>procedure index doesn't list it
<amz3>Got it
<amz3>you know it's painful to use third party libraries, don't you ?
<amz3> https://github.com/ashinn/irregex
<amz3>(Actually it's possible to make delegate/call-only-if-match reverse urls if one makes them handle a special kind of 'reverse' request)
<nalaginrut>amz3: but it's the best regex lib in Scheme I can find
<nalaginrut>amz3: Artanis need good regex lib anyway
<nalaginrut>amz3: Artanis uses irregex everywhere
<nalaginrut>of course, the interface is compatible with Guile inner one
<nalaginrut>but IMO it's better one
<amz3>nalaginrut: do you include the sources in artanis? or something else?
<nalaginrut>amz3: included it
<nalaginrut>maybe I should put COPY.irregex on toplevel
<nalaginrut>it's 3-clauses BSD
<civodul>Hello Guilers!
<artyom-poptsov>Hello civodul
<wingo>moin
<wingo>ACTION has unboxed floating-point arithmetic working in the vm, whee
<wingo>with compiler support :)
<civodul>woow, impressive!
<civodul>that's really going to help for many apps
<civodul>it changes what people would consider writing in Scheme vs. C
<wingo>i think actually the reverse is true
<civodul>right :-)
<wingo>it's going to help a lot for a small number of apps :)
<civodul>sure
<wingo>but yeah
<civodul>but i mean those doing number crunching will know they can reasonably do it in Scheme
<wingo>the tricky thing is knowing when the optimization will kick in
<wingo>right now it's pretty hard to tell
<civodul>i guess ",optimize" doesn't show this explicitly, right?
<wingo>if there's a chance that the number is actually complex, then the optimization doesn't kick in
<wingo>civodul: sadly ,optimize is less and less useful now :(
<wingo>,optimize shows what peval does
<civodul>yeah
<wingo>but not what the cps optimizations do
<wingo>and this is a cps optimization
<wingo>currently anyway...
<civodul>it'd be nice to have another meta-command showing the result of the CPS transforms
<wingo>yes agreed
<wingo>,c does, to an extent, but unless you look at it all day it's hard to tell
<civodul>yes :-)
<lloda>wingo, the array functions will need to be moved to Scheme to take advantage of these optimizations, right? To access the array memory directly in C one needs to acquire an array handle, so I think the array descriptor can be made a Scheme record or whatever and we can remain backwards compatible with the C API
<wingo>lloda: yes
<wingo>or at least, i think so
<wingo>but actually maybe not
<wingo>since the compiler needs to inline everything for the optimizations to work, you would need the compiler to know about array-ref and array-set!
<wingo>humm
<wingo>you could write routines that access the backing vector explicitly, and if it's a bytevector and you specialize your routine on f64 values that would hit the fast paths
<wingo>really you want type feedback and adaptive optimization but all that requires this work anyway (the compiler has to do the same thing, you just have more type info to use in inference at runtime)
<wingo>we're not talking julia-level perf here, fwiw...
<civodul>ACTION guesses lloda is one of the main customers of unboxed floats ;-)
<roelj>I have a snippet of my program, and I think I should be using macros for 'fleets-of-self' and 'fleets-of-enemy': http://paste.lisp.org/+3DQ9 . But I don't know enough about macros to know how to do this. Is there some example/tutorial somewhere I could use to make the changes I think I need? Or is this the right way to go?
<dsmith-work>Thursday Greetings, Guilers
<taylan>roelj: why do you think you should be using macros for that?
<roelj>taylan: Because that would transform the calls to (fleets-of-self ...) to calls to (fleets-of-player ...) once. So when the functions are used often later on, it doesn't have to call two functions (fleets-of-self) and (fleets-of-player). Instead it only has to call one function (fleets-of-player).
<roelj>(I could be very wrong about this...)
<taylan>roelj: is that really a bottleneck in your program? it's best not to optimize prematurely. procedure calls are quite cheap in Guile AFAIK.
<taylan>you can also use define-inlinable for that though
<taylan>just change the 'define' to 'define-inlinable' and it will magically define a macro for you (and it'll still work like a procedure too when you pass it as an object)
<roelj>taylan: No it's not really a bottleneck in my program. However I'd like to learn Scheme/Guile, and this seems like an opportunity to learn how to write a simple macro.
<taylan>but I'd recommend writing your code in the most normal, readable, straightforward way possible first, then profiling to find bottlenecks
<roelj>taylan: That's awesome
<roelj>taylan: Thanks for your advice. I really appreciate the help from everyone in this channel.
<taylan>happy to help :)
<wingo>i have unboxed phi variables working, wheeee
<wingo>to sum 1e7 float32 values goes down from this:
<wingo>;; 0.655246s real time, 1.220614s run time. 0.680194s spent in GC.
<wingo>to this:
<wingo>;; 0.161052s real time, 0.161125s run time. 0.000000s spent in GC.
<karhunguixi^>Holy diver, that's awesome! :)
<roelj>Impressive!
<davexunit>wingo: wow!
<davexunit>what does "phi variable" mean here?
<wingo>davexunit: it's a variable that has more than one definition. notable a loop variable.
<wingo>*notably
<davexunit>ah, thanks.
<davexunit>good to know more terms.
<davexunit>"if you know the name of the spirit, you can have power over it"
<wingo>:)
<wingo>hmm, guile 2.0 run time for the same silly microbenchmark
<wingo>;; 1.230953s real time, 1.483924s run time. 0.335132s spent in GC.
<wingo>heh heh
<taylan>one order of magnitude, that's really great :)
<davexunit>so, a little over twice as slow as 2.2 pre-unboxing optimization
<wingo>ACTION wonders whether to untag integers too
<taylan>wingo: BTW would you be interested at all in giving feedback on SRFI-126? I perfectly understand if not. :P (dunno if you've seen my thread on the ML couple weeks ago where I was asking for feedback)
<civodul>wingo: i would think that untagging integers doesn't matter much at this stage, no?
<wingo>taylan: i don't think i have the time to do it justice...
<civodul>instruction dispatch is usually more important than fiddling with tags when doing integer arithmetics
<civodul>(at least i would think)
<taylan>wingo: ok, no problem
<wingo>civodul: i am not sure. in a region of code in which you are dealing with untagged integers there is only one control-flow path
<wingo>which might be an advantage
<civodul>one virtual control-flow path
<wingo>right
<civodul>yeah, dunno
<wingo>i'm also thinking towards native compilation
<holomorph>ACTION wonders about (ice-9 json)
<wingo>where obviously this would be a nice thign
<civodul>for native-compiled code, untagging integers surely makes a difference
<civodul>yeah
<wingo>the other thing is that in the 2.1.2 branch, all stack elements are 64 bits wide
<civodul>davexunit: json? :-) ↑
<wingo>even on a 32-bit machine
<civodul>oh
<wingo>so having untagged integers would lower gc pressure a lot for a common range of integers
<civodul>how well does that perform on 32-bit machines?
<civodul>ah yes, possibly
<wingo>i have no idea :) i just changed that yesterday so i haven't tested it
<wingo>on 32-bit machines i mean
<civodul>ok
<davexunit>holomorph, civodul: I have to respond to some feedback from mark that is taking some time.
<davexunit>I have fixed the easy to fix things, but there are difficult things that need to be done as well.
<davexunit>I'd like to get it into 2.0.12, if possible, but I wouldn't want to delay its release further.
<davexunit>so, if I can make it, cool, if not, it will have to be for next time.
<civodul>sure!
<wingo>ACTION thinks we should release 2.0.12 and 2.1.1 as-is
<wingo>we can release again in a month :)
<holomorph>meep
<davexunit>wingo: more frequent releases would be great
<davexunit>I wouldn't want to wait another 2 years for (ice-9 json) to be available, which is why I was trying to shoot for 2.0.12.
<davexunit>I think other folks would appreciate more frequent releases as well. :)
<lloda>I wish I could follow this compiler stuff :-/
<paroneayea>davexunit: btw, in case you're curious about the stuff I'm working on / was talking about as in terms of activitystreams stuff
<paroneayea>I just put up docs, they're nearly finished http://activipy.readthedocs.org/en/latest/index.html
<paroneayea>need to finish the section of the tutorial on extending vocabulary and the section on how immutability is pseudo-enforced
<paroneayea>now that most things are working
<paroneayea>I hope to move lessons learned over to the guile library soon
<paroneayea>(the above link is python-based, I guess kinda off-topic to #guile, sorry!)
<amz3>paroneayea: interesting!
<amz3>it's an application protocol of some sort
<paroneayea>amz3: yeah
<davexunit>paroneayea: meant to say awhile ago that I took a look at this and it's neat!
<davexunit>(just got caught up in #guix and work stuff)
<paroneayea>activitystreams is kind of a combination of logging notation for social sites, and also a command language
<paroneayea>davexunit: yeah I was curious about also what you thought of the method dispatch approach taken
<paroneayea>basically, AS2 has composite types, so you can't use python's class heirarchy
<paroneayea>so I ended up implementing an intermediate "environment" that knows about the vocabulary, but also has methods registered for different types
<davexunit>paroneayea: haven't inspected closely
<paroneayea>so you can very flexibly add methods relevant to your site, without needing to mutate some global dispatch tables
<paroneayea>and without fixing types to a fixed set of methods through message passing
<amz3>single dispatch doesn't work?
<paroneayea>amz3: not in order to make it moderately pythonic, and to support the type heirarchy that is provided
<amz3>Don't have all the requirements in the head.
<paroneayea>amz3: read the tutorial section if you're interested :)
<amz3>I'm reading
<wingo>moo
<daviid>hug!