tonyg changed the topic of #racket to: The Racket Programming Language -- https://racket-lang.org/ -- https://gather.town/app/wH1EDG3McffLjrs0/racket-users -- http://pasterack.org -- logged at https://libera.irclog.whitequark.org/racket/ -- This is the right place to ask for help with (Dr)Racket. Remember to wait around for an answer!
Avichi has quit [Ping timeout: 244 seconds]
jao has quit [Ping timeout: 246 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 248 seconds]
monkey_ has quit [Ping timeout: 255 seconds]
tgi has joined #racket
thegeekinside has quit [Ping timeout: 255 seconds]
jeosol has joined #racket
jeosol has quit [Ping timeout: 244 seconds]
monkey_ has joined #racket
lowhope has quit [Ping timeout: 246 seconds]
ncf has quit [Ping timeout: 246 seconds]
ncf has joined #racket
monkey_ has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 246 seconds]
monkey_ has joined #racket
morte_ has joined #racket
monkey_ has quit [Remote host closed the connection]
ur5us has joined #racket
lucerne has quit [Read error: Connection reset by peer]
morte_ has quit [Ping timeout: 255 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 255 seconds]
jeosol has joined #racket
skapata has quit [Remote host closed the connection]
ur5us has quit [Remote host closed the connection]
ur5us has joined #racket
ur5us has quit [Ping timeout: 255 seconds]
tgi has quit [Ping timeout: 248 seconds]
lucerne has joined #racket
lucerne has quit [Ping timeout: 255 seconds]
mdhughes has quit [Remote host closed the connection]
mdhughes has joined #racket
ttree has quit [Ping timeout: 246 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 248 seconds]
szkl has quit [Quit: Connection closed for inactivity]
lucerne has joined #racket
lucerne has quit [Ping timeout: 252 seconds]
msiism has joined #racket
<msiism> Is it generally okay to provide pre-defined constants through modules?
<msiism> I mean,you can definitely do that. But it might not be ideal.
<msiism> If, e.g., I had some sort of math library that needs pi, I could compute it once and save it as a global constant.
<msiism> But I could also provide a funtion that computes it every time.
<msiism> I tend to think, though, that at least for the sake of efficiency, the latter approach should not be chosen in such a case.
<bremner> well, you could memoize the function
<msiism> In what sense?
<bremner> save the result in a module local variable, return that on successive calls
<msiism> Okay, interesting. I'd have to look into how that works.
<msiism> But is this necessarily better than just defining the constant and providing it directly?
<msiism> In my case, I'm trying to put some command line parsing helpers in a module.
<bremner> it might depend how complex the literal is. For 10 digits of pi, sure , just write it. For 1000 digits?
<msiism> Good point.
<msiism> I guess just providing the invocation name of a program as INVOCNAME directly should be fine.
<bremner> sure
<msiism> Okay, thanks.
<msiism> It also seems the least complex approach to be.
<bremner> for things that are not quite constants, parameters are useful
<msiism> Yeah, I've come across that a while ago and totally didn't get what that's about. Though I'd say I know what a parameter is, in general.
<bremner> something like "special variables" in common-lisp / dynamically scoped variables in elisp, but with a function-like syntax
<bremner> so you can't set! them by mistake
<msiism> Oh, right, I remember that part now (function-like syntax).
<msiism> Not being able set! is actually pretty much what I'm looking for in this case.
<msiism> Okay, I'll put that on my todo list.
<msiism> But then, how would you define a "true" constant in Racket? I mean because you said "not quite constants".
<msiism> My my idea of what a constant is is a bit off.
<msiism> E.g., when I say (define PROGNAME "mytool"), I could still set! PROGNAME later.
badkins has joined #racket
<msiism> So, is a "true" constant always literal then?
<bremner> iirc, set! cannot rebind identifiers from other modules, so your original idea is probably the right one
<bremner> I have vague memories of makeing a submodule just to define some constants, but can't find an example now
<msiism> I see. Well, I often want to define read-only variables up top in a program.
<msiism> Maybe parameters are the way to go then.
badkins has quit [Ping timeout: 255 seconds]
<msiism> For example, I'd define a programs version as (define VERSION "0.3.1").
<msiism> And there should be no way to (accidentally) set! that during execution.
lucerne has joined #racket
szkl has joined #racket
<bremner> msiism: a simple way to do it https://paste.debian.net/1259144/
<bremner> if you uncomment the last line, you get something like /home/bremner/test.rkt:11:6: set!: cannot mutate module-required identifier
<msiism> Thanks, I'll put that in my notebook.
msiism has quit [Quit: Konversation vaporized.]
badkins has joined #racket
badkins has quit [Ping timeout: 248 seconds]
badkins has joined #racket
morte_ has joined #racket
AnnArcana has quit [Remote host closed the connection]
thegeekinside has joined #racket
lucerne has quit [Ping timeout: 252 seconds]
badkins has quit [Quit: Leaving...]
badkins has joined #racket
jeosol has quit [Quit: Client closed]
skapata has joined #racket
morte_ has quit [Read error: Connection reset by peer]
monkey_ has joined #racket
demonTal is now known as dTal
badkins has quit [Remote host closed the connection]
monkey_ has quit [Ping timeout: 252 seconds]
ec has quit [Remote host closed the connection]
badkins has joined #racket
ec has joined #racket
monkey_ has joined #racket
ttree has joined #racket
lucerne has joined #racket
xgqt has quit [Read error: Connection reset by peer]
xgqt has joined #racket
jeosol has joined #racket
badkins has quit [Remote host closed the connection]
monkey_ has quit [Remote host closed the connection]
_________ has quit [Quit: leaving]
_________ has joined #racket
monkey_ has joined #racket
badkins has joined #racket
morte_ has joined #racket
jao has joined #racket
skapata has quit [Remote host closed the connection]
badkins has quit [Remote host closed the connection]
ec has quit [Remote host closed the connection]
ec has joined #racket
badkins has joined #racket
morte_ has quit [Ping timeout: 252 seconds]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 248 seconds]
morte_ has joined #racket
monkey_ has quit [Remote host closed the connection]
monkey_ has joined #racket
jao has quit [Ping timeout: 252 seconds]
jao has joined #racket
morte_ has quit [Ping timeout: 255 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 255 seconds]
morte_ has joined #racket
morte_ has quit [Ping timeout: 252 seconds]
monkey_ has quit [Ping timeout: 255 seconds]
morte_ has joined #racket
ur5us has joined #racket
monkey_ has joined #racket
monkey_ has quit [Ping timeout: 252 seconds]
ASau has joined #racket
jao has quit [Ping timeout: 252 seconds]
jao has joined #racket
jeosol has quit [Quit: Client closed]
morte_ has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 255 seconds]
badkins has joined #racket
ur5us has joined #racket
badkins has quit [Ping timeout: 255 seconds]
lucerne has quit [Read error: Connection reset by peer]
ec has quit [Ping timeout: 258 seconds]
ec has joined #racket
badkins has joined #racket
ur5us has quit [Ping timeout: 255 seconds]
badkins has quit [Remote host closed the connection]