Re: [racket-users] Why does syntax-parser work here but not syntax-parse?

2021-09-08 Thread Stephen Chang
> shouldn't the entire parenthesized expression be given to the macro processor > and then replaced with something valid before being rejected? That would be true if you're defining a macro, i.e. if you use `define-syntax` instead of `define`. > > -- > You received this message because you are

Re: [racket-users] how to convert encoded path to something build-path can use?

2021-05-21 Thread Stephen Chang
) > > > At Fri, 21 May 2021 11:33:41 -0400, Stephen Chang wrote: > > Hi, > > > > It seems that, since 8.1, the format of paths in links.rktd has changed? > > > > Are there new API fns that deal with this new kind of encoded path? Or > > what is the rec

[racket-users] how to convert encoded path to something build-path can use?

2021-05-21 Thread Stephen Chang
Hi, It seems that, since 8.1, the format of paths in links.rktd has changed? Are there new API fns that deal with this new kind of encoded path? Or what is the recommended way to process them? Something like this? (Is this `decode-link-path` public? I couldnt find it)

[racket-users] eq? behavior changed on Racket CS?

2021-05-20 Thread Stephen Chang
Hi everyone, Has eq? behavior changed with Racket CS? (ie, 8.0+) Specifically: $ racket79/bin/racket Welcome to Racket v7.9 [bc]. > (eq? (integer->char 955) (integer->char 955)) #f $ plt/racket/bin/racket Welcome to Racket v8.1.0.6 [cs]. > (eq? (integer->char 955) (integer->char 955)) #t Is

Re: [racket-users] Racket Generic Graph Library: non-numerical edge weight/labels + Graphviz?

2020-02-24 Thread Stephen Chang
> I am somewhat surprised that the graph library enforces numerical edge > weights at all. The docs do informally say number weights but I don't think the constructors do any checking? Any enforcement should be deferred to individual algorithms. Re: graphviz, I took a quick look and I think we

Re: [racket-users] TR: cast on mutable hash table...

2020-02-14 Thread Stephen Chang
Your second suggestion is described in this (hard to find) section of the TR Guide on Type Generalization: https://docs.racket-lang.org/ts-guide/caveats.html#%28part._.Type_generalization%29 I agree it should be much more prominent. At the very least, any docs for invariant constructors should

Re: [racket-users] [racket users] Macro literal "|"

2020-02-03 Thread Stephen Chang
As mentioned, to get your macro to work, you have to change how the reader behaves on "|". You might be interested in the (implementation of) no-vert-bar reader lang: https://docs.racket-lang.org/no-vert-bar-lang/index.html On Mon, Feb 3, 2020 at 6:27 PM Kevin Forchione wrote: > > Hi guys, >

Re: [racket-users] Re: expanding to typed/racket using #lang turnstile

2019-11-01 Thread Stephen Chang
I dont know much about J, but if I'm understanding correctly, you have an implementation of J in Typed Racket? And then you want to be able to infer more specialized cases in some instances by pruning the type? You might be able to do it with just plain macros in that case, which would generate

Re: [racket-users] expanding to typed/racket using #lang turnstile

2019-10-31 Thread Stephen Chang
As William mentioned, the example conflates Typed Racket types with surface language types, which would probably not be right even if Typed Racket did not complain. Does your custom language have its own type system? If not, you may not need to use Turnstile. Plain macros that expand to Typed

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

2019-10-25 Thread Stephen Chang
I don't know of a more efficient way to convert, but depending on what operations you want, you might be able to compute it directly on the hash, e.g., see hash-has-key?, hash-keys-subset?, hash-union, etc. (I didnt know about some of the functions until recently.) On Fri, Oct 25, 2019 at 4:21 PM

Re: [racket-users] [ANN] RacketScript working for 7.x

2019-10-08 Thread Stephen Chang
nality of RacketScript has not changed. It is in the same experimental state and supports the same subset of Racket as before. On Wed, Oct 2, 2019 at 2:04 PM Hendrik Boom wrote: > > On Wed, Oct 02, 2019 at 01:53:46PM -0400, Stephen Chang wrote: > > The RacketScript compiler [1] has be

[racket-users] [ANN] RacketScript working for 7.x

2019-10-02 Thread Stephen Chang
The RacketScript compiler [1] has been updated to work with Racket 7.x programs, ie all tests pass (though we are still working to support more primitives). Try it out here: http://rapture.twistedplane.com:8080/ The next milestone is to improve RacketScript enough to compile the Racket expander

Re: [racket-users] tex2page and Racket(latest version) problem

2019-06-30 Thread Stephen Chang
In case this issue is still unresolved, I just ran into this error message because I accidentally installed a 64 bit distribution when I needed 32-bit. On Tue, Jun 16, 2015 at 12:11 PM Vincent St-Amour wrote: > > Hi, > > How did you install Racket? It looks like you have used the wrong >

Re: [racket-users] Macro help

2019-05-24 Thread Stephen Chang
If `define-values` is not strictly required, here's a more syntax-case-y recursive version: (define-syntax (aux stx) (syntax-case stx () [(_) #'(begin)] [(_ (var val) . rst) (identifier? #'var) #'(begin (define var val) (aux . rst))] [(_ var . rst)

Re: [racket-users] Cleanest way to 'if/then' inside a macro?

2019-05-15 Thread Stephen Chang
> For the same reasons I would use a `let` around a code block -- it's an easy > way to isolate computation and create reusable elements. What would a more > normal way be when using syntax-parse? The #:with syntax-parse "pattern directive" does the same thing, but with less parens.

Re: [racket-users] Cleanest way to 'if/then' inside a macro?

2019-05-15 Thread Stephen Chang
answer 1) You are missing a dot in (~@ propthing), ie this will work: (~@ . propthing) minor question) is there a reason you are using with-syntax with syntax-parse? answer 2) You may want to try "attribute". It's somewhat like "syntax", except it returns false when there are unbound patvars,

Re: [racket-users] https://lists.racket-lang.org/ is throwing a security exception

2019-05-06 Thread Stephen Chang
https for lists.racket-lang is not working at the moment. Sorry for the inconvenience. The server hosting lists.racket-lang went down recently. A partial temporary non-https version is up but https hasnt been enabled yet. On Mon, May 6, 2019 at 12:48 PM David Storrs wrote: > > I'm not sure if

Re: [racket-users] Re: catch and bind an unbound id in a macro

2019-04-20 Thread Stephen Chang
fwiw, I think here is a working version along the lines of your original attempt. #lang racket (require (for-syntax syntax/parse)) (define-syntax set/define (syntax-parser [(_ h k v) #:when (with-handlers ([exn:fail:syntax:unbound? (lambda _ #f)]) (local-expand #'h

Re: [racket-users] Racket 5, multiple-collection packages and info.rkt

2018-12-12 Thread Stephen Chang
Hi Claes, Thanks for the effort in splitting the package. Would any users of the graph library object to dropping support for 5.x? On Tue, Dec 11, 2018 at 10:19 PM Claes Wallin (韋嘉誠) wrote: > > I am trying to split the package graph into graph-doc and graph-lib, > see:

Re: [racket-users] what do people use for number formatting?

2018-05-07 Thread Stephen Chang
Oops, I didnt see the rounding. On Mon, May 7, 2018 at 7:53 PM, Ben Greenman wrote: > I use this: > http://docs.racket-lang.org/gtp-util/index.html#%28def._%28%28lib._gtp-util%2Fmain..rkt%29._rnd%29%29 > > I didn't know about SRFI 54 --- looking forward to reading

Re: [racket-users] what do people use for number formatting?

2018-05-07 Thread Stephen Chang
~r http://docs.racket-lang.org/reference/strings.html?q=~r#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29 On Mon, May 7, 2018 at 7:46 PM, 'John Clements' via Racket Users wrote: > Okay, how many times have I written the function that accepts 1.237472387 and

Re: [racket-users] Is it possible to pass syntax information from bottom up?

2018-04-18 Thread Stephen Chang
Here's a version of your program that performs as you specified: http://pasterack.org/pastes/91460 But do take a look at the paper, docs [1], or codebase [2], which turns this idea into complete languages. [1]: http://docs.racket-lang.org/turnstile/index.html [2]:

Re: [racket-users] Reimplementing Hackett’s type language: expanding to custom core forms in Racket

2018-04-17 Thread Stephen Chang
Hi Alexis, Great article. And timely too, since it addresses some of the same usage issues of local-expand and stoplists that we ran into with Turnstile. (I'm also interested in why the core forms are added to the stop list. Is it because of let-syntax? I know it's probably been mentioned before

RE: [racket-users] sharing an awesome plot - warms the cockles of my heart

2018-03-24 Thread Stephen Chang
For those who don't have drracket handy: http://pasterack.org/pastes/59296 On Mar 24, 2018 4:26 PM, "Jos Koot" wrote: > > Very nice, > Jos Koot > > > From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On > Behalf Of

[racket-users] running tests with different #langs

2018-03-23 Thread Stephen Chang
I frequently want to run the same tests with different #lang's. Has anyone written a test harness that lets me do this without duplicating the test code? (I couldnt find anything on the pkg server.) -- You received this message because you are subscribed to the Google Groups "Racket Users"

Re: [racket-users] "Site not secure"

2018-03-09 Thread Stephen Chang
It's fixed now. Cron job didn't run for some reason. Thanks for the heads up! On Fri, Mar 9, 2018 at 12:42 PM, 'John Clements' via Racket Users wrote: > > >> On Mar 9, 2018, at 8:25 AM, Tim Hanson wrote: >> >> Hi, I tried to grab the latest

[racket-users] weak references and quoted values

2017-09-07 Thread Stephen Chang
Ran into some unexpected behavior today. Quoted values do not seem to be garbage collected when there are only weak references. Is this correct behavior? Here's an example program: #lang racket/base (define key1 (list 1)) (define key2 '(1)) (define hash1 (make-weak-hash (list (cons key1 1

Re: [racket-users] immutable hash table references?

2017-05-24 Thread Stephen Chang
I believe Racket uses HAMTs [1] for immutable hash tables. [1]: http://lampwww.epfl.ch/papers/idealhashtrees.pdf On Wed, May 24, 2017 at 11:01 AM, 'John Clements' via users-redirect wrote: > I’m introducing hash tables to students in a first-year class. Is there a > handy

Re: [racket-users] Re: syntax expands to define syntax, problems with ...

2017-03-15 Thread Stephen Chang
The inner ellipses need to be "escaped". I like using the dot notation in nested macros but I know others do not like that style. (define-syntax (test stx) (syntax-case stx () ((_ n e ...) #'(define-syntax (n stx) (syntax-case stx () ((_ e0 (... ...))

Re: [racket-users] help with splicing syntax class error report

2017-03-14 Thread Stephen Chang
You get the dreaded "bad syntax" because syntax-parse doesnt know which pattern failed. There a couple of things you can do: 1) Use a commit pattern, which tells syntax-parse not to backtrack past the commit point. You have to change the order of patterns for this to work.

Re: [racket-users] create a new provide syntax

2017-03-10 Thread Stephen Chang
combine-out may help simplify things? (define-syntax my-out (make-provide-transformer (lambda (stx modes) (syntax-parse stx ((_ name:id) #:with mk-name (format-id #'name "make-~a" #'name) (expand-export #'(combine-out name mk-name) modes)) or

Re: [racket-users] scribble section as link

2017-03-04 Thread Stephen Chang
vid Van Horn <dvanh...@cs.umd.edu> wrote: >> Thanks, this does make the section heading a link, but in the table of >> contents or in the left hand navigation bar, the link is to the >> (empty) section, not the URL. What I'd like is for the navigation >> links to go to the URL. >

Re: [racket-users] scribble section as link

2017-03-04 Thread Stephen Chang
Does `hyperlink` do what you want? eg @section{@hyperlink["http://google.com"]{The Google}} On Sat, Mar 4, 2017 at 1:49 PM, David Van Horn wrote: > I'm using scribble to make a web page and I'd like a section-like > heading that is just a link to an external URL, but I

Re: [racket-users] Idiomatic way to include numbers in a map?

2017-03-02 Thread Stephen Chang
Not with map, which requires equal-length arguments. You could do the slightly less ugly: (map foo lst-A lst-B (range (length lst-A))) On Thu, Mar 2, 2017 at 11:14 AM, David Storrs <david.sto...@gmail.com> wrote: > > > On Thu, Mar 2, 2017 at 10:09 AM, Step

Re: [racket-users] Idiomatic way to include numbers in a map?

2017-03-02 Thread Stephen Chang
The in-X forms are sequences, and must be used with the sequence API, ie for/X. map only works with lists, so you could use build-list or range: (map foo lst-A lst-B (range 2)) On Thu, Mar 2, 2017 at 9:55 AM, David Storrs wrote: > I'd like to be able to

Re: [racket-users] Package layout in docs

2017-01-29 Thread Stephen Chang
I like the current structure of the docs but Ethan's comments reminded of recent blog posts by Eric Raymond (of "Cathedral and the Bazaar" fame), who surprisingly advocates against "swarm design". The posts are about Rust but maybe it's something to keep in mind if the package system gets much

[racket-users] specify test timeout for pkg-build?

2017-01-27 Thread Stephen Chang
I have a package whose tests are timing out when run by pkg-build. Is there a way to extend this timeout? I know I can specify individual file timeouts with `test-timeouts` but I couldnt figure out how to specify a timeout for testing the whole package. Is this possible? Steve -- You received

Re: [racket-users] Client side web applications in Racket

2017-01-22 Thread Stephen Chang
> Do you have plans to revist the tail call question within RacketScript? Yes we do. The readme includes that statement just to be upfront with users about racketscript's philosophy and what to expect when trying racketscript. That being said, RacketScript currently converts self-tail-calls to

Re: [racket-users] syntax-property lost across module boundary (WAS: format-id doesn't preserve preserved?-edness of syntax-property?)

2016-12-15 Thread Stephen Chang
> What are the implications of this for the Types as Macros/Turnstile stuff? As William mentioned, he's also working on a language using the Types as Macros approach. Alex and I have run into the same issue, but it's always with compiled files (without compiling, requires and provides appear to

Re: [racket-users] hyperlink in code:comment

2016-11-30 Thread Stephen Chang
s.k...@gmail.com> wrote: > Thanks, I'll try that. > It is not clear to me where I can use @#, > But certainly your response will be a great help for me. > Thanks again, Jos > > -Original Message- > From: stchang...@gmail.com [mailto:stchang...@gmail.com] On Behalf Of Stephen &g

Re: [racket-users] hyperlink in code:comment

2016-11-29 Thread Stephen Chang
You can use the escape identifier: #lang scribble/manual @(require scribble/eval (for-label racket)) @interaction[ (define a (list 1)) (define b (list 1)) (code:comment @#,para{a and b are not @racket[eq?], but they are @racket[equal?]:}) (eq? a b) (equal? a b)] On Tue, Nov 29,

Re: [racket-users] Using the graph library

2016-10-31 Thread Stephen Chang
Hi Lawrence, Can you provide some more context? Are you looking to learn about graphs in general, or specifically about the graph library API. For the former, any well known algorithms textbook should have a decent introduction. I used CLRS [1] as a guide when developing the library. For the

Re: [racket-users] How to 'apply' a function with optional parameters?

2016-10-29 Thread Stephen Chang
string-join already expects a list of strings, so are you sure you want apply? Can you give a more specific example? Perhaps map or some other iteration is what you want? (for ([strs '(("a" "b") ("c" "D" "E"))]) (displayln (string-join strs " "))) => a b c D E On Sat, Oct 29, 2016 at 10:27

Re: [racket-users] is there a way to syntax-local-lift- something into a define-syntax?

2016-10-09 Thread Stephen Chang
Yes, that worked. Thanks. On Sun, Oct 9, 2016 at 8:11 AM, Matthew Flatt <mfl...@cs.utah.edu> wrote: > Does `syntax-local-lift-module-end-declaration` work? > > At Sat, 8 Oct 2016 19:29:19 -0400, Stephen Chang wrote: >> I'm trying to write a provide transformer that wraps a p

[racket-users] is there a way to syntax-local-lift- something into a define-syntax?

2016-10-08 Thread Stephen Chang
I'm trying to write a provide transformer that wraps a provided identifier and then provides that instead. For example, #lang racket (require (for-syntax syntax/parse racket/provide-transform)) (define-syntax wrapped-out (make-provide-pre-transformer (lambda (stx modes) (syntax-parse

Re: [racket-users] Re: Sending a file via HTML request.

2016-08-24 Thread Stephen Chang
Vishesh Yadav wrote a DrRacket plugin that automatically compiles a program to JS via whalesong and uploads it to a server. It sounds related to what you are describing so you may want to take a look at his code. The plugin code is here: https://github.com/vishesh/drracket-whalesong in particular

Re: [racket-users] Racket Shell

2016-08-20 Thread Stephen Chang
Cool! Will definitely check it out. Is this at all related to Vincent's work? [1] [1]: https://github.com/stamourv/rash On Sat, Aug 20, 2016 at 3:17 PM, William G Hatch wrote: > Hello everyone, > > Being obsessed with shells and wanting very badly to have a racket > shell,

Re: [racket-users] How do I "make base"

2016-08-03 Thread Stephen Chang
> It was also suggested that it is not in src/Makefile, instead: "I'm usually in the top-level checkout dir", to quote stamourv. Is this what you're looking for? https://github.com/racket/racket/blob/master/Makefile#L153-L160 On Wed, Aug 3, 2016 at 1:02 PM, Tim Brown wrote: >

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

2016-03-22 Thread Stephen Chang
> It may be overkill for this use case, but I would probably use the > parsack package, since I think its interface is pretty intuitive. :) I had started writing up a parsack example, and I was all set to admonish the OP for not creating a parser when you want a parser but then I saw it was for a

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

2016-03-22 Thread Stephen Chang
A "read" variant that works with format strings would be a useful addition I think. Matthew, your solution is clever :) (but with symbols instead of strings). Another alternative could be to use match: #lang racket (define (trim-brackets str) (string-trim str #rx"\\[|\\]|,")) (define (pad n

Re: [racket-users] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Stephen Chang
You can also submit the code to pasterack.org, which uses the scribble css. Each paste page also gives the html source of the code and output on the side, which you can copy to anywhere you want. On Tue, Mar 15, 2016 at 7:11 PM, Sanjeev Sharma wrote: > is there a quick &

Re: [racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Stephen Chang
Do you mean something like? #lang racket (require rackunit) (require rackunit/gui) (define tests (test-suite "my tests" (test-equal? "check 1" 1 1) (test-equal? "check 2" 2 2))) (test/gui tests) But that will pop a window. Alternatively, #lang racket (require rackunit) (require

Re: [racket-users] Re: Racket 6.4 very slow

2016-03-02 Thread Stephen Chang
In general, times reported in DrRacket are unreliable. See: https://docs.racket-lang.org/guide/performance.html#%28part._.Dr.Racket-perf%29 Try the command line. Here's what I get on my machine: $ ~/racket61/bin/racket Welcome to Racket v6.1. -> (define (total n) (for/sum ([x (in-range (+

Re: [racket-users] Writing a blank to a file

2016-03-02 Thread Stephen Chang
Use display? or set read-accept-bar-quote to #f On Wed, Mar 2, 2016 at 1:12 PM, Marco Morazan wrote: > > Hi All, > > I seem to recall I knew how to do this once, but can't recall the details. > > How do we write a blank to a text file without the parallel bars appearing? > >

Re: [racket-users] Strange Output from check-expect ???

2016-02-24 Thread Stephen Chang
Thanks for the report. Which version are you using? I'm seeing that the behavior appears in 6.3 but is fixed in 6.4. On Wed, Feb 24, 2016 at 4:22 PM, Jeffrey Edgington wrote: > I am getting an unexpected message from check-expect when I try the following: > > #lang racket >

Re: [racket-users] Chaperone of immutable hash

2016-02-13 Thread Stephen Chang
I added similar basic tests here. https://github.com/racket/racket/blob/master/pkgs/racket-test-core/tests/racket/hash.rktl On Feb 13, 2016 4:12 PM, "Robby Findler" wrote: > I think this is what you want? > > (chaperone-hash > (hash) > (λ (h key) (values key (λ (h

Re: [racket-users] backwards-incompatible change to in-vector

2016-01-19 Thread Stephen Chang
e there's no agreement, I'll leave it for now. I'll just add a special case for empty vectors and 0,0. It's probably not worth it to add yet-another new special case, as in Matthew's email, right? > > Robby > > On Tue, Jan 19, 2016 at 1:16 PM, Stephen Chang <stch...@ccs.neu.edu> wr

[racket-users] backwards-incompatible change to in-vector

2016-01-19 Thread Stephen Chang
I'm fixing pr 15227 but I would like to do so in a backwards-incompatible way. Right now an out-of-range index is sometimes allowed as an argument to in-vector, leading to the bug: $ racket Welcome to Racket v6.4.0.4. -> (for/sum ([x (in-vector (vector 10 20) 2 -1 -1)]) x) SIGSEGV MAPERR si_code

Re: [racket-users] backwards-incompatible change to in-vector

2016-01-19 Thread Stephen Chang
2) 1 1) On Tue, Jan 19, 2016 at 2:06 PM, Vincent St-Amour <stamo...@eecs.northwestern.edu> wrote: > Would it be possible to special-case `(in-vector (vector) 0 0)` > directly, and fix the bug while keeping backwards compatibility? > > Vincent > > > On Tue, 19 Jan 201

Re: [racket-users] begin-for-syntax causes syntax objects to expand to a different #'quote

2015-12-16 Thread Stephen Chang
o > indicate I would like it to match on all phases? > > ~Leif Andersen > > > On Wed, Dec 16, 2015 at 10:02 PM, Stephen Chang <stch...@ccs.neu.edu> wrote: >> There's a #:phase option available when specifying literals: >> >> http://docs.racket-lang.org/syntax

Re: [racket-users] R7RS (small) in Racket

2015-10-25 Thread Stephen Chang
This paper is not about Racket but reports on an r7rs implementation experience and so may have some helpful hints: http://www.schemeworkshop.org/2014/papers/Kato2014.pdf On Oct 25, 2015 5:18 PM, "Alexis King" wrote: > I have built a very small, very incomplete

Re: [racket-users] Strange garbage collection behavior with closures

2015-10-22 Thread Stephen Chang
pasterack uses make-module-evaluator in a sandbox. It's also still running 6.1.1. Would either of those cause the observed difference? On Wed, Oct 21, 2015 at 9:18 PM, Matthew Flatt wrote: > An empty closure is allocated as a constant --- similar to a literal > string or

[racket-users] Whalesong-as-a-service

2015-09-08 Thread Stephen Chang
Hi Racket users, This past summer, Vishesh Yadav created a web application to facilitate sharing of Racket programs as Javascript (big-bang programs in particular). Vishesh is exploring improvements to Whalesong as part of a master's thesis, taking a descriptive approach and focusing on how

[racket-users] macro-generate attribute access?

2015-08-21 Thread Stephen Chang
Is there a way to access an attribute, other than with the . syntax? For example, the following example does not work: #lang racket (require (for-syntax syntax/parse)) (define-syntax (define-stuff stx) (syntax-parse stx [(_ attr-name macro-name) #'(begin (begin-for-syntax

Re: [racket-users] Some help with syntax-parse: macro in macro

2015-07-31 Thread Stephen Chang
You might want to specify collect in #:datum-literals if it is not a defined name. Can you describe some usage examples? That may lead to better insight for the implementation. On Fri, Jul 31, 2015 at 11:49 AM, Deren Dohoda deren.doh...@gmail.com wrote: Suppose I have a macro (experiment ...)

Re: [racket-users] Re: is this a bug?

2015-07-29 Thread Stephen Chang
For any f, acc, and lst, (foldl f acc lst), from left-to-right, applies to f to each element of lst and the current accumulated value. The initial accumulator is acc so the second intermediate accumulated value is (f (first lst) acc). Replacing f, acc, and lst with your arguments, the second

Re: [racket-users] is this a bug?

2015-07-29 Thread Stephen Chang
What's the output you expected? Does this post help you? http://stackoverflow.com/questions/8778492/why-is-foldl-defined-in-a-strange-way-in-racket On Wed, Jul 29, 2015 at 9:45 AM, sagyo12341...@gmail.com wrote: Dear racket maintainers, Maybe, I found a bug. (foldr (lambda (x y) (list x

Re: [racket-users] Affecting the errors generated by syntax-parse

2015-07-25 Thread Stephen Chang
I haven't played with the example in detail, but do you want the cut operator here? http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29 On Sat, Jul 25, 2015 at 9:55 AM, Jens Axel Søgaard jensa...@soegaard.net wrote: Hi

Re: [racket-users] Affecting the errors generated by syntax-parse

2015-07-25 Thread Stephen Chang
class? On Sat, Jul 25, 2015 at 10:51 AM, Stephen Chang stch...@ccs.neu.edu wrote: I haven't played with the example in detail, but do you want the cut operator here? http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29

Re: [racket-users] Re: How to return summary from the inner loop?

2015-07-10 Thread Stephen Chang
I understand now. I still claim that an (explicit) inner loop is not needed: (define (validate-ranges5 value-list low-list high-list) (for*/fold ([failures 0]) ([(lo hi) (in-parallel low-list high-list)] [v value-list] #:when ( lo v hi)) (printf

Re: [racket-users] How to return summary from the inner loop?

2015-07-10 Thread Stephen Chang
Perhaps I don't understand the problem, but why is the inner loop necessary? By the way, you can use (printf ...) instead of (fprintf (current-output-port) ...) Would this work? (define (validate-ranges2 value-list low-list high-list) (for/sum ([v value-list] [lo low-list]

Re: [racket-users] could i get some feedback and help on a graphical editor project?

2015-07-08 Thread Stephen Chang
The Style Guide is a good place to start for learning Racket conventions: http://docs.racket-lang.org/style/index.html Overall, things look good! Your code already uses many Racket idioms. Some things that caught my attention on first glance: - The code is wider than typical. Though tastes

Re: [racket-users] API design 2 -- variadic styles

2015-07-06 Thread Stephen Chang
Racket has linguistic support for keyword arguments, which address many of the issues you raised: http://docs.racket-lang.org/guide/keywords.html Would this help in your case? Additional background: http://www.cs.utah.edu/plt/publications/scheme09-fb.pdf On Mon, Jul 6, 2015 at 10:56 AM, John

Re: [racket-users] API design 2 -- variadic styles

2015-07-06 Thread Stephen Chang
, 2015 at 11:05 AM, Stephen Chang stch...@ccs.neu.edu wrote: Racket has linguistic support for keyword arguments, which address many of the issues you raised: http://docs.racket-lang.org/guide/keywords.html Would this help in your case? Additional background: http://www.cs.utah.edu/plt

Re: [racket-users] API function naming

2015-07-03 Thread Stephen Chang
The prefixes are based on this file: https://github.com/racket/gui/blob/master/tex-table/tex-table.rkt Maybe there are missing ones you're used to? Sorry, that was supposed to be a compliment! I love DrRacket's support for unicode and I havent wanted any symbols that aren't already supported.

Re: [racket-users] API function naming

2015-07-03 Thread Stephen Chang
, Stephen Chang stch...@ccs.neu.edu wrote: What symbols have the least historic baggage? I've gone through this exercise a few times, and each time settled on '$'. As Greg points out, pretty much every one of my my Racket libraries makes use of this symbol (was it that obvious? :) ) exactly

Re: [racket-users] API function naming

2015-07-03 Thread Stephen Chang
What symbols have the least historic baggage? I've gone through this exercise a few times, and each time settled on '$'. As Greg points out, pretty much every one of my my Racket libraries makes use of this symbol (was it that obvious? :) ) exactly because I was looking for something that

Re: [racket-users] API function naming

2015-07-03 Thread Stephen Chang
Perhaps this isn’t applicable in this case, but may I suggest a less-common alternative: no prefixing at all? If you put all the commands into a separate module, users of the module can use ‘prefix-in’ to choose whatever prefix they prefer. Prefixes (and suffixes) have two purposes. One is

Re: [racket-users] variadic function who use parameters from a mother variadic function

2015-07-03 Thread Stephen Chang
Actually, ~a by itself might do what you want. (~a 1 2 3) ; = 123 On Fri, Jul 3, 2015 at 4:18 PM, Stephen Chang stch...@ccs.neu.edu wrote: I think the call to values is misplaced. Here's a functioning version of foo, and a perhaps more concise alternative: (define (foo . L) (let ([bar

Re: [racket-users] variadic function who use parameters from a mother variadic function

2015-07-03 Thread Stephen Chang
I think the call to values is misplaced. Here's a functioning version of foo, and a perhaps more concise alternative: (define (foo . L) (let ([bar (string-join (build-list (length L) (λ (x) ~a)) )]) (apply format bar L))) (define (my-foo . L) (string-join (map ~a L) )) On Fri, Jul 3,

Re: [racket-users] right abstraction for this?

2015-06-11 Thread Stephen Chang
Would any of the functions in unstable/list help? For example, #lang racket (require unstable/list) (define (gather lst) (for/hash ([g (group-by car lst)]) (values (caar g) (append-map cdr g (gather '((a c) (a d) (b e) (b f))) ; = '#hash((a . (c d)) (b . (e f))) On Thu, Jun 11, 2015

[racket-users] Re: Use Parsack to parse a #language?

2015-05-12 Thread Stephen Chang
Once I get my head around what's needed to connect up a custom reader Matthew's example from his talk at the first RacketCon (and other conferences) might be a good place to start: https://github.com/mflatt/scratchy/blob/master/scratchy/reader.rkt

[racket-users] Re: Use Parsack to parse a #language?

2015-05-11 Thread Stephen Chang
Glad you're having a good time! I think you should be able to use it to implement your language's reader but I don't have any actual experience doing so. I seem to recall that Racket used to come with a combinator parser library. It's been removed but I don't remember why but maybe that could be

[racket-users] Re: [racket] Racket 6.0 does not work

2015-05-05 Thread Stephen Chang
./racket: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./racket) I just ran into this problem and a search led me to this thread, thanks. I am running Debian 7.8 wheezy which includes glibc 2.13. I originally used the Ubuntu 12.04 (Precise) 64bit installer from