<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I’ve been trying to create JSExprs, as defined in the typed/json library. This is one of those instances where it seems like I must be making things harder than they should be, but I’m still feeling like a duck on rollerskates in TR, so I want to make sure I’m not missing an easier way to do it.</div><div class=""><br class=""></div><div class="">Would you please confirm if this is indeed a smallest-possible solution?</div><div class=""><br class=""></div><div class=""><b class="">;;;; begin</b></div><div class=""><div class="">#lang typed/racket/base</div><div class=""><br class=""></div><div class="">(require typed/json)</div><div class=""><br class=""></div><div class="">(: jsx JSExpr) ; <b class=""><-- jsx is what I ultimately want.</b></div><div class=""><br class=""></div><div class="">;; Attempt #1:</div><div class="">#;</div><div class="">(define jsx #hasheq((a . "val1") (b . "val2") (c . "val3")))</div><div class=""><br class=""></div><div class="">#| Resulting error:</div><div class="">Type Checker: type mismatch</div><div class=""> expected: JSExpr</div><div class=""> given: (HashTable Symbol String)</div><div class=""><br class=""></div><div class=""><b class="">[This seems weird, since it seems like (HashTable Symbol String) should be</b></div><div class=""><b class=""> a subtype of JSExpr. </b><b class="">Is the problem that the typechecker can’t recognize</b></div><div class=""><b class=""> the Strings as JSExprs?]</b></div><div class="">|#</div><div class=""><br class=""></div><div class="">;; Attempt #N (<b class="">shortest </b><b class="">successful version I’ve found</b>):</div></div><div class="">(define jsx</div><div class=""><div class=""> (for/hasheq : (HashTable Symbol JSExpr) ([k '(a b c)]</div><div class=""> [v '("val1" "val2" "val3")])</div><div class=""> (values k v)))</div></div><div class=""><b class="">;;;; end</b></div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Jordan</div><div class=""><br class=""></div></body></html>