IRC channel logs

2015-04-23.log

back to list of logs

<nalaginrut>morning guilers~
***michel_mno_afk is now known as michel_mno
<civodul>Hello Guilers!
***karswell` is now known as karswell
<jmd>How do I do bit shifting in scheme?
<taylanub>jmd: R6RS has a library for that I think; might want to check the specification. I think it was the fixnum chapter.
<taylanub>other than that I think there was an SRFI
<taylanub> http://srfi.schemers.org/srfi-60/srfi-60.html
<jmd>taylanub: I'll look it up, thanks
<healer`>greetings guild of guilers
<healer`>anyone knows the current state of javascript on guile?
<taylanub>jmd: oh, I just realized this is #guile and not #scheme. I'm pretty sure Guile has something for it. (but maybe indeed one or both of those I mentioned)
<jmd>healer`: Isn't that rather like asking what the current state of Fortan on Algol?
<taylanub>jmd: have you checked (info "(guile) Bitwise Operations") ?
<jmd>taylanub: I'm reading it now.
<taylanub>probably `ash' and/or `round-ash' are what you want (weird names; didn't know these myself)
<ArneBab>meta/guile --language=ecmascript
<ArneBab>^ javascript
<ArneBab>healer`: do you have a testfile?
<ArneBab>healer`: this works: function foo(a) {a * 5;};foo(4);
<ArneBab>healer`: but stuff like semicolon insertion does not work, and I’m sure it is missing some features.
<ArneBab>(many)
<ArneBab>I don’t know internals, though
<davexunit>hopefully this will all be improved in this year's GSoC
<davexunit>fingers crossed
<ArneBab>is there a GSoC for Javascript in Guile?
<ArneBab>guile-emacs + js in Guile + eww would be … eww
<civodul>:-)
*davexunit reads http://srfi.schemers.org/srfi-116/srfi-116.html
<davexunit>basically a SRFI-1 for a new immutable pair type. neat, but I feel that it would be cumbersome to use.
<davexunit>no read syntax, need to convert to a regular list before doing pattern matching, etc.
<taylanub>yeah, J. Cowan has some weird ideas
<wleslie>healer`: it was ES4 last time I looked
<wleslie>so it's a bit dated.
<ijp>taylanub: this is why I have stopped speaking to him about r7rs
<ijp>davexunit: and there was already an immutable list srfi that got rid of the pair baggage
<davexunit>ijp: oh, interesting
<davexunit>didn't see that one
<davexunit>so many things that I don't know...
<mark_weaver>honestly, the stuff that is coming out of R7RS-large so far is so bad that I'm having second thoughts about whether Guile should even support R7RS-small.
<mark_weaver>(even thought I've already done 99% of that work)
<mark_weaver>*though
<dsmith-work>sneek: seen mark_weaver?
<sneek>I last saw mark_weaver on Apr 23 at 03:07 pm UTC, saying: *though.
<mark_weaver>I like J. Cowan as a person, and I'm grateful for his role in helping me keep the R6RS semantics of eqv? within R7RS
<dsmith-work>Morning Greetings, Guilers
<mark_weaver>but on his own, he's going kind of off the rails IMO with R7RS-large, probably because he doesn't actually write any real code except to play as far as I can see.
<davexunit>:(
<davexunit>seems that we need more people that write "production" Scheme code to weigh in on standardization decisions.
<mark_weaver>I agree with what wingo wrote in http://permalink.gmane.org/gmane.lisp.scheme.reports/4005 and http://permalink.gmane.org/gmane.lisp.scheme.reports/4019
<taylanub>is R7RS-large even progressing?
<taylanub>ah, there seems to be activity in specific new SRFIs' individual MLs
<mark_weaver>right, like SRFI-116 and SRFI-117
<mark_weaver>so, I'm thinking that R6RS is the right "fork" to follow out of the two.
<mark_weaver>IMO anyway
<davexunit>it's a shame that the standardization process is so messed up.
<davexunit>I want to see a bright future for Scheme as a language, but that's not what I see currently.
<taylanub>has anyone looked into SRFI-106? a standardized socket API would be very neat, but I can't judge how good it is because I typically use higher-level networking APIs.
<mark_weaver>davexunit: I don't see a bright future for a standard Scheme shared between most of the implementations. But there are highly successful languages with only one implementation, and R6RS is already supported by more high-quality implementations than most successful languages have.
<mark_weaver>how many good implementations are there of Lua, or Clojure, or Perl, or even C++?
<ijp>there can be only one perl
<davexunit>mark_weaver: that's very true.
<ijp>any successor needs to behead the other in a titanic struggle
<mark_weaver>haha
<taylanub>.oO( what ever happened to Perl 6? )
<mark_weaver>dsmith-work: yay, thanks for setting sneek's clock!
<bipt>taylanub, i'm not sure, but supposedly there will be a 1.0 release by christmas 2015
***michel_mno is now known as michel_mno_afk
<bipt> http://blogs.perl.org/users/shadowcat_mdk/2015/02/fosdem-2015-its-christmas.html
<paroneayea>yeah
<paroneayea>bipt: weird talk to attend at fosdem
<paroneayea>larry wall made the announcement then spent the rest of the time talking about lord of the rings
<please_help>Is there a way to verify whether a symbol is defined in the local environment? There are many references to facilities to do that but none of them seem to work in guile-2.0.9 or guile-2.0.11
<taylanub>please_help: what exactly do you mean with "local environment"? there is `defined?' for top-level definitions; for lexically bound identifiers it seems pretty useless since, well, they are lexically apparent :)
<please_help>They can't be lexically apparent at runtime which is the problem. I want to be able to capture every symbol known at the point of call, like the-environment or local-eval permitted.
<ijp>so what is wrong with local eval?
<taylanub>please_help: what's the exact use-case? maybe there's a better overall solution, since this seems to go against the idea of lexical scoping. going AFK for ~15 minutes now though, be back in a bit.
<please_help>The use-case is automatically detecting and wrapping unbound variables, capturing the name of reference in an annotated record, and taking the enclosing computational graph inside a lambda that takes the values of the read-time-unbound variables.
<please_help>What's wrong with local-eval is that it seemingly doesn't exist in guile-2.0.{11,9}
<please_help>might be missing something though of course
<ijp>local eval returned in 2.0.4
<ijp>(info "(guile) Local Evaluation")
<ijp>in (ice-9 local-eval)
<please_help>A new question as well: is there no way to define generic getters/setters for records? If I define-record-type <a> and <b>, with constructor (make-{a,b} var) and call both accessors the-var, the later accessor overrides the first.
<please_help>ijp, OK thanks.
<ijp>no way to do it automagically, even if you used goops
<please_help>I don't want to do it automagically, I just don't want to dispatch manually. goops has define-generic/define-method which I think does what I want. Records don't seem to have anything equivalent.
<taylanub>please_help: why would lexically scoped code have unbound variables? (sorry if I'm being obtuse)
<please_help>taylanub, the exact use case is to build a computational graph that allows 1- optimizing the flow (e.g. substituting repeated ops) 2- symbolic ops, such as differentiation or integration
<please_help>For this purpose, you might want to (make-graph (sigm (mat+ (mat* W x) b))) where W and b are defined at this point, but not x
<please_help>the output of make-graph is a computational graph that can be evaluated with, say, (run-graph (make-identity-matrix 10)), such that x is bound to a 10x10 identity matrix only at this point.
<taylanub>hm, interesting. I guess the "right" way to do this might be with procedural macros, but I'm probably being idealistic.
<please_help>If I have a (let loop ((...)) (begin (...) (loop ...)), it's still properly TCO'd, right?
<please_help>or does begin do something weird that requires keeping the context alive?
<davexunit>please_help: that should work fine.
<davexunit>test it out in the REPL with something trivial to make sure
<davexunit>you'll know right quick if it works or not ;)
<taylanub>the last expression in a body form is certainly in tail context
<daviid>I know it's a detail really, but imo, goops manual should use "Generic functions and Methods" and not the other way round as it is now, all occurences except 8.6.5 Generic Function and Method Examples [which imo is the good 'way'], wdyt?
<daviid>although the contract for define-generic and define-method wrt "If symbol was previously bound to a Scheme procedure..." is honored, such a (re)definitin does not change the printed represention of those, which remains #<procedure ... (_)>, i think it should be changed to #<<generic> ... (...)>
<bipt>daviid, it sounds a bit better to me, and FWIW the cl hyperspec has a section titled "generic functions and methods" (7.6)
<daviid>bipt: yep, indeed, in these 'original' manuals, tutorials... the order is always "generic functions and methods"
<bipt>the examples are also not great, e.g. it seems like pretty bad style to define + on both strings and matrices (string concatenation and addition aren't the same abstract operation in any meaningful way)
<daviid>bipt: true. mmaybe you'd prefer the olg example [stklos]? which redefines log as this
<please_help>bipt: it is a very common pattern. The idea is that it is useful, in a domain-specific way, to define simple operators that follow standard terminology (we write W*x + b, not W conv x mat+ b): it is clearer and easier to remember.
<please_help>whether or not it's a good habit to do so is another story of course.
<daviid>s/olg/log
<daviid>(define-method (log (s <string>) . l)
<daviid> (apply format (current-output-port) s l)
<daviid> (newline (current-output-port)))
<bipt>please_help, i'm not objecting to the matrix addition part, but to its combination with the string "addition" method, which obscures the idea that the methods of a generic function should be related
<daviid>anyway, compared to the goops bugs that need to be fixed, these things are details really. goops needs to be fixed, urgently imo, to correctly implement the clos protocol wrt inheritance, both setters and slot definitions, as well as fixing the none respect of the merge-generics contract...
<bipt>for example, the (print <document>) method for making a hardcopy shouldn't be on the same GF as the 'print' procedure for displaying something on the terminal
<bipt>s/be on the same GF as the 'print' procedure/be a method of the 'print' GF/
<please_help>Is there a clean (and hopefully efficient) way to determine to type a symbol would have if it weren't quoted? E.g. (define-syntax-rule (my-macro form) (procedure? (car form))); (my-macro (+ 1 2)) ;=> #t
<please_help>alternatively, (define-...) (my-macro '(+ 1 2)) ;=> #t since (unquote (quote +)) is a procedure
<bipt>please_help, i don't know how to use it, but there is syntax-local-binding described in (info "(guile) Syntax Transformer Helpers") that looks like it does what you want
<bipt>or at least, it can tell you whether the identifier names a macro, lexical variable, global variable, etc.
<please_help>I really need to know whether it's a procedure, a symbol (i.e. double-quoted), or a variable (of any type).
<please_help>whether I'm dealing with a lexical v.s. global variable doesn't matter to me in this case.