6macros: discussing the finer points of Perl 6 macros, Qtrees, and how to stay sane | irclog: irclog.perlgeek.de/6macros/today
Set by moderator on 11 March 2015.
00:04 vendethiel joined 00:29 vendethiel joined 01:11 vendethiel joined 05:19 vendethiel joined 06:23 vendethiel joined 07:34 vendethiel joined 07:53 Ven joined 08:44 vendethiel joined 09:38 vendethiel joined 09:45 Ven joined 10:22 vendethiel joined 10:24 masak joined 11:22 vendethiel joined 12:19 vendethiel joined 12:28 Ven joined
Ven hmm 13:41
I took sweet.js
I installed contracts.js, es6-macros and sparkler(pattern matching macros)
gist.github.com/vendethiel/c643a3e3b2af4ebef4d2 13:43
I like the looks of it
13:43 vendethiel joined
masak huh. 13:46
some of these things have syntax and assumptions too far away from what I'm used to, so it's hard to say anything constructive or useful about them...
nevertheless; interesting.
Ven Alright! Sorry!
masak not a criticism. :) more of an observation about my own ignorance. 13:47
Ven the "usual" syntax for contracts.js is
@ (Num, Num) -> Num function foo() { ... }
the usual syntax for sparkler (the pattern-match thing) is 13:48
function foo { 42 => 0, x => x * 3 }
the usual syntax for es6 arrows is (x) => x * 10
so, here, I wrote a "fun" macro to be able to use *both* 13:49
masak ah.
Ven because contract was looking for the "function NAME ()"
masak yes, I suspected you were doing something like that.
Ven but sparkler didn't allow parens(that's how you mark a pattern-matching function)
masak so it's all text-based, like Perl 5's source filters?
Ven nope.
it's token-based 13:50
"..." is used to repeat "expressions" just like with scheme/racket's templates
masak needs to learn more about those, too :/
Ven so, here, (Num -> Foo) are different "expressions"
because they're not one single valid parse 13:51
hence the need for "..."
masak ok
Ven same for the body
So here
I have a syntax to define a named function with a contract
and pattern match the arguments inside
which I think looks really neat 13:52
I'll just throw: github.com/natefaubion/adt.js in the mix
which works with the pattern-match "sparkler" lib
(because it's from the same author :P)
masak unfortunately I'm at $work, so I can't give this its full attention 13:54
Ven The guy actually made a whole different language: github.com/natefaubion/derelicte
hah :) I'm at $school, so I have nothing else to do
masak aside from tagging "sweet.js" and "racket" as potentially interesting venues to explore in the future 13:55
Ven I hope you tagged those already ;-) I've mentioned them a fair bit! :P
masak I did.
this is a tagging for the nth time :) 13:56
Ven :P
15:02 vendethiel joined 15:06 Ven joined 15:10 Ven joined 15:13 Ven_ joined 15:18 Ven joined 16:35 Ven joined
Ven masak: eli-se is a mad genius as well :P 16:39
masak seems that way :) 16:41
Ven I'm mostly their rubber duck, tbh 16:50
github.com/rightfold?tab=activity
they're working on github.com/rightfold/mill
masak looks familiar. has probably been mentioned before. 16:56
17:00 vendethiel joined 17:40 vendethiel joined 18:49 vendethiel joined 19:01 Mouq joined