[pollen] Is there a nice way to display a hash table in my document?
I've been struggling with this for two hours. I want to have a nice overview of all links at the bottom of my document, so I defined a mutable hash table and made my link function add an entry to it every time it's called. (define references (make-hash)) (define (link url text [class ""]) (hash-set! references text url) `(a ((href ,url) (target "_blank") (class ,class)) ,text)) My problem now, is how do I actually display this thing? I've turned the hash table into a list of strings: from '#hash(("Blender" . "https://www.blender.org/";) ("Racket" . "http://racket-lang.org/";)) with ◊(hash-map references (lambda (x y) (string-append x ": " y))), to '("Racket: http://racket-lang.org/"; "Blender: https://www.blender.org/";) Now I want to feed each element of this list into a tag function, basically something like ◊(map p (hash-map references (lambda (x y) (string-append x ": " y if it actually works. How do I make this work? -- You received this message because you are subscribed to the Google Groups "Pollen" group. To unsubscribe from this group and stop receiving emails from it, send an email to pollenpub+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [pollen] Is there a nice way to display a hash table in my document?
> On Sep 17, 2017, at 10:02 AM, 飛羽如月 wrote: > > Now I want to feed each element of this list into a tag function, basically > something like > ◊(map p (hash-map references (lambda (x y) (string-append x ": " y > if it actually works. How do I make this work? Which part isn't working? Your code works for me. (Though if you're using Pollen markup, you'd need to put the result of the `map` operation inside some kind of container, so it qualifies as an X-expression) -- You received this message because you are subscribed to the Google Groups "Pollen" group. To unsubscribe from this group and stop receiving emails from it, send an email to pollenpub+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [pollen] Is there a nice way to display a hash table in my document?
> > (Though if you're using Pollen markup, you'd need to put the result of the > `map` operation inside some kind of container, so it qualifies as an > X-expression) > > Right, so that's what I'm looking for. Thanks! pollen.rkt: ... (define (reference x) ; list x -> txexpr `(div ((class "reference")) ,@(map p (sort x stringhttps://groups.google.com/d/optout.