2 ms·
Although, could this message thing not be modelled with lambdas taking remaining "holes" as arguments, "formatting" the message, which are given as arguments to
by zelphirkalt 6y ago
Although, could this message thing not be modelled with lambdas taking remaining "holes" as arguments, "formatting" the message, which are given as arguments to functions?
The gain seems smaller than the gain from first class procedures, but it is an interesting idea, which might avoid some lambda wrapping in the code.
- bjoli 6y agoI don't think I have to explain this to you (hello fellow guiler!), but in a language with first class procedures and proper macros there doesn't have to be any lambda typing overhead. I implemented "megacut" in guile, which is a clojuresque lambda shorthand: #%(+ %1 5 (* %2 4)) => (lambda (%1 %2) (+ %1 5 (* %2 4))) in about 30 lines of code (unhygienically, though, but that should be a small fix in a psyntax-based scheme)
- zelphirkalt 6y agoHehe, you are correct, indeed I did not think of macros in the moment. We do have some megacut wrapping overhead then though ;) Can you post a link to the macro on the Guile user list? Perhaps someone can rewrite it to a hygienic macro. Some people there very proficient in macrology. I am not that proficient in macrology. I am also trying to maintain a list of libraries and things for Guile, which I could add this too.
- bjoli 6y agoI have written enough macros to be able to do it (among others, the guile-for-loops macros). There are some issues with a macro like this. I can make it quasi-hygienic by hygienically checking for megacut (right now I am just comparing symbols, as returned by datum->syntax). Doing it in another way than "Any binding looking like %n and %& will be captured and shadowed" is pretty much unsolved using any standard scheme. I could probably hack something together using syntax-locally-bound-identifiers, but then I would have to implement local macro expansion (which is possible. I'm just lazy!). The link is https://hg.sr.ht/~bjoli/megacut/ https://hg.sr.ht/~bjoli/megacut/ Btw, the link for guile-for-loops should be updated in your list: https://hg.sr.ht/~bjoli/guile-for-loops https://hg.sr.ht/~bjoli/guile-for-loops
- zelphirkalt 6y agoThanks! I'll get to it later : )