Re: [racket-users] Syntax for hash contracts
On Thu, Dec 1, 2016 at 10:18 PM, Alexis King wrote: > > On Dec 1, 2016, at 21:43, David Storrs wrote: > > > > The difference between a dictionary and a structure being that > dictionaries are easily extensible on the fly and structures are not? I'm > curious -- what are the elements of that design and what are the reasons? > It seems like a natural fit -- if Racket supported contracts on the values > of a contract then you would have the best of dictionaries and structures. > > The difference is that a structure has intrinsic meaning while a hash > with a particular collection of keys has extrinsic meaning.[...] Racket in > general heavily favors custom, tagged data over reusing > data structures Fair enough. I come from a Perl background and am used to a slightly more relaxed system, but I'll try to get used to the new way. > > > Hm. Well, that approach would work. It's not really what I'm looking > for, though -- this is data that's coming back from a SQL query and being > forwarded on to another function for further processing. It isn't needed > anywhere else, and creating a struct for this one use feels pretty clumsy > and heavyweight. "Hash of field-name-in-table to value-in-field" seemed > like a really intuitive solution. It's fine, though. I can just do a > manual check. > > If you are just handing off this data between two functions as an > implementation detail, do you need the contract at all? That is, what > value are you getting from it? Could the arguments be provided as > keyword arguments, instead? > That's a good thought. Yes, that will work. I had them as a hash because I used them in the source function and it was convenient to have them that way, so I figured I could just hand them off to the sub-function in the original hash form. Better to split it up though, I suppose. > That said, if you wanted a contract that does what you describe, it > wouldn’t be too difficult to write: > > (define (hash-object/c ctc-dict) > (make-contract > #:name `(hash-object/c > ,(for/list ([(k v) (in-dict ctc-dict)]) > (cons k (contract-name v > #:projection > (λ (blame) >(λ (val) > (for ([(k v) (in-hash val)]) >(let ([ctc (dict-ref ctc-dict k #f)] > [blame (blame-add-context > blame (format "value for key ~e of" k))]) > (when ctc >(((contract-projection ctc) blame) v > ...I think your definition of "not too hard" may differ from mine. :> > The existing hash contracts are mostly designed to accommodate > homogenous dictionaries, like (hash/c string? boolean?). I’m not > entirely sure what the intended use case of hash/dc is, and while I’m > sure I’d be very glad it exists if I ever needed it, I admit I’ve never > used it myself. It just allows you to provide a function that determines > the contract of a value given the key, but it still requires that all > keys have the same contract, and it does not let you specify which keys > should be supplied. > Okay, that makes more sense. Thanks for all the explanation. > > -- > 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: Methods for least squares
> On Dec 1, 2016, at 12:07, Bradley Lucier wrote: > > On 12/01/2016 02:04 PM, John Clements wrote: >> >> Would it be all right with you if I shared your mail with the mailing list? >> A brief reading of this paper shows me the relationship between solving this >> problem and approximation of gaussian elimination, and I’d like to ask Jens >> Axel Soegaard and Neil Toronto how this relates to the general algorithms >> for matrix solution. > > Yes, you can share it. > > The Conjugate Gradient method is applicable to solving $Ax=b$ when $A$ is a > symmetric, positive definite matrix. It's not applicable to the problem with > general $A$. > > So, in fact, it's applicable to solving $A^*Ax=A^*b$, the normal equations > for least squares, since $A^*A$ is symmetric and positive definite. The > brilliance of the method is that it doesn't actually compute $A^*A$, but only > $Ay$ and $A^*y$ for various vectors $y$. > > The method is particularly useful when the linear system $Ax=b$ has inherent > error in $A$ and $b$, and so one requires only an approximation to the > solution $x$. Okay, I’ve taken a crack at implementing this… well, I have a toy implementation, that doesn’t do any checking and only works for a particular matrix shape. Short version: yep, it works! Now, a few questions. 1) What should one use as the initial estimate, x_0 ? The method appears to work fine for an initial estimate that is uniformly zero. Is there any reason not to use this? 2) When does one stop? I have not read the paper carefully, but it appears that it’s intended to “halt” in approximately ’n’ steps, where ’n’ is the … number of rows? In the one case I tried, my “direction” vector p_i quickly dropped to something on the order of [1e-16, 1e-16], and in fact it became perfectly stable, in that successive iterations produced precisely the same values for the three iteration variables. However, it wouldn’t surprise me to discover that there were cases on which the answer oscillated between two minutely different values. Can you shed any light on when it’s safe to stop in the general case? 3) Do you have any idea how this technique compares to any described in Numerical Recipes or implemented in LAPACK ? 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] Syntax for hash contracts
> On Dec 1, 2016, at 21:43, David Storrs wrote: > > The difference between a dictionary and a structure being that dictionaries > are easily extensible on the fly and structures are not? I'm curious -- what > are the elements of that design and what are the reasons? It seems like a > natural fit -- if Racket supported contracts on the values of a contract then > you would have the best of dictionaries and structures. The difference is that a structure has intrinsic meaning while a hash with a particular collection of keys has extrinsic meaning. One could represent a point in two-dimensional space as a struct called “point” or a hash with keys 'x and 'y. The former is intrinsically a point, but the latter is only a point if you use it like a point; it could just as easily be a two-dimensional vector (which itself has a myriad of possible meanings). Put more practically, structs are tagged, and hashes are untagged. This might not seem terribly important in your case (and it probably isn’t), but Racket in general heavily favors custom, tagged data over reusing data structures, in contrast with Clojure, which takes precisely the opposite approach. (The design differences between Racket’s contract combinators and the recent clojure.spec illustrate much of this difference in philosophy.) I’m sure there are many other people on this list who can describe the reasoning behind Racket’s design choices here far better than I can, so I will not try at this time. > Hm. Well, that approach would work. It's not really what I'm looking for, > though -- this is data that's coming back from a SQL query and being > forwarded on to another function for further processing. It isn't needed > anywhere else, and creating a struct for this one use feels pretty clumsy and > heavyweight. "Hash of field-name-in-table to value-in-field" seemed like a > really intuitive solution. It's fine, though. I can just do a manual check. If you are just handing off this data between two functions as an implementation detail, do you need the contract at all? That is, what value are you getting from it? Could the arguments be provided as keyword arguments, instead? That said, if you wanted a contract that does what you describe, it wouldn’t be too difficult to write: (define (hash-object/c ctc-dict) (make-contract #:name `(hash-object/c ,(for/list ([(k v) (in-dict ctc-dict)]) (cons k (contract-name v #:projection (λ (blame) (λ (val) (for ([(k v) (in-hash val)]) (let ([ctc (dict-ref ctc-dict k #f)] [blame (blame-add-context blame (format "value for key ~e of" k))]) (when ctc (((contract-projection ctc) blame) v This contract is not terribly robust or performant (it should ensure the value is immutable, use the late negative projection and do more work ahead of time, etc.), but it’s a demonstration of the behavior you want. You could use it like this: (define/contract h (hash-object/c `([foo . ,string?] [bar . ,boolean?])) (hash 'foo "hello" 'bar #f)) > So, given that these don't work the way I thought, how DO they work? I still > can't understand this documentation -- like, literally *at all*. I have not > managed to write a single non-trivial contract thus far. Could you please > provide some examples of how to use hash contracts and why? > > For example, I don't see how to do something as simple as "this hash must > have the following keys". Or how to say that some keys will be of different > types -- e.g., 'foo and "bar". The existing hash contracts are mostly designed to accommodate homogenous dictionaries, like (hash/c string? boolean?). I’m not entirely sure what the intended use case of hash/dc is, and while I’m sure I’d be very glad it exists if I ever needed it, I admit I’ve never used it myself. It just allows you to provide a function that determines the contract of a value given the key, but it still requires that all keys have the same contract, and it does not let you specify which keys should be supplied. -- 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] Syntax for hash contracts
On Thu, Dec 1, 2016 at 8:59 PM, Alexis King wrote: > > On Dec 1, 2016, at 16:29, David Storrs wrote: > > > > - This function returns #t because it is a simple test function intended > to get the hang of hash contracts... > > - This function takes one argument... > > - Which is a hash... > > - Which has keys 'success, 'file-id, 'scratchdir-path, and 'chunk-hash... > > - All of which are symbols... > > - The values will be, respectively: > > success boolean? > > file-id (or/c #f exact-positive-integer?) > > scratchdir-path path-string? > > chunk-hash string? > > The hash/dc contract is not designed to assign contracts to the values > associated with specific keys; rather, it allows the contract on a value > to depend generally on the value of the key. You could theoretically use > the right hand side of the contract to do a case analysis on the value > of the key, but that would not be pretty. This is mostly intentional, > though: Racket hashes are designed to be used as dictionaries, not > structures. > The difference between a dictionary and a structure being that dictionaries are easily extensible on the fly and structures are not? I'm curious -- what are the elements of that design and what are the reasons? It seems like a natural fit -- if Racket supported contracts on the values of a contract then you would have the best of dictionaries and structures. (I'm worried that the above sounds snarky, but I'm not sure how to rephrase it It's not intended as snark, it's an honest question.) > > It sounds like you likely want a struct, not a hash. Probably something > like this: > > (struct some-name (success file-id scratchdir-path chunk-hash)) > > …with the following contract: > > (struct/c some-name > boolean? > (or/c #f exact-positive-integer?) > path-string? > string?) > > Hm. Well, that approach would work. It's not really what I'm looking for, though -- this is data that's coming back from a SQL query and being forwarded on to another function for further processing. It isn't needed anywhere else, and creating a struct for this one use feels pretty clumsy and heavyweight. "Hash of field-name-in-table to value-in-field" seemed like a really intuitive solution. It's fine, though. I can just do a manual check. So, given that these don't work the way I thought, how DO they work? I still can't understand this documentation -- like, literally *at all*. I have not managed to write a single non-trivial contract thus far. Could you please provide some examples of how to use hash contracts and why? For example, I don't see how to do something as simple as "this hash must have the following keys". Or how to say that some keys will be of different types -- e.g., 'foo and "bar". -- > 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] Syntax for hash contracts
> On Dec 1, 2016, at 16:29, David Storrs wrote: > > - This function returns #t because it is a simple test function intended to > get the hang of hash contracts... > - This function takes one argument... > - Which is a hash... > - Which has keys 'success, 'file-id, 'scratchdir-path, and 'chunk-hash... > - All of which are symbols... > - The values will be, respectively: > success boolean? > file-id (or/c #f exact-positive-integer?) > scratchdir-path path-string? > chunk-hash string? The hash/dc contract is not designed to assign contracts to the values associated with specific keys; rather, it allows the contract on a value to depend generally on the value of the key. You could theoretically use the right hand side of the contract to do a case analysis on the value of the key, but that would not be pretty. This is mostly intentional, though: Racket hashes are designed to be used as dictionaries, not structures. It sounds like you likely want a struct, not a hash. Probably something like this: (struct some-name (success file-id scratchdir-path chunk-hash)) …with the following contract: (struct/c some-name boolean? (or/c #f exact-positive-integer?) path-string? string?) -- 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] Scribble equivalent of rowspan
We currently don't have good enough tests for renderers. The tests in scribble-test/tests/scribble/docs use only the text renderer, and they're mostly meant to check renderer-independent formatting details. That could be a starting point and a good way to test the text renderer, though. At Thu, 1 Dec 2016 19:00:33 -0600, Philip McGrath wrote: > Thanks for this. I think I see in general where the changes need to be, and > I've taken some first steps toward making them, though it will probably be > a week or so before I have time to totally dive in. > > One additional question: is there a good/light-weight way to test changes > to the renderers? This is having me dive into much lower-level parts of > Scribble than I've looked at previously (though maybe I was headed there > eventually). It seems like it would be ideal to avoid manually checking the > rendering of a dummy document, but it isn't immediately obvious to me how > to write more rackunit-like test cases. > > -Philip > > On Wed, Nov 30, 2016 at 7:56 AM, Matthew Flatt wrote: > > > Hi Philip, > > > > There's nothing like rowspan currently. > > > > If you want to try adding something, I think you'll end up changing the > > "scribble-lib" package in several places: in "core.rkt" to adjust the > > contract for tables, in "base.rkt" to adjust the contract for > > `tabular`, and in "html-render.rkt", "latex-render.rkt", > > "markdown-render.rkt", and "text-render.rkt" to adjust the various > > renderers. The rendering part is the main work, naturally. > > > > If you decide not to try, I can take a look in a few days. > > > > Matthew > > > > At Tue, 29 Nov 2016 21:47:03 -0600, Philip McGrath wrote: > > > A very rookie question: I am trying to figure out how to specify the > > > equivalent of HTML's rowspan attribute for tabular from scribble/base: > > that > > > is, to have a cell which spans more than one row. In LaTeX, I think I > > would > > > use "multirow" (but I'm no LaTeX expert). > > > > > > I know so know about 'cont, but I believe that only lets a cell span > > > multiple columns: I'm looking for the a vertical version. Is there a > > > built-in way to do this? Or otherwise, if it's not too daunting to > > > implement myself, could someone point me in the right direction? > > > > > > Here's some ASCII art of what I'm going for, if that's clearer: > > > > > > - > > > | | Date: | Nov 29 | Dec 30 | > > > | |---||| > > > | | Time: | 12:18 | 3:06 | > > > |---| > > > | | Expected: | 3| 1| > > > | Apples |---||| > > > | | Actual: | 2| 1| > > > |---| > > > | Pears & | Expected: | 4| 9| > > > | |---||| > > > | Plums | Actual: | 6| 3| > > > - > > > > > > -- > > > 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] Scribble equivalent of rowspan
On Thu, Dec 1, 2016 at 5:00 PM, Philip McGrath wrote: > Thanks for this. I think I see in general where the changes need to be, > and I've taken some first steps toward making them, though it will probably > be a week or so before I have time to totally dive in. > > One additional question: is there a good/light-weight way to test changes > to the renderers? This is having me dive into much lower-level parts of > Scribble than I've looked at previously (though maybe I was headed there > eventually). It seems like it would be ideal to avoid manually checking the > rendering of a dummy document, but it isn't immediately obvious to me how > to write more rackunit-like test cases. > If you're thinking about manually checking it then you should be able to generate a reference document, right? You could try generating the document to a string (or to a file and then read it in) and then running a regex against it, or comparing it to the reference. Alternatively, you could hash the reference and generated documents and verify that the hashes are identical. That might be a higher standard of 'correct' than you're looking for, though. Dave -Philip On Wed, Nov 30, 2016 at 7:56 AM, Matthew Flatt wrote: > Hi Philip, > > There's nothing like rowspan currently. > > If you want to try adding something, I think you'll end up changing the > "scribble-lib" package in several places: in "core.rkt" to adjust the > contract for tables, in "base.rkt" to adjust the contract for > `tabular`, and in "html-render.rkt", "latex-render.rkt", > "markdown-render.rkt", and "text-render.rkt" to adjust the various > renderers. The rendering part is the main work, naturally. > > If you decide not to try, I can take a look in a few days. > > Matthew > > At Tue, 29 Nov 2016 21:47:03 -0600, Philip McGrath wrote: > > A very rookie question: I am trying to figure out how to specify the > > equivalent of HTML's rowspan attribute for tabular from scribble/base: > that > > is, to have a cell which spans more than one row. In LaTeX, I think I > would > > use "multirow" (but I'm no LaTeX expert). > > > > I know so know about 'cont, but I believe that only lets a cell span > > multiple columns: I'm looking for the a vertical version. Is there a > > built-in way to do this? Or otherwise, if it's not too daunting to > > implement myself, could someone point me in the right direction? > > > > Here's some ASCII art of what I'm going for, if that's clearer: > > > > - > > | | Date: | Nov 29 | Dec 30 | > > | |---||| > > | | Time: | 12:18 | 3:06 | > > |---| > > | | Expected: | 3| 1| > > | Apples |---||| > > | | Actual: | 2| 1| > > |---| > > | Pears & | Expected: | 4| 9| > > | |---||| > > | Plums | Actual: | 6| 3| > > - > > > > -- > > 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. > -- 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] Scribble equivalent of rowspan
Thanks for this. I think I see in general where the changes need to be, and I've taken some first steps toward making them, though it will probably be a week or so before I have time to totally dive in. One additional question: is there a good/light-weight way to test changes to the renderers? This is having me dive into much lower-level parts of Scribble than I've looked at previously (though maybe I was headed there eventually). It seems like it would be ideal to avoid manually checking the rendering of a dummy document, but it isn't immediately obvious to me how to write more rackunit-like test cases. -Philip On Wed, Nov 30, 2016 at 7:56 AM, Matthew Flatt wrote: > Hi Philip, > > There's nothing like rowspan currently. > > If you want to try adding something, I think you'll end up changing the > "scribble-lib" package in several places: in "core.rkt" to adjust the > contract for tables, in "base.rkt" to adjust the contract for > `tabular`, and in "html-render.rkt", "latex-render.rkt", > "markdown-render.rkt", and "text-render.rkt" to adjust the various > renderers. The rendering part is the main work, naturally. > > If you decide not to try, I can take a look in a few days. > > Matthew > > At Tue, 29 Nov 2016 21:47:03 -0600, Philip McGrath wrote: > > A very rookie question: I am trying to figure out how to specify the > > equivalent of HTML's rowspan attribute for tabular from scribble/base: > that > > is, to have a cell which spans more than one row. In LaTeX, I think I > would > > use "multirow" (but I'm no LaTeX expert). > > > > I know so know about 'cont, but I believe that only lets a cell span > > multiple columns: I'm looking for the a vertical version. Is there a > > built-in way to do this? Or otherwise, if it's not too daunting to > > implement myself, could someone point me in the right direction? > > > > Here's some ASCII art of what I'm going for, if that's clearer: > > > > - > > | | Date: | Nov 29 | Dec 30 | > > | |---||| > > | | Time: | 12:18 | 3:06 | > > |---| > > | | Expected: | 3| 1| > > | Apples |---||| > > | | Actual: | 2| 1| > > |---| > > | Pears & | Expected: | 4| 9| > > | |---||| > > | Plums | Actual: | 6| 3| > > - > > > > -- > > 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.
[racket-users] Syntax for hash contracts
Hi folks, I'm having trouble understanding the docs on hash contracts ( https://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29 ) What I'm trying to express is: - This function returns #t because it is a simple test function intended to get the hang of hash contracts... - This function takes one argument... - Which is a hash... - Which has keys 'success, 'file-id, 'scratchdir-path, and 'chunk-hash... - All of which are symbols... - The values will be, respectively: success boolean? file-id (or/c #f exact-positive-integer?) scratchdir-path path-string? chunk-hash string? My first attempt was: (define/contract (x h) (-> (hash/dc [file-id symbol?] [a (file-id) (or/c #f exact-positive-integer?)] [scratchdir-path symbol?] [b (scratchdir-path) path-string?] [chunk-hash symbol?] [c (chunk-hash) string?] [success symbol?] [d (success) boolean?]) #t) #t) My second attempt was: (define/contract (x h) (-> (hash/dc [file-id symbol? scratchdir-path symbol? chunk-hash symbol? success symbol?] [a (file-id) (or/c #f exact-positive-integer?) b (scratchdir-path) path-string? c (chunk-hash) string? d (success) boolean?]) #t) #t) Both of these have syntax issues and I can't make heads or tails of the docs. Help, please? -- 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] running dr racket on chromebook without ubuntu
Is your filesystem mounted with "noexec"? Vincent On Mon, 28 Nov 2016 09:14:01 -0600, yehoshua zaman wrote: > > I have asus chromebook c100p. i am in developer mode. I installed dr racket > while in developer mode by entering crosh, then typing shell then finding the > location of downloads and while in that location typing racket.sh (i renamed > it to racket.sh) after that i went into the directory of racket and am trying > to run drracket by typing ./drracket it says bash: ./drracket permission > denied. i tried chmod +x drracket and chmod u+x drracket still it says > permission denied. the rights of the file are -rwxr-xr-x > > -- > 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] hyperlink in code:comment
Thank you very much. I don't understand why I missed that part of the docs. Jos -Original Message- From: stchang...@gmail.com [mailto:stchang...@gmail.com] On Behalf Of Stephen Chang Sent: miércoles, 30 de noviembre de 2016 19:56 To: Jos Koot Cc: Racket Users Subject: Re: [racket-users] hyperlink in code:comment Each code formatting form, like `racketblock`, allows specifying an escape identifier for use within that form, though all forms default to `unsyntax` if unspecified, I believe. Some forms, like `codeblock` do not support escapes. The docs here [1] has more details, and specifically the docs for racketblock [2] has more examples. [1]: http://docs.racket-lang.org/scribble/scribble_manual_code.html [2]: http://docs.racket-lang.org/scribble/scribble_manual_code.html?#%28form._%28%28lib._scribble%2Fmanual..rkt%29._racketblock%29%29 On Tue, Nov 29, 2016 at 3:42 PM, Jos Koot wrote: > Thanks, I'll try that. > It is not clear to me where I can use @#, > But certainly your response will be a great help for me. > Thanks again, Jos > > -Original Message- > From: stchang...@gmail.com [mailto:stchang...@gmail.com] On Behalf Of Stephen > Chang > Sent: martes, 29 de noviembre de 2016 21:31 > To: Jos Koot > Cc: Racket Users > Subject: Re: [racket-users] hyperlink in code:comment > > You can use the escape identifier: > > #lang scribble/manual > > @(require scribble/eval > (for-label racket)) > > @interaction[ > (define a (list 1)) > (define b (list 1)) > (code:comment @#,para{a and b are not @racket[eq?], but they are > @racket[equal?]:}) > (eq? a b) > (equal? a b)] > > On Tue, Nov 29, 2016 at 2:56 PM, Jos Koot wrote: >> A simplified fragment of scribble code: >> >> #lang scribble/manual >> >> @(require scribble/eval) >> >> @interaction[ >> (define a (list 1)) >> (define b (list 1)) >> (code:comment "a and b are not eq, but they are equal:") >> (eq? a b) >> (equal? a b)] >> >> Within the comment I would like to hyperlink 'eq' to the doc of [eq?] >> and 'equal' to the doc of [equal?] >> >> Is this possible? >> If so how? >> I have tried it without success. >> >> Thanks, Jos >> >> -- >> 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.
[racket-users] Re: Confused about bitmaps drawing to canvas
On Thursday, December 1, 2016 at 6:40:01 AM UTC-6, Alex Harsanyi wrote: > Without seeing the code, this is just a blind guess, but try "(send canvas > refresh)" in the implementation for your "set-bitmap" method. > > Best Regards, > Alex. > > On Thursday, December 1, 2016 at 4:28:02 PM UTC+8, Hersh Krishna wrote: > > So I'm making a frame which draws a bitmap that can be replaced at runtime > > so if you call (send my-frame set-bitmap *bitmap*) it will switch from > > displaying whatever bitmap you had previously to the bitmap you passed it. > > (its doing a lot of other stuff and I want the interface to this canvas > > that's drawing the bitmap to be through the frame) At least that's the > > theory. In practice, whenever I call (send my-frame show #t) the bitmap > > that's being drawn is locked permanently. Doesn't matter if the > > paint-callback fetches the bitmap dynamically or if I draw in the bitmap's > > dc. I know the bitmap is getting updated or switched. Is there something > > I'm missing or a technique I should be using? That seams to have done the trick. Sorry about that. -- 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: Confused about bitmaps drawing to canvas
Without seeing the code, this is just a blind guess, but try "(send canvas refresh)" in the implementation for your "set-bitmap" method. Best Regards, Alex. On Thursday, December 1, 2016 at 4:28:02 PM UTC+8, Hersh Krishna wrote: > So I'm making a frame which draws a bitmap that can be replaced at runtime so > if you call (send my-frame set-bitmap *bitmap*) it will switch from > displaying whatever bitmap you had previously to the bitmap you passed it. > (its doing a lot of other stuff and I want the interface to this canvas > that's drawing the bitmap to be through the frame) At least that's the > theory. In practice, whenever I call (send my-frame show #t) the bitmap > that's being drawn is locked permanently. Doesn't matter if the > paint-callback fetches the bitmap dynamically or if I draw in the bitmap's > dc. I know the bitmap is getting updated or switched. Is there something I'm > missing or a technique I should be using? -- 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] Confused about bitmaps drawing to canvas
So I'm making a frame which draws a bitmap that can be replaced at runtime so if you call (send my-frame set-bitmap *bitmap*) it will switch from displaying whatever bitmap you had previously to the bitmap you passed it. (its doing a lot of other stuff and I want the interface to this canvas that's drawing the bitmap to be through the frame) At least that's the theory. In practice, whenever I call (send my-frame show #t) the bitmap that's being drawn is locked permanently. Doesn't matter if the paint-callback fetches the bitmap dynamically or if I draw in the bitmap's dc. I know the bitmap is getting updated or switched. Is there something I'm missing or a technique I should be using? -- 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.