Re: [racket-users] google groups transition pretty much done
On 2015 Apr 29, at 18:06, Neil Toronto neil.toro...@gmail.com wrote: I suggest we thank John for carrying out this annoying drudgery whose results are good but unobservable to most of us. Hear hear! Norman (also doing some 'annoying drudgery' this week) -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Another typed/racket puzzle: module+ and scope
Greetings. I have come across another occasion where TR appears to behave in an unexpected way. Consider: % cat add1.rkt #lang typed/racket/base (provide add1) (: add1 (- Integer Integer)) (define (add1 x) (+ x 1)) % cat call-add1.rkt #lang typed/racket/base (require add1.rkt) (module+ main ;(require add1.rkt) (printf 2 + 1 = ~a~% (add1 2))) % racket call-add1.rkt add1.rkt:3:9: Type Checker: missing type for identifier; consider using `require/typed' to import it identifier: add1 from module: add1.rkt in: add1 context...: /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:275:0: type-check /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:411:0: tc-module /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:40:0: tc-setup /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:25:4 standard-module-name-resolver % racket --version Welcome to Racket v6.1.1. % It appears that the add1 is visible within the main module, but its type isn't. Adding the (require) inside the module produces the same error. Adding the (require) inside the module and removing it from the enclosing module does work in this example, but obviously makes add1 invisible in that enclosing module. The TR documentation for #%module-begin http://docs.racket-lang.org/ts-reference/special-forms.html?q=module-begin#%28form._%28%28lib._typed-racket%2Ftyped-racket..rkt%29._~23~25module-begin%29%29 says Otherwise, the #%module-begin form of typed/racket behaves like #%module-begin from racket. I take that to suggest that there should be no surprises here. Looking through the TR reference, the only other mention I can see of modules is in Sect. 5.1 on 'Untyped Utilities'. I can't see any notes on this in the TR Guide Sect. 8, 'Caveats and Limitations'. As an additional remark (and this is a little weird), if I give in, and try to use require/typed, then I get a rather perplexing error: % cat call-add1.rkt #lang typed/racket/base (require add1.rkt) (module+ main (require/typed add1.rkt [add1 (- Integer Integer)]) (printf 5 + 1 = ~a~% (add1 5))) % racket call-add1.rkt add12: unbound identifier; also, no #%top syntax transformer is bound in: add12 context...: /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/utils/require-contract.rkt:13:0 /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:40:0: tc-setup /Data/LocalApplications/Racket/6.1.1/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:25:4 standard-module-name-resolver % Best wishes, Norman -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Another typed/racket puzzle: module+ and scope
Alexis, hello. On 2015 May 4, at 16:37, Alexis King lexi.lam...@gmail.com wrote: Yes, it’s a known bug that submodules are broken within Typed Racket. I’m not entirely clear on the details, but I believe it is suspected that the reason is actually due to a bug in the macro expander, which should be fixed with Matthew Flatt’s new scope-sets model. Ah, that's a pity. Otherwise, I don’t think there’s a particularly good workaround for this issue, so you’ll probably just have to avoid submodules in TR for the time being. What I've done is simply to move most of the content of the main submodule into a top-level function, and call that with (current-command-line-arguments). Not as pretty, but it typechecks. Thanks for your help. All the best, Norman -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Storing functions in a hash
j b, hello. Depending on what this is a cut-down version of, I think you may have slightly over-engineered it. On 2015 May 20, at 13:41, j b phra...@gmail.com wrote: ; function definition helper (define-syntax-rule (define-hash-function f p ...) (define (f) (lambda () p ...))) This defines f to be a function returning a function. ; function caller helper (define-syntax-rule (call-hash-function x) (apply x '())) ...and because of that, you have to add this indirection to call it. ; define functions (define-hash-function random-foo (random 100)) (define-hash-function random-bar (random 500)) ; put functions into hash (define h1 (hash 'foo (random-foo) 'bar (random-bar))) Here, you're initialising the hash with the functions which are returned by random-foo and random-bar ; call functions from hash (displayln h1) (displayln (call-hash-function (hash-ref h1 'foo))) (displayln (call-hash-function (hash-ref h1 'foo))) (displayln (call-hash-function (hash-ref h1 'bar))) (displayln (call-hash-function (hash-ref h1 'bar))) Another way is (define-syntax-rule (define-hash-function f p ...) (define (f) p ...) ; or (define f (lambda () p ...)) ) ; f is just a function (define-hash-function random-foo (random 100)) (define-hash-function random-bar (random 500)) (define h1 (hash 'foo random-foo 'bar random-bar)) ; ... so the hash-values are simply the functions which random-foo and random-bar evaluate to ; call functions from hash (displayln h1) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'bar))) (displayln ((hash-ref h1 'bar))) ; ...which means that calling the results of those hash lookups is as simple as an extra pair of brackets. The extra indirection may be useful in some circumstances, for example if the functions produced by your define-hash-function were parameterised at the call to define-hash-function. For example: (define (make-random-function limit) ;; make-random-function : number? - (- number?) ;; (ie, this is a function which evaluates to a function, ;; namely a function which evaluates to a random number between 0 and limit) (lambda () (random limit))) (define h2 (hash 'f100 (make-random-function 100) 'f500 (make-random-function 500))) (displayln h2) (displayln ((hash-ref h2 'f100))) (displayln ((hash-ref h2 'f100))) (displayln ((hash-ref h2 'f500))) (displayln ((hash-ref h2 'f500))) but even then, you don't need the indirection for the apply. Remember functions are first-class values -- they're as much 'a thing you can pass around' as a string is, or a number. Have fun, Norman -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Naming conventions
Greetings. On 2015 Jun 29, at 16:05, Philip Blair peblair...@gmail.com wrote: Perhaps, I'm wrong, but I don't believe there's an *explicit* convention; however, as far as I've seen, it typically is used for function variants (more specifically, I *usually* see it used to distinguish multiple functions which do more or less the same thing with different input forms). To quote Neil Van Dyke: Pronounce the '/' as 'with' [...] Sometimes it's for a variation in behavior, or composition of behaviors, sometimes it's just a shorthand for the word 'with', and sometimes it's something else. Source: http://lists.racket-lang.org/users/archive/2011-September/048044.html I've tended to make names consistent with the list of conventions collected in http://community.schemewiki.org/?variable-naming-convention (with 'plt-scheme' - 'racket'). These are mostly echoed in the Racket style guide at http://www.ccs.neu.edu/home/matthias/Style/style/Textual_Matters.html#%28part._names%29 (though I think that '#:' is a syntactical constraint that denotes keywords, and not just a naming convention). All the best, Norman -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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: Typeset equations using Latex packages amsmath and amssym
Greetings, all. On 24 Sep 2015, at 13:12, Alex Knauth wrote: Ah, I actually had tried that and was about to send you the error code for bad syntax. But then I realised that it complained about me defining $ as the equivalent of math-inline, which of course clashes with #\$. Oh. Well, if you can change the #\$ to a different character, say #\^, then you can use ^[\begin{equation*}] instead, to avoid clashes. At the risk of a slight tangent... Recall that (La)TeX allows fairly extensive reallocation of functionality to characters: the escape character doesn't have to be backslash, the math-open character doesn't have to be dollar. In my experience, when generating (La)TeX, it's useful to do some category-code magic -- even using non-ASCII characters for some of the categories -- and generate LaTeX accordingly. The resulting LaTeX looks weird, but completely avoids a whole class of escaping headaches. Thus: This is ^Aemph^Bemphasised^C text, and standard LaTeX. I can fill in further details if that would be useful. All the best, Norman -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] typed/racket (or foo #f) doesn't work as expected
Greetings. Consider the following: #lang typed/racket ;#lang typed/racket/no-check ; <-- this works as expected (: func (case-> ([#:as (U Integer False)] -> Any) (Integer [#:as (U Integer False)] -> Any))) (define (func (arg1 #f) #:as (opt-arg #f)) (cond (arg1 (or arg1 #f)); <-- removing this expression means things work as expected (else (eprintf "func: opt-arg=~s, so (or ~s #f) -> ~s~%" opt-arg opt-arg (or opt-arg #f)) (or opt-arg #f (func #:as 1) (func 1) When run... % racket -v Welcome to Racket v6.3. % racket test.rkt func: opt-arg=1, so (or 1 #f) -> #f #f 1 % That is, in the first case (or 1 #f) appears to evaluate to #f, not 1 as expected. Very much not as expected. If I replace the definition with (define (func (arg1 #f) #:as (opt-arg : (U Integer False) #f)) ...) then this works as expected. That is, TR appears to be typing opt-arg, within the function, as False, and rewriting the (or opt-arg #f) accordingly. It's not doing the same with the (arg1 (or arg1 #f)) clause. Given that I've typed the func function before defining it, and have typed the #:as argument as (U Integer False), I would not expect to have to repeat myself in the function definition. Related, perhaps: If I declare the type of 'func' as follows: (: func (case-> ([#:as Integer] -> Any) (Integer [#:as Integer] -> Any))) Then the default opt-arg value does not match the function type. This does not produce any error or warning, and this suggests to me that this declaration is not being examined when the function is defined. I would have expected this to be caught as a type error. That said, the following program 'works' #lang typed/racket (: f ([#:o Integer] -> Any)) (define (f #:o (opt-arg #f)) (or opt-arg #f)) (f #:o 1) ; --> 1 So it's not just a matter of 'type of optional arguments is too narrow'. Also, this program has the same glaring type error in it. What _may_ be a related issue is that, if I try the program at the top in DrRacket with the 'Debug' button, I get an error message: Welcome to DrRacket, version 6.3 [3m]. Language: typed/racket [custom]; memory limit: 128 MB. exception raised by error display handler: normalize-path: element within the input path is not a directory or does not exist element: /home/ryan; original exception raised: expr-syntax-object-iterator: unknown expr: (quote-syntax (:-internal func (case-> ((#:as Integer) -> Any) (Bytes (#:as Integer) -> Any))) #:local) But this may be a separate issue, because if I put the smaller program, above, into DrRacket, and press Debug, I get ../../Data/LocalApplications/Racket/6.3/share/pkgs/drracket/gui-debugger/annotator.rkt:227:6: expr-syntax-object-iterator: unknown expr: (quote-syntax (:-internal f ((#:o Integer) -> Any)) #:local) I don't know if this is related, but I wouldn't have expected to see a /home/ryan above. Additionally, doing find /Data/LocalApplications/Racket/6.3 -type f | xargs grep /home/ryan ...I get _lots_ of matches. Is there a possible build glitch here? I'm on OS X, 10.10.5 The same thing happens as far back as Racket 5.3.6, which is the earliest I have to hand. Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Slack IRC bridge malfunctioning
Neil, hello. Separately from the question about the wisdom or not of a Slack/IRC bridge, you mentioned On 7 Feb 2016, at 20:31, Neil Van Dyke wrote: much less bridged to this billion-dollar data-grabbing intermediary Slack dotcom. Is that a thing that Slack do? I've previously been comfortable using Slack in a light way, precisely because their business model appears to be a freemium one, as opposed to one which exists by monetising user data. That is, I can (I thought) understand where their money comes from, in such a way that exploiting user data (for some value of 'exploiting') would represent a potential reputational danger rather than a fundamentally necessary income stream. Since I use it for stuff which is not public, but professional rather than Personal, it seems to fit into a vague category of uses where I'm probably comfortable with the tradeoffs of a cloud solution. Have I deceived myself with respect to Slack (as distinct from the model in general), or is this down to a matter of where you or I or others might locate those tradeoffs? All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Slack IRC bridge malfunctioning
Matthew (and Neil), hello. (and being conscious of Neil's implied suggestion that this may be drifting off-topic for the list) On 9 Feb 2016, at 1:26, Matthew Butterick wrote: Neil's critique ought not be lightly dismissed. Oh, I certainly didn't intend to _dismiss_ Neil's critique (and I don't read Jack Firth as doing so either), much less dismiss it lightly. For me (and this is clearer to me after thinking about Neil's remarks), this is now less of a technical question than a commercial one. The question of whether an organisation has my data seems less salient than the question of what they plan to do with it. If a company says they're not going to exploit my data for money, but it later emerges that they do, then I and a lot of other people/companies will stop using them, and that gives them a direct bet-the-farm interest in being 'honest'. That is, the business model means that I don't have to greatly _trust_ them to be honest actors (with scare-quotes round quite a lot of that). If there was a service like Slack's which worked without sharing data -- for example, by using end to end encryption or doing everything P2P -- then I would prefer that, all other things being equal. I've almost completely migrated from Dropbox to Tresorit for more or less this reason. So for Slack, it comes down to trade-off, and it seems to me that Slack isn't a bad offender here; Neil noted this, and I find their privacy policy broadly reassuring, to the extent that it seems to contain quite a few hostages to fortune if they were to plan on exploiting the data for money. More interesting than Slack, though, are Neil's two points that (i) there is now a pervasive expectation that nothing is ephemeral -- everything is logged somewhere; and (ii) that the ubiquity of one or two dotcom business models limits the expectations of students, startups and investors. Re (i): one could expand this into both a socio-legal privacy point, and an aesthetic or even I'm sure spiritual point about ephemera. That would send us wildly off-topic. Re (ii): I had not thought of this point, or at least not in such concrete terms; and mulling it over in the last couple of days, it is a very sobering point indeed. Having everyone think the same way is all sorts of nasty, and means that I do now share at least some of Neil's distaste for the situation. The internet's become a very different place from what it was going to be 20 or 25 years ago. *sigh* All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Detect version of OS X
Jens Axel, hello. On 24 Feb 2016, at 14:04, Jens Axel Søgaard wrote: What happens if /Library/Tex/texbin is present - but not in the path? A good point. Using Matthew's reminder of the existence of find-executable-path (which I've used before, but was too focused on "system" here), how about: #lang racket/base (require racket/string) (let ([p (string-join `("/Library/TeX/texbin" "/usr/texbin" ;; ...plus anywhere else I can think of... ,(getenv "PATH")) ":")]) (parameterize ([current-environment-variables (make-environment-variables #"PATH" (string->bytes/utf-8 p))]) (let-values ([(base name must-be-dir?) (split-path (find-executable-path "tex"))]) (printf "binaries in ~a~%" base That encodes some platform-specific knowledge in the list of possible binary locations, but it can be extended to 'everywhere I've ever heard of a LaTeX binary ending up, on any platform, plus some extra heuristics', and still be fairly robust. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Detect version of OS X
Greetings On 23 Feb 2016, at 20:46, Jens Axel Søgaard wrote: Use case: The paths to LaTeX has changed on El Capitan, which makes it difficult to choose a default path, that works for all. Addressing that particular use-case (following the motto that one should test the functionality rather than switch on the version), and if a system call is OK, then adapting Stephen De Gabrielle's example you could try #lang racket/base (require racket/system racket/port) (let-values (((base name must-be-dir?) (split-path (string->path (with-output-to-string (λ () (system "which tex"))) (printf "binaries in ~a~%" base)) or call out to "tlmgr conf" or one of its subcommands (if your installation is based on TeXLive). This would obviously work on other unixes, and there might be a path-searching equivalent on Windows, too. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] What do you use macros for?
Greetings. Quoting Asumu quoting Matthias: I'd like to propose that there are three disciplined uses of macros: 1. data sublanguages: I can write simple looking expressions and [...] 2. binding constructs: I can introduce new binding constructs with [...] 3. evaluation reordering: I can introduce constructs that delay/postpone [...] [Note: In Haskell, you don't need that one.] This is a seriously naive question, because I have only trivial experience with Haskell (and by extension other lazy languages), but aren't each of these things that you can do with a lazy language? If I can control when an expression is evaluated, then I can obviously do (3), but supposing I can also control the environment within which it's evaluated, can't I also do (2) and thence, with suitable juggling, go on to (1)? Asumu's further example of 'use of macros that expand into submodules in order to provide metadata for other programs/tools' sounds at least complicated to do lazily, without macros, but not fundamentally impossible. Macros are obviously not the same as lazy evaluation (though from the point of view of the macro expander, perhaps all the post-compilation stages are 'lazy'), but I'm having a hard time seeing why it's obvious they're not isomorphic. I imagine there may be both pragmatic and fundamental semantic reasons why the two are different. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] quoting in posts to this email list
Greetings. On 7 Apr 2016, at 5:13, Neil Van Dyke wrote: I suggest that people posting replies to posts on this email list try to *minimize* quoting of the previous post(s). add1 Oh, for the sake of my poor heart, and the strain on it from my dark mutterings when disentangling top-posting: (add1 (add1 (add1 (what-neil-said All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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 Shell
William, hello. On 20 Aug 2016, at 23:23, Matthias Felleisen wrote: You may wish to read up on scsh. While it was way ahead of its time, Olin Shivers made the syntax as natural as possible so it would be quickly useful to people used to basic shell scripting syntax. After all, this syntax has a 40+ history and shouldn’t be thrown out. What Matthias said... I think that Olin Shivers made a lot of excellent syntactical decisions when designing scsh -- in particular his syntax for regular expressions and for extended process forms -- to the extent that if one were simply to reimplement the scsh syntax in Racket, that would be an excellent departure point. This is not to dispute your own syntactical choices, but in an enterprise like this, scsh would be the elephant in the room. There have been a couple of attempts to support the scsh syntax in Racket, and the scsh code is still under active, though rather low-level, maintenance <https://github.com/scheme/scsh>. Incidentally, scsh does start up very quickly, which is an attractive feature. And this enthusiasm isn't just because scsh was the first Scheme implementation I spent serious time with (*wipes wistful tear*). Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] fivethirtyeight indexes reddit
Greetings. On 25 Aug 2016, at 17:10, 'John Clements' via Racket Users wrote: http://projects.fivethirtyeight.com/reddit-ngram/?keyword=racket=20071014=20150831=10 (It’s also a bit sobering to see what happened to Haskell) That's interesting, but what's happened to Haskell in that graph might be deceptive. I tried looking at the terms racket, haskell, ocaml, perl, swift and python, and _all_ of them except 'racket' and 'swift' go down in a roughly exponential way. That's curious for 'haskell' and 'ocaml', reassuring for 'perl' (die, Perl, die!), but not really believable for 'python', which I added as a language that I would expect to be fairly level in popularity in those years. What this looks consistent with -- given that the vertical axis is a fraction not absolute -- is that these terms have stayed roughly constant in popularity, but the rest of Reddit has grown exponentially, talking about stuff _other than_ programming languages (exotic though such a conversation would be). Is that plausible? (I'm not a Reddit habitué). If so, that means that the growth in 'racket', and more so with the more predictable growth in 'swift', is all the more impressive. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] fivethirtyeight indexes reddit
Andreas, hello. On 25 Aug 2016, at 18:22, Andreas Perstinger wrote: If so, that means that the growth in 'racket', and more so with the more predictable growth in 'swift', is all the more impressive. Well there is also a singer named Taylor Swift which IMHO would explain this growth. :-) http://projects.fivethirtyeight.com/reddit-ngram/?keyword=swift.taylor=20071015=20150831=9 How desperate are some people?! Naming themselves after happening programming languages just in order to get some reflected cool. What's the world coming to? (I have entertained the possibility I am slightly zeitgeist-challenged, at this point) And as much as I like Racket (the programming language), I'm pretty sure there is a similar explanation for the word "racket" (e.g. the sport equipment, the fraudulent scheme, ...) But one would expect those ideas to have roughly constant currency over the eight years of these searches, so that the term 'racket' would share in the apparent general decline in numbers. Daniel Prager pointed to the difference between 'clinton' visibility over the eight years. That contrast seems more extreme than I'd have expected, given its position within the US electoral cycle, but is very broadly consistent with a general dilution of all terms on Reddit. But that general dilutions means almost _any_ increase in a term's occurrence in these graphs suggests a very substantial increase in its significance. Comparing 'scheme' with, eg, 'haskell' and 'python' suggests that's declined relatively modestly. Perhaps the world is finally catching on. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] What is the Racket equivalent to 'return' for early exit?
Greetings. On 21 Nov 2016, at 18:07, Leif Andersen wrote: (define (do-something) (unless (some-condition) (error "NO")) (do-the-thing)) (with-handlers ([exn:fail? (lambda (e) (displayln "I returned early"))]) (do-something)) But that is specifically because I prefer the workflow of catching errors, rather than always having to manually check the output of the function (I'm looking at you C...) On reflection, I think this is a better answer than mine (and is probably what I'd do in fact). Apart from anything else, it means that (do-something) will only return the type of thing it's supposed to return, and not anything that needs checked. That would be still more important if you were using Typed Racket. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Error when codesigning Racket created executable - codesign_allocate: file not in an order that can be processed
Seamus, hello. On 3 Jul 2017, at 23:17, Seamus Brady wrote: I got a bit further than Norman :) Well done! I've added to the Stackoverflow question, a pointer to this discussion. The trick from Matthew did the trick and that Racket based app gets signed and passes all the local GateKeeper checks :) Great stuff. Great stuff indeed. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Error when codesigning Racket created executable - codesign_allocate: file not in an order that can be processed
Seamus, hello. On 2 Jul 2017, at 22:57, Seamus Brady wrote: I cannot find any bug reports or Stackoverflow issues about Racket binaries and codesigning on macOS but there seems to be similar problems with other open sources binaries (such as binaries produced by PyInstaller). The problem is a known one. I was hoping that someone could provide some advice if anyone has seen similar problems. I'm not sure if it's exactly the same problem, but I attempted something similar a few years ago [1], and concluded that it was infeasible, then. It seems that signing involves editing the OS X binary, and that is hard to do after linking. Apologies if you've already found [1] on stackoverflow -- I mention it here since the post has a title that isn't obviously about code-signing. Best wishes, Norman [1] https://stackoverflow.com/questions/4022495/how-can-i-add-sections-to-an-existing-os-x-executable -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Proper non-tail recursion?
Greetings. On 25 Apr 2017, at 23:51, 'John Clements' via Racket Users wrote: In answer to your actual question, the most common name is “Tail Call Optimization,” which many people correctly object to because it’s not an optimization, it’s a change to the meaning of terms in the language I've seen the phrase 'Tail Call Elimination' used, for precisely this reason, that it's not merely an optimisation. While it's not as cute as Proper Implementation of Tail Call Handling, it's possibly more descriptive (saying 'proper' is rather begging the question), and close enough to the more widespread TCO to be intelligible. All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] RacketCon Code of Conduct
Greetings. On 25 Jun 2017, at 2:37, Vincent St-Amour wrote: We (the RacketCon organizers) have decided to adopt the SNAPL code of conduct (based on the ACM's) for RacketCon. You can find it on the RacketCon web page[1]. A excellent choice: pretty near unexceptionable. Except (typo-level things I noticed): 1. You write 'ofprogram design', missing a space. 2. Deriving the text from the SNAPL one, you've changed '...unwelcome or hostile behavior of an ad hominem nature, i.e., that focuses not on ideas but on people and identity' into '...unwelcome or hostile behavior, that is, behavior that focuses on people instead of ideas'. The first version glosses 'ad hominem', but the second appears to gloss 'hostile behavior' instead. If the intention was simply to rewrite the latinism 'ie', then you may have deleted a phrase too much and inadvertently garbled the sense. If the intention was to avoid 'ad hominem' as well, then perhaps simply '...unwelcome or hostile behavior that focuses on people instead of ideas'. 3. Layout: wow -- the 70s are back (in a good way). All the best, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] RacketCon Code of Conduct
Greetings. On 19 Jun 2017, at 16:18, John Berry wrote: Nothing about a document saying "hey, don't be an ass" implies that the reader themselves, or the community, are asses. Only that the community values not being an ass, and those who might wish to join that community and not be an ass are welcome, and that those who have had to deal with too many asses will hopefully find fewer here. If the document literally said just 'hey, don't be an ass', or 'don't be a git', or 'c'mon, behave', then that would be fine. Perhaps it could have a footnote saying 'Surely you can tell when you're being a git -- if you for some reason have difficulty with this, then see [link]'. A text like that presumes that the reader is grown-up, but indicates, for the avoidance of doubt, that adult civility is indeed expected in the meeting. The problem with the longer text, such as the Strange Loop one[1], is that it's manifestly _very_ hard to come up with a text that doesn't radiate censoriousness; and however much this isn't the literal implication of the text, it does implant the notion that the reader or the community has behaviour problems. That text does not radiate 'you are welcome' -- it tells me, 'we have so many gits roaming the corridors of our conference that we have to police them'. In its phrasing, a text like this appears to presume that the reader is an undersocialised thug, who needs to be given an extensive but non-exhaustive list of things to remember not to do. One has to carefully suppress one's initial reaction to it, and smile sweetly. Also, any text like that almost inevitably acquires a legalistic air, and just screams out for disputation, and the reddit thread... For the unconvinced, I really appreciated Graydon Hoare's perspective on why he implemented the Rust CoC. https://www.reddit.com/r/rust/comments/6ewjt5/question_ about_rusts_odd_code_of_conduct/didrult/ https://www.reddit.com/r/rust/comments/6ewjt5/question_ about_rusts_odd_code_of_conduct/dif1xvb/ ...seems to corroborate this. To clarify, this remark is about communication and presentation. The underlying wish to encourage civility is entirely laudable, and the experience of being on the wrong end of careless or careful incivility would be entirely unpleasant and deplorable, and a conference should aim to discourage such incivility by any available effective mechanisms. If, after all, the only effective mechanism is a rule-book such as is being discussed, then can I commend the FreeBSD code [2] which I think communicates the underlying goals very well, even though it's primarily intended to cover behaviour online, rather than face-to-face. To my ear it benefits from a very slightly old-fashioned air, including the rather old-fashioned implication that 'we're sure this stuff doesn't really need to be said, but since you ask...' Best wishes, Norman [1] https://www.thestrangeloop.com/policies.html [2] https://www.freebsd.org/internal/code-of-conduct.html -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] Please HELP ME! Programmers at scheme, i am calling you ! :D
Patrik, hello. On 11 May 2018, at 16:03, Patrik novak wrote: Ok then, i got problem with this. I wrote a procedure which i called 'make-mutable-selector', which make a mutable selector from quote symbol like 'mcaar, 'mcadr etc. But i don't know, how i can use this in the code, what i want to write... i mean a macro with-mcxrs. Perhaps ask the question as if you were emailing your teachers (who may already be on the list, who knows?). If you ask a question that you'd be comfortable asking them, then I think the list (many of the members of which are themselves teachers) will be better able to help. Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] What is the right way to generate HTML from the web server?
Greetings. On 4 Jan 2018, at 19:07, Philip McGrath wrote: > P.S.: I was very comfortable reading and writing HTML and XML-ish notation > long before I came to Racket, and I initially resisted giving up my > angle-brackets (to the extent of fiddling around with reader extensions), > but I have since become convinced that x-expressions are really a better > notation for XML than XML syntax is. Lots of ditto! Tangential for this list, but <https://nxg.me.uk/dist/lx/>. Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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] (number->string -nan.0) == "+nan.0" ?
Greetings. On 6 Feb 2018, at 13:00, ben.rudgers wrote: "The library [math.h] doesn't try to distinguish +0 from -0. IEEE 754 worries quite a bit about this distinction. All the architectures I mentioned above can represent both flavors of zero. But I have trouble accepting (or even understanding) the rationale for this extra complexity. I can sympathize with recent critiques of the IEEE 754 Standard that challenge that rationale. Most of all, I found the functions quite hard enough to write without fretting about the sign of nothing." If I recall correctly, this is included in the IEEE standard in order to support various functions which have a cut along the real axis in the complex plane, and so which have a significantly different values on that real line, when approached from above and below the line (in the complex plane). But this is a rather hand-waving explanation, and I'll defer to those with more detailed knowledge of the relevant numerical analysis. Norman -- Norman Gray : https://nxg.me.uk -- 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] Legal/Business Case Management DSLs
Neil and Richard, hello. On 26 Aug 2018, at 9:48, Neil Van Dyke wrote: You could do all structural markup this way, or combine markup with inferred bits. Incidentally, your example is a good fit for how SGML (and then HTML) was intended to be used, for text markup using elements and attributes (but it does involve more typing, and SGML don't have TeX-like blank line paragraph separation): "Spoke to the client by telephone. Confirmed I would DEADLINE="2018-08-28">send out the court form on Tuesday." Just as a parenthesis, SGML was originally conceived as something that (trained) people would type without editor support, and the document type definition has facilities for heavily tuning the lexer to support abbreviation. Thus with a few declarations, you could set up an SGML document in which a standard/unmodified SGML processor would parse We must [todo 2018-08-28/send out the court forms]. in the same way that it would parse, say, We must send out the court forms. (if I recall correctly -- it's been a while). It could quite possibly handle newlines as paragraph breaks, too. The facilities to do this were what amongst the things which were removed from SGML to get XML (and made creating an XML parser merely a manageable headache). This does not constitute a suggestion for immediate further work! I mention this in part for sentimental reasons, because I was at one point enjoying processing SGML documents using a language called DSSSL, and decided to explore this language 'scheme' that it was reportedly an implementation of, and I printed out R5RS. So DSSSL Good. Best wishes, Norman -- Norman Gray : https://nxg.me.uk -- 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] Legal/Business Case Management DSLs
Hendrik and all, hello. On 26 Aug 2018, at 17:47, Hendrik Boom wrote: SGML had a hierarchy of tags -- which ones would automatically close off others, so that it wasn't necessary to slavishly balance all the tag-bracketting. But the exact hierarchy would depend on the publisher's style definition for the document type. For example if 'em' elements are declared to be contained within 'p' elements, and 'p' elements not to include other 'p' elements, then Text with emphasis. Another paragraph. The closing tag, and the two closing tags, would be inserted by the parser. In other circumstances, you could have A single word. To be precise, and as a point of historical interest (and this is still somewhat at a tangent from Richard's original query), SGML had exactly[1] the same hierarchical model as XML, but it also had various 'tag minimisation' features, one of which, if enabled, required the SGML parser to insert closing tags into the parse stream in the way you describe, Hendrik. Other options allowed one to omit attribute names if the attribute values were unique, or use a generic end-tag , and so on. When XML first appeared, it was defined as (or rather the independent definition was intended to be equivalent to) a profile of SGML, in the sense that there was an SGML declaration (ie, a set of parser settings) which, amongst other things, turned off all optional features. The differences between the two technologies, expressed in rather recondite SGML terms, is at <https://www.w3.org/TR/NOTE-sgml-xml-971215/> (by the way, the author of this note is indeed the James Clark of groff). HTML was, I think, initially defined in conceptually the same way, as an SGML declaration and DTD. Then XHTML was defined in terms of a DTD for XML, and HTML redefined in terms of XHTML plus-error-recovery-for-illformed-documents (ie, with things like missing end-tags), but that struggled to be adopted. Finally (?) HTML5 was redefined from scratch by a loose (and reportedly rather bad-tempered) consortium of browser makers as a ragbag of element-start and element-end tags and the presumed effects when a parser stumbled across them (that may be a less sympathetic description of HTML5 than its designers would provide). I may have fumbled bits of that history, but it's something like that. Best wishes, Norman *now getting rather lost down memory lane* [1] I say 'exactly': I can't think of any differences, but I wouldn't want to insist there were none. -- Norman Gray : https://nxg.me.uk -- 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] Legal/Business Case Management DSLs
Richard, hello. On 26 Aug 2018, at 13:01, Richard Parsons wrote: SGML is sounding more and more like something I should know about given my project. A quick google has turned up the hashtag #makesgmlgreatagain ?! If anyone has any suggestions where to start my research, then that would be welcome I'll reply on-list to stress that it really wasn't my intention to suggest you develop an active interest in SGML, an interest in which can, I think, now be regarded as even more retro than Facebook. SGML was^Wis a wonderful thing (it and its associated technologies was the first genuinely interesting computing domain I was aware of), but I suspect that ship has now sailed, unless you're in one of the industries that has invested decades of effort in SGML-based systems. SGML addressed a lot of problems -- structured markup, archival formats, overlaying semantics by aspect /annotation -- but these having been rediscovered as problems, now have more fashionable solutions. On the more general point: On the other hand, I don't want to create lots of separate systems (contact management, calendar systems etc) which then have to be kept in sync with my notes. It's too easy to forget and for them to fall out of sync. You might be interested in looking at the Semantic Web, and RESTful interfaces, if you're not aware of them already. They're very different things (and the former is not easy to get into), but both are motivated by the idea that the online world is now a interacting world of loosely coupled systems, each with their own semantics. The semantic web says that the world is a highly heterogeneous database; the REST paradigm claims that if you conceptualise remote gobbets of information as named things, then this is a useful way to integrate heterogeneity. If you were to wrap a contacts management system in a RESTful interface which exposed adequately-described and machine-processable named contacts, that becomes a good starting point for integration down the line. Or at least that's what I'd start with, if given free rein with your problem, and no deadlines. If there is already software for embedding business information into documents then I would certainly be interested. 'Embedding into documents...': now _that_ makes me think of Project Xanadu, which is even further back down the line! Do not go to Xanadu; noone comes back from Xanadu. Best wishes, Norman -- Norman Gray : https://nxg.me.uk -- 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] Why is there a space in the path to the Racket application on MacOSX?
Greetings. On 30 Mar 2018, at 15:44, David Storrs wrote: On Thu, Mar 29, 2018 at 5:54 PM, HiPhish <hiph...@openmailbox.org> wrote: I think you are trying to solve the wrong problem. If people want to use a command-line tool they should know how to use the command line first. They [...] I look at it the other way: there are clear benefits to NOT having names containing characters that need to be quoted, so any use of such characters has an opportunity cost. What benefit does the space provide that outweighs that opportunity cost? I think the main benefit is simply that it looks nice. OSX ^W macOS is primarily [1] designed for GUI users. The Finder has no problem with files containing spaces, or other bash-annoying characters such as various brackets, dollar-signs and ampersands. I can name a file 'A $/€/£ conversions (2017)' and not think twice about it. Spaces in the Racket installation locations represent a mild inconvenience only to the minority of users (including me) who use the command line more than the Finder, and we, to a first approximation, don't count. If I find such a name inconvenient, then I can either find the tab key on my keyboard, or add a symlink somewhere convenient (as suggested above, and what I actually do), or else learn to love the bit of the bash manual about quoting arguments (which one should do anyway, when writing half-way-careful scripts). Catering to command-line users in this way, and naming A-and-B_USD-EUR-GPB_conversions-2017 is frankly ugly, significantly less readable, unintelligibly obscure for anyone who doesn't have bash-expansion intuitions, and is still something I'd use the tab character to complete when typing. Best wishes, Norman [1] ...for some value of 'primarily' which might not survive close examination -- Norman Gray : https://nxg.me.uk -- 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] Licence guidance
Greetings. On 27 Sep 2018, at 3:48, Anthony Carrico wrote: On 09/26/2018 05:32 PM, Deren Dohoda wrote: I put a package up but it has no license info in the code. I would add one which is the most permissive possible that wouldn't cause conflict. I guess this is BSD? MIT? In this case, don't license your code, declare it to be in the public domain. That doesn't necessarily solve the problem, or at least not internationally. In UK law, for example, 'public domain' means simply 'known to the public', and doesn't have a link to licence information. Also, it seems that there isn't the notion of 'unowned (intellectual) property', so that 'I place this in the public domain' could at most be interpreted as a vague disavowal of interests. That is, it would be an absence of a statement of a licence, rather than a statement of an absence of a licence. Thus the BSD licence is probably the most permissive thing that's still unequivocally recognisable as a licence. Best wishes, Norman -- Norman Gray : https://nxg.me.uk -- 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] make extensions or replacements
On 20 Apr 2019, at 1:11, 'John Clements' via Racket Users wrote: There’s a paper at the most recent ICFP from Simon Peyton Jones (et al., I’m guessing) on make languages, IIRC. Very interesting -- thanks! The paper is Andrey Mokhov, Neil Mitchell, and Simon Peyton Jones. 2018. Build Systems à la Carte. _Proc. ACM Program. Lang._ 2, ICFP, Article 79 (September 2018), 29 pages. <https://doi.org/10.1145/3236774> My brain-dump notes from a fairly superficial read of that paper (thinking about make alternatives, rather than the functional properties of them, which is the authors' actual goal) are below, if anyone's interested. With that in mind, it strikes me, Hendrik, that if you developed a (Racket) system which generated Ninja files, that might tick a few boxes. Best wishes, Norman Build systems, various == I read an interesting article about build systems (Andrey Mokhov, Neil Mitchell, and Simon Peyton Jones. 2018. Build Systems à la Carte. _Proc. ACM Program. Lang._ 2, ICFP, Article 79 (September 2018), 29 pages. <https://doi.org/10.1145/3236774>). It's a discussion of build systems, and a reimplementation of four of them in Haskell. Interesting overall, but also interesting because investigation makes it clear that there are remarkably few build systems which are real alternatives to Make. The four they discuss are Make, Excel (the spreadsheet), Shake (which is implemented in, and used for building, Haskell) and [Bazel](https://bazel.build) (which they describe in terms which suggests it's a cloud-based one for huge code bases, but which seems to be usable for small ones as well; it's an open-sourced version of an internal Google tool). At the end of the paper they mention a few others: * Ninja: see below. * Nix: really a package management system. * [Pluto](http://pluto-build.github.io): seems to be focused on Java. * Redo: slightly weird, in that the existing implementations appear to be the result of reverse-engineering the manual for the never-released original ([one version](https://redo.readthedocs.io/en/latest/) points to other implementations). * [Tup](http://gittup.org/tup/) looks interesting, and conceptually not massively far from Make in specification, but seems to detect dependencies by instrumenting the commands it runs. * [Buck](https://buckbuild.com) is a Facebook tool, written in Java. It looks quite similar to Bazel in the syntax. [Ninja](https://ninja-build.org) describes itself as a _low-level_ build system, where the input files are expected to be generated by a different system. And in fact [CMake](https://cmake.org) has a mode where it can generate Ninja files which do the actual building (as opposed to generating Makefiles). Of those, I think only Tup and CMake+Ninja would repay closer study, and possibly Bazel, though it looks pretty heavyweight. Some of these systems (as discussed in the paper at the top) also care about dependencies on, eg, compiler versions. I haven't looked specifically at that above. -- Norman Gray : https://nxg.me.uk -- 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] LaTeX
Hendrik, hello. (a tangent...) On 27 Aug 2019, at 14:16, Hendrik Boom wrote: > That said, it doesn't even have a stable syntax. I tried to find a > grammar for parsing LaTeX, and discovered there is none. It seems > LaTeX's macros do the parsing, and they're a Turing-complete > laanguage. Oh yes. LaTeX is fun. TeX has a _small_ set of very primitive commands -- loosely like add-character-to-list or add-box-to-list-of-boxes, none of which a normal user would type or be aware of -- and all of the rest is macro expansion. LaTeX is just a package of macros, originally written by Leslie Lamport, sitting on top of (the package of macros that is) plain TeX. The tokeniser turns "\emph {x$y$}" into at which point "emph" is looked up to see if it's a macro. "emph" is, and requires an argument, so the tokeniser then gobbles this is replaced by the expansion of "emph"+arguments, which is then expanded, and so on until something expands to one or more primitives. Thus what syntax there is is entirely specified by the definitions of the macros. Even the tokeniser is reconfigurable on the fly, so that the following is a valid LaTeX file: \documentclass{article} \catcode`@=0 @catcode`<=1 @catcode`>=2 @catcode`;=14 @catcode`\%=11 ; % is now just an ordinary alphabetic-letter @begin Hello, this is a 100% valid @LaTeX@ file. @end Although mathematical expressions > (which Latex is all about) have tree structure (like MathML does, and > is excessively wordy), for the most part latex represents mathematics > as just a symbol cluster. TeX doesn't represent any of the structure of the mathematics, because it's focused purely on the typesetting of maths (and other text). Semantics, as far as TeX is concerned, is for human readers. Thus in $\sum_i x_i$, the fact that \sum is a summation is not important; what's important is that it's in a category of objects for which certain spacing and layout rules apply, and these are managed/implemented/realised by the internals of TeX -- the primitives -- not by any macros. Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/C703278D-3C0C-4305-8904-4DBC2379D105%40glasgow.ac.uk.
[racket-users] Exception throwing in web-server
Greetings. I define a custom exception: (define-struct (my-exception exn:fail) ()) (define (my-error fmt . args) (let ((msg (apply format (cons fmt args (raise (my-exception msg (current-continuation-marks) The plan is that I can throw this within a servlet, and then catch it, and produce a 5xx response, within a with-handlers clause wrapping the dispatcher passed to serve/servlet. However this doesn't always work as I expect it to. The exception is thrown inside the 'output' procedure that's provided as the last argument to the 'response' constructor (I belatedly realise this is probably a bad idea). Sometimes, when the custom exception is thrown, that exception appears, not prettyprinted via the handler that I have defined, but printed on stderr via the default exception output formatter: My exception-message ... context...: [...blah...] /Data/LocalApplications/racket/7.7/share/pkgs/web-server-lib/web-server/http/response.rkt:141:12 Looking at that place in the file, I see (define (output-response-body/chunked conn bresp) [blah...] (with-handlers ([exn:fail? (lambda (e) (kill-thread to-chunker-t))]) ...which causes the servlet to (effectively) hang, so that the client sits around waiting for output that isn't going to come. Exactly the same thing happens if I avoid wrapping the dispatcher, and instead provide a #:servlet-responder procedure as a keyword argument to serve/servlet. Now, in tracking this down I can see that I have a wrong design here: the servlet has started producing output before the exception is thrown, so it's at this point really too late for me to be throwing errors and producing custom 5xx error pages. But (a) what should I be doing? And (b) since that exception is caught in this with-handlers clause, what is it that's producing the (default) exception output message? And (c) should I expect the client just to hang here? I'm guessing that an answer to (a) is 'avoid throwing exceptions inside 'output', but given that that will sometimes happen, is the output-response-body/chunked procedure doing the right thing here? Am I missing something? Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/4C0F2FAD-9C7F-4FD0-8955-623833ECE863%40glasgow.ac.uk.
[racket-users] Re: Exception throwing in web-server
Thank you, Brian and Jesse, for your thoughts on this. There may still be an exception problem here, though. (and sorry for being sluggish to respond) On 16 May 2020, at 20:16, Norman Gray wrote: Now, in tracking this down I can see that I have a wrong design here: the servlet has started producing output before the exception is thrown, so it's at this point really too late for me to be throwing errors and producing custom 5xx error pages. Brian said: I think you need to decide when to stream, and when not to stream. In my web framework, most requests involve computing the entire response string prior to calling (response ...), so if an error is encountered, I can send an error response instead of a success response. and Jesse: I suggest thinking of a servlet as a response builder, and, if possible, to delegate serialization of the response (output-response & friends) till after a response? value has been created. I agree this is the right way of thinking about things here, and it's reassuring to have that confirmed. Part of what was confusing me was that it's not particularly clear from the documentation what serve/servlet's #:servlet-responder is there for. It appears to be just an odd spelling of 'exception handler', as far as I can tell from the code. Indeed it's true that, once the HTTP status code has hit the wire, there's no provision in the protocol to change one's mind and come up with a different status (it's possible that forthcoming HTTP/3, with its concern to multiplex content on the wire, will come up with something here, but I haven't examined HTTP/3 in detail, and I'd be surprised if this was one of its concerns). However, a problem comes when the serialiser _does_ produce a 'real' exception -- meaning an exception that isn't one that I expected it to produce. In that case, the response.rkt code just hangs. Consider: #lang racket/base (require web-server/servlet web-server/servlet-env) (define (make-response/output writer) (λ (req) (response 200 #"OK" (current-seconds) #"text/plain" '() writer))) (define my-app/simple (make-response/output (λ (op) (display "hello" op (define my-app/error (make-response/output (λ (op) (error "Oooops") (display "Hello" op (define my-app/handlers (make-response/output (λ (op) (with-handlers ((exn:fail? (λ (ex) (display "Eeek!" op (error "Oooops") (display "Hello" op) (serve/servlet my-app/error #:servlet-regexp #rx"" #:command-line? #t) If we run this server, and dereference <http://localhost:8000/>, for example with curl, then the retrieval simply hangs. It appears that the handler in web-server-lib/web-server/response.rkt:148 is supposed to handle this case, but it appears not to. I think it's possible the handler should be in to-chunker-t instead or as well. This means that a further possibility is to have an exception handler within the serialiser, and handle exceptions appropriately there (as in my-app/handlers above). However all this means that a carefully-written servlet _must_ have such handlers, if an inadvertent exception in the serialiser procedure isn't to stall a client. Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/AB2357DF-5A41-429F-A7BB-7B4321EEDBE3%40glasgow.ac.uk.
Re: [racket-users] Exception throwing in web-server
Ryan and Matthew, hello. On 25 May 2020, at 19:43, Ryan Culpepper wrote: As I understand the HTTP protocol (that is, some but not lots), the most reasonable thing for the server to do if it discovers an error after the status code has been sent seems to be to just hang up and let the client realize that *something* went wrong. I don't mean just truncate the output; I mean the server should say "here comes another chunk" and then close the TCP connection, so it cannot be mistaken for a valid response. (The servlet should probably make a note so the next request doesn't just fail in exactly the same way.) I have spent a fair amount of quality time with the HTTP RFCs, and I'm surprised I can't think of an answer to this off the top of my head. Looking through RFC 7230, however (RFCs 7230--5 replace RFC 2616), we find in Sect.3.3.3 'Message Body Length', Since there is no way to distinguish a successfully completed, close-delimited message from a partially received message interrupted by network failure, a server SHOULD generate encoding or length-delimited messages whenever possible. The close-delimiting feature exists primarily for backwards compatibility with HTTP/1.0. If a response includes a Content-Length header, then truncation would be detectable, if not, not. This passage is talking about network failure, but I think the server-failure we're talking about here is morally similar. RFC 7230 Sect 6.3.2, though it's talking about a slightly different thing, also conceives of the notion of 'partial failure conditions' whilst being vague about what these are or what a client should do (the implication is that the client should... do the right thing). HTTP is generally deliberately rather vague about the payload -- the representation of the named resource -- and RFC 7231 Sect.3.3 'Payload Semantics' is a mere four paragraphs long. It includes text For example, the payload of a 200 (OK) response to GET (Section 4.3.1) represents the current state of the target resource, as observed at the time of the message origination date There's quite a lot that doesn't say, -- it's even prefaced by 'for example'. It doesn't even say that the payload _accurately_ represents the state of the resource. That sounds like quibbling, but it fits in with a general idea of 'the client gets what it's given, and it'll like it'. However vague this is, I think this would not be consistent with a server deliberately causing a TCP error, in a protocol at a lower layer than HTTP. Apart from anything else (a) the HTTP transaction might not, in principle, be running over TCP, and (b) it would be a lie, since the problem wasn't a TCP problem. In other words, truncating the output isn't desirable, obviously, but the alternatives of a deliberate lower-layer error, or stalling, seem both to be against the spirit of the spec. Matthew said: AFAICT this is the intended behavior. To me it is consistent with the usual policy: an uncaught error stops the program. If you want the program to keep running, then you have to catch the error and make other arrangements. But what happens in this case (the my-app/error case in my example) is that the (server) program keeps going but the client stalls. The unexpected error in the response-output procedure is caught, and (as far as I can see) handled by killing the producer thread _without_ closing the connection. To be clear, I think that the handler should do both. All my servlet routes are surrounded by a top-level `with-handlers` block that catches `exn:fail?`. If I get an error, I usually a) log it to the remote system, b) send an email to myself, and c) send a status 400 response to the browser with the error string. But the web server keeps running as usual. I'm not positive where you mean by 'servlet routes'. If you mean creating a handler to wrap my-app/foo in my example, then yes, that's what I do, too, and/or create a handler within my-app/foo before I create the response object. But it looks as if I must _additionally_ create a handler inside the response-output procedure (on the occasions when I do that 'by hand'), to cope with any exceptions thrown in there. Of course, I should design that response-output procedure so that it won't throw exceptions, but... never say never. Best wishes, Norman -- Norman Gray : http://www.astro.gla.ac.uk/users/norman/it/ Research IT Coordinator : School of Physics and Astronomy // My current template week for IT tasks is: Monday, Tuesday, and Friday -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/E012F389-5CCC-48E1-A255-96F8CAC70FD4%40glasgow.ac.uk.
Re: [racket-users] [racket users] list question
Kevin, hello. On 25 Feb 2021, at 17:07, Kevin Forchione wrote: As you can see each element of the sublist corresponds to the list-ref of the modulo n (length sublist) as n proceeds from 0 to some maximum value. I’ve created a function that does exactly this, but … I’ve no idea what this process might be called. As they say, the naming of cats, and all that.Does this sort of mapping have a formal name? I think this is called 'zip', or a convolution [1]. The variant you describe is (effectively) with circular lists, but seems to be the same principle. ...and I see that, with that name in hand, SRFI/1 does indeed have a zip procedure, which works with circular lists. [1] https://en.wikipedia.org/wiki/Convolution_(computer_science) Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/7F1C9263-EA6A-4B5F-A0CF-15A5725E1EAE%40glasgow.ac.uk.
[racket-users] Equivalent of exec
Greetings. I can't find a way of doing something equivalent to exec in Racket. Is this Hard, or am I just missing it? By 'exec', I mean the equivalent of replacing the process with a new image, as distinct from `system` (and friends) or `process` (and friends), which are concerned with creating a subprocess, controlling it, and handling its exit. In my particular case, I want to call vi at the end of a Racket script. I'm sure it's possible to do that with process and friends, but it would require being careful about input and output ports, worrying about buffering, whether things are terminals or not, and so on and on. I can imagine this isn't trivial as an implementation issue -- I can see there would potentially be custodians to worry about (*waves hands vaguely*), but I'd be surprised if it were impossible. However I'm completely failing to find anything on [1], searching for eg 'exec' or 'return' (as in 'does not return'); and 'exec' isn't a very handy search term on the web. Thanks for any pointers, Norman [1] https://docs.racket-lang.org/reference/subprocess.html -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/9CD816A7-8DA1-4C50-9F18-534BFC65750B%40glasgow.ac.uk.
Re: [racket-users] Equivalent of exec
George, hello. On 3 Aug 2021, at 17:38, George Neuner wrote: Racket is multi-platform and tries to present a common API for dealing with underlying operating systems. Windows is an important platform, but Windows does not have the concept of fork/exec ... so Racket doesn't offer it either. Ah: good point. That said, I'd have guessed that similar behaviour -- 'invoke and don't return' -- would be at least emulatable on Windows, though. The closest (and simplest) you can achieve, I think, would to start Vi asynchronously using 'process*' and then terminate the Racket script. I don't think that works, since terminating the Racket process would also terminate its child (unless I were to do something similar to the usual extra fork to disconnect the child from its parent, and... hmmm, this isn't sounding very rackety). Doing the next simplest thing -- using (process* "/usr/bin/vi" '("foo")) and calling (control 'wait) using the result -- doesn't seem to work, but instead just hangs, until I kill the vi child process. Without digging into it too deeply, I'd guess that's because of the usual problems about wiring up FDs and buffers and so on, which I was rather hoping to avoid. Best wishes, Norman -- Norman Gray : http://www.astro.gla.ac.uk/users/norman/it/ Research IT Coordinator : School of Physics and Astronomy -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/D9F0F60A-D41F-454B-AC8C-9E9FD140F9D9%40glasgow.ac.uk.
Re: [racket-users] Equivalent of exec
Kieron, hello. On 4 Aug 2021, at 22:04, Kieron Hardy wrote: I’m surprised no one has mentioned Rash so I will ... perhaps Rash will be a useful tool for you ... https://docs.racket-lang.org/rash/ “2 Rash Guide ... Rash is a shell language embedded in Racket. “ Thanks for pointing this out. I've looked at rash before, when you or someone else has mentioned it on-list. The thing that I really enjoyed about scsh was that it was convenient in a different direction from rash, which aims to be nice to use interactively. Scsh didn't aim for interactive use -- it was purely for scripts -- but it provided really well thought-out bindings for lots of POSIX, plus sane syntax (and a fast start-up), so that it was a _very_ effective alternative to sh scripts. Unfortunately scsh last got some love about five years ago [1]. It also has a sentimental attachment for me, because it was the first Scheme implementation I played with. Best wishes, Norman [1] https://github.com/scheme/scsh and https://scsh.net -- Norman Gray : http://www.astro.gla.ac.uk/users/norman/it/ Research IT Coordinator : School of Physics and Astronomy -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/EF13F4C2-55C8-498B-B5F3-672796DD5837%40glasgow.ac.uk.
Re: [racket-users] Equivalent of exec
Ben, hello. On 4 Aug 2021, at 16:45, D. Ben Knoble wrote: On a slightly unrelated note, if this for consumption by anyone other than just you, I would use (getenv "EDITOR") (or VISUAL, if you prefer) rather than hard-code the path to vi. An excellent point. In fact this is indeed a program just for me. It's a little diary/journal/notes tool which started as a quick experiment with scsh a number of years ago, which I then ported to Chicken when scsh died (boo-hoo), and which I'm now porting to Racket because I"m having difficulty getting Chicken to work on a new machine (and I need some urgent procrastination). It's slightly unfortunate that Racket's start-up time make it slightly suboptimal as a command-line tool, but raco make helps with that. Best wishes, Norman -- Norman Gray : http://www.astro.gla.ac.uk/users/norman/it/ Research IT Coordinator : School of Physics and Astronomy -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/7365B4BD-1E9E-49A6-BF89-B06C0858EF56%40glasgow.ac.uk.
Re: [racket-users] Equivalent of exec
Many thanks for your thoughts, George and Shu-Hung. Rather embarassingly, I've found my answer in what's almost the simplest subprocess procedure: (exit (system*/exit-code "/usr/bin/vi" "filename")) exhibits the behaviour I want. That does all the required plumbing flawlessly. I'm not sure how I missed this! When I've needed to manage subprocesses in the past, the `system` procedure (and its analogues in other languages) has always been a bit too simple-minded to provide the control I've required in a particular situation, so I think I automatically skipped over it when looking here. Also, this illustrates the perennial mistake of focusing on one solution -- how do I exec? -- rather than stepping back and asking 'what am I actually trying to do?' Sorry for the noise Best wishes, Norman -- Norman Gray : http://www.astro.gla.ac.uk/users/norman/it/ Research IT Coordinator : School of Physics and Astronomy -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/BE49F582-2636-4F63-9E06-917AC5657428%40glasgow.ac.uk.
Re: [racket-users] Racket Discourse
Greetings. On 22 Nov 2021, at 4:24, Sage Gerard wrote: > But I have to ask, who wrote the ToS? Who is "the company" in its > > context? Discord? One of the Racket team's universities? A sponsor? I'm not sure who 'the company' is, either, but they appear to be called 'company_name' (catchy!), and that users are notified that disputes can only be arbitrated in city_for_disputes, under governing_law. *cough* Such curiosities aside, all of that does represent unappealingly more legalese than one expects for a mailing list. But since the current list is hosted at googlegroups, and since it's not obvious that Discourse Corp is more predatory than Google Corp (indeed, the former is dispensing freemium-ware rather than ad-ware, so are more attractive in terms of business model), it feels irrational for me to be too put off by it. Best wishes, Norman -- Norman Gray : https://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/BEC261BF-C274-4221-8F62-C77D181ED1EF%40glasgow.ac.uk.