Re: [racket-users] IO in racket is painful

2017-07-20 Thread Sorawee Porncharoenwase
Sorry for reviving an old thread. As someone who did a lot of programming competition in the past, I can totally see why IO in Racket is difficult. As mark.engelberg said, the goal is to solve as many problems as possible. After the competition is over, it's over. No one is going to care about

[racket-users] Re: Edmond's Blossom Algorithm

2018-05-23 Thread Sorawee Porncharoenwase
I'm not sure that what you need is Edmond's blossom algorithm. Maximum matching is a problem on undirected graphs. Your problem seems to involve a directed graph structure (A prefers B doesn't mean B prefers A). Daniel Prager's solution involves randomization, so I think it's possible that the

Re: [racket-users] More DrRacket binding arrow woes

2018-02-14 Thread Sorawee Porncharoenwase
cult for me to say much more > without looking at the code itself. > > (As an aside, you should probably be providing the first argument of > my-read-syntax as the first argument to `parse` instead of (object-name > in), but I’m not sure if that’s at all related to the issue here.) > &

[racket-users] Re: More DrRacket binding arrow woes

2018-02-13 Thread Sorawee Porncharoenwase
I have a similar problem but I can't figure out a way to fix it yet :( So, when I hover on `sum` on line 3, I get "no bound

Re: [racket-users] More DrRacket binding arrow woes

2018-02-14 Thread Sorawee Porncharoenwase
t id > > I just wrote a neat little paren-free language for optmizing network flows > this way and it’s a rather viable strategy. > > > > On Feb 14, 2018, at 5:39 AM, Sorawee Porncharoenwase < > sorawee_por...@brown.edu > wrote: > > It works now! I think I simply

[racket-users] Re: Redex: making a #lang with native lambda, app, etc.

2018-12-31 Thread Sorawee Porncharoenwase
I'm a novice too, but here's my attempt to help. > I'd like to use (define-syntax) to make lambda, #%app, etc. all expand > into terms in my model. > This works for me. Is this what you want? #lang racket/base (require redex) (define-language L (term ::= (TermLambda var term)

[racket-users] Extracting known keywords from make-keyword-procedure

2018-12-27 Thread Sorawee Porncharoenwase
In Python, we can extract known keywords easily: def f(a, *args, b=2, c=3, **kwargs): return (a, args, b, c, kwargs) print(f(42, 43, c=44, d=45)) #=> (42, (43,), 2, 44, {'d': 45}) Doing so in Racket is not as easy. #lang racket/base (provide lambda/kw define/kw) (require racket/list

[racket-users] Requiring "introduced identifiers" to be explicitly declared

2019-01-19 Thread Sorawee Porncharoenwase
Is it possible to require "introduced identifiers" to be explicitly declared, and error otherwise? For instance: (define-syntax (swap stx) (my-syntax-parse stx [(_ x y) (with-syntax ([(tmp) (generate-temporaries #'(my-tmp))]) #'(begin (define tmp x) (set!

[racket-users] Re: Functions that are sometimes tail recursive

2019-01-15 Thread Sorawee Porncharoenwase
Also note that that there's something called "tail recursion modulo cons" (https://en.wikipedia.org/wiki/Tail_call#Tail_recursion_modulo_cons), though as I understand, Racket didn't implement it. On Tuesday, January 15, 2019 at 7:29:28 AM UTC-8, Sorawee Porncharoenwase wrote: >

Re: [racket-users] Scribble: ugly spacing due to missing SIntrapara

2019-01-15 Thread Sorawee Porncharoenwase
Yup. This is exactly the proposal I made above, but you stated it far more clear :) On Tuesday, January 15, 2019 at 6:50:41 AM UTC-8, Greg Hendershott wrote: > > It seems to me that each of those `defthing`s has reasonably good text. > > The problem is that the text is in the preceding

[racket-users] Re: Functions that are sometimes tail recursive

2019-01-15 Thread Sorawee Porncharoenwase
Yes, Racket recognizes the distinction and "optimize" those calls that can be optimized. Though people might not be happy with the word "optimize". To quote Shriram: It is not an "optimization". An optimization is an optional > thing; you can't rely on it being done. When you program

Re: [racket-users] Scribble: ugly spacing due to missing SIntrapara

2019-01-14 Thread Sorawee Porncharoenwase
using way… >> >> John >> >> >> > On Jan 14, 2019, at 11:46 AM, Matthew Butterick > > wrote: >> > >> > I believe the `defthing` tags need an empty {} after them. >> > >> > >> >> On Jan 13, 2019, at 11:51 PM, Soraw

[racket-users] Re: Giving scribble a shot

2019-01-08 Thread Sorawee Porncharoenwase
> > > 1. @#reader scribble/comment-reader doesn't help comments to be rendered > in this case. Is it because it only works with a racketblock? How can I > get comments in examples to be displayed > This is asked in the Slack channel recently. Florence replied: You want `code:comment` I

Re: [racket-users] Scribble: ugly spacing due to missing SIntrapara

2019-01-14 Thread Sorawee Porncharoenwase
ter/web-server-doc/web-server/scribblings/tutorial/continue.scrbl > > > > > > > On Mon, 14 Jan 2019 at 07:51, Sorawee Porncharoenwase > wrote: > >> My friend found this in the web-server tutorial ( >> https://docs.racket-lang.org/continue/). He said it is very

Re: [racket-users] Collections and data structures wishlist?

2019-01-26 Thread Sorawee Porncharoenwase
Matthias, where can I find this "History of Clojure"? I searched for "It is better to have 100 transducers ..." and found no result (besides this very thread). I also searched for "History of Clojure" and only found this tweet from

Re: [racket-users] Is it necessary to print after expansion?

2019-04-07 Thread Sorawee Porncharoenwase
Not sure if this is *the* right way, but it should work: (define-syntax (handle-sentence stx) (syntax-case stx () [(handle-sentence _) #'((current-print) (#%datum . 2))])) On Sun, Apr 7, 2019 at 5:40 PM Raoul Schorer wrote: > Hi all, > > I am trying to write my first language based upon

Re: [racket-users] Cannot use case+else inside match+else

2019-02-25 Thread Sorawee Porncharoenwase
I usually use _ for the otherwise case because I usually match on an identifier, so I have an id to refer to the matched value already if I need to. The only case I don’t use _ is when I compute something inside the match and also need to use its result: (match (foo bar) [... ...]

Re: [racket-users] big-step-stepper ==> tree-er?

2019-02-22 Thread Sorawee Porncharoenwase
I think Shriram and Preston have/had a plan similar to this. The top level shows a function call tree, and users can focus on a node which will show the usual stepper in that function. On Fri, Feb 22, 2019, 11:18 AM 'John Clements' via Racket Users < racket-users@googlegroups.com> wrote: > Has

Re: [racket-users] Macros that conditionally generate code

2019-03-06 Thread Sorawee Porncharoenwase
Isn’t this because of hygienity in general? For example: #lang racket (define-syntax (foo stx) (syntax-case stx () [(_) #'(define doubleup 1)])) (foo) doubleup ; unbound id doesn’t define doubleup. While the below code does: #lang racket (define-syntax (foo stx) (syntax-case stx ()

Re: [racket-users] Reusing scribble/examples for other languages with external interpreters (Coq)?

2019-02-15 Thread Sorawee Porncharoenwase
Might if I reuse some of that code and put it in a little scribble library? > (I don't see a license) > > -- > William J. Bowman > > On Thu, Feb 14, 2019 at 03:49:55PM -0800, Sorawee Porncharoenwase wrote: > > I did exactly this, but for Pollen. You will want to create a new > &g

Re: [racket-users] Reusing scribble/examples for other languages with external interpreters (Coq)?

2019-02-14 Thread Sorawee Porncharoenwase
I did exactly this, but for Pollen. You will want to create a new subprocess with coqtop -emacs 2>&1. You need -emacs because coqtop alone won’t distinguish the message panel and the context panel, and you need 2>&1 because Racket’s merge-input doesn’t preserve the order when merging stderr and

Re: [racket-users] Beginning of the end for googlegroups?

2019-01-29 Thread Sorawee Porncharoenwase
1784 at the moment, way beyond "500-750 users" On Tue, Jan 29, 2019 at 10:39 AM Jens Axel Søgaard wrote: > How many users are on the racket-users list? > > Are we anywhere near the listed numbers? > > Den lør. 26. jan. 2019 kl. 01.01 skrev 'Paulo Matos' via Racket Users < >

Re: [racket-users] How can I include a literal ellipsis in a macro?

2019-04-10 Thread Sorawee Porncharoenwase
Use either (... ...) or (quote-syntax ...). See https://stackoverflow.com/a/38276476/718349 On Wed, Apr 10, 2019 at 3:23 AM David Storrs wrote: > Assuming I would like a macro to generate a match statement, like the > following: > > (match foo > [(list (vector x y z) ...) ]) > > '...'

Re: [racket-users] Trouble writing unhygienic macro

2019-05-27 Thread Sorawee Porncharoenwase
On Mon, May 27, 2019 at 7:54 PM Greg Hendershott wrote: > p.s. That (datum->syntax _ (string->symbol (syntax->datum _))) triplet > has an equivalent handy shortcut -- `format-id`: > > (format-id #'magic-name "~a" #'magic-name) This doesn't work in the string literal case because an argument

Re: [racket-users] redundancy in GUI callback functions

2019-05-25 Thread Sorawee Porncharoenwase
Just abstract the common part out? E.g., (define (update-text-field read-field write-field converter) (define text (send read-field get-value)) (cond [(string=? text "") (send read-field set-field-background (make-object color% 255 255 255 1)) (send write-field set-value "")]

Re: [racket-users] Macro guards question

2019-05-29 Thread Sorawee Porncharoenwase
The issue is that #'arg will always be a syntax object. An identifier is a kind of syntax object, so it makes sense to test (identifier? #’arg). However, (symbol? #’arg) and (string? #’arg) will always fail. Suppose then that you invoke the macro with "1" as the operand, it would fail every case

Re: [racket-users] Why struct type doesn't include field names?

2019-06-15 Thread Sorawee Porncharoenwase
First of all, . won’t work in standard Racket because . has a special meaning (see https://docs.racket-lang.org/reference/reader.html#%28part._parse-pair%29). But yes, this is directly related to the discussion above because with the field name information, you can write your own accessor. #lang

Re: [racket-users] macro guard question (ellipsis)

2019-06-18 Thread Sorawee Porncharoenwase
I’d write this. Not sure if there’s a better way. (define-syntax (foo stx) (syntax-case stx () [(_ (key val ...) ...) (andmap identifier? (syntax->list #'(key ... {~@ val ...} ...))) #'(quote (list ((quote key) (quote val) ...) ...))])) On Tue, Jun 18, 2019 at 8:11 PM Kevin

Re: [racket-users] macro guard question (ellipsis)

2019-06-18 Thread Sorawee Porncharoenwase
Also note that with syntax/parse, it becomes much easier: (require (for-syntax syntax/parse)) (define-syntax (foo stx) (syntax-parse stx [(_ (key:id val:id ...) ...) #'(quote (list ((quote key) (quote val) ...) ...))])) On Tue, Jun 18, 2019 at 8:56 PM Sorawee Porncharoenwase

Re: [racket-users] symbols question

2019-06-20 Thread Sorawee Porncharoenwase
Is #%top what you are looking for? #lang racket (require syntax/parse/define) (define-simple-macro (#%top . x) 'x) (define x 42) x ;=> 42 y ;=> 'y (string-length (symbol->string abcdef)) ;=> 6 Unbound identifiers are wrapped with #%top

Re: [racket-users] Relative Pathname problem

2019-06-23 Thread Sorawee Porncharoenwase
This is almost certainly due to Geiser and not Racket. IIRC, there are C-c C-a and C-c C-b. One of them works with Racket and the other does not. If you only work with Racket, I would recommend racket-mode instead of Geiser. It's far more integrated to Racket. On Sun,

Re: [racket-users] Racket Mode documentation

2019-05-24 Thread Sorawee Porncharoenwase
Hmm. I'm seeing "This site can’t be reached" (DNS_PROBE_FINISHED_NXDOMAIN). On Thu, May 23, 2019 at 8:50 PM Greg Hendershott wrote: > Recently I consolidated and updated Racket Mode documentation. > > It is generated in two formats: > > - Info: Installed locally. View in Emacs with `C-h i`. > >

Re: [racket-users] Pattern matching as computation

2019-06-27 Thread Sorawee Porncharoenwase
If you want only one match, it seems what you really want is ~seq-like form from syntax/parse. E.g., #lang racket (require syntax/parse) (define ->value syntax->datum) (define (apply-lift op args) (datum->syntax #f (apply op (->value args (syntax-parse (vector 1 2 3 4) [#(a {~and

Re: [racket-users] Trying to get my head around typed racket and higher order functions

2019-06-30 Thread Sorawee Porncharoenwase
inst is the way to go. How did you use it? This seems to work fine for me. #lang typed/racket (: create-points : (Listof Flonum) (Listof Flonum) -> (Listof (Vectorof Flonum))) (define (create-points xs ys) (map (inst vector Flonum) xs ys)) On Sun, Jun 30, 2019 at 1:03 AM greadey wrote: >

Re: [racket-users] raise-argument-error missing list?

2019-07-08 Thread Sorawee Porncharoenwase
On Mon, Jul 8, 2019 at 12:56 PM Greg Hendershott rac...@greghendershott.com wrote: - The return value is `any` -- not even `any/c`, just `any`. Effectively > don't check the return value(s). > If I use define/contract, does any restore tail-recursion?

Re: [racket-users] Re: Macro containing a list of elements that each have optional keyword options

2019-08-19 Thread Sorawee Porncharoenwase
You could use (splicing) syntax class to help with normalization: #lang racket (require syntax/parse/define (for-syntax syntax/parse racket/syntax)) (begin-for-syntax (define-splicing-syntax-class methods-cls #:attributes (methods) (pattern (~seq

Re: [racket-users] Splicing the result of one macro into another

2019-08-20 Thread Sorawee Porncharoenwase
1. You will need a cooperation of phone-numbers macro. There are two ways I am aware of 1.1 You could hard code in phone-numbers to deal with add-prefix directly. 1.2 A more general approach is to use local-expand in phone-numbers to partially expand macros in the body of

Re: [racket-users] Splicing the result of one macro into another

2019-08-21 Thread Sorawee Porncharoenwase
> > I appreciate all of the Racket documentation, but I think there is a need >> for a much better presentation of the material in a graduated way. >> > I think what you are saying is, there should be more Racket Guide content, and I think everyone agrees on that... > you seem to have an

Re: [racket-users] Re: The case, and a proposal, for elegant syntax in #lang racket2

2019-08-21 Thread Sorawee Porncharoenwase
Pyret was a pain. Error messages were not clear and the whole change > confused students. > Can you elaborate more on this? My personal experience with Pyret is that it has an exceptionally good error message, except when an internal error occurs (which should not happen). Two language features

Re: [racket-users] Listing All Programs

2019-09-05 Thread Sorawee Porncharoenwase
Oh, this is easy. The grammar of Racket is #lang * which, as I showed above, is expressible as regular expression. Regular languages are easily decidable :) On Thu, Sep 5, 2019 at 9:07 PM Laurent wrote: > Although it's not about checking, but generating, which *may* be easier. > (Though if

Re: [racket-users] Simple macro issues

2019-09-08 Thread Sorawee Porncharoenwase
This works for me: #lang racket (define (hex:char x) (if (number? x) x (string->number (symbol->string x) 16))) (define-syntax-rule (hex num ...) (bytes (hex:char (quote num)) ...)) (hex a b c 1 2 3) ; #"\n\v\f\1\2\3" It’s almost always a mistake to use a function that

Re: [racket-users] Why custom-display of printable<%> interface is called twice?

2019-07-28 Thread Sorawee Porncharoenwase
I’m not sure why it’s like that, but I know what’s the problem and how to fix it. custom-display and custom-write provide the output port to you. You are supposed to write to the port. (define/public (custom-display out) (displayln "custom-display" out)) (define/public

Re: [racket-users] Re: Do custodians shutdown when Racket exits?

2019-08-06 Thread Sorawee Porncharoenwase
I have a similar question on will executor. It doesn't seem to get run on program exiting/breaking. Do I need a plumber that calls `collect-garbage`? On Tue, Aug 6, 2019 at 10:27 AM David Storrs wrote: > I should mention that the reason I'm looking into this is because I have > UDP sockets that

Re: [racket-users] [racket users] module question

2019-08-06 Thread Sorawee Porncharoenwase
You need: (module B racket (require (submod ".." A)) (printf "X=~a~%" X)) On Tue, Aug 6, 2019 at 3:58 PM Kevin Forchione wrote: > Is there a way to define 2 modules within a file and reference them or is > a file limited to 1 module only (but may have multiple submodules)? > > Here’s a

Re: [racket-users] The case, and a proposal, for elegant syntax in #lang racket2

2019-07-18 Thread Sorawee Porncharoenwase
> > The other thing I'd like to see would be the option to return nothing. > Not #, '(), or #f. Nothing. It's useful e.g. when you want to > simultaneously transform and filter a list. > Would (values) satisfy your criteria? #lang racket (define (my-filter-map proc xs) (match xs ['()

Re: [racket-users] Contracts referring to earlier elements?

2019-07-18 Thread Sorawee Porncharoenwase
Hi Kevin, Take a look at Racket Guide’s Argument and Result Dependencies and/or Racket Reference’s ->i

[racket-users] Why struct type doesn't include field names?

2019-06-13 Thread Sorawee Porncharoenwase
Several struct extensions need to construct accessors unhygienically even though the accessors can be extracted from struct types. The reason is that there’s not enough information to establish connection between field names and accessors. For instance, consider struct* from racket/match. #lang

Re: [racket-users] xml library clarification - "" symbol parsing

2019-11-22 Thread Sorawee Porncharoenwase
I’ll probably do this if I were you: #lang racket (require xml) (struct data (b1 b2) #:transparent) ;; extract :: XExpr -> (Listof data?) (define (extract xexpr) (match-define `(ROOT () ,xs ...) xexpr) (for/list ([e xs] #:when (list? e)) (match-define `(A () ,b1 ,b2) e) (data b1

Re: [racket-users] Limiting consecutive identical elements with match

2019-12-04 Thread Sorawee Porncharoenwase
This is super cool indeed. Now I feel stupid. On Wed, Dec 4, 2019 at 2:56 PM Matthew Butterick wrote: > > On Dec 4, 2019, at 2:39 PM, 'Joel Dueck' via Racket Users < > racket-users@googlegroups.com> wrote: > > So it seems easy to match "*at least *N identical elements". > But is there a method

Re: [racket-users] DrRacket 7.5 colors a bit dark and low contrast on Mac

2019-12-06 Thread Sorawee Porncharoenwase
Confirm that I have this problem as well, even when I reset all preference files. On Fri, Dec 6, 2019 at 11:17 AM Daniel Prager wrote: > Hi Robby > > > What happens if you open the preferences dialog and turn white-on-Black > on and back off again? > > No change. > > I still have 7.2 on my

Re: [racket-users] Efficient idiom for converting key-set of a hash-map into a hash-set

2019-10-25 Thread Sorawee Porncharoenwase
It also might be worth trying `(for/set ([(k v) (in-hash h)]) k)`. On Fri, Oct 25, 2019 at 1:19 PM David Storrs wrote: > On Fri, Oct 25, 2019 at 10:28 AM Thomas Dickerson > wrote: > > > > For reasons that are unclear to me, hash-keys and dict-keys both return > a list? instead of a set?

Re: [racket-users] xexpr cond failing

2020-03-01 Thread Sorawee Porncharoenwase
ng unnecessary > code to make the xexpr valid which can be really annoying if having nested > cases or other more complex situations. Thanks again for your fast reply! > > On Sunday, March 1, 2020 at 7:43:20 PM UTC+11, Sorawee Porncharoenwase > wrote: >> >> One possible way is to

Re: [racket-users] xexpr cond failing

2020-03-01 Thread Sorawee Porncharoenwase
One possible way is to have the first case returns a list of one element, and the else case returns an empty list. You then splice this list into body via ,@. `(body (form ((action "") (method "post")) (label ((for "username")) "Username:") (input ((type "text") (name

Re: [racket-users] xexpr cond failing

2020-03-01 Thread Sorawee Porncharoenwase
Actually you might want to use (list (let () body ...)) rather than (list (begin body ...)) so that you can use define inside when/splice, just like how you can do that in when. On Sun, Mar 1, 2020 at 3:26 AM Sorawee Porncharoenwase < sorawee.pw...@gmail.com> wrote: > Well, you can a

Re: [racket-users] how to reinstall a broken package?

2020-01-23 Thread Sorawee Porncharoenwase
I usually do raco setup --pkgs On Thu, Jan 23, 2020 at 8:34 AM Hendrik Boom wrote: > My installation of OpenGL Mathematics (GLM) for Racket is defective > in that the installed manual has tha complete table of contents but does > not > have any content past section 2.1.1. > This may be

Re: [racket-users] Re: How to convert String to Integer

2020-02-11 Thread Sorawee Porncharoenwase
You can convert a string to a list of characters by using string->list. The code snippet that you presented in your very first post also uses this function. > (string->list "abc") - : (Listof Char) '(#\a #\b #\c) What I want to ask you though is what is wrong with the code that Phillip

Re: [racket-users] Starting syntax highlighter project

2020-02-19 Thread Sorawee Porncharoenwase
In my opinion, it would be very cool if the project is based on DrRacket’s color-lexer ecosystem. So instead of writing an ad-hoc lexer for, say, Python, we instead help improving the existing #lang python‘s color-lexer. Pro: - The result will look just like what DrRacket displays. -

Re: [racket-users] Starting syntax highlighter project

2020-02-19 Thread Sorawee Porncharoenwase
On Wed, Feb 19, 2020 at 11:55 PM Sage Gerard wrote: > I'm very much in favor of interoperability and am happy to work in that > direction. Does this imply that we need a #lang for each highlighting > target? With my approach, yes, but note that technically, the #lang doesn't need to be

Re: [racket-users] DrRacket Dark Mode in Windows

2020-01-17 Thread Sorawee Porncharoenwase
s that >> correct?" >> >> You are correct. Currently I have the editor with a dark theme >> (Spacemacs), but the DrRacket UI itself is light, even though I set it to >> "Dark" in Windows settings. >> >> Thank you for seeking clarification! >&

Re: [racket-users] How do I provide a name as both a match expander and contracted function?

2019-12-30 Thread Sorawee Porncharoenwase
IIUC, this is what Alex Knauth did in https://github.com/mbutterick/txexpr/pull/8. On Mon, Dec 30, 2019 at 7:07 PM Jack Firth wrote: > If I'm making my own data types, one common thing I want to do is make > smart constructors that double as match expanders. I could use >

Re: [racket-users] why is glCreateVertexArrays absent?

2020-03-08 Thread Sorawee Porncharoenwase
Have you tried this? https://github.com/dbenoit17/dynamic-ffi On Sun, Mar 8, 2020 at 5:52 AM Hendrik Boom wrote: > On Sat, Mar 07, 2020 at 07:32:01AM -0800, Sorawee Porncharoenwase wrote: > > I know nothing about OpenGL, but the autogeneration > > <https://github.com/stepha

Re: [racket-users] why is glCreateVertexArrays absent?

2020-03-07 Thread Sorawee Porncharoenwase
I know nothing about OpenGL, but the autogeneration seems to read the information from this directory , which was last updated 7 years ago (2013). OpenGL

Re: [racket-users] Suggestions for "The Racket Guide"

2020-04-08 Thread Sorawee Porncharoenwase
Thoughts: - I take a look at the compiled HTML document. It doesn't seem suffice to only change JavaScript because the information about "what is the input" is pretty much lost at the HTML level. - IIUC, Scribble targets older version of HTML (HTML4?), so it doesn't really care about the

Re: [racket-users] rename-in issue

2020-04-09 Thread Sorawee Porncharoenwase
There are two colliding names. make and interface-version. As shown in the error message, you fixed one but not the other. (require net/url web-server/dispatchers/filesystem-map web-server/dispatchers/dispatch-files (rename-in web-server/dispatchers/dispatch-sequencer

Re: [racket-users] Gradual Typed Racket?

2020-04-17 Thread Sorawee Porncharoenwase
> > My understanding is that contract-out only provides protection against > inappropriate calls from clients *outside* the module, whereas > define/contract enforces the contract against everyone, including things > inside the module. Do I have that right? > I think that's correct. Note though

Re: [racket-users] Understanding P. Ragde's Proust

2020-03-15 Thread Sorawee Porncharoenwase
You need to add a case in parse-expr to deal with annotations, which is in the form ( : ). E.g., [`(,e : ,t) (TA (parse-expr e) (parse-type t))] On Sun, Mar 15, 2020 at 7:21 AM Adrian Manea wrote: > Hi Matt, > > Thank you very much for the details! What you're saying makes sense and is > in

Re: [racket-users] Code Jam

2020-03-30 Thread Sorawee Porncharoenwase
It’s a programming competition by Google. https://codingcompetitions.withgoogle.com/codejam Code Jam used to allow participants to use any languages, but they changed that a couple of years ago. To quote its website: With the new platform, we have aimed to support the most popular programming

Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Sorawee Porncharoenwase
uld be OK, right? > Re: reason to use it - performance. I'm applying the string-append > operation in a pairwise way over input sequences, and re-converting to > immutable at each step appears to have a measurable cost. > > > On Mon, Mar 30, 2020 at 12:11 PM Sorawee Porncharoenwase

Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Sorawee Porncharoenwase
Your code would not work because prior 7.5.0.14, there’s no string-append-immutable, so the use of string-append-immutable in the else branch will result in an unbound id error. Instead, use https://docs.racket-lang.org/version-case/index.html which will run the “if” at compile-time, making the

Re: [racket-users] Best way to handle different versions of Racket?

2020-03-30 Thread Sorawee Porncharoenwase
Mar 30, 2020 at 12:00 PM Sorawee Porncharoenwase < sorawee.pw...@gmail.com> wrote: > Your code would not work because prior 7.5.0.14, there’s no > string-append-immutable, so the use of string-append-immutable in the > else branch will result in an unbound id error. >

Re: [racket-users] on reducing barriers in the Racket community

2020-04-25 Thread Sorawee Porncharoenwase
It could go either way, no? I've also heard a lot of people complaining that debugging Racket programs is difficult because the stack trace is not useful, and this is because they use the command-line version which doesn't have errortrace enabled (by default). Perhaps what you really are

Re: [racket-users] on reducing barriers in the Racket community

2020-04-25 Thread Sorawee Porncharoenwase
> > I like the idea of adding a "with debugging" to the banner when a program > is run in DrRacket, but I´m not sure it is possible. > It current exists already! The screenshot I attached above is from the actual DrRacket when debugging is enabled. > (It would be even better if the user can

Re: [racket-users] on reducing barriers in the Racket community

2020-04-30 Thread Sorawee Porncharoenwase
race doesn't enabled. > > To be clarify, what you mentioned is "Preserve errortrace" option, what > about "Debugging" option, is it a must enabled option in a non-debugging > run? > > <截圖 2020-04-25 下午9.22.20.png> > > > Sorawee Porncharoenwase 於

Re: [racket-users] Reducing parentheses without language damage.

2020-04-30 Thread Sorawee Porncharoenwase
> > I hate being at the mercy of whatever editor I'm stuck using. I agree with this in principle, but in practice, it's really a matter of what mainstream editors support. Editors in the past don't universally support automatic indentation, and I could imagine a criticism like "Indentation

Re: [racket-users] Questions about working on DrRacket and gui

2020-05-01 Thread Sorawee Porncharoenwase
Sam just suggested me in the other email thread that a much easier way to do things is to download and install Minimal Racket, then install DrRacket from source. On Fri, May 1, 2020 at 7:59 AM Dexter Lagan wrote: > Hi, > > I apologize in advance if my questions are naïve or have been asked >

Re: [racket-users] for/stream and values

2020-05-02 Thread Sorawee Porncharoenwase
I just created a package that helps creating a stream of multiple values a couple of weeks ago. You might find it useful: https://docs.racket-lang.org/stream-values/ On Sat, May 2, 2020 at 3:38 PM Yury Bulka wrote: > (sorry for the typos - obviously, it should be racket/stream) > > -- > Yury

Re: [racket-users] Rhombus project plan

2020-04-29 Thread Sorawee Porncharoenwase
(Not directly related to Rhombus) Speaking of “how to contribute”, I find that it is not friendly at all to setup stuff in order to contribute to Racket core and main distribution. According to https://blog.racket-lang.org/2017/09/tutorial-contributing-to-racket.html, if I want to make a change

[racket-users] DrRacket's dark mode: anyone familiar with Windows internals?

2020-04-25 Thread Sorawee Porncharoenwase
Hi everyone, DrRacket's dark mode currently doesn't work on Windows. If you know Windows internals and would like to help, you can participate at https://github.com/racket/drracket/issues/235. -- Forwarded message - From: Robby Findler Date: Fri, Apr 24, 2020 at 7:32 PM Subject:

Re: [racket-users] Re: Racket Program doesn't save

2020-05-11 Thread Sorawee Porncharoenwase
Does tst.rkt get created? I use racket-7.7-x86_64-macosx and run macOS Catalina too, but could not reproduce the problem. On Mon, May 11, 2020 at 2:56 PM Sai Ganesh Buchireddy wrote: > After I save the file and try to close Dr. Racket, I get the msg saying > the file is not saved as shown in

Re: [racket-users] Make your computer talk in Racket on Windows in 5 lines

2020-05-16 Thread Sorawee Porncharoenwase
On Mac, there’s a say command, so this would do it. (system "say \"hello world\"") When I had a Linux machine, I recalled using a command named espeak, which is similar to say on Mac. On Sat, May 16, 2020 at 11:15 AM Sam Phillips wrote: > Stephen De Gabrielle and I are wondering if any Mac or

Re: [racket-users] Re: Practical HTTP requests?

2020-05-17 Thread Sorawee Porncharoenwase
I did a web scraping in Racket a couple of months ago, and I agree that it is painful. On the bright side, Bogdan seems to start working on a practical requests-like library due to this thread, so we should have a good practical HTTP request library

Re: [racket-users] at sign in scribble

2020-05-15 Thread Sorawee Porncharoenwase
See https://docs.racket-lang.org/scribble/reader.html?q=escape#%28part._.The_.Scribble_.Syntax_at_a_.Glance%29 Either of this works: - @bold{a@"@"b} - @bold|{a@b}| On Fri, May 15, 2020 at 5:04 AM Hendrik Boom wrote: > I hae not been able to figure out from the scribble documentation how to >

Re: [racket-users] for/set

2020-05-08 Thread Sorawee Porncharoenwase
There’s a search bar in the top left of every doc page. Typing for/set and enter will show you this search result page . Here, the first result

Re: [racket-users] for/stream and values

2020-05-03 Thread Sorawee Porncharoenwase
> > Thank you for the package! So, do I understand correcty that it is > impossible to produce multi-valued streams with for/stream? If so, maybe > it's worth adding a note about it to the documentation of for/stream? > That is correct. Feel free to submit a PR to improve the documentation. You

Re: [racket-users] Re: provide-if-not-defined

2020-09-03 Thread Sorawee Porncharoenwase
I want to propose another interface: (my-provide #:default + - * #:override [my-+ +]) which expands to: (provide - *) (provide (rename-out [my-+ +])) and checks that + must be in the #:default section (because we are overriding it, it’d better already exist). More generally:

Re: [racket-users] Making expanded bindings visible in top-level

2020-09-06 Thread Sorawee Porncharoenwase
I think it’s only enough to fabricate the #%info-* identifiers. For example, in the file you linked above, you can add: [#%info-domain (datum->syntax stx '#%info-domain)] to with-syntax, and provided that you provide #%top-interaction, you should be able to use #%info-domain in the REPL. On

Re: [racket-users] Is this running in DrRacket or as a script?

2020-09-02 Thread Sorawee Porncharoenwase
Using Laurent’s suggestion, you can also create a global variable / parameter that will be set by the drracket submodule. That way, you can create running-in-drracket? and use it inside functions. On Wed, Sep 2, 2020 at 12:54 AM Laurent wrote: > You can use a `drracket` submodule: > > (module+

Re: [racket-users] provide-if-not-defined

2020-09-02 Thread Sorawee Porncharoenwase
IIUC, that’s not what Shriram wants. He wants a kind of interface / contract for a module (that it must export certain identifiers). The solution that you posted makes the module satisfy the interface by construction, but it creates another problem which is that he might accidentally export a

Re: [racket-users] -i as an identifier

2020-09-10 Thread Sorawee Porncharoenwase
I think you read the doc correctly, but there are programs that use +i and -i, so it's unclear if fixing the reader is desirable. Perhaps the documentation should be adjusted instead. Here’s an example of how people use +i and -i:

Re: [racket-users] package manager woes on Windows 10?

2020-09-14 Thread Sorawee Porncharoenwase
uld probably add a 'single-no-return style and then grep > the codebase for places that use 'single and change them (as appropriate). > > Robby > > > On Sun, Sep 13, 2020 at 3:15 PM Sorawee Porncharoenwase < > sorawee.pw...@gmail.com> wrote: > >> I meant, wouldn’t

Re: [racket-users] package manager woes on Windows 10?

2020-09-13 Thread Sorawee Porncharoenwase
I meant, wouldn’t it be better to fix text-field% itself, instead of only some instances of it? Sorry if that was confusing. On Sun, Sep 13, 2020 at 1:12 PM Sorawee Porncharoenwase < sorawee.pw...@gmail.com> wrote: > Should the fix apply to all 'single styled text-field% > <http

Re: [racket-users] package manager woes on Windows 10?

2020-09-13 Thread Sorawee Porncharoenwase
Should the fix apply to all 'single styled text-field% too? On Sun, Sep 13, 2020 at 7:50 AM Robby Findler wrote: > Yea, I agree. I'd made that change locally but hadn't pushed because I > couldn't make the bad behavior happen reliably. Perhaps

Re: [racket-users] [scribble] Are nested lists possible?

2020-10-13 Thread Sorawee Porncharoenwase
apparently it doesn’t like having an itemlist inside of a {} block at all I’m not sure if I totally understand it, but this doesn’t appear to be true. The below doc renders correctly as I expect. #lang scribble/manual @itemlist[ @item{foo @itemlist[ @item{bar}

Re: [racket-users] Clearer code in DrRacket?

2020-10-10 Thread Sorawee Porncharoenwase
> > Looks interesting. Do you know any package of this type for DrRacket (or > another program) that works semantically while you program? (not just as a > checking tool like View Syntax) > I think it would be difficult. Racket has macros, and it allows shadowing on anything. The attached image

[racket-users] Re: [racket-dev] Does the Guide need to mention syntax parse & does the Style guide need to provide guidance?

2020-08-23 Thread Sorawee Porncharoenwase
The guide seems to be for the Racket code base (https://github.com/racket) rather than general Racket code, so I don't think it should say "prefer syntax-parse over syntax-case". I do think there should be a style guide for general Racket code (which could very well be based on the style guide

Re: [racket-users] graphical debugging

2020-08-29 Thread Sorawee Porncharoenwase
It (kinda) works for me. You should make sure that debugging is enabled in the language setting (it should display something like “Language: racket, with debugging [custom]” in the REPL). Then, click “Debug” and then click “Step” for a couple of times (seven to be precise). The little green

Re: [racket-users] graphical debugging

2020-08-29 Thread Sorawee Porncharoenwase
I meant the REPL in DrRacket (interaction window). On Sat, Aug 29, 2020 at 5:21 AM Catonano wrote: > Il giorno sab 29 ago 2020 alle ore 12:11 Sorawee Porncharoenwase < > sorawee.pw...@gmail.com> ha scritto: > >> It (kinda) works for me. You should make sure that

Re: [racket-users] printing errors

2020-08-29 Thread Sorawee Porncharoenwase
Alternatively, I think you can simply supply a non-exception value to the handler. This will suppress the red cross icon too, though. (define (print-exn exn) ((error-display-handler) (if (exn? exn) (exn-message exn) (format "~a" exn)) #f)) On Sat, Aug 29, 2020 at 8:17 AM

Re: [racket-users] Re: Application Templates!

2020-08-20 Thread Sorawee Porncharoenwase
Is this intended to be something like https://docs.racket-lang.org/scaffold/ ? On Thu, Aug 20, 2020 at 10:12 AM Stephen De Gabrielle < spdegabrie...@gmail.com> wrote: > Alex is right, most developers don't need this. > > The point of templates is

Re: [racket-users] Deserializing snips from untrusted input

2020-08-20 Thread Sorawee Porncharoenwase
I don't know much about this specific case, but see Robby's comment about how "DrRacket can run user (untrusted) code in certain situations" at https://github.com/racket/gui/issues/157. A concrete problem I found is that you can have a snip running `struct->vector` and it will successfully extract

  1   2   >