You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you seeing a bug in practice, or asking based on the code?
If the latter, it may not be clear from context but the properties value there is a map from properties to values. It's an optional argument, so I use the & variable args construct: (defn f [& props] ... ), which means that in the body of the function props is actually bound to a seq with one item. Calling first simply extracts the map from the seq.
Another way to handle this case is with destructuring: (defn f [& [props]] ... ) in which case props will be bound to the first item passed, not to the seq created by the ampersand.
I was asking based on the code, mainly because I've written a serialize-to-string function and wanted to be sure of your intent. Personally I prefer the destructuring option because it makes it clear the function takes only one additional argument, but each to their own :-).
Just curious. Why do the serialize methods take multiple props but only use the first one?
The text was updated successfully, but these errors were encountered: