uh well good evening again uh I think I
have a little time here
uh to talk about macros uh is there
still room in our in our schedule for
that
or should I just kind of jump to some of
my thoughts on the day
you are now unmuted um pretty sure we
have some time
all right great yeah go for it well I'll
just drive into my pre
prepared thing to hear that yeah
actually you're right on time so
oh what an amazing thing I I just uh
you know I have been trying to do what I
I've got a big thank you planet to get
at the end but let me just say I uh
it's it's been really cool to watch the
way that people work together
absolutely it's this whole event today
has been
nothing but awesome and uh no less like
no little part thanks to all of the help
from all of you guys
and um everyone oh yeah it's awesome
um yeah with that all just um shut up
for now and uh
take it away corwin you know how to make
make that the default and good old cemex
all right so I'm gonna try to continue
my theme from the previous talk I'm a
longtime Emacs user but I'm
a pretty new person
to trying to really understand what's
going on within Emacs and make
my customizations to it uh simple for
what I tend to just think of will work
and maybe that's that's that's a nice
bow to put on that earlier talk
so uh whoops
uh let's see here now it's ctrl x
alt I that's right
and let's try that again okay good
so demoing is fun uh but I
will save most of that for tomorrow
where my
dear friend and co-collaborator in
bringing you the dungeon mode project
which is uh sort of
the exciting thing that we we hope
you'll be interested in
um I think gets a little more of a
reveal
uh tonight I'll just uh close saying
um a few things about the process of
making it and continuing my theme of
community
uh first of all a specific and upfront
shout out
to tv's wasa masa who
um absolutely shaped and guided this
this program I I may have taken out a
slide with your name on it but
thank you um
so when we think about Emacs macros and
the
power that they give us
I think about them the the
you know I think about them as a really
deep rabbit hole they confuse
people a lot and so to try to center
myself on that I remember first that
they're
they're going to be talking to us about
code
uh excuse me I realize I hadn't set my
timer
here we are
um so a simple macro syntax is going to
generate
something that is implicitly confusing
to somebody that knows the syntax of
emax lisp
well we see something like this and a
veteran I
says that x isn't quoted what's going on
but it can be hard to miss
um a lot of the functions as we'll talk
about in a moment that are built into
Emacs
really are macros so a lot of Emacs
features work this way
it might be scary but we have to look at
it closely if we really want to get
friendly with Emacs
um let's just jump right into deaf macro
which is which is our key entry point
and the
notes from this talk include the link um
to that uh which which definitely
uh read through a couple of times and
that may take you through
into the cldf macro which adds
the common list lisp extensions
and uh definitely
uh challenging uh I've struggled there
as we'll take a look at in
in a moment um
so I haven't played too much with cl
maclet perhaps success in
in that uh keyword space and figuring
out what the right balance is there
what will give me the confidence to try
some more lexical
uh macros
let me also briefly introduce the comma
and back quote if you
have uh allowed your eyes to cross when
you see these and that's not
uh a shameful shameful thing it's
confusing and we should be
alerting each other when we when we
stick macros in
often by putting them in different
different library spaces for complicated
projects
or um otherwise sort of warning people
that this is not an interactive function
if you get away with using it like one
um
to watch your back
the uh
the manual itself talks about macros
as being a way of evaluating
you know as as being um
an evaluator that will take our amex
lisp expression
and the set of forms that kind of that
will feed to it our code
[Music]
but it also provides us with this
concept of an
environment and and and that's really
where the power
comes in through that we can have
lexical variables and
um think about uh bring in some of the
capabilities that
um can be harder to reach with
a a a pure declarative statement that
doesn't allow
for uh
top level
um asynchronous asynchronicity
uh I'm gonna basically
[Music]
ignore the bike compilation phase for
this talk
uh in order to have any prayer of
getting through it in the
remaining nine or 11 minutes or whatever
uh but
suffice it to say it that's a scary
space and that's that's that's really
the thing that you want to start
learning about as you think about taking
taking macros on uh in earnest
the um coming back to the comma syntax
then
having having given ourselves sort of a
working definition for the Emacs lisp
runtime environment then we can say that
macros are going to
inject code back into that stream
whereas back quote is going to
uh going to give code back
to the to the stream or interject sorry
it's going to interject uh back into the
stream
uh sort of uh an exclamatory excuse me
I'd like to uh
have a value here and we can take that
value from the environment as it exists
when our macro is evaluated
back quote on the other hand takes the
result
from that and uh
and returns it back to the stream for
evaluation at the processing level that
invoked us
so in other words perhaps back up to
a top level eval expression where our
macro is invoked
uh wrong way so um
with what's I'm going to briefly bring
you back to the game
for just a moment
um I won't
I won't has I won't linger on this slide
but but
briefly uh this is a
roll paper role-playing pen
and pencil uh physical dice
tradition that dates back a long time
from a technology perspective
it's it's old in the same way that uh
other tools uh that I like are
old
uh it's simple to understand and I can
communicate a lot with it with a simple
amount of you know typing or
scribbling something on a piece of paper
it has a complicated problem space um
of its own again I don't want to
get too much into the game here but
uh in this in this talk for the last
five minutes I'll focus
on the process that we took to to
automate uh getting data out of the org
mode tables which
eventually as we'll talk about more
tomorrow are used to draw
game maps and other things
um here I talk about kind of why we did
that I'm going to skip briefly past that
and say instead that at a high level
it's it's symbolic informatics we're
giving a symbolic name
to a tile set and then
uh
and then assigning that tile set some
some characteristics like physical
speeds
screen space a variable that we might
want to swap in
and so forth uh and
you know our project rests heavily on on
org mode and
it's it's fundamental capabilities
so the the code I'm going to show here
is
uh is
is focused around sort of a a sticky
problem space in in the information
technology and I'm I'm a professional
uh uh software engineer turned uh
technology architect I support
the websites for a recognizable
financial services brand that I don't
identify just so I don't accidentally
end up
uh inadvertently misrepresenting my firm
in some financial
uh perspective if I let some other
companies slip at certain let some other
companies slip
name slip or my own it's certainly no
representation of an opinion other than
my own
the um
[Music]
so etl has to do with moving data around
we we have the idea of of
a pipeline where we'll be able to verify
certain assumptions not
nominally about data quality but it
could be about anything
before the pipeline starts okay we've
got a state where we think it should
work if we run it
we have uh some extraction where we'll
get our sources and we may have the the
opportunity to
uh make some assertions there and in the
transform
stage as well as the load things get a
little dicer
to the point where we come out of the
load stage and we should have some
really solid assertions again that we
can even go back and compare to the
extract stage
and from this we have the rudimentaries
of a data quality practice
uh in this case we have a number of org
mode files that will all
be distributed across a
number of players uh computers
so we might not want to update every
part of every buffer
I think it's a complicated problem space
and so we tried to take
a long-term view of
the solution that we needed um so I'll
go ahead
and open up the fun function
that well let's let's actually start
with the one that's pretty easy to read
and uh I'm gonna go ahead and just crank
it up huge
in case anybody's watching in 480.
um so this this program is not
a work of art it's a simple
implementation of the idea that a list
an a list of functions that return
maybe some data maybe some data and an
entry back into that a list
um can be done quite extensively with
very few lines of code
neither is it an especially tight or
thrifty implementation
it's just trying to get the job done
with a doc
statement for everything at the heart
um we see a call to this macro called dm
coalesce hash and that's what I'd like
to focus in on you can see I think
that something on unpleasant is
happening here
I've got an eval in um
what is I will share a a
fairly central function that that that
that
those implementing this etl pattern are
welcome to
derive from that is this is a default
transform
that you can get when loading certain
kinds of
uh orgmo tables that have been uh
properly adorned and again we'll get
into that all tomorrow
so keep an eye on time couple minutes
left let's look at the macro itself and
I have a slide on this but let's go
ahead and risk getting off page
oh boy here we go so this is my
utilities bucket
it has such basic features as give me a
hash table with some defaults I'll think
about that later
and
and add to list um a special version
that enables us to be a little cavalier
in experimenting with a-list versus
hashes versus p
lists we've made a right mess for
ourselves in the proof of concept area
and it's ripe
for someone to write a white paper about
when to prefer these things
and fix
the merge a list uh
same work here let's get let's get down
to business
this function has quite a this a macro
has quite a doc string and I think I
mentioned earlier that I got myself into
trouble with the keyword properties you
can see that we have
not only quite a number of them but
a lot of a lot of default values many of
which
may be relying on the
values that are passed in here this is
complicated and as it turns out
um I wasn't brave enough in most cases
to try to write a lambda that could
understand and
replace uh its own local variable I just
didn't
it didn't save me enough time this was
really easy
to read and write and understand as I
thought through my problem
but now as I use it I I've lost a little
ground maybe with this and I'm not even
sure
I like what I got from uh the many
keyword
properties when it and we can look
perhaps if we have
the time at what that looks like in uh
[Music]
oh all right I have to separately
dismiss and restart that
um so that so that's just about my time
uh and being respectful of that I want
to invite presenters to just jump in at
any of the many large pauses I leave
uh as I'll just leave up the doc string
for a moment and maybe split the screen
and pull open an item
you are now unmuted uh thank you very
much for your talk corwin
um I think you still have like uh
maybe three or four more minutes if you
want to quickly wrap up
okay so three or four more minutes I can
easily spend
on thank yous
I might switch to that if there aren't
questions on the path
[Music]
um would you like me to pull up the pad
or are you looking at it
I am I bookmarked it I am
pulling the tab and I'll bring it in
okay
all right this is the wrong ether pad
thanks for the link
all right um so I think I'm looking for
macros
uh okay key message sure so the
the key message is that it's um it's a
jungle out there
macros along with any other design can
leave you in a position
where you have a nice api and I can show
you other examples you can find them in
the dungeon mode source
of many many other places where I use
this exact same formula quickly
sketching out how a character sheet
or another big data set needs to
needs to figure out what tables are
going to be interesting from the
collection of files
and then load up the tile set and
the uh layout file from that
and I mean it works this the project is
moving forward with this I have the
flexibility that I need
but here I am evaling my own code to
make darn sure even if I get by
by compiled uh this macro doesn't uh
does get evaluated in the user's real
run time clearly a design fail so that
would be
the key point of my talk is is to
present this design
fail and uh thank
um thank the community but especially
wasa masa
for for some patience and let me add at
this moment that
uh he was so frustrated with me they
were sort of frustrated with me I think
I
didn't qualify pronouns um
with um
with doing this the the first the this
was one of our first interactions and
the feedback was
why is this a macro full stop
and uh that's a great message actually
and I and I hope that
uh maybe this can encourage further
talks across the subject about
you know hey wait a minute macros are
really fantastic as I hope I made
clear you can do a tremendous amount
about uh with them and we rely on them
for
almost all the fun goodies um from you
know defund
secu
um I want to get to my my thank yous let
me just
peek back at the pad
oh
well that was actually a scratch buffer
so I'll have to sort of read it cold off
my notes
um
but also but I'll switch to I'll also
I'll say a couple of thank yous if you
don't mind
in addition to the big thank you that I
hope was implied by my shout out to wasa
masa
um I also want to thank you amen for
um your kindness in extending
to the project as well as to me the
the chance to present here and and and
you've you've also
just done a lot of great stuff for our
project thank you very much for that and
sasha
I'll get there um thank you so much for
the inspiration that you are to our
whole community
I also want to thank the presenters
um for just being so flexible and
uh nagging back through the whole thing
and especially to leo
who has done so much to drive the show
today
um I
this is a fractious tent at times and
sometimes
it is indeed a little bit of a circus
but I
am learning so much so fast I'm just
inspired by how much
Emacs can teach us thank you
uh corbin for your kind words and you
know about me of course but all about
you know all of us
and the conference and you know indeed
thanks to everyone who's helped uh
including the speakers of course
without whom you know a maxcom really
wouldn't have been a EmacsConf
and you know it's been a pleasure
knowing you and working with
you um I guess um from afar for the most
part on dungeon mode like helping
helping with like small things here and
there but um
yeah it's been my pleasure and it's
great to have you and
um everyone else you know part of the
community and
for me to be part of the community it's
been a lot of fun
thank you
it's it's it's it's an honor and I don't
use that word an awful lot because I
sort of
sort of smirk at it but um gets us in a
lot of trouble honor does but
this will be a sure time to use it thank
you
likewise