Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When you see weird syntax I suggest doing FullForm[Hold[whatever]] which is kind of like doing quote and macroexpand in a Lisp.

  f[#u, #v, #u] &[<|"u" -> x, "v" -> y|>] // Hold // FullForm  =>  
  Hold[Function[f[Slot["u"],Slot["v"],Slot["u"]]][Association[Rule["u",x],Rule["v",y]]]]

  FullForm[Hold[f[#u, #v, #u] &[<|"u" -> x, "v" -> y|>] // Hold // FullForm]] =>
  Hold[FullForm[Hold[Function[f[Slot["u"], Slot["v"], Slot["u"]]][Association[Rule["u", x], Rule["v", y]]]]]]


Just in time for Hallowe'en: The Nightmare before Lisp.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: