#racket

/

      • ballpark joined the channel
      • ballpark has quit
      • damke_ joined the channel
      • damke has quit
      • lexi-lambda
        technomancy: I believe RacketCon is going to be back in St. Louis this year
      • technomancy
        oh, back-to-back with strange loop?
      • lexi-lambda
        and ICFP
      • iitalics has quit
      • technomancy
        well, I suppose that's nearly as good =)
      • damke joined the channel
      • dbenoit
        Is there a rough estimate for the date of RacketCon 2018?
      • damke_ has quit
      • lexi-lambda
        I would imagine late september or early october
      • dbenoit
        Cool, thanks!
      • pierpa joined the channel
      • Does anyone have an example handy of using ~optional with a single id pattern in a syntax-parse expression?
      • meaning, without using ~seq
      • tsou has quit
      • lexi-lambda
      • dbenoit
        Is there a way to omit the optional id in the stx object instead of setting a default?
      • lexi-lambda
        you can use syntax/parse/experimental/template
      • which has experimental in the name but I think too many people depend on it for it to go away any time soon :)
      • dbenoit
        Cool, thanks!
      • So, specifically, I'm trying to write a macro around struct. struct itself optionally takes a parent argument. Is using ~optional the most appropriate way to replicate that functionality in a macro? I suppose my question should be, how does struct accomplish it?
      • lexi-lambda
        the struct macro predates syntax/parse, so it does it differently (and with much more effort). I think using ~optional is the right thing to do.
      • dbenoit
        awesome, thanks a bunch!
      • lexi-lambda: syntax/parse/experimental/template was exactly what I need. Thanks :D
      • s/need/needed/
      • slemonide joined the channel
      • slemonide has quit
      • slemonide joined the channel
      • slemonide has quit
      • dbenoit has quit
      • dan_f joined the channel
      • slemonide joined the channel
      • slemonide has quit
      • ballpark joined the channel
      • bigfondue
        So, I made a function to estimate pi with a monte carlo sim, but my accuracy is within around %0.02 - %0.005 percent of racket's pi value, regardless of whether I sample 100000 or 6000000. Is there any way I can tweak it to get better accuracy, or am I running against the limits of floating point numbers?
      • rRru has quit
      • badkins_ has quit
      • ballpark has quit
      • dbenoit joined the channel
      • damke_ joined the channel
      • dan_f has quit
      • damke has quit
      • gorjusborg joined the channel
      • dbenoit has quit
      • dan_f joined the channel
      • dbenoit joined the channel
      • nisstyre
        bigfondue: I don't think it's a problem of precision if that's what you mean
      • because you're using the same number type as pi right?
      • how many significant digits does yours have?
      • dan_f has quit
      • ZombieChicken has quit
      • forgottenwizard joined the channel
      • jimmyrcom joined the channel
      • jimmyrcom_ joined the channel
      • forgottenwizard has quit
      • forgottenwizard joined the channel
      • jimmyrcom joined the channel
      • jimmyrcom_ joined the channel
      • christiansen` is now known as christiansen
      • JoshS joined the channel
      • jshjsh has quit
      • ozzloy joined the channel
      • ozzloy joined the channel
      • jimmyrcom has quit
      • jimmyrcom_ has quit
      • gorjusborg has quit
      • mrm
        You can always get 'better' accuracy, but every extra digit of accuracy will require at least 10 times your current number of samples (if you're doing it with a monte carlo sim).
      • slemonide joined the channel
      • jao has quit
      • slemonide has quit
      • pierpa has quit
      • kPb_in joined the channel
      • RiverMesa has quit
      • dbenoit
        Is there a way to create an identifier dynamically from a string?
      • Lowl3v3l joined the channel
      • kPb_in has quit
      • mbuf joined the channel
      • damke joined the channel
      • damke_ has quit
      • lexi-lambda
        dbenoit: depends on what you mean
      • forgottenwizard is now known as ZombieChicken
      • jimmyrcom joined the channel
      • jimmyrcom_ joined the channel
      • dbenoit
        I'm looking for something like:
      • (define (string->identifer <id string>) (<body>))
      • where <id string> is an expression which evaluates to a string
      • and the resulting string can be called as an identifier, if that makes sense
      • (define (string->identifier "hello") "hi")
      • hello
      • > "hi"
      • lexi-lambda
        dbenoit: you can do it if and only if the <id string> is known at compile-time, in which case you can generate the definition with a macro.
      • kPb_in joined the channel
      • you can’t synthesize new definitions at runtime because Racket is a lexically-scoped language and all bindings are resolved statically.
      • if you need that, you should probably just use a hash map or something like that. you could even write a macro to indirect lookups through the hash table if you really wanted.
      • it’s also worth saying that this is a small lie… you can use Racket’s reflective capabilities to create a fresh namespace and dynamically bind new things into that namespace. but you can never bind something into a namespace and use it to capture an existing local binding.
      • (and dynamic namespace manipulation and eval are almost always the wrong solution to a problem, unless you’re implementing DrRacket)
      • dbenoit
        So, the context I am using it is actually in a macro
      • ZombieChicken has quit
      • <id string> is a macro id
      • and I am trying to prepend a string to it
      • ZombieChicken joined the channel
      • lexi-lambda
        Then yes, you can do that. The format-id function from racket/syntax is often used to synthesize identifiers from old ones, but it’s just a small layer around string->symbol and datum->syntax.
      • dbenoit
        aha, thanks!
      • sz0 joined the channel
      • kPb_in has quit
      • soegaard joined the channel
      • kPb_in joined the channel
      • jshjsh joined the channel
      • JoshS has quit
      • LocaMocha joined the channel
      • kPb_in has quit
      • dbenoit has quit
      • damke_ joined the channel
      • damke has quit
      • dtornabene has quit
      • ozzloy joined the channel
      • ozzloy joined the channel
      • cuicui joined the channel
      • Lowl3v3l has quit
      • Lowl3v3l joined the channel
      • damke joined the channel
      • soegaard has quit
      • damke_ has quit
      • slack-irc-bot has quit
      • slemonide joined the channel
      • slack-irc-bot joined the channel
      • slemonide has quit
      • damke_ joined the channel
      • damke has quit
      • jimmyrcom_ has quit
      • jimmyrcom has quit
      • kPb_in joined the channel
      • YuGiOhJCJ joined the channel
      • ziyourenxiang joined the channel
      • orivej joined the channel
      • thblt joined the channel
      • soegaard joined the channel
      • soegaard has quit
      • soegaard joined the channel
      • kPb_in has quit
      • kPb_in joined the channel
      • kPb_in has quit
      • kPb_in joined the channel
      • davidl has quit
      • RiverMesa joined the channel
      • damke joined the channel