12:03
lucasb joined
|
|||
masak | this channel is small enough that I might get away with spoiling what I'll be writing about in the advent calendar on Monday | 18:13 | |
(you guessed it, it's about 007 again!) | 18:14 | ||
so, there's SEND + MORE = MONEY, the alphametic problem. quite famous | |||
I blogged about it long ago. strangelyconsistent.org/blog/send-m...y-in-perl6 | |||
I figured I might do it again, but from the point-of-view of my current understanding of slangs and "little languages" | 18:15 | ||
I predict it'll be quite nice :) | |||
main idea is this: start with a language that just looks like the original sum; that is, an ASCII version of the LaTeX sum at the top of en.wikipedia.org/wiki/Verbal_arithmetic | 18:16 | ||
compile it to the next language: a set of equalities/inequalities describing the letter variables involved (plus the four invisible carry variables tying them together) | 18:17 | ||
compile *that* to Perl 6, but with one extra feature: the `amb` operator, allowing us to specify the solution without nested loops, as just a zero-indent program | 18:18 | ||
finally, compile away the `amb` and turn it into regular loops | |||
... | |||
that in itself makes for a fairly nice post, I think. I was planning to start from the final program, having written it manually, and then work backwards into the nicer and more declarative languages | 18:19 | ||
but! | |||
lucasb | there's always a butt | 18:20 | |
*but | |||
masak | as a last point, almost an afterthought, I'm going to show how to *reason* about the second language, re-arranging the equalities/inequalities, basically *solving* the problem there instead of in the brute-force search | ||
and then concluding with: this is the final dream Perl 6 is aiming towards. many problems can be solved more easily if you're willing to invent languages that'll support and more easily express the problems. ASTs are optimizable; in this case the "AST" just happened to be a set of simultaneous equations. | 18:22 | ||
in a sense, both Lisp and Smalltalk are aiming there too; Perl 6 is just aiming there from inside the Algol family | 18:23 | ||
lucasb | so, no macros involved, right? this first and second declaratives languages are stand-alone, I suppose | 18:32 | |
about lisp, is that talk about "don't program from the problem down to the language, but grow the language torwards the problem" ? | 18:33 | ||
masak | yes, it's about that | 18:48 | |
I guess for now we'll have to settle for treating all the four "languages" as isolated islands with separate compilation processes between them | |||
in the fullness of time, they should just be macro rewriting, possibly between different slangs, all inside the same compilation process within 007 or Perl 6 | 18:49 | ||
that's the goal | |||
and that's what I want to advent blog about :) | |||
thesis: Perl 6 hasn't fully extended its wings until *all* the tools in the language are also applicable "inwards", onto the compilation toolchain itself | 18:50 | ||
somewhat hinted at here: github.com/masak/007/issues/420 | 18:51 |