winny has quit [Remote host closed the connection]
winny has joined #racket
vats has quit [Ping timeout: 240 seconds]
lagash has quit [Remote host closed the connection]
lagash has joined #racket
notzmv has quit [Ping timeout: 260 seconds]
littlebo1eep has joined #racket
littlebobeep has quit [Ping timeout: 240 seconds]
badkins has quit [Remote host closed the connection]
GreaseMonkey has quit [Remote host closed the connection]
greaser|q has joined #racket
livoreno has quit [Ping timeout: 248 seconds]
livoreno has joined #racket
ark has joined #racket
<ark>
so uh
<ark>
https://pastebin.com/raw/v5HdCTFG am i correct in interpreting this to mean: 1. define with list first argument = create function, 2. define with just the name = immediately eval the body and bind it to a name?
<winny>
which line numbers for each question?
lowak has quit [Remote host closed the connection]
lowak has joined #racket
capfredf has joined #racket
capfredf has quit [Ping timeout: 276 seconds]
<ark>
(define (x) (+ 1 1)) creating a callable thing that evaluates to 2 vs (define x (+ 1 1)) immediately binding the value to the name
<ark>
essentially
badkins has joined #racket
jao has quit [Remote host closed the connection]
badkins has quit [Ping timeout: 250 seconds]
jao has joined #racket
littlebo1eep has quit [Ping timeout: 240 seconds]
littlebobeep has joined #racket
jao has quit [Ping timeout: 272 seconds]
<winny>
ark: there's a few different define forms, the one that's just (define x some-value) which expands the some-value, and assigns its result to x. Then there's (define (x) some-value) which is a short-cut form for (define x (lambda () some-value)) . This binds a procedure that returns some-value when it's called like `(x)`
<ark>
yeah
notzmv has joined #racket
<ark>
i somehow thought the forms would be closer to each other
<ark>
like how haskell 0-argument/constant functions act like literals
<ark>
to my understanding at least...
<winny>
https://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29 i think this is a little challenging to follow (like IDK what a CVT is without thinking hard), but here's where define is documented
capfredf has quit [Remote host closed the connection]
szkl has quit [Quit: Connection closed for inactivity]
average_ has quit [Quit: Connection closed for inactivity]
jao has joined #racket
capfredf has joined #racket
badkins has quit [Remote host closed the connection]
morte_ has joined #racket
twosuns has quit [Quit: ...]
ASau has quit [Read error: Connection reset by peer]
badkins has joined #racket
kengruven has joined #racket
rudybot_ has joined #racket
rudybot has quit [Ping timeout: 256 seconds]
jao has quit [Ping timeout: 246 seconds]
capfredf has quit [Remote host closed the connection]
xgqt has quit [Ping timeout: 256 seconds]
xgqt has joined #racket
twosuns has joined #racket
dhil has joined #racket
morte_ has quit [Remote host closed the connection]
littlebobeep has joined #racket
littlebobeep has quit [Ping timeout: 240 seconds]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 246 seconds]
aidalgol has quit [Ping timeout: 246 seconds]
aidalgol has joined #racket
ec has quit [Remote host closed the connection]
ec has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
capfredf has joined #racket
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
badkins has joined #racket
twosuns has quit [Quit: ...]
greaser|q has joined #racket
greaser|q has quit [Changing host]
greaser|q is now known as GreaseMonkey
badkins has quit [Ping timeout: 246 seconds]
ec has quit [Quit: ec]
ec has joined #racket
ec has quit [Client Quit]
ec has joined #racket
capfredf has quit [Remote host closed the connection]
capfredf has joined #racket
capfredf has quit [Ping timeout: 272 seconds]
<kengruven>
i've got a struct and i want to compute some extra slots at init time (essentially a cache of expensive calculations of other fields). is the standard way to simply write a wrapper func for the constructor?
<winny>
kengruven: the #:guard keyword argument might help
littlebobeep has joined #racket
jao has joined #racket
twosuns has joined #racket
twosuns is now known as proportions
<kengruven>
winny: oh, i didn't realize it uses the return values from the guard. that doesn't seem to be mentioned in the documentation text (though the example does use that)
proportions is now known as TCZ
TCZ is now known as twosuns
badkins has joined #racket
<winny>
Feel free to open a bug, authors might have a different way to write that section to be more discoverable
badkins has quit [Ping timeout: 250 seconds]
<kengruven>
oh, i see it now. it's one sentence in the middle of a long paragraph.
<winny>
Regardless it wasn't easy to find?
<kengruven>
well, let's just say it's not the clearest paragraph in the docs
<kengruven>
is it possible to use #:guard to assign an #:auto slot? with slots (a [b #:auto]), i get an arity error at definition-time when my guard takes 3 args, and an arity error at call-time when it takes 2 args.
skapata has quit [Remote host closed the connection]
<winny>
kengruven: referring to the docs it doesn't seem to have any way to initialize an #:auto field other than using #:auto-value . Haven't really ran into this issue, but one way I might try to solve it is using a different struct constructor procedure, perhaps one that calls the original constructor to do most of the work