Re: [racket-users] Scribble: Advice for treating content as structured data foremost and as documents secondarily?
On Oct 12, 2016, at 4:19 PM, CJ Gaconnet wrote: > > To recap, I'm looking to treat my written output as structured datums/syntax > objects/structs foremost, which I can traverse/combine/transform into > documents as needed; I want to extend my ontology of datums easily whenever > needed; I want to define translations of new datums into various > content-types whenever relevant. Scribble is two separate components: the @-expression syntax, and the document model / rendering system. If you want to use both, try the full `scribble` dialects, like `scribble/doc`. If you only want @-expressions, try the `at-exp` metalanguage, which you can mix in to any Racket language. > Finally, something like `(math-term "finite list")`, when embedded into a > document, should be able to render to html as 'finite > list' and to TeX as "\textbf{finite list}", and I should be able to > define new entity types & their content-type translations easily whenever > needed. You can do that with Pollen, which I derived from Scribble. http://docs.racket-lang.org/pollen/ -- 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: FUSE filesystem package
Good catch! Thanks Robby. On October 12, 2016 at 4:03:36 PM, Robby Findler (ro...@eecs.northwestern.edu) wrote: Looks like the code has a race-condition. You could either define it away (using thread-cells (ie once per thread)) or add some syncronization. Robby On Wed, Oct 12, 2016 at 4:53 PM, Scott Moore wrote: > On October 12, 2016 at 2:35:37 PM, Vincent St-Amour > (stamo...@eecs.northwestern.edu) wrote: > > On Wed, 12 Oct 2016 16:31:46 -0500, > Scott Moore wrote: >> >> PS: is the documentation for use-once/c somewhere? >> >> I’ll add it to the docs when I get a chance. You can see the definition >> here: >> >> https://github.com/thinkmoore/racket-fuse/blob/master/private/filesystem.rkt#L132 >> >> >> use-once/c is a combinator that takes a procedure contract and makes it >> so that the contracted procedure can only be applied once. Ideally, I’d >> enforce the stronger property that you can use only one of the response >> or error callback for each procedure, but that would have been a bit >> trickier due to the need to attach the contract to two values at once. >> use-once/c is a nod to at least making sure you didn’t reuse them >> between operations... > > Any connection to Jesse's affine contracts? > > http://planet.racket-lang.org/package-source/tov/affine-contracts.plt/2/2/planet-docs/manual/index.html > > > Vincent > > Neat! Hadn’t seen those before. My implementation is basically exactly > makeAffineFunContract from the paper but as a combinator instead of a new -> > contract. > > -- > 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] Scribble: Advice for treating content as structured data foremost and as documents secondarily?
Hi, I have been seeking a system that will allow me to store all of my written output as structured data. After recently discovering Scribble, I think I may have found it (I really like the @-form syntax)! However, I think I need to make some changes to turn it into what I need, and that's where I could use some help. I want to treat all of my written output as structured data first and foremost, which I could then traverse & transform into various documents as needed. As an example, suppose I have taken notes on 100 different math books and have written down some 3000 theorems from these books. Throughout the rest of my life, there are a number of things I may want to do with these notes, such as: - In a REPL, get a list of all theorems I've ever written down. - In a REPL, for a given list xs of theorems, get a list of all references I have made to those theorems across all my written content. - Take theorems x and y and display them in a document. At a finer granularity, within a theorem, I might reference a specific entity type that I deemed important enough to represent structurally, like, say `@math-term{finite list}` (or more likely as `@finite-list`, which expands to `@math-term{finite list}`). Years later, I may want to do something like 'Traverse the list of all top-level entities that reference `(math-term "finite list")` anywhere within.' Generalizing from those examples, I actually have a pretty broad ontology of entity types I am devising for different types of content I might write down. Things like: (ask scribble-devs "Advice for treating content as structured data ...") (tell scribble-devs "I love Scribble and its embedded @-form s-exprs!") (code [racket library] "I had an idea for a Scribble modification that...") (search [web] "Is there anything else out there like Scribble?") (explore [math] @{Is @theorem-ref{LADR/foo} about @finite-list related to @theorem-ref{IntroToProbability/bar} somehow?} (remember [happened-to-me] "Today I discovered Scribble and got very excited.") That `(explore ...)` example would show up in my REPL "list of all references...to those theorems [xs]" I mentioned in the example use cases earlier, because it references a `@theorem-def` I'm interested in. Finally, something like `(math-term "finite list")`, when embedded into a document, should be able to render to html as 'finite list' and to TeX as "\textbf{finite list}", and I should be able to define new entity types & their content-type translations easily whenever needed. To recap, I'm looking to treat my written output as structured datums/syntax objects/structs foremost, which I can traverse/combine/transform into documents as needed; I want to extend my ontology of datums easily whenever needed; I want to define translations of new datums into various content-types whenever relevant. Although Scribble is mostly document-oriented as it stands, my instincts tell me that the combination of Racket + Scribble's @-forms would make a great fit for my needs. Do you think I could/should leverage Scribble for any of this? Do you have any advice on approaches I might try to get to where I want to be? I realize those are extremely open-ended and vague questions. Feel free to answer at whatever level of granularity you have time for, if at all. I just wanted to gather suggestions from the world's premier Scribble experts before I begin writing any code. -- 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: FUSE filesystem package
Looks like the code has a race-condition. You could either define it away (using thread-cells (ie once per thread)) or add some syncronization. Robby On Wed, Oct 12, 2016 at 4:53 PM, Scott Moore wrote: > On October 12, 2016 at 2:35:37 PM, Vincent St-Amour > (stamo...@eecs.northwestern.edu) wrote: > > On Wed, 12 Oct 2016 16:31:46 -0500, > Scott Moore wrote: >> >> PS: is the documentation for use-once/c somewhere? >> >> I’ll add it to the docs when I get a chance. You can see the definition >> here: >> >> https://github.com/thinkmoore/racket-fuse/blob/master/private/filesystem.rkt#L132 >> >> use-once/c is a combinator that takes a procedure contract and makes it >> so that the contracted procedure can only be applied once. Ideally, I’d >> enforce the stronger property that you can use only one of the response >> or error callback for each procedure, but that would have been a bit >> trickier due to the need to attach the contract to two values at once. >> use-once/c is a nod to at least making sure you didn’t reuse them >> between operations... > > Any connection to Jesse's affine contracts? > > http://planet.racket-lang.org/package-source/tov/affine-contracts.plt/2/2/planet-docs/manual/index.html > > Vincent > > Neat! Hadn’t seen those before. My implementation is basically exactly > makeAffineFunContract from the paper but as a combinator instead of a new -> > contract. > > -- > 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: FUSE filesystem package
On October 12, 2016 at 2:35:37 PM, Vincent St-Amour (stamo...@eecs.northwestern.edu) wrote: On Wed, 12 Oct 2016 16:31:46 -0500, Scott Moore wrote: > > PS: is the documentation for use-once/c somewhere? > > I’ll add it to the docs when I get a chance. You can see the definition > here: > https://github.com/thinkmoore/racket-fuse/blob/master/private/filesystem.rkt#L132 > > > use-once/c is a combinator that takes a procedure contract and makes it > so that the contracted procedure can only be applied once. Ideally, I’d > enforce the stronger property that you can use only one of the response > or error callback for each procedure, but that would have been a bit > trickier due to the need to attach the contract to two values at once. > use-once/c is a nod to at least making sure you didn’t reuse them > between operations... Any connection to Jesse's affine contracts? http://planet.racket-lang.org/package-source/tov/affine-contracts.plt/2/2/planet-docs/manual/index.html Vincent Neat! Hadn’t seen those before. My implementation is basically exactly makeAffineFunContract from the paper but as a combinator instead of a new -> contract. -- 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: FUSE filesystem package
> > > Any connection to Jesse's affine contracts? > > http://planet.racket-lang.org/package-source/tov/affine- > contracts.plt/2/2/planet-docs/manual/index.html Whoa, I didn't know those existed. Cool! -- 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: FUSE filesystem package
On Wed, 12 Oct 2016 16:31:46 -0500, Scott Moore wrote: > > PS: is the documentation for use-once/c somewhere? > > I’ll add it to the docs when I get a chance. You can see the definition > here: > https://github.com/thinkmoore/racket-fuse/blob/master/private/filesystem.rkt#L132 > > use-once/c is a combinator that takes a procedure contract and makes it > so that the contracted procedure can only be applied once. Ideally, I’d > enforce the stronger property that you can use only one of the response > or error callback for each procedure, but that would have been a bit > trickier due to the need to attach the contract to two values at once. > use-once/c is a nod to at least making sure you didn’t reuse them > between operations... Any connection to Jesse's affine contracts? http://planet.racket-lang.org/package-source/tov/affine-contracts.plt/2/2/planet-docs/manual/index.html Vincent -- 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: FUSE filesystem package
On October 12, 2016 at 12:15:38 PM, Dupéron Georges (jahvascriptman...@gmail.com) wrote: This is great! Thumbs up, and thanks for writing this library. I have a couple of filesystems in my "TODO" list, hopefully this package will motivate me to actually write them one of these days :) . Awesome! A nice feature would be some simpler API for creating filesystems which work by virtually moving or changing the attributes of (or concatenating + splitting, or otherwise transforming) files stored in an existing directory. This is a common use case in FUSE, I believe. PS: is the documentation for use-once/c somewhere? I’ll add it to the docs when I get a chance. You can see the definition here: https://github.com/thinkmoore/racket-fuse/blob/master/private/filesystem.rkt#L132 use-once/c is a combinator that takes a procedure contract and makes it so that the contracted procedure can only be applied once. Ideally, I’d enforce the stronger property that you can use only one of the response or error callback for each procedure, but that would have been a bit trickier due to the need to attach the contract to two values at once. use-once/c is a nod to at least making sure you didn’t reuse them between operations... -- 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: FUSE filesystem package
This is great! Thumbs up, and thanks for writing this library. I have a couple of filesystems in my "TODO" list, hopefully this package will motivate me to actually write them one of these days :) . A nice feature would be some simpler API for creating filesystems which work by virtually moving or changing the attributes of (or concatenating + splitting, or otherwise transforming) files stored in an existing directory. This is a common use case in FUSE, I believe. PS: is the documentation for use-once/c somewhere? -- 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] Unable to utilize parse-command-line to build command line application
On Wednesday, October 12, 2016 at 10:19:28 AM UTC-4, Ben Greenman wrote: > Alright, here's something that I think does what you want. > > > > #lang racket > > > (require racket/base > racket/cmdline) > > > (parse-command-line "com_line" > ;; argv > (current-command-line-arguments) > ;; table > `((once-each > [("-i" "--input-file") > ,(lambda (flag) (displayln "Using ")) > ("Use input file as the input file.")])) > ;; finish-proc > (lambda (flag-accum file) file) > ;; arg-help-strs > '("Input file.") > ;; help-proc > (lambda (flag) (raise-user-error "com_line -i | --input-file input file"))) > > > ;; $ ./com_line --input-file "hacking.rkt" > ;; Using > ;; "hacking.rkt" > > > ;; $ ./com_line --help > ;; com_line -i | --input-file input file > > > > The code in your last message expects 1 flag, 1 argument to the flag (`in`), > and 1 `file` argument. Okay - I've figured this out. Output from testing below. I'll add in exit codes for the help-proc and unknown-proc so the finish-proc is never executed in cases where the user asks for help or uses an unknown flag. I'd rather return exit codes instead of raising an error as this code will likely be interacting with other code via a shell. Thanks for the exception handling suggestion. $ ./com_line --input-file hacking.rkt Once-each: Using hacking.rkt finish-proc: Exit 0 if we make it this far. $ ./com_line --help com_line -i help-proc: Exit 1 here. Skip finish-proc. finish-proc: Exit 0 if we make it this far. $ ./com_line --unknown Unknown flag: --unknown com_line -i unknown-proc: Exit 1 here. Skip finish-proc. finish-proc: Exit 0 if we make it this far. Code that generates the above output below. (Let me know if there's a way to make code look better in these posts) #lang racket (require racket/base racket/cmdline) (define usage "com_line -i ") (parse-command-line "com_line" ;;argv (current-command-line-arguments) ;;table `((once-each [("-i" "--input-file") ,(lambda (flag in) (displayln (string-append "Once-each: Using " in))) ("Use input file as the input file." "Input file.")])) ;;finish-proc (lambda (flag-accum) (displayln "finish-proc: Exit 0 if we make it this far.")) ;;arg-help-strs '() ;;help-proc (lambda (flag) (displayln usage) (displayln "help-proc: Exit 1 here. Skip finish-proc.")) ;;unknown-proc (lambda (unknown_flag) (displayln (string-append "Unknown flag: " unknown_flag)) (displayln usage) (displayln "unknown-proc: Exit 1 here. Skip finish-proc."))) -- 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: Properly annotating disappeared uses/bindings for substituted identifiers
My experience with check-syntax is that several conditions have to be met: * The identifiers must have the correct source locations (actually, you can make arrows point to weird places by faking the source locations) * The properties must be present high enough in the AST. For example, if you put a 'sub-range-binders property on the "name" in "(define name value)", it won't work, instead the property should be present on the "(define name value)" syntax object itself, not on one of its subparts * The planets must align. At a first glance, I think in your case the problem is with the second condition, so you should "lift" all those properties out onto the topmost syntax object (they probably can be present at a lower point, but why bother?). There's a with-disappeared-uses + record-disappeared-uses utility [1], and I wrote my own with-sub-range-binders + record-sub-range-binders! [2]. I also threw in a with-arrows form which combine both with-xxx forms. Unfortunately, there is nothing for disappeared-bindings (yet). You can copy-paste and adjust my sub-range-binders code [3] and adjust it (permission granted to use whatever licence your project uses). Georges [1] http://docs.racket-lang.org/reference/syntax-util.html#%28form._%28%28lib._racket%2Fsyntax..rkt%29._with-disappeared-uses%29%29 [2] http://docs.racket-lang.org/phc-toolkit/phc-toolkit-format-id-record.html#%28form._%28%28lib._phc-toolkit%2Funtyped-only%2Fformat-id-record..rkt%29._with-sub-range-binders%29%29 [3] https://github.com/jsmaniac/phc-toolkit/blob/master/untyped-only/format-id-record.rkt -- 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] Planet package murphy/protobuf for Protocol Buffers
I'm trying to use the (require (planet murphy/protobuf)) module to work with Google's Protocol Buffers standard. protobuf comes with a generator tool, http://planet.racket-lang.org/archives/murphy/protobuf.plt/1/1/contents/planet-docs/generator/, which is a plugin for the protoc compiler. Unfortunately, I'm not finding it. It's probably on the disk somewhere and not in my path, but I don't know where to look for it. The error message I get is: $ protoc -I=src --racket_out=rkt src/P2P.proto protoc-gen-racket: program not found or is not executable --racket_out: protoc-gen-racket: Plugin failed with status code 1. I searched around in /Users/dstorrs/Library/Racket/planet/300/6.6/cache/murphy/protobuf.plt/1/1 to see if I could find it and had no luck. Where should I be looking for 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] How to edit the htdp package from a release?
yes yes yes Thank you! On Wed, Oct 12, 2016 at 12:01 PM, Matthew Flatt wrote: > At Wed, 12 Oct 2016 11:34:06 -0400, Ben Greenman wrote: > > I've installed Racket 6.6 from download.racket-lang.org and I'd like to > > submit a change to the HTDP repo. > > > > (This question is not really specific to HTDP, anyway) > > > > Before I submit the edit, I want to test the change on my machine, so I > > figure I'll make a clone of the htdp package: > > > > $ raco pkg update --clone htdp > > > > But this gives me an error: > > > > Inferred package name from given `--clone' path > > package: htdp > > given path: htdp > > Inferred package scope: installation > > raco pkg update: package is not currently installed from a repository > > package: htdp > > current installation: (catalog htdp) > > > > Is it possible for my install of Racket 6.6 to use a cloned version of > htdp? > > Yes, but since "htdp" starts out installed from a catalog that provides > a built "htdp" package instead of the Git package source, you have to > also specify the Git source. > > Although you can do that with > > $ raco pkg update --clone htdp "https://github.com/racket/ > htdp.git?path=htdp" > > I bet you actually want to modify "htdp-lib" or "htdp-doc"... and then > I see that you're going to get to a dependency mismatch with > "string-constants". > > > In this case, things will work better if you use > > $ bin/raco pkg update --catalog https://pkgs.racket-lang.org htdp > > to switch to the development version of the package, so you get needed > updates for other packages (also from the catalog). The catalog > provides a Git path, so then > > $ raco pkg update --clone htdp > > will do what you expected. > > Really, I guess you want to use a catalog that has Git paths but also > checksums at the time of the v6.6 release, as opposed to using the > post-6.6 development branch. I don't think we currently have catalogs > like that, though. > > -- > 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] How to edit the htdp package from a release?
At Wed, 12 Oct 2016 11:34:06 -0400, Ben Greenman wrote: > I've installed Racket 6.6 from download.racket-lang.org and I'd like to > submit a change to the HTDP repo. > > (This question is not really specific to HTDP, anyway) > > Before I submit the edit, I want to test the change on my machine, so I > figure I'll make a clone of the htdp package: > > $ raco pkg update --clone htdp > > But this gives me an error: > > Inferred package name from given `--clone' path > package: htdp > given path: htdp > Inferred package scope: installation > raco pkg update: package is not currently installed from a repository > package: htdp > current installation: (catalog htdp) > > Is it possible for my install of Racket 6.6 to use a cloned version of htdp? Yes, but since "htdp" starts out installed from a catalog that provides a built "htdp" package instead of the Git package source, you have to also specify the Git source. Although you can do that with $ raco pkg update --clone htdp "https://github.com/racket/htdp.git?path=htdp"; I bet you actually want to modify "htdp-lib" or "htdp-doc"... and then I see that you're going to get to a dependency mismatch with "string-constants". In this case, things will work better if you use $ bin/raco pkg update --catalog https://pkgs.racket-lang.org htdp to switch to the development version of the package, so you get needed updates for other packages (also from the catalog). The catalog provides a Git path, so then $ raco pkg update --clone htdp will do what you expected. Really, I guess you want to use a catalog that has Git paths but also checksums at the time of the v6.6 release, as opposed to using the post-6.6 development branch. I don't think we currently have catalogs like that, though. -- 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] How to edit the htdp package from a release?
> On Oct 12, 2016, at 8:43 AM, 'John Clements' via Racket Users > wrote: > > >> On Oct 12, 2016, at 8:34 AM, Ben Greenman >> wrote: >> >> I've installed Racket 6.6 from download.racket-lang.org and I'd like to >> submit a change to the HTDP repo. >> >> (This question is not really specific to HTDP, anyway) >> >> Before I submit the edit, I want to test the change on my machine, so I >> figure I'll make a clone of the htdp package: >> >> $ raco pkg update --clone htdp >> >> But this gives me an error: >> Inferred package name from given `--clone' path >> package: htdp >> given path: htdp >> Inferred package scope: installation >> raco pkg update: package is not currently installed from a repository >> package: htdp >> current installation: (catalog htdp) >> >> Is it possible for my install of Racket 6.6 to use a cloned version of htdp? > > Should this be > > raco pkg install —clone htdp > > instead? Ohh…. I see. From a release! Sorry, I’m a bit slow. I’m guessing you could manually remove the package, though there might be dependencies on it. John -- 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] How to edit the htdp package from a release?
> On Oct 12, 2016, at 8:34 AM, Ben Greenman wrote: > > I've installed Racket 6.6 from download.racket-lang.org and I'd like to > submit a change to the HTDP repo. > > (This question is not really specific to HTDP, anyway) > > Before I submit the edit, I want to test the change on my machine, so I > figure I'll make a clone of the htdp package: > > $ raco pkg update --clone htdp > > But this gives me an error: > Inferred package name from given `--clone' path > package: htdp > given path: htdp > Inferred package scope: installation > raco pkg update: package is not currently installed from a repository > package: htdp > current installation: (catalog htdp) > > Is it possible for my install of Racket 6.6 to use a cloned version of htdp? Should this be raco pkg install —clone htdp instead? > > -- > 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] How to edit the htdp package from a release?
I've installed Racket 6.6 from download.racket-lang.org and I'd like to submit a change to the HTDP repo. (This question is not really specific to HTDP, anyway) Before I submit the edit, I want to test the change on my machine, so I figure I'll make a clone of the htdp package: $ raco pkg update --clone htdp But this gives me an error: Inferred package name from given `--clone' path package: htdp given path: htdp Inferred package scope: installation raco pkg update: package is not currently installed from a repository package: htdp current installation: (catalog htdp) Is it possible for my install of Racket 6.6 to use a cloned version of htdp? -- 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] Unable to utilize parse-command-line to build command line application
Alright, here's something that I think does what you want. #lang racket (require racket/base racket/cmdline) (parse-command-line "com_line" ;; argv (current-command-line-arguments) ;; table `((once-each [("-i" "--input-file") ,(lambda (flag) (displayln "Using ")) ("Use input file as the input file.")])) ;; finish-proc (lambda (flag-accum file) file) ;; arg-help-strs '("Input file.") ;; help-proc (lambda (flag) (raise-user-error "com_line -i | --input-file input file"))) ;; $ ./com_line --input-file "hacking.rkt" ;; Using ;; "hacking.rkt" ;; $ ./com_line --help ;; com_line -i | --input-file input file The code in your last message expects 1 flag, 1 argument to the flag (`in`), and 1 `file` argument. On Wed, Oct 12, 2016 at 7:15 AM, Ian Thomas wrote: > On Wednesday, October 12, 2016 at 6:54:45 AM UTC-4, Ian Thomas wrote: > > On Tuesday, October 11, 2016 at 9:50:12 PM UTC-4, Ben Greenman wrote: > > > Indirect answer: could you use `command-line` instead? > > > > > > > > > > > > #lang racket/base > > > (require racket/cmdline) > > > > > > > > > (define input-from (make-parameter #f)) > > > > > > > > > (command-line > > > #:program "sample" > > > #:once-each > > > [("-i" "--input-file") > > >i > > >"Use as the input file." > > >(input-from i)] > > > #:args (file) > > > (printf "my argument is: ~a\n" file) > > > ;; do things with `file` and `input-from` here > > > ) > > > > > > > > > On Tue, Oct 11, 2016 at 9:24 PM, Ian Thomas wrote: > > > I'm trying to add a simple command line interface to a program and > receive the following error: > > > > > > > > > > > > parse-command-line: expected argument of type flag-list/procedure pairs (spec-line help list strings must match procedure > arguments)>; given: '((once-each (("-i" "--input\ > > > > > > -file") # ("Use as > the input file." > > > > > > context...: > > > > > > > > > > > > The command should take a single flag and an input file as arguments. > Code below. Any help would be much appreciated. > > > > > > > > > > > > #lang racket > > > > > > > > > > > > (require racket/base > > > > > > racket/cmdline) > > > > > > > > > > > > (parse-command-line "com_line" > > > > > > ;; argv > > > > > > (current-command-line-arguments) > > > > > > ;; table > > > > > > `((once-each > > > > > >[("-i" "--input-file") > > > > > > ,(lambda (flag in) (displayln "Using ")) > > > > > > ("Use as the input file.")])) > > > > > > ;; finish-proc > > > > > > (lambda (flag-accum file) file) > > > > > > ;; help-proc > > > > > > (lambda () (displayln "com_line -i | --input-file > input file")) > > > > > > ;; unknown-proc > > > > > > (lambda (unknown_flag) (displayln "Unknown flag: > "))) > > > > > > > > > > > > -- > > > > > > 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...@googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > > > > I'd like to handle usage - help-proc - and unknown flags - unknown-proc > - and the documentation states you need to use parse-command-line and not > command-line to achieve this. > > I've re-read the documentation and added some more arguments to the > parse-command-line function, and now I think I'm almost there. Error > messages immediately below: updated code follows. > > $ ./com_line --input-file hacking.rkt > Using > com_line: expects 1 on the command line, given 0 arguments > > $ ./com_line --help > com_line -i | --input-file input file > com_line: expects 1 on the command line, given 0 arguments > > > #lang racket > > (require racket/base > racket/cmdline) > > (parse-command-line "com_line" > ;; argv > (current-command-line-arguments) > ;; table > `((once-each >[("-i" "--input-file") > ,(lambda (flag in) (displayln "Using ")) > ("Use input file as the input file." "Input > file.")])) > ;; finish-proc > (lambda (flag-accum file) file) > ;; arg-help-strs > '("Input file.") > ;; help-proc > (lambda (flag) (displayln "com_line -i | --input-file > input file")) > ;; unknown-proc > (lambda (unknown_flag) (displayln "Unknown flag: > "))) > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receivin
Re: [racket-users] Unable to utilize parse-command-line to build command line application
On Wednesday, October 12, 2016 at 6:54:45 AM UTC-4, Ian Thomas wrote: > On Tuesday, October 11, 2016 at 9:50:12 PM UTC-4, Ben Greenman wrote: > > Indirect answer: could you use `command-line` instead? > > > > > > > > #lang racket/base > > (require racket/cmdline) > > > > > > (define input-from (make-parameter #f)) > > > > > > (command-line > > #:program "sample" > > #:once-each > > [("-i" "--input-file") > > i > > "Use as the input file." > > (input-from i)] > > #:args (file) > > (printf "my argument is: ~a\n" file) > > ;; do things with `file` and `input-from` here > > ) > > > > > > On Tue, Oct 11, 2016 at 9:24 PM, Ian Thomas wrote: > > I'm trying to add a simple command line interface to a program and receive > > the following error: > > > > > > > > parse-command-line: expected argument of type > flag-list/procedure pairs (spec-line help list strings must match procedure > > arguments)>; given: '((once-each (("-i" "--input\ > > > > -file") # ("Use as the > > input file." > > > > context...: > > > > > > > > The command should take a single flag and an input file as arguments. Code > > below. Any help would be much appreciated. > > > > > > > > #lang racket > > > > > > > > (require racket/base > > > > racket/cmdline) > > > > > > > > (parse-command-line "com_line" > > > > ;; argv > > > > (current-command-line-arguments) > > > > ;; table > > > > `((once-each > > > > [("-i" "--input-file") > > > > ,(lambda (flag in) (displayln "Using ")) > > > > ("Use as the input file.")])) > > > > ;; finish-proc > > > > (lambda (flag-accum file) file) > > > > ;; help-proc > > > > (lambda () (displayln "com_line -i | --input-file input > > file")) > > > > ;; unknown-proc > > > > (lambda (unknown_flag) (displayln "Unknown flag: > > "))) > > > > > > > > -- > > > > 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...@googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > I'd like to handle usage - help-proc - and unknown flags - unknown-proc - and > the documentation states you need to use parse-command-line and not > command-line to achieve this. I've re-read the documentation and added some more arguments to the parse-command-line function, and now I think I'm almost there. Error messages immediately below: updated code follows. $ ./com_line --input-file hacking.rkt Using com_line: expects 1 on the command line, given 0 arguments $ ./com_line --help com_line -i | --input-file input file com_line: expects 1 on the command line, given 0 arguments #lang racket (require racket/base racket/cmdline) (parse-command-line "com_line" ;; argv (current-command-line-arguments) ;; table `((once-each [("-i" "--input-file") ,(lambda (flag in) (displayln "Using ")) ("Use input file as the input file." "Input file.")])) ;; finish-proc (lambda (flag-accum file) file) ;; arg-help-strs '("Input file.") ;; help-proc (lambda (flag) (displayln "com_line -i | --input-file input file")) ;; unknown-proc (lambda (unknown_flag) (displayln "Unknown flag: "))) -- 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] Unable to utilize parse-command-line to build command line application
On Tuesday, October 11, 2016 at 9:50:12 PM UTC-4, Ben Greenman wrote: > Indirect answer: could you use `command-line` instead? > > > > #lang racket/base > (require racket/cmdline) > > > (define input-from (make-parameter #f)) > > > (command-line > #:program "sample" > #:once-each > [("-i" "--input-file") > i > "Use as the input file." > (input-from i)] > #:args (file) > (printf "my argument is: ~a\n" file) > ;; do things with `file` and `input-from` here > ) > > > On Tue, Oct 11, 2016 at 9:24 PM, Ian Thomas wrote: > I'm trying to add a simple command line interface to a program and receive > the following error: > > > > parse-command-line: expected argument of type flag-list/procedure pairs (spec-line help list strings must match procedure > arguments)>; given: '((once-each (("-i" "--input\ > > -file") # ("Use as the > input file." > > context...: > > > > The command should take a single flag and an input file as arguments. Code > below. Any help would be much appreciated. > > > > #lang racket > > > > (require racket/base > > racket/cmdline) > > > > (parse-command-line "com_line" > > ;; argv > > (current-command-line-arguments) > > ;; table > > `((once-each > > [("-i" "--input-file") > > ,(lambda (flag in) (displayln "Using ")) > > ("Use as the input file.")])) > > ;; finish-proc > > (lambda (flag-accum file) file) > > ;; help-proc > > (lambda () (displayln "com_line -i | --input-file input > file")) > > ;; unknown-proc > > (lambda (unknown_flag) (displayln "Unknown flag: > "))) > > > > -- > > 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...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. I'd like to handle usage - help-proc - and unknown flags - unknown-proc - and the documentation states you need to use parse-command-line and not command-line to achieve 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.
[racket-users] Properly annotating disappeared uses/bindings for substituted identifiers
I have a rather strange macro. My macro works just like lambda, except that it only accepts one argument, and inside the body of the lambda, it annotates all uses of that argument with a syntax property. The macro looks like this: (require (for-syntax racket/syntax syntax/transformer) syntax/parse/define) (define-syntax-parser strange-λ #:literals [#%plain-lambda let-values] [(_ x:id body:expr) #:with y (generate-temporary #'x) #:with wrapped-body #'(λ (y) (let-syntax ([x (make-variable-like-transformer (syntax-property #'y 'marked-by-strange-λ #t))]) body)) #:with (#%plain-lambda (y*) (let-values () (let-values () body*))) (local-expand #'wrapped-body 'expression '()) #'(λ (y*) body*)]) (For context, the real-world reason for such a macro is for use with Turnstile, which annotates bindings with syntax properties to track type information, but this is a simplified example.) I can use my new strange-λ macro like this: (strange-λ x (+ x 1)) It works. However, Check Syntax does not draw an arrow from the use of x to the binding of x because neither identifier appears in the fully expanded program. Therefore, it seems clear that the solution is to add the necessary 'disappeared-use and 'disappeared-binding syntax properties: (begin-for-syntax (define (make-variable-like+disappeared stx) (syntax-parser [x:id (syntax-property stx 'disappeared-use (syntax-local-introduce #'x))] [(x:id . rest) (syntax-property #`(#,stx . rest) 'disappeared-use (syntax-local-introduce #'x))]))) (define-syntax-parser strange-λ #:literals [#%plain-lambda let-values] [(_ x:id body:expr) #:with y (generate-temporary #'x) #:with wrapped-body #'(λ (y) (let-syntax ([x (make-variable-like+disappeared (syntax-property #'y 'marked-by-strange-λ #t))]) body)) #:with (#%plain-lambda (y*) (let-values () (let-values () body*))) (local-expand #'wrapped-body 'expression '()) #:with y*+disappeared (syntax-property #'y* 'disappeared-binding (syntax-local-introduce #'x)) #'(λ (y*+disappeared) body*)]) However, even with these additions, Check Syntax does not appear to be satisfied, and it does not draw any arrows between the two xs. Looking at the macro stepper, the fully expanded program does indeed have the syntax properties in place, so why doesn’t this work? -- 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.