slack1
2017-12-12 19:01:53

How does one match a list of items to function parameters?


lexi.lambda
2017-12-12 19:02:24

apply?


slack1
2017-12-12 19:02:29

Such as (fn/10 (range 10))


lexi.lambda
2017-12-12 19:02:49

(apply fn/10 (range 10))?


slack1
2017-12-12 19:04:19

ah I see


slack1
2017-12-12 19:05:04

I somehow thought apply works one argument at a time


slack1
2017-12-12 23:02:27

Is there a way to do a struct literal?


slack1
2017-12-12 23:02:32

And is a struct a kind of declaration?


samth
2017-12-12 23:03:57

@slack1 yes, structs are a declaration


samth
2017-12-12 23:04:07

and there are struct literals for prefab structs


samth
2017-12-12 23:04:23

#s(p 1 2 3)


samth
2017-12-12 23:04:37

that’s a literal for a prefab struct named p with 3 fields


slack1
2017-12-12 23:06:04

mm thanks I shall read more on prefab structs


brendan
2017-12-13 06:10:57

Should I/why should I prefer local defines to lets?


notjack
2017-12-13 06:18:37

notjack
2017-12-13 06:19:01

> Racket comes with quite a few definitional constructs, including let, let*, letrec, and define. Except for the last one, definitional constructs increase the indentation level. Therefore, favor define when feasible.


notjack
2017-12-13 06:19:37

avoiding paren creep and indent creep is really the only reason, it’s not a big deal


brendan
2017-12-13 06:24:03

ah, gotcha


brendan
2017-12-13 06:24:11

yeah I came here from that section of the guide lol


notjack
2017-12-13 06:24:42

AFAIK that’s the only authoritative word on the subject


lexi.lambda
2017-12-13 06:38:24

I admit to personally preferring let, but there is an advantage to internal definitions: they can be easily mixed.


notjack
2017-12-13 06:38:49

oh I’ve been meaning to ask you about your let preference :p


lexi.lambda
2017-12-13 06:39:03

You can have a define, a define-values, a match-define and even a struct form together in the same internal definition context.