badkins has quit [Remote host closed the connection]
cynomys has quit [Quit: leaving]
badkins has joined #racket
badkins has quit [Ping timeout: 240 seconds]
lagash has quit [Ping timeout: 250 seconds]
ec has quit [Quit: ec]
lagash has joined #racket
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
<willghatch[m]>
Not 100% certain, but it may be the file extension. If you make a scribblings.rkt instead you can likely reference it.
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
TCZ has joined #racket
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
capfredf has quit [Ping timeout: 252 seconds]
cynomys has joined #racket
badkins_ has joined #racket
badkins has quit [Ping timeout: 240 seconds]
badkins_ has quit [Remote host closed the connection]
badkins has joined #racket
countvaj` has joined #racket
countvajhula has quit [Ping timeout: 250 seconds]
countvaj` has quit [Ping timeout: 240 seconds]
Rue has joined #racket
TCZ has quit [Quit: Leaving]
cynomys has quit [Quit: Lost terminal]
s-liao has joined #racket
badkins has quit [Remote host closed the connection]
capfredf has joined #racket
capfredf has quit [Ping timeout: 240 seconds]
countvajhula has joined #racket
<countvajhula>
I see, yeah it does appear to be the case that a module provided at the same scribblings collection path but with a .rkt instead of a .scrbl extension is `require`able. Thanks willghatch[m] !
s-liao has quit [Quit: Client closed]
badkins has joined #racket
skapata has quit [Remote host closed the connection]
badkins has quit [Ping timeout: 240 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
s-liao has joined #racket
s-liao has quit [Quit: Client closed]
capfredf has joined #racket
ur5us_ has quit [Ping timeout: 240 seconds]
capfredf has quit [Ping timeout: 252 seconds]
countvaj` has joined #racket
countvajhula has quit [Ping timeout: 240 seconds]
monkey_ has quit [Remote host closed the connection]
s-liao has joined #racket
ur5us_ has joined #racket
cynomys has joined #racket
lagash has quit [Ping timeout: 252 seconds]
lagash has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 240 seconds]
countvaj` has quit [Ping timeout: 240 seconds]
ur5us_ has quit [Ping timeout: 240 seconds]
meinside has joined #racket
capfredf has joined #racket
capfredf has quit [Ping timeout: 252 seconds]
s-liao has quit [Quit: Client closed]
ASau has quit [Remote host closed the connection]
badkins has joined #racket
Algernon69 has joined #racket
badkins has quit [Ping timeout: 240 seconds]
wwalker has quit [Quit: leaving]
wwalker has joined #racket
Avichi has quit [Quit: Client closed]
yagamisa1o is now known as newblue
newblue has quit [Changing host]
newblue has joined #racket
Avichi has joined #racket
m5zs7k has quit [Read error: Connection reset by peer]
m5zs7k_ has joined #racket
m5zs7k_ is now known as m5zs7k
Avichi has quit [Quit: Client closed]
capfredf has joined #racket
capfredf has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 240 seconds]
klf has joined #racket
<klf>
Greetings!
<klf>
(define (id arg ...) body ...+) is a shorthand for (define id (lambda (arg ...) body ...+))
<klf>
now, I want to dive deeper to gain a better understanding of how things work under the hood, but is overwhelmed by the concepts/terminologies
<klf>
is (id arg ...) in "(define (id arg ...) body ...+)" known as an internal-definition context?
gproto23 has joined #racket
ASau has joined #racket
skapata has joined #racket
skapata has quit [Changing host]
skapata has joined #racket
patrice has joined #racket
cynomys has quit [Quit: Lost terminal]
<klf>
"A top-level binding is a binding from a definition at the top-level; a module binding is a binding from a definition in a module; all other bindings are local bindings."
capfredf has joined #racket
<klf>
By default, for example, is the binding for '+' a module or a top-level binding?
Avichi has joined #racket
capfredf has quit [Ping timeout: 240 seconds]
mon_aaraj has quit [Ping timeout: 252 seconds]
mon_aaraj has joined #racket
s-liao has joined #racket
codingquark has quit [Ping timeout: 256 seconds]
Vaelatern has quit [Ping timeout: 252 seconds]
Vaelatern has joined #racket
Vaelatern has quit [Changing host]
Vaelatern has joined #racket
s-liao has quit [Ping timeout: 256 seconds]
notzmv has joined #racket
capfredf has joined #racket
s-liao has joined #racket
capfredf has quit [Ping timeout: 256 seconds]
codingquark has joined #racket
kayprish has joined #racket
Avichi has quit [Quit: Client closed]
Avichi has joined #racket
patrice has quit [Quit: Leaving]
s-liao has quit [Quit: Ping timeout (120 seconds)]
<tonyg>
No, an internal definition context is something else
<tonyg>
The binding for + is a module binding; the top-level is the *REPL*
<tonyg>
I'm afraid I don't have a good name for the (id arg ...) part -- it's kind of template-like I suppose? Generically, it's a "form" but then so is just about everything
s-liao has joined #racket
s-liao has quit [Client Quit]
s-liao has joined #racket
s-liao has quit [Client Quit]
meinside has quit [Quit: Connection closed for inactivity]
<klf>
tonyg, when (id arg ...) get parsed it has to know that it's not in expression context
<klf>
otherwise it would treat it as a function call, which it isn't
<tonyg>
that's true. The `define` macro takes care of that
<tonyg>
There are generally no good names for the portions of syntax that are not "expression context", unfortunately
<klf>
The only thing I still don't understand is "the top-level is the REPL".
<klf>
Can you elaborate on that a little more?
<klf>
"Within a module, references to top-level bindings are disallowed. "
<klf>
Is my code written inside a module (mymodule.rkt) "unde" the top-level?
<klf>
under*
<tonyg>
So the "top-level" is another name for the repl, the read-eval-print-loop; in interactive use in the repl, bindings may be created, but ALSO the module form is available, so modules can be defined at the repl (!!!)
<tonyg>
those modules defined at the repl are forbidden from referring to other top-level bindings (I think)
<tonyg>
certainly, a module in a *.rkt file is completely separate from the repl (hooray!) and so the question is moot
<tonyg>
there are, in that case, no top-level bindings to discuss since, at require time, there's no repl
<tonyg>
rudybot: eval (define x 1)
<rudybot>
tonyg: Done.
<tonyg>
rudybot: eval x
<rudybot>
tonyg: ; Value: 1
<tonyg>
rudybot: eval (module y racket (define v (+ x 1)) (provide v))
<rudybot>
tonyg: error: eval:1:30: x: unbound identifier in module <NEWLINE> in: x
<klf>
tonyg, thank you for that example :-)
<tonyg>
:)
<klf>
what is the #' notation in #'blah ?
<bremner>
in common-lisp/emacs-lisp it means (function blah). I didn't know it was a thing in racket
<rudybot>
klf: error: eval:1:15: lambda: default-value expression missing <NEWLINE> at: c <NEWLINE> in: (lambda ((x 4) c) (+ x c))
<rudybot>
klf: your sandbox is ready
<klf>
rudybot: (lambda (c [x 4]) (+ x c))
<rudybot>
klf: ; Value: #<procedure>
<klf>
I find that interesting.
<klf>
The grammar says that arg can be either id or [id default-expr] (among others)
<klf>
why does the order matter here?
<bremner>
because of how missing parameters are detected
<bremner>
so everything after the first missing parameter is also missing
<bremner>
(just talking about positional parameters here)
<klf>
> "because of how missing parameters are detected"
<klf>
in other words, (lambda ([x 4] c) (+ x c)) actually did not violate the grammar
<klf>
bremner: ^
<bremner>
uh. Well. it doesn't make sense. Whether it violates a grammer I don't know
<bremner>
if you pass one parameter, is that x or c
Guest3567 has quit [Quit: Reconnecting]
sudden has joined #racket
sudden is now known as Guest402
Guest402 has quit [Changing host]
Guest402 has joined #racket
kayprish has quit [Ping timeout: 252 seconds]
Avichi has quit [Quit: Client closed]
Algernon69 has quit [Read error: Connection reset by peer]
Algernon91 has joined #racket
badkins has quit [Remote host closed the connection]
Algernon91 has quit [Ping timeout: 252 seconds]
badkins has joined #racket
<klf>
For someone who is learning about Racket, the Racket doc is cryptic. So I come across the term "tainted identifier" and so I click on the hyperlink to the section that describes it and this is what I get:
<klf>
"A syntax object is tainted when it is included in an exception by the macro expander or when it is produced by a function like expand using a code inspector that is not the original code inspector. The function syntax-taint also returns a tainted syntax object."
<bremner>
to be fair, this is a specialized kind of "learning about racket"
<bremner>
but *shrug*, documentation can always be improved. Unfortunately the more specialized the documentation, the fewer people can improve it.
sagax has joined #racket
<klf>
at which point I ask myself, should I continue to recurse into "code inspector"
capfredf has joined #racket
<samth>
klf: no, you should definitely back out several steps
gproto23 has quit [Remote host closed the connection]
Algernon91 has joined #racket
Algernon666 has joined #racket
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
<klf>
Yea, I don't think I'll learn what a syntax object/identifier is. For someone who doesn't know what it is, I'd like to know when (i.e. what circumstances) the macro expander might reject it.
<samth>
klf: (a) the guide is a good place to start, better than the reference (b) you almost certainly don't need to know what certificates are
<samth>
klf: if you want to know how to write macros, then learning what syntax objects are is useful -- basically, they're an s-expression representing a program together with some information about what the names in the s-expression mean and where they came from
juanfra__ has quit [Read error: Connection reset by peer]
capfredf has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
badkins has quit [Remote host closed the connection]
capfredf has quit [Ping timeout: 252 seconds]
mzan has quit [Quit: No Ping reply in 180 seconds.]
mzan has joined #racket
Algernon666 has quit [Read error: Network is unreachable]
capfredf has joined #racket
capfredf has quit [Ping timeout: 240 seconds]
<klf>
samth, can you help me with an earlier question about the example for the predicate bound-identifier=?
<klf>
the syntax-rule transforms (check-a a) -> (check a a)
<klf>
and so the check would be (bound-identifier=? #'a #'a), wouldn't it?
ec has joined #racket
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
<samth>
klf: the point there is that it doesn't just transform it into `(check a a)`, instead it adds some additional information to the part of the program generated by the macro, so that the first `a` has that extra information, which `bound-identifier=?` detects
<klf>
samth, re: "the first `a` has that extra information". Where is that extra information kept? how does `bound-identifier=?` know where to look for it? I thought `a` is just an indentifier.
<samth>
`a` is indeed an identifier, and that's what I was saying earlier about syntax objects -- they have extra information about what names mean, which is the extra information that `bound-identifier=?` is checking
<samth>
(an identifier is just a syntax object representing a name, rather than representing a number or some bigger piece of syntax)
countvajhula has joined #racket
badkins has joined #racket
<klf>
I guess the lecture slide definition of a macro is too simple and lacks the detail that I need:
<klf>
"A macro is a function taht transforms a piece of Racket syntax into another."
<samth>
klf: maybe I could give a better answer if I understood more of what you're trying to learn
<klf>
Is it correct to say that a macro transforms one syntax object into another syntax object?
<samth>
yes, macros are functions from syntax objects to syntax objects
<klf>
just trying to get a better sense of how things work in Racket so that the Racket docs will be more useful to me,
badkins has quit [Ping timeout: 240 seconds]
<samth>
if you are relatively new to racket, you are unlikely to need `bound-identifier=?` at all
<samth>
(I am very much not new, and I almost never use it)
<samth>
klf: right, that's reference documentation which very precisely defines everything
<samth>
I would say that if you just want to get a sense for Racket, the Guide is a good place to start. If you want to learn how to write macros, then I recommend Fear of Macros: https://www.greghendershott.com/fear-of-macros/ If you want to learn how macros in Racket work, I recommend the talk video I linked above.
Avichi has quit [Ping timeout: 256 seconds]
cynomys has quit [Quit: leaving]
badkins has quit [Ping timeout: 240 seconds]
<klf>
thank you
klf has quit [Quit: leaving]
ur5us has joined #racket
ur5us_ has joined #racket
ur5us has quit [Ping timeout: 240 seconds]
badkins has joined #racket
capfredf has joined #racket
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
capfredf has quit [Ping timeout: 252 seconds]
ur5us_ has quit [Read error: Connection reset by peer]
ur5us_ has joined #racket
cynomys has joined #racket
Algernon666 has joined #racket
Vaelatern has quit [Ping timeout: 240 seconds]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
countvaj` has joined #racket
Vaelatern has joined #racket
Vaelatern has quit [Changing host]
Vaelatern has joined #racket
countvajhula has quit [Ping timeout: 240 seconds]
countvaj` has quit [Remote host closed the connection]