Re: [pollen] Enthusiastic thank you and beginner question about metas

2019-03-29 Thread Zach Mandeville
This worked, thank y'all!

On Thursday, March 28, 2019 at 10:32:21 PM UTC+13, Sorawee Porncharoenwase 
wrote:
>
> You might want to try this pollen.rkt
>
> #lang racket
>
> (provide (all-defined-out))
>
> (define scuttlebutts
>   (hash
>"Gillis" "@a;lksjd2j3j1k2j.sha256f"
>"Brenda" "@s8/sj31l13j2k32.sha256"))
>
> (define (author name)
>   `(details (summary ,name) (p ,(hash-ref scuttlebutts name
>
> And here’s the output:
>
> '(root
>   (title "A Cool Essay")
>   "\n"
>   (details (summary "Brenda") (p "@s8/sj31l13j2k32.sha256"))
>   "\n"
>   "\n"
>   "this is the essay and all the paragraphs and all that")
>
> Notice the following changes:
>
>1. I convert keys of scuttlebutts to strings so that I do not need to 
>convert name in the author function to symbol. 
>2. Since name will always be one string in your use case, you don’t 
>need to use the rest argument. 
>3. You want to compute (hash-ref scuttlebutts name), so it’s needed to 
>be unquoted with ,. 
>
> To perfectly get the output that you indicate above, you also need to 
> define the root function that decodes paragraphs. You also need to define 
> the title function which creates the h1 tag.
>
> On Thu, Mar 28, 2019 at 12:42 AM Zach Mandeville  > wrote:
>
>> Hello!
>>
>> Thank you v. much for dreaming up and creating pollen (and thanks to all 
>> y'all making cool things with it!).  I discovered it through an article 
>> about medium, from practical typography, that was shared with me.  Pollen 
>> represents exactly what I want for a web publishing tool.  Especially the 
>> notion of creating your own tags, that can then be rendered however you'd 
>> like in html (or other forms).  That's philosophically just so good to me!
>>
>> The dilemma I have now, though, is that I started to write in pollen 
>> first, defining tags as I went along, and then found out I didn't quite get 
>> how to turn them into the html elements I want.  Worse, I enjoy writing in 
>> the pollen style so much  that I can't go back.  So I have an html.pm 
>> that I can't quite figure out how to turn into the .html i'm envisioning, 
>> and hoping someone here might be able to help?
>>
>> What I'd like is to have a list of essays by different authors, and each 
>> author has an id attached to them (it's authors from Scuttlebutt 
>> , and so each person has a public key ID 
>> associated with them).  the ID is long and strange, and so I don't wanna 
>> have to enter it each time.
>>
>> So for an essay, I'd have:
>>
>> ◊title{A Cool Essay}
>> ◊author{Brenda}
>>
>>
>> this is the essay and all the paragraphs and all that
>>
>> And I'd want this html:
>>
>> A Cool Essay
>> 
>>   Brenda
>>   @s8/sj31l13j2k32.sha256
>> 
>> this is the essay and all the paragraphs and all that
>>
>> In my pollen.rkt I created a meta hash that had each author's name and 
>> their ID:
>>
>> (define scuttlebutts
>>   (hash
>>'Gillis "@a;lksjd2j3j1k2j.sha256f"
>>'Brenda "@s8/sj31l13j2k32.sha256"))
>>
>> And below this I wanted a function to turn ◊author into that details 
>> element by referencing ◊author text against that 'scuttlebutts' meta...but, 
>> I can't  get it to work.  The closest I got is this:
>>
>> (define (author . elements)
>>   `(details (summary ,@elements)(p `(select-from-metas elements 
>> scuttlebutts
>>
>>
>> Essentially, I can't figure out how to have the value of the for the p 
>> x-expression to be the result of the select-from-metas expression.  I know 
>> it's likely something to do with quoting or some such, but I don't have 
>> enough racket knowledge (yet) to quite make sense of it.
>>
>> So my question is: what would be the best way to accomplish this?  Is 
>> there a correction to my function I'm missing, or would y'all recommend 
>> going about this in a wholly different way?
>>
>> Thank you!  And thank you again for this wonderfully strange language!
>>
>>
>>
>>
>> -- 
>> 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 poll...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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] Enthusiastic thank you and beginner question about metas

2019-03-28 Thread Matthew Butterick


> On Mar 28, 2019, at 12:42 AM, Zach Mandeville  
> wrote:
> 
> And below this I wanted a function to turn ◊author into that details element 
> by referencing ◊author text against that 'scuttlebutts' meta...but, I can't  
> get it to work.  The closest I got is this:

FWIW though you call `scuttlebutts` a "meta", in terms of Pollen terminology, 
that's imprecise. "Metas" are key/value pairs stored by a Pollen source 
(usually with `define-meta`), and exported via the `metas` hash table. 

The `select-from-metas` function is just a disguised version of `hash-ref`. So 
it won't complain about your attempt to treat `scuttlebutts` as a source of 
quasi-metas, because it's also a hash.

-- 
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] Enthusiastic thank you and beginner question about metas

2019-03-28 Thread Sorawee Porncharoenwase
You might want to try this pollen.rkt

#lang racket

(provide (all-defined-out))

(define scuttlebutts
  (hash
   "Gillis" "@a;lksjd2j3j1k2j.sha256f"
   "Brenda" "@s8/sj31l13j2k32.sha256"))

(define (author name)
  `(details (summary ,name) (p ,(hash-ref scuttlebutts name

And here’s the output:

'(root
  (title "A Cool Essay")
  "\n"
  (details (summary "Brenda") (p "@s8/sj31l13j2k32.sha256"))
  "\n"
  "\n"
  "this is the essay and all the paragraphs and all that")

Notice the following changes:

   1. I convert keys of scuttlebutts to strings so that I do not need to
   convert name in the author function to symbol.
   2. Since name will always be one string in your use case, you don’t need
   to use the rest argument.
   3. You want to compute (hash-ref scuttlebutts name), so it’s needed to
   be unquoted with ,.

To perfectly get the output that you indicate above, you also need to
define the root function that decodes paragraphs. You also need to define
the title function which creates the h1 tag.

On Thu, Mar 28, 2019 at 12:42 AM Zach Mandeville 
wrote:

> Hello!
>
> Thank you v. much for dreaming up and creating pollen (and thanks to all
> y'all making cool things with it!).  I discovered it through an article
> about medium, from practical typography, that was shared with me.  Pollen
> represents exactly what I want for a web publishing tool.  Especially the
> notion of creating your own tags, that can then be rendered however you'd
> like in html (or other forms).  That's philosophically just so good to me!
>
> The dilemma I have now, though, is that I started to write in pollen
> first, defining tags as I went along, and then found out I didn't quite get
> how to turn them into the html elements I want.  Worse, I enjoy writing in
> the pollen style so much  that I can't go back.  So I have an html.pm
> that I can't quite figure out how to turn into the .html i'm envisioning,
> and hoping someone here might be able to help?
>
> What I'd like is to have a list of essays by different authors, and each
> author has an id attached to them (it's authors from Scuttlebutt
> , and so each person has a public key ID
> associated with them).  the ID is long and strange, and so I don't wanna
> have to enter it each time.
>
> So for an essay, I'd have:
>
> ◊title{A Cool Essay}
> ◊author{Brenda}
>
>
> this is the essay and all the paragraphs and all that
>
> And I'd want this html:
>
> A Cool Essay
> 
>   Brenda
>   @s8/sj31l13j2k32.sha256
> 
> this is the essay and all the paragraphs and all that
>
> In my pollen.rkt I created a meta hash that had each author's name and
> their ID:
>
> (define scuttlebutts
>   (hash
>'Gillis "@a;lksjd2j3j1k2j.sha256f"
>'Brenda "@s8/sj31l13j2k32.sha256"))
>
> And below this I wanted a function to turn ◊author into that details
> element by referencing ◊author text against that 'scuttlebutts' meta...but,
> I can't  get it to work.  The closest I got is this:
>
> (define (author . elements)
>   `(details (summary ,@elements)(p `(select-from-metas elements
> scuttlebutts
>
>
> Essentially, I can't figure out how to have the value of the for the p
> x-expression to be the result of the select-from-metas expression.  I know
> it's likely something to do with quoting or some such, but I don't have
> enough racket knowledge (yet) to quite make sense of it.
>
> So my question is: what would be the best way to accomplish this?  Is
> there a correction to my function I'm missing, or would y'all recommend
> going about this in a wholly different way?
>
> Thank you!  And thank you again for this wonderfully strange language!
>
>
>
>
> --
> 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.
>

-- 
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.


[pollen] Enthusiastic thank you and beginner question about metas

2019-03-28 Thread Zach Mandeville
Hello!

Thank you v. much for dreaming up and creating pollen (and thanks to all 
y'all making cool things with it!).  I discovered it through an article 
about medium, from practical typography, that was shared with me.  Pollen 
represents exactly what I want for a web publishing tool.  Especially the 
notion of creating your own tags, that can then be rendered however you'd 
like in html (or other forms).  That's philosophically just so good to me!

The dilemma I have now, though, is that I started to write in pollen first, 
defining tags as I went along, and then found out I didn't quite get how to 
turn them into the html elements I want.  Worse, I enjoy writing in the 
pollen style so much  that I can't go back.  So I have an html.pm that I 
can't quite figure out how to turn into the .html i'm envisioning, and 
hoping someone here might be able to help?

What I'd like is to have a list of essays by different authors, and each 
author has an id attached to them (it's authors from Scuttlebutt 
, and so each person has a public key ID associated 
with them).  the ID is long and strange, and so I don't wanna have to enter 
it each time.

So for an essay, I'd have:

◊title{A Cool Essay}
◊author{Brenda}


this is the essay and all the paragraphs and all that

And I'd want this html:

A Cool Essay

  Brenda
  @s8/sj31l13j2k32.sha256

this is the essay and all the paragraphs and all that

In my pollen.rkt I created a meta hash that had each author's name and 
their ID:

(define scuttlebutts
  (hash
   'Gillis "@a;lksjd2j3j1k2j.sha256f"
   'Brenda "@s8/sj31l13j2k32.sha256"))

And below this I wanted a function to turn ◊author into that details 
element by referencing ◊author text against that 'scuttlebutts' meta...but, 
I can't  get it to work.  The closest I got is this:

(define (author . elements)
  `(details (summary ,@elements)(p `(select-from-metas elements scuttlebutts



Essentially, I can't figure out how to have the value of the for the p 
x-expression to be the result of the select-from-metas expression.  I know 
it's likely something to do with quoting or some such, but I don't have 
enough racket knowledge (yet) to quite make sense of it.

So my question is: what would be the best way to accomplish this?  Is there 
a correction to my function I'm missing, or would y'all recommend going 
about this in a wholly different way?

Thank you!  And thank you again for this wonderfully strange language!




-- 
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.