[racket-users] Putting Racket into the database or, more sanely, storing continuations
Is it possible to take (e.g.) a procedure object and decompose it back into its original source code? Background: I need a very simple pure-Racket task manager for the app I'm working on. This is an application-internal TM, not a for-users TM -- the sort of tasks it will be handling are "in 5 minutes, release this block of disk space that we just reserved". The app will eventually be installed on end-user machines, so using something like ZeroMQ is unappealing because it would mean installing additional software. One (bad) idea that came to mind was to simply shove some Racket code into a TEXT field in the database, then eval it when the time comes. Now, this is horrible for a lot of reasons (security and error handling being two of them), but it got me thinking: how would I do this? I could build a Racket list that happens to be code, then eval that but suppose I already had a function that did what I needed and I wanted to use that -- how could I store that? Some googling and documentation-searching has not shown me a way to decompose a procedure. I played around with some syntax-related calls but made no headway. Another (saner) solution would be to serialize a continuation to disk, the way the web server does, then put some sort of activation trigger (e.g. a URL) in the database. I'm not going that route because I don't understand the process very well and based on the reading I've done it's got some pitfalls. So, with the caveat that I'm not actually going to put Racket in the DB and this is mostly just intellectual curiosity, how would I do this? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Building regexen in at-exp
Sort of. at a high level pseudo code view I have a file of things the user inputs a list of things for each thing the user inputs it finds all reference in the file of things To put it plainly if you are familiar with Princeton's word net db/files I am searching the words in a user inputted sentence against the file index.senses. Documentation for that file is online. Anyway this is part of an NLP approach I am working on. Ken On Fri, Oct 28, 2016 at 3:41 PM, David Storrswrote: > On Fri, Oct 28, 2016 at 3:24 PM, Ken MacKenzie > wrote: > > In a future version of what I am working on I see regex being an > excellent solution. My search is against a file I load into a list at > program initialization. However for other parts of this to load a list > based on a partial file filtered with regex may be a better solution. > > So you're doing something like "load the whole file, then search for > all lines that start with prefix X"? > > You might try something like this: > > (define prefix #px"^foo") ;; Construct this however you like > > (for ((line (file->lines "/path/to/file))) > (when (pregexp-match prefix l) > (do-the-thing-with line))) > > Code not tested. > > > > There is also the case that I eventually switch to a DB backend, but at > prototype stage I have been skipping that. > > > > Sorry not an answer to your query, but I think I could make use of the > answer so inserting myself into the thread. > > > > Ken > > > > On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote: > >> tl;dr : Why is the following an error? > >> > >> #lang at-exp racket > >> (define a "this") > >> @pregexp{^@a} ;; Should produce #px"^this" but errors out > >> @pregexp{@(~a "^" a)} ;; This works but is clumsy > >> > >> Long version: > >> > >> The at-exp language > >> (http://www.greghendershott.com/2015/08/at-expressions.html and > >> https://docs.racket-lang.org/scribble/reader-internals.html) allows > >> for (among other things) more convenient construction of regexen, like > >> so: > >> > >> (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh. > >> @pregexp{\d\d\.\d\d} ;; at-exp...ah, much better > >> > >> I started to reply to Ken MacKenzie's recent post about string > >> prefixes with a suggestion that, although string-prefix was what he > >> wanted in this case, a regex would be a more general solution. When I > >> went to test the code I was suggesting, I was surprised to find it > >> didn't work as expected. I thought maybe "^@" was a function or > >> special form in Racket, but a quick search of the docs revealed > >> nothing. I tried various forms of quoting inside the at-exp but > >> nothing worked. > >> > >> What am I missing? > > > > -- > > You received this message because you are subscribed to the Google > Groups "Racket Users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to racket-users+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 "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Building regexen in at-exp
*@pregexp{^@a}* is read as *(pregexp "^" a)* [you can test this by evaluating the quoted form, '*@pregexp{^@a}* ], but the function pregexp expects a single string as its first argument (and, apparently, a function or #f as its optional second argument). More generally, the body part of an @-expression is read as several strings (i.e. a list, or several arguments to a function), not a single string. You could get what you want by writing, for example, *(pregexp @~a{^@a})* On Fri, Oct 28, 2016 at 2:41 PM David Storrswrote: > On Fri, Oct 28, 2016 at 3:24 PM, Ken MacKenzie > wrote: > > In a future version of what I am working on I see regex being an > excellent solution. My search is against a file I load into a list at > program initialization. However for other parts of this to load a list > based on a partial file filtered with regex may be a better solution. > > So you're doing something like "load the whole file, then search for > all lines that start with prefix X"? > > You might try something like this: > > (define prefix #px"^foo") ;; Construct this however you like > > (for ((line (file->lines "/path/to/file))) > (when (pregexp-match prefix l) > (do-the-thing-with line))) > > Code not tested. > > > > There is also the case that I eventually switch to a DB backend, but at > prototype stage I have been skipping that. > > > > Sorry not an answer to your query, but I think I could make use of the > answer so inserting myself into the thread. > > > > Ken > > > > On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote: > >> tl;dr : Why is the following an error? > >> > >> #lang at-exp racket > >> (define a "this") > >> @pregexp{^@a} ;; Should produce #px"^this" but errors out > >> @pregexp{@(~a "^" a)} ;; This works but is clumsy > >> > >> Long version: > >> > >> The at-exp language > >> (http://www.greghendershott.com/2015/08/at-expressions.html and > >> https://docs.racket-lang.org/scribble/reader-internals.html) allows > >> for (among other things) more convenient construction of regexen, like > >> so: > >> > >> (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh. > >> @pregexp{\d\d\.\d\d} ;; at-exp...ah, much better > >> > >> I started to reply to Ken MacKenzie's recent post about string > >> prefixes with a suggestion that, although string-prefix was what he > >> wanted in this case, a regex would be a more general solution. When I > >> went to test the code I was suggesting, I was surprised to find it > >> didn't work as expected. I thought maybe "^@" was a function or > >> special form in Racket, but a quick search of the docs revealed > >> nothing. I tried various forms of quoting inside the at-exp but > >> nothing worked. > >> > >> What am I missing? > > > > -- > > You received this message because you are subscribed to the Google > Groups "Racket Users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to racket-users+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 > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+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 "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Building regexen in at-exp
On Fri, Oct 28, 2016 at 3:24 PM, Ken MacKenziewrote: > In a future version of what I am working on I see regex being an excellent > solution. My search is against a file I load into a list at program > initialization. However for other parts of this to load a list based on a > partial file filtered with regex may be a better solution. So you're doing something like "load the whole file, then search for all lines that start with prefix X"? You might try something like this: (define prefix #px"^foo") ;; Construct this however you like (for ((line (file->lines "/path/to/file))) (when (pregexp-match prefix l) (do-the-thing-with line))) Code not tested. > > There is also the case that I eventually switch to a DB backend, but at > prototype stage I have been skipping that. > > Sorry not an answer to your query, but I think I could make use of the answer > so inserting myself into the thread. > > Ken > > On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote: >> tl;dr : Why is the following an error? >> >> #lang at-exp racket >> (define a "this") >> @pregexp{^@a} ;; Should produce #px"^this" but errors out >> @pregexp{@(~a "^" a)} ;; This works but is clumsy >> >> Long version: >> >> The at-exp language >> (http://www.greghendershott.com/2015/08/at-expressions.html and >> https://docs.racket-lang.org/scribble/reader-internals.html) allows >> for (among other things) more convenient construction of regexen, like >> so: >> >> (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh. >> @pregexp{\d\d\.\d\d} ;; at-exp...ah, much better >> >> I started to reply to Ken MacKenzie's recent post about string >> prefixes with a suggestion that, although string-prefix was what he >> wanted in this case, a regex would be a more general solution. When I >> went to test the code I was suggesting, I was surprised to find it >> didn't work as expected. I thought maybe "^@" was a function or >> special form in Racket, but a quick search of the docs revealed >> nothing. I tried various forms of quoting inside the at-exp but >> nothing worked. >> >> What am I missing? > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+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 "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Building regexen in at-exp
To understand what's going on, consider the following program: #lang at-exp racket (define a "this") (define (f . l) (for-each displayln l)) @f{^@a} which prints ^ this What's going on is that the `{}` in at-exp notation will evaluate to a list of strings. One for the "^", and one for `a`. `pregexp` accepts a single string as argument (whereas `f` accepts as many as you want). To make this work, you have to combine all these strings into one, as you did using `~a`. Vincent On Fri, 28 Oct 2016 14:18:10 -0500, David Storrs wrote: > > tl;dr : Why is the following an error? > > #lang at-exp racket > (define a "this") > @pregexp{^@a} ;; Should produce #px"^this" but errors out > @pregexp{@(~a "^" a)} ;; This works but is clumsy > > Long version: > > The at-exp language > (http://www.greghendershott.com/2015/08/at-expressions.html and > https://docs.racket-lang.org/scribble/reader-internals.html) allows > for (among other things) more convenient construction of regexen, like > so: > > (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh. > @pregexp{\d\d\.\d\d} ;; at-exp...ah, much better > > I started to reply to Ken MacKenzie's recent post about string > prefixes with a suggestion that, although string-prefix was what he > wanted in this case, a regex would be a more general solution. When I > went to test the code I was suggesting, I was surprised to find it > didn't work as expected. I thought maybe "^@" was a function or > special form in Racket, but a quick search of the docs revealed > nothing. I tried various forms of quoting inside the at-exp but > nothing worked. > > What am I missing? > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+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 "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Building regexen in at-exp
In a future version of what I am working on I see regex being an excellent solution. My search is against a file I load into a list at program initialization. However for other parts of this to load a list based on a partial file filtered with regex may be a better solution. There is also the case that I eventually switch to a DB backend, but at prototype stage I have been skipping that. Sorry not an answer to your query, but I think I could make use of the answer so inserting myself into the thread. Ken On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote: > tl;dr : Why is the following an error? > > #lang at-exp racket > (define a "this") > @pregexp{^@a} ;; Should produce #px"^this" but errors out > @pregexp{@(~a "^" a)} ;; This works but is clumsy > > Long version: > > The at-exp language > (http://www.greghendershott.com/2015/08/at-expressions.html and > https://docs.racket-lang.org/scribble/reader-internals.html) allows > for (among other things) more convenient construction of regexen, like > so: > > (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh. > @pregexp{\d\d\.\d\d} ;; at-exp...ah, much better > > I started to reply to Ken MacKenzie's recent post about string > prefixes with a suggestion that, although string-prefix was what he > wanted in this case, a regex would be a more general solution. When I > went to test the code I was suggesting, I was surprised to find it > didn't work as expected. I thought maybe "^@" was a function or > special form in Racket, but a quick search of the docs revealed > nothing. I tried various forms of quoting inside the at-exp but > nothing worked. > > What am I missing? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Building regexen in at-exp
tl;dr : Why is the following an error? #lang at-exp racket (define a "this") @pregexp{^@a} ;; Should produce #px"^this" but errors out @pregexp{@(~a "^" a)} ;; This works but is clumsy Long version: The at-exp language (http://www.greghendershott.com/2015/08/at-expressions.html and https://docs.racket-lang.org/scribble/reader-internals.html) allows for (among other things) more convenient construction of regexen, like so: (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh. @pregexp{\d\d\.\d\d} ;; at-exp...ah, much better I started to reply to Ken MacKenzie's recent post about string prefixes with a suggestion that, although string-prefix was what he wanted in this case, a regex would be a more general solution. When I went to test the code I was suggesting, I was surprised to find it didn't work as expected. I thought maybe "^@" was a function or special form in Racket, but a quick search of the docs revealed nothing. I tried various forms of quoting inside the at-exp but nothing worked. What am I missing? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Trying to build 'routing' macro for dispatch-rules
I'm trying to build a macro that will generate routing rules for 'dispatch-rules'. (dispatch-rules) from web-server/dispatch has this form: (dispatch-rules (("announce-user") #:method post process-announce-user)) ...more routes here... ) This seems like it should be automatable, so I tried to write a macro to generate these rules. I'd like (routing announce-user) to expand to the line above:(("announce-user") #:method post process-announce-user)) Here's my stab at it, which is currently failing: ;;This part works if I use it directly, ie: ;; [("announce-file") #:method post (make-route msg-announce-file announce-file*)] ;; (define (make-route msg-handler pbuf-type) (lambda (req) (msg-handler (req->protobuf req pbuf-type ;;Let's try to generate the entire rule using the above (define-syntax (routing stx) (syntax-case stx () ([_ pbuf-type] (with-syntax* ([type-name(format-id stx "~a*" #'pbuf-type)] [handler-name (format-id stx "msg-~a" #'type-name)] [route-name (symbol->string (syntax->datum (format-id stx "~a" (syntax->datum #'pbuf-type] ) #'[(route-name) #:method "post" (make-route handler-name type-name)] ;; #'(quote [(route-name) #:method "post" (make-route handler-name type-name)]) ;;(routing announce-file) ; If I use this (i.e. outside the dispatch-rules) in combination with the 'quote' version above, I see the correct thing (define-values (dispatch-request url-for) (dispatch-rules (routing announce-file) [("create-user") #:method post process-create-user] ...more routes here... ) Error is: racket network/routing.rkt ~/app/network/routing.rkt:194.2: dispatch-rules: bad syntax in: (dispatch-rules (routing announce-file) (("create-user") #:method post process-create-user) ... context...: /Applications/Racket_v6.6/collects/syntax/parse/private/runtime-report.rkt:698:0: error/report /Applications/Racket_v6.6/collects/syntax/parse/private/runtime-report.rkt:28:0: call-current-failure-handler standard-module-name-resolver As mentioned in the comments, it does generate (the quoted form of) the correct thing if I: 1) inside the macro, comment in the 'quote' line and comment out the line above it 2) comment OUT the '(routing announce-file) that is inside dispatch-rules 3) comment IN the (routing announce-user) line that is just above dispatch-rules My suspicion is that dispatch-rules is a macro and so my macro is not being expanded inside another macro. That's not how I thought macros worked, though, so now I'm really puzzled. Can anyone clarify this for me? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Convention for package build scripts (that don't really have to be part of the package)?
When I made recent changes to my tzdata package, I included a module that automates the process of re-building the package. (It downloads the latest version of the tz data and its associated code, builds the zoneinfo database from it, and constructs an info.rkt file for it.) I have a similar kind of script in the works for my next version of the CLDR packages. Is there any kind of convention about where this kind of code should go? For obvious reasons, I want it to be in the same repository as the package itself, but it really doesn't need to be distributed as part of the package. I could put it in its own -build directory from the repo root, just like I might have -lib, -doc, and -test packages. (The -test packages aren't terribly interesting from a distribution standpoint either.) I'm just curious if anyone else has thought about this or has any good ideas. - Jon -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Compare parts of string or compare with wildcard.
Excellent thank you. To note I am searching the docs but I see I did not scroll far enough. I went to go find string-prefix in the doc and also found string-contains and string-suffix in the same set of examples. So you gave me an inadvertent trifecta of useful information. It also means that where the original code was used as part of a filter (lambda(x) expression I should be able to ditch the extra function and just handle as a filter (string-prefix. Ken On Friday, October 28, 2016 at 12:34:29 PM UTC-4, Shu-Hung You wrote: > Hi Ken, > string-prefix? does exactly what you want. > > > (define a "this") (define b "that") (define c "thisandthat") > > (string-prefix? c a) > #t > > (string-prefix? c b) > #f > > https://docs.racket-lang.org/reference/strings.html#%28def._%28%28lib._racket%2Fstring..rkt%29._string-prefix~3f%29%29 > > Best, > Shu-Hung > > > Ken -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] git-checkout-credentials
The `raco pkg config` options are documented here: http://docs.racket-lang.org/pkg/cmdline.html#%28part._raco-pkg-config%29 (It might be a good idea to add the names of the individual options to the index so they can be searchable.) Specifically, the format is a series of username:password pairs that correspond to HTTP Basic Authentication username & password. The `raco pkg config` command should also prompt you with the proper format if you provide an improperly formatted value. Here’s a usage example: raco pkg config --set git-checkout-credentials alyssa:pass1234 > On Oct 27, 2016, at 02:55, Philip McGrathwrote: > > I'm excited by the ability to use authentication-required git repositories > with the package system. > - The package system supports authentication when installing packages > from git, using the `raco pkg config git-checkout-credentials` > configuration option. > What is the value to be provided for git-checkout-credentials? It doesn't > seem to have made it into the docs yet (or, at least, I haven't found it). > Thanks, > Philip -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Compare parts of string or compare with wildcard.
Hi Ken, string-prefix? does exactly what you want. > (define a "this") (define b "that") (define c "thisandthat") > (string-prefix? c a) #t > (string-prefix? c b) #f https://docs.racket-lang.org/reference/strings.html#%28def._%28%28lib._racket%2Fstring..rkt%29._string-prefix~3f%29%29 Best, Shu-Hung On Friday, October 28, 2016 at 11:19:26 AM UTC-5, Ken MacKenzie wrote: > I have two things I am trying to compare, both strings. > > What I want to know is if string a is the beginning of string b. > > Example (pseudo code) > > string a = this > string b = that > string c = thisandthat > > a... == c #t > b... == c #f > > Hope I am making sense here. I couldn't figure out a way so at present my > program does this > > (define alen (length astr)) > (define bpart (substring bstr 0 alen)) > (cond > [(string=? astr bpart) #t] > [else #f]) > > That is working, but it seems like there should be a simpler solution to this. > > Ken -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Compare parts of string or compare with wildcard.
I have two things I am trying to compare, both strings. What I want to know is if string a is the beginning of string b. Example (pseudo code) string a = this string b = that string c = thisandthat a... == c #t b... == c #f Hope I am making sense here. I couldn't figure out a way so at present my program does this (define alen (length astr)) (define bpart (substring bstr 0 alen)) (cond [(string=? astr bpart) #t] [else #f]) That is working, but it seems like there should be a simpler solution to this. Ken -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Request for comments: An embedded DSL for CSS in Racket
> I just meant: it's an approach that has worked before. "Better"? That's for > you to decide. Alright :) Regarding the syntax of the DSL, I was intentionally vague about it in the original post because I wanted to focus on the technical choices I made. But let me expand on it a bit the means of an example. The following is the source code: (define two-column-layout #`(#:max-width 910px [@media (and screen (#:min-width 960px)) #:max-width 1000px [a #:color |#ff0011|]])) (css-expr->string #`([body #:margin-left 10px #:padding-left (px 10) #:font-family "Equity" "Concourse" Arial #:border {#:left (1px solid yellow) #:right (2px solid black)} #,@two-column-layout])) The following is the compiled CSS: body { margin-left: 10px; padding-left: 10px; font-family: "Equity", "Concourse", Arial; border-left: 1px solid yellow; border-right: 2px solid black; max-width: 910px; } @media screen and (min-width: 960px) { body { max-width: 1000px; } body a { color: #ff0011; } } Note that: - [Selector “body”, declarations “margin-left” and “padding-left”] The value “10px” is expressible in two ways “10px” and “(px 10)”. The former representation is better for writing out explicitly (yes, it is a pun on “10px” being a symbol in Racket). The latter representation is better when the magnitude is a variable, for example, “(px #,gutter)”. Similar representation options are available elsewhere in the DSL, for example, CSS at rules. - [Selector “body”, declaration “font-family”] The CSS value delimited by quotes is a Racket string, the CSS value not delimited by quotes is a Racket symbol. In fact, in the DSL both the values “10px” and “Arial” go through the same translation mechanism. - [Selector “body”, declaration “font-family”] Lists of CSS values do not require extra parenthesis in the DSL. - [Selector “body”, declaration “border”] It is possible to nest declarations, a featured borrowed from SASS. - [Selector “body”, declaration “border”, sub-declarations “left” and “right”] A composite CSS value require extra parenthesis in the DSL. - [Selector “body”, splicing “two-column-layout”] A mixin is the result of an “unquote-splicing”. Mixins can have parameters, in the form of a function that returns a piece of DSL syntax. This is a feature from SASS that the DSL gets for free, because of the Racket embedding. The same is true of SASS variables. - [Mixin “two-column-layout”, at-rule “@media” and selector “a”] It is possible to nest rules. Another feature borrowed from SASS. - [Mixin “two-column-layout”, selector “a”, declaration “color”] It is possible to represent colors with Racket symbols, for example, “|#ff0011|” and “\#ff0011”. Unsurprisingly, they go through the same translation mechanism as “10px” and “Arial”. This is one of the very few places where I anticipate users having to escape characters in symbols. There are many more tricks in this DSL. This example serves only to give you a flavor of what I am trying to accomplish while trying to avoid overwhelm you with the details. These details are still changing, which is the main reason why I have not published the library yet. Of course, if it interests you, I can give an overview of the whole language. But that goes beyond my main point for the moment, which is to figure out if I am using the right tools for the job. If you have more suggestions, please comment. I am happy to read your feedback. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Racket builds for ARM?
Matthew Flatt[16-10-28 05:04]: > If ARMBIAN and Raspbian are compatible, then you could try the Utah > snapshot site's Raspbian build: > > http://www.cs.utah.edu/plt/snapshots/ > > At Fri, 28 Oct 2016 03:21:49 +0200, meino.cra...@gmx.de wrote: > > Hi, > > > > after putting Racket on my desktop Linux box and on my tablet > > (ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI > > PC (which is a Raspberry Pi inspired SoC-Computer). This Orange > > Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i" > > The CPU is (according to /proc/cpuingo) a > > ARMv7 Processor rev 5 (v7l). > > > > ARMBIAN only offers a (according to 'apt search racket') > > racket/stable 6.1-4 armhf. > > > > Is there any source known, which offers recent builds for this > > platform? > > > > Thanks a lot for any help! > > Cheers, > > Meino > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Racket Users" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to racket-users+unsubscr...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > Hi @all! Thanks to all the help of the friendly people of this list now my GENTOO Linux PC, my tablet and my Orange PI PC are successfully "racketificated" :) (GREAT) Cheers, Meino -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Request for comments: An embedded DSL for CSS in Racket
>> 1) Perhaps have a look at the approach used by the `xml` and `html` and >> `json` >> libraries, which is 1) parse data from string, 2) store data in nested >> structs, 3) generate new string from nested-struct thingy. > > I understand this approach, but I do not understand how it is better than > what I > proposed. Can you please elaborate on that? I just meant: it's an approach that has worked before. "Better"? That's for you to decide. >> Notationally, how is this an improvement over regular CSS? And if it's not, >> why not use regular CSS notation, and parse it? > > I believe it is easier to build syntactically correct S-expressions than it is > to concatenate strings to form syntactically correct CSS. Perhaps, but looking at your example again, it seems you intend to represent CSS values (on the right-hand side) as symbols, using vertical bars to escape things like |#444|? ([body {#:margin (40px auto) #:max-width 650px #:line-height 1.6 #:font-size 18px #:color |#444| #:padding (0 10px)}] [h1 h2 h3 {#:line-height 1.2}]) If so, while 650px can be made into a symbol, 1.6 and 0 cannot (would have to be |1.6| and |0|). Also, certain CSS values have double quotes (for instance `font-family`) so the "font-family-name" would have to be notated as |"font-family-name"|. If I misunderstand your notation proposal, I apologize. But I think that users should be spared notational inconvenience wherever possible. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Request for comments: An embedded DSL for CSS in Racket
Hi, all. Greg Trzeciak: I did not know about Garden, thank you for the reference. In particular, I liked the way he talks about decoupling selectors and declarations. It is something I have been doing in my CSS for a long time: previously with SASS mixins, now with my library and calls to Racket functions in a CSS rule. But I had never thought about the practice in terms of decoupling selectors and declarations. It is a nice new frame for an existing picture. Matthew Butterick: > None of the below is meant to deter your voyage of discovery! On the contrary, your feedback encourages to move on! :) > 1) Perhaps have a look at the approach used by the `xml` and `html` and `json` > libraries, which is 1) parse data from string, 2) store data in nested > structs, 3) generate new string from nested-struct thingy. I understand this approach, but I do not understand how it is better than what I proposed. Can you please elaborate on that? > 2) Maybe a metalanguage that embeds at the reader level, and expands certain > source strings into S-expressions? See http://docs.racket-lang.org/debug/ for > an example, where the `#R` prefix in source takes on special meaning. This idea of prefixing is interesting. I view it as separate from the previous one, though. I could have (or not) prefixes to either strings or S-expressions—in fact, in “debug”, the “#R” prefix is for S-expressions. I actually had a similar thing in a previous iteration of my language. Not at the reader level, but as macro called “css”. Here is an example: “(css [body {…}])”. I decided to drop it because it was nothing more than “#`”. What else do you think the prefix could do? How is it better than the macro version? > Notationally, how is this an improvement over regular CSS? And if it's not, > why not use regular CSS notation, and parse it? I believe it is easier to build syntactically correct S-expressions than it is to concatenate strings to form syntactically correct CSS. At the very minimum, there is a guarantee that there are no missing semicolons or closing braces. I also believe it is a simpler approach: parsing S-expressions with “syntax-parse” is simpler than parsing text. > 1) To write a library that actually parses and generates good CSS, I'd have to > keep up with the CSS spec, and all the browsers, and that gives me the > shivers. Then you will be happy to know that I did the work that gives you the shivers. I read the CSS specifications to make sure my library only generates syntactically correct CSS. Yes, it took me a while :) And yes, I plan on updating the library with respect to changes to the specification. Most changes to CSS are not syntactical, so it should not be too hard. > 2) Most of what I need is basic computational work — variable substitution, > math operations, string expansions — and I couldn't figure out what a separate > library would add that I couldn't already do with simple Racket functions > embedded in a Pollen source file. There are some things that are impossible to do with text manipulation alone. For example, to nest rules (in particular, “at rules” with media queries) and attributes. I believe those are powerful features because they allow for better organization and maintainability. So, even if I were to use Pollen preprocessor on stylesheets, I would be generating SASS. But, if “the book is a program” why shouldn’t the stylesheet be a program as well? :) * * * I plan to release this library for the general public. My idea is to publish it as soon as I finish working on the new version of my website, which is serving as testbed. But I am doing the strange things I mentioned on my original posting so I decided to collect feedback as soon as possible. Please keep the comments coming and stay tuned for the release of the library. I am not committing to any schedule, but I expect it to be ready by the end of this year. And thank you Greg Trzeciak and Matthew Butterick for the insightful messages! -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Racket builds for ARM?
Hi Meino, I run Racket on my Raspberry Pi (version 2 and 3)[*]. I download unix source + built packages and build the "core" following the instructions in src/README: https://github.com/racket/racket/blob/master/racket/src/README Basically it's just: mkdir build cd build ../configure make make install and just works (tested for Racket 6.5, 6.6 and 6.7). Kind regards, Daniel [*] http://www.dbrunner.de/blog/2015/08/27/how-to-run-racket-on-the-raspberry-pi-2/ Am 28.10.2016 um 05:20 schrieb meino.cra...@gmx.de: > Hi Matthew, > > thanks fpr your reply! :) > > I received a recipe how to modify the configuration > of the ARMBIAN to pull from "unstable" source. > "Unstable" includes racket 6.6 (and hopfully 6.7 > soon) -- I think those "unstable" sources are of > Raspbian... :) > Still downloading/updateingfingers crossed... > > Cheers, > Meino > > > > Matthew Flatt[16-10-28 05:04]: >> If ARMBIAN and Raspbian are compatible, then you could try the Utah >> snapshot site's Raspbian build: >> >> http://www.cs.utah.edu/plt/snapshots/ >> >> At Fri, 28 Oct 2016 03:21:49 +0200, meino.cra...@gmx.de wrote: >>> Hi, >>> >>> after putting Racket on my desktop Linux box and on my tablet >>> (ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI >>> PC (which is a Raspberry Pi inspired SoC-Computer). This Orange >>> Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i" >>> The CPU is (according to /proc/cpuingo) a >>> ARMv7 Processor rev 5 (v7l). >>> >>> ARMBIAN only offers a (according to 'apt search racket') >>> racket/stable 6.1-4 armhf. >>> >>> Is there any source known, which offers recent builds for this >>> platform? >>> >>> Thanks a lot for any help! >>> Cheers, >>> Meino >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Racket Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to racket-users+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 >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to racket-users+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 "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.