Perl 6 - the future is here, just unevenly distributed

IRC log for #6macros, 2015-11-02

| Channels | #6macros index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
10:31 pdcawley joined #6macros
10:41 masak \o
10:42 masak pdcawley++ suggested the solution to http://strangelyconsistent.org/blog/macros-time-travel-is-hard might be to put a lambda around the {{{ }}} in the unquote
10:42 masak I can't immediately dismiss that idea :) have to try it.
10:45 pdcawley p6 has quasi, does it have quote too?
10:45 pdcawley Or is that simply lambda {...}?
10:46 pdcawley because it's a bloody useful special form to have when you're fiddling with stuff.
10:47 masak isn't quote just a quasi without unquotes?
10:50 pdcawley How do you write: quasi { quote {{{expr}}}  }
10:51 masak dunno; maybe Ven does?
10:51 pdcawley masak: You can't write it as quasi { quasi { {{{expr}}} } } can you?
10:52 masak I think that'd parse, but...
10:52 pdcawley macro quote expr { quasi { sub () { {{{ expr }}} } }
10:52 masak ...the {{{expr}}} would expand in evaluating the *outer* quasi
10:52 pdcawley masak: Which, in that case would be what you want.
10:53 pdcawley given $thing = quasi { ... }. How do you get at the actual value, btw? (been away from Perl 6 for a while...)
10:57 pdcawley masak: Does macro lookup (expr) { quasi { -> { {{{expr}}} }() } not do the trick?
10:58 pdcawley masak: No... no it doesn't. Call me mr silly.
10:58 masak the more I think about it, the less I think it helps
10:58 masak it boild down to just a lambda
11:02 masak supper &
11:02 pdcawley So... in 007, how would you write short_circuiting_and(expr1, expr2)?
11:02 pdcawley assuming all you've got available to you is 'if'?
11:03 pdcawley ie, how do you control what gets evaluated when?
11:05 pdcawley or, say,  macromap { it * 2 } @list
11:07 pdcawley last one's easy: macro macromap(block_expr, list_expr) { quasi { map ->(it) { {{{block_expr}}} } {{{list_expr}}} } }
12:49 masak macro short_circuiting_and(expr1, expr2) { return quasi { my $e = {{{expr1}}}; if $e { $e = {{{expr2}}} }; $e } }
14:36 masak boo-yah!
14:36 masak $ perl6 bin/007 -e='macro foo() { my how = "correctly"; return quasi { say("quasi lookup works " ~ how) } }; my how = "incorrectly"; foo()'
14:36 masak quasi lookup works correctly
14:36 masak \o/
14:37 masak biggest breakthrough since custom operators :D
15:47 pdcawley joined #6macros
16:25 pdcawley joined #6macros
16:25 _Ven joined #6macros
16:25 _Ven ahoy.
16:25 _Ven seen some messages in the irclog
16:26 _Ven the nested macro case is an interested one, but I think we can just copy what lisp does here
16:26 _Ven two level of quoting, so for us, nested quasis (since quote == quasi)
16:26 _Ven if we need to double-unquote, we'll probably going to use {{{ {{{ :)
16:37 _Ven ah but since it's 4pm, masak++ is probably sleeping :(
16:37 _Ven hi, pdcawley.
16:39 _Ven oh..
19:45 vendethiel joined #6macros
19:48 Ven_ joined #6macros
21:12 Ven_ joined #6macros
21:33 Ven_ joined #6macros
21:45 Ven_ joined #6macros
21:57 Ven_ joined #6macros
22:10 Ven_ erm, didn't get to the ast thing yet. got a bit of smalltalk and apl done, though... I'll try to do a bit of that tomorrow
23:12 Ven_ joined #6macros

| Channels | #6macros index | Today | | Search | Google Search | Plain-Text | summary