Re: [racket-users] trying to install Rhombus

2023-01-31 Thread Alex Knauth
ptions at https://snapshot.racket-lang.org/. The current most up-to-date snapshot available from the University of Utah is version 8.8.0.5. Alex Knauth he/him or they/them -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To

Re: [racket-users] Scribble: Typeset equations using Latex packages amsmath and amssym

2015-09-24 Thread Alex Knauth
t you can do `#lang at-exp raw-string racket #\$`, because at-exp is more flexible than raw-string. It might be possible to make raw-string accept an arbitrary #lang language, but I don't know how. > Thanks for the solutions, > Marc > > On Thu, Sep 24, 2015 at 7:34 AM, Alex Knau

Re: [racket-users] Ambiguous binding error, and trying to add generic-interface inheritance

2015-09-24 Thread Alex Knauth
> /Users/travis/build/AlexKnauth/racket/racket/collects/racket/private/generic-methods.rkt:161:2 > > I'm also getting errors from data/order.rkt, but that's a separate problem, > and an easy one to fix. (I already did on my computer, but Travis is getting > data/order f

Re: [racket-users] Defining a symbol breaks symbols?

2015-09-30 Thread Alex Knauth
languages like rackjure, curly-fn, and sugar/debug also use hygiene in reader macros. I don't have time for a full explanation right now, but I'll come back in ~3 hours (after choir rehearsal) and give you one if your interested. Alex Knauth -- You received this message becaus

Re: [racket-users] Defining a symbol breaks symbols?

2015-09-30 Thread Alex Knauth
> On Sep 30, 2015, at 5:45 PM, Alex Knauth wrote: > > >> On Sep 30, 2015, at 4:19 PM, Lyle Kopnicky > <mailto:lylew...@gmail.com>> wrote: >> That bothers me a bit. It looks unhygienic, as the quote function is being >> captured. I guess reader m

Re: [racket-users] Typed Racket: Does positive? have an invisible filter?

2015-10-03 Thread Alex Knauth
> On Oct 3, 2015, at 8:42 AM, Paolo Giarrusso wrote: > > Hi all! > It seems to me that positive? is handled somehow specially by occurrence > typing, and that this is not documented but should be. > > It appears to have a filter in practice, even the Typed Racket guide [1] > claims so in pass

[racket-users] Re: Standardizing the threading macro and organizing packages

2015-10-07 Thread Alex Knauth
> On Oct 8, 2015, at 12:02 AM, Jack Firth wrote: > As for the actual package, I'm a strong proponent of a non-macro version > that's just the reverse of compose, mostly because it plays very nicely with > anonymous macro functions like fancy-app. I'm a bit biased as that's the one > I made in

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-07 Thread Alex Knauth
ntifier to use as a placeholder allows -> expressions to be nested within other ->, meaning pieces can be fit together much more nicely. That's one thing functions do that these shorthand macros tend to leave aside. > On Oct 8, 2015, at 12:34 AM, Alex Knauth wrote: > >

Re: [racket-users] planet questions

2015-10-07 Thread Alex Knauth
Looking at http://pkgs.racket-lang.org/#%28author:anu...@mendhekar.com%29 , It looks like the package catalog (not planet) found the docs, but it can't build them because it can't find libWN.so I know nothing about that, so someone else

Re: off topic, Re: [racket-users] Defining a symbol breaks symbols?

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 9:00 AM, Lyle Kopnicky wrote: > > Yes, sorry, I've been traveling and didn't have time to respond. I was > originally tempted to say "statically typed" and then realized that wasn't > exactly right, because it was not static types that would forbid such a > construction,

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
You don't think (define-simple-macro (-> var:id expr:expr ...+) (let* ([var expr] ...) var)) Is better? It's more powerful, because it allows placeholders to be arbitrarily nested within the expressions. Also, it allows the user to supply their own identifier to use as a placeholder instead o

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 2:27 PM, Alexis King wrote: > > >> On Oct 8, 2015, at 11:08 AM, Alex Knauth wrote: >> >> You don't think >> (define-simple-macro (-> var:id expr:expr ...+) >> (let* ([var expr] ...) var)) >> >> Is better? >

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 2:27 PM, Alexis King wrote: > > The original threading macro is a simple macro that unwinds nested function > application. Implementation aside, I find that the most intuitive way to > visualize it—introducing binding makes that more complicated, not less. An ~> expressio

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 4:48 PM, Jay McCarthy wrote: > A key thing that Remix has is buttery C-like syntax for infix dots. So > you can write r.ul.x and it might be the same as (posn-x (rectangle-ul > r)) if `r` were bound to a "dot transformer" that looked for .ul and > so on. (Off topic) Sounds

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 4:51 PM, Jack Firth wrote: > > Looking at that one, I'm against back-referencing N clauses with (<> n). I > find it very difficult to read, and it strikes me as particularly fragile if > you're inserting or removing steps into the flow as you edit it. > Trying to count b

[racket-users] Bug with errortrace and begin-for-syntax?

2015-10-09 Thread Alex Knauth
The error below doesn't point to my own code, but to here, in errortrace-lib.rkt: (syntax-case* disarmed-expr (begin-for-syntax module module*) (lambda (a b) (free-identifier=? a b phase 0)) [(begin-for-syntax body ...)

[racket-users] Naming for generalization of find-min and find-max?

2015-10-11 Thread Alex Knauth
Hi, Alexis King and I were discussing adding versions of argmin and argmax to the alexis/collection library, but we agreed that find-min and find-max were clearer names. Then we came up with a generalization of those that would take an ordering procedure (< for find-min and > for find-max), and

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-11 Thread Alex Knauth
Felleisen wrote: > > argbest Um, ok. If we were making the naming consistent with argmin and argmax, that would be good. But we renamed those to find-min and find-max because we thought arg... was confusing. I know we try not to be confusing here. > On Sun, Oct 11, 2015, 6:25 PM

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-11 Thread Alex Knauth
y closer to best. But then I thought, we're really saying best anyway, just in latin. But Alexis? What do you think? > On Oct 11, 2015 6:25 PM, "Alex Knauth" <mailto:alexan...@knauth.org>> wrote: > > > > Hi, > > > > Alexis King and I were discu

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
awkward because it seems like saying it's the most greater than everything else. The names `find-best`, `find-most-relevant`, and `first-by`/`find-first-by` sound better in that way. Alex Knauth -- You received this message because you are subscribed to the Google Groups "Racket Us

Re: [racket-users] help on coding finite state automata

2015-10-12 Thread Alex Knauth
What about Alexis King's persistent vectors? > On Oct 12, 2015, at 6:14 PM, Matthias Felleisen wrote: > > > > So I couldn't resist and wrote the vector-based, allocation-minimizing > version of the program. I didn't get that much of a performance gain. > > I might still change the fitness r

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
you > think that the passed in function should be a predicate on one element, not > two. How about something like first-by? > > > (first-by stringstring second) '((3 pears) (1 banana) > > (2 apples))) > '(2 apples) > > martin > > On Sun, Oct 11,

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
> On Oct 12, 2015, at 8:35 PM, Alexis King wrote: > > I’m not completely sold on `most`, but I’m close. I like that it’s terse and > fairly obvious in what it does. The obvious downside is that it’s a little > vague. The expression (most < lst) doesn’t read super well, IMO. > > I think passin

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Alex Knauth
> On Oct 12, 2015, at 8:55 PM, Alex Knauth wrote: > > >> On Oct 12, 2015, at 8:35 PM, Alexis King wrote: >> In the same line of thought as `append-map`, the name `first-sort` has >> crossed my mind, but this feels just as opaque. The name `first-by` is very &

Re: [racket-users] help on coding finite state automata

2015-10-13 Thread Alex Knauth
w — Typed Racket > doesn’t have types) and the typed documentation is pretty solid. (I’ll > do types later to validate.) > >> On Oct 12, 2015, at 7:37 PM, Alex Knauth wrote: >> >> What about Alexis King's persistent vectors? -- You received this message becaus

Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Alex Knauth
Racket has an option for that. It's a meta-language that I made this morning. #lang colon-kw racket You can use it for one or two files without messing up everything else. > On Oct 14, 2015, at 2:19 PM, Martin DeMello wrote: > > Chicken scheme has an option for that: > http://wiki.call-cc.o

Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Alex Knauth
You can use #lang colon-kw racket for :kw syntax, and #lang kw-colon racket for kw: syntax. They are compose-able as well, so you can use #lang colon-kw kw-colon racket to let :kw and kw: both work in the same file. > On Oct 14, 2015, at 2:37 PM, Alex Knauth wrote: > > Racket has

Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Alex Knauth
> On Oct 14, 2015, at 5:34 PM, Neil Van Dyke wrote: > I very much appreciate diligence about backward-compatibility, but I'm not > actually aware of any Racket code that actually uses colon-symbol for any > purpose other than as a keyword. And the ones that use colon-symbol as > makeshift ke

Re: [racket-users] Defining a symbol breaks symbols?

2015-10-15 Thread Alex Knauth
et expander right now, although I could probably tweak it so that it works for both. > On Oct 8, 2015, at 11:31 AM, Alex Knauth wrote: > > >> On Oct 8, 2015, at 9:00 AM, Lyle Kopnicky wrote: >> >> Yes, sorry, I've been traveling and didn't have time

Re: [racket-users] Defining a symbol breaks symbols?

2015-10-18 Thread Alex Knauth
his inner scope is different for every use of the reader extension, just like it would be for each use of a regular macro. > But I think it's not a problem for real word use, and it's better than > the standard behavior. > > Gustavo > > On Fri, Oct 16, 2015 at

Re: [racket-users] Defining a symbol breaks symbols?

2015-10-19 Thread Alex Knauth
Would you expect anything different if it were a normal macro? #lang racket (define-syntax-rule (define-quote (arg ...) expr) (define (quote arg ...) expr)) (define-quote (x) 5) (define-quote (x) 5) (quote 3) This also compiles without error, and also returns 3. Were you expecting a hygienic

Re: [racket-users] Probabilities in log-space and rounding errors

2015-10-22 Thread Alex Knauth
lg+ and lg- are defined to work with log and exp, but I'm just wondering if versions of those defined to work with log1p and expm1 would eliminate some of these errors, by getting rid of the badlands of log and exp? Would that work? http://docs.racket-lang.org/math/flonum.html#%28def._%28%28lib.

Re: [racket-users] let/define

2015-11-02 Thread Alex Knauth
This is because begin can have potentially recursive and mutually recursive definitions in it. This does the same thing: (let ([y 5]) (local [(define x y) ; this y should be bound to (define y 10)] ; <- this y, but it is used too early y)) While this slightly different case wor

Re: [racket-users] Evaluating whatever expression halfway a debugging session

2015-11-03 Thread Alex Knauth
> On Nov 3, 2015, at 3:01 PM, 'John Clements' via Racket Users > wrote: > >> On Oct 29, 2015, at 10:01 AM, Marco Faustinelli >> wrote: >> I see that during a debugging session I can hover above an expression and >> rightclick to send its value to the console or so set! it something else. >>

Re: [racket-users] Correct use of pattern-expander (example in docs is broken)

2015-11-10 Thread Alex Knauth
Oh, oops. I hadn't realized that syntax-rules using syntax-protect could cause problems. This works though: (define-syntax ~maybe (pattern-expander (lambda (stx) (syntax-case stx () [(~maybe pat ...) #'(~optional (~seq pat ...))] I'll open a pull request to fix that.

Re: [racket-users] Correct use of pattern-expander (example in docs is broken)

2015-11-10 Thread Alex Knauth
Ok, I just opened https://github.com/racket/racket/pull/1133, which fixes this so that syntax-rules still works. > On Nov 10, 2015, at 6:19 PM, Alex Knauth wrote: > > Oh, oops. I hadn't realized that syntax-rules using syntax-protect could > cause problems. > > This

Re: [racket-users] raco install says it is already there, raco setup says it doesn't exist ...

2015-11-11 Thread Alex Knauth
rg/2015/08/modules-packages-and-collections.html) Alex Knauth > On Nov 12, 2015, at 2:17 AM, thomas.lynch > wrote: > > would some kind person clue me in to the raco setup syntax? When I try to > install this, it tells me it is there. When I run setup it says it doesn't

[racket-users] DrRacket just crashed 3 times in a row in quick succession so far

2015-11-15 Thread Alex Knauth
I have no idea what could have caused this, but if it helps, here's the crash report from the 3rd time: Process: DrRacket [10818] Path: /Applications/Racket/*/DrRacket.app/Contents/MacOS/DrRacket Identifier:org.racket-lang.DrRacket Version:

Re: [racket-users] DrRacket just crashed 3 times in a row in quick succession so far

2015-11-15 Thread Alex Knauth
seems to crash most of the time. > On Nov 15, 2015, at 4:29 PM, Alex Knauth wrote: > > I have no idea what could have caused this, but if it helps, here's the crash > report from the 3rd time: > > Process: DrRacket [10818] > Path: >

Re: [racket-users] DrRacket just crashed 3 times in a row in quick succession so far

2015-11-15 Thread Alex Knauth
That seems to keep it from happening. > On Nov 15, 2015, at 5:30 PM, Robby Findler > wrote: > > What if you disable background expansion? > > Robby > > > On Sun, Nov 15, 2015 at 3:52 PM, Alex Knauth wrote: >> I've gotten it several more times now,

Re: [racket-users] DrRacket just crashed 3 times in a row in quick succession so far

2015-11-15 Thread Alex Knauth
;>> 13 Racket0x00010c1943f8 place_start_proc >>>>> + 120 >>>>> 14 Racket0x00010c128301 mzrt_thread_stub >>>>> + 81 >>>>> 15 libsystem_pthread.dylib 0x7fff99f3d9b1 _pthread_body

Re: [racket-users] DrRacket just crashed 3 times in a row in quick succession so far

2015-11-15 Thread Alex Knauth
-all c)) > > The actual work that DrRacket does is more complex than that, so this > not crashing doesn't mean too much, but if it is did crash, that would > be progress. > > Robby > > > On Sun, Nov 15, 2015 at 5:15 PM, Alex Knauth wrote: >> >>> On Nov 15

Re: [racket-users] quote-srcloc an questions of getting location

2015-11-21 Thread Alex Knauth
> On Nov 21, 2015, at 6:21 AM, thomas.lynch > wrote: > > The example in the manual for quote-srcloc shows it wrapped as a syntax > object, and it gives the correct call point location answer. however, when > the result from quoteloc is instead put in a variable, then variable has the > wron

Re: [racket-users] Re: quote-srcloc an questions of getting location

2015-11-23 Thread Alex Knauth
e. It only goes one level deep though, so you're not getting the actual benefit of using syntax/loc over syntax, unless the error happens in the outer let expression instead of one the inner expressions. Alex Knauth -- You received this message because you are subscribed to the Google

Re: [racket-users] The mythical top-level

2015-11-30 Thread Alex Knauth
> On Nov 30, 2015, at 12:20 PM, brendan wrote: > > On Monday, November 30, 2015 at 10:52:05 AM UTC-5, Asumu Takikawa wrote: >> When you use a REPL, like if you launch racket at the command-line, you are >> using the top-level: >> >> Welcome to Racket v6.3.0.6. >> -> (begin-for-syntax (display

Re: [racket-users] format-id and blue arrows

2015-12-04 Thread Alex Knauth
h your fix, (if I only cared about future versions of racket) would it be able to return the identifier with the syntax property on it instead of doing this two-value stuff? Alex Knauth > On Dec 4, 2015, at 11:15 AM, Robby Findler > wrote: > > I've pushed a fix to DrRacket t

Re: [racket-users] Call methods inside a macro

2015-12-05 Thread Alex Knauth
syntax-local-value #'foo) get-foo))) #'(void))])) (say-hello foo-object) ; Hello foo at compile time The (define-for-syntax foo-class% ...) creates class that exists at compile time. The (define-syntax foo-object ...) creates a compile time binding that can be accessed with syn

Re: [racket-users] Call methods inside a macro

2015-12-08 Thread Alex Knauth
~G4sp7Kpj18rYLsSKM~BM4g4vz6VZQD5~LyQ~OGS0SMUyicrGacoeOJh7DIN5WmK-0KY3CG~sY4vFX6VtnLZ3WfLR~yvsF-32YiDTbAGOzNZjrhG7RtXb3BEEXSqzRYw_&Key-Pair-Id=APKAIMZVI7QH4C5YKH6Q> Alex Knauth > On Dec 8, 2015, at 8:48 AM, Guilherme Ferreira > wrote: > > Thank you Alex for your help. Considering the second examp

Re: [racket-users] Typed Racket: Is (- 1 1) equivalent to (- 2 2)?

2015-12-10 Thread Alex Knauth
that's a Fixnum. Alex Knauth > On Dec 10, 2015, at 12:26 PM, Klaus Ostermann wrote: > > This Typed Racket term is well-typed: > > (+ 1 (if (= 0 (- 1 1)) 1 "x")) > > This one isn't: > > (+ 1 (if (= 0 (- 2 2)) 1 "x")) > > This looks

Re: [racket-users] Is there a way to return no value?

2015-12-11 Thread Alex Knauth
> On Dec 11, 2015, at 5:27 PM, David Storrs wrote: > > > > On Fri, Dec 11, 2015 at 1:53 PM, Matthew Butterick > wrote: > PS. I'm assuming that you're using `eq?` here in deliberate preference to > `equal?`. Because `eq?` is not reliable for string comparisons. >

Re: [racket-users] about rackjure

2015-12-12 Thread Alex Knauth
> On Dec 12, 2015, at 9:18 AM, Taro Annual wrote: > In racket libraries, rackjure module looks usable. > But, rackjure's threading(~>) denys lambda. > > > #lang rackjure > >> (#fn(map sqr %) '(1 2)) > '(1 4) >> (~> '(1 2) #fn(map sqr %)) > [Error] lambda: not an identifier, identifier wit

Re: [racket-users] Confused about the difference between the REPL and the toplevel.

2015-12-21 Thread Alex Knauth
I get that `compile` doesn't evaluate the require form, but why doesn't it evaluate what's needed for compile time? I thought that was the reason for needing require as a macro instead of a function. Or am I getting the purpose of compile wrong? Alex Knauth > On Dec 21

Re: [racket-users] Confused about the difference between the REPL and the toplevel.

2015-12-21 Thread Alex Knauth
ny sense, or was it too rambly. > > ~Leif Andersen > > > On Mon, Dec 21, 2015 at 8:24 PM, Alex Knauth wrote: >> I get that `compile` doesn't evaluate the require form, but why doesn't it >> evaluate what's needed for compile time? I thought that was the re

Re: [racket-users] Counterintuitive performance results

2016-01-08 Thread Alex Knauth
I tried doing stuff, but then I realized that there's a typo that messes this up. > On Jan 8, 2016, at 4:29 PM, Andrew Kent wrote: > > Any guesses why adding more indirection speeds up the code here? > > #lang racket > > (define (set-members? s . xs) > (for/and ([x (in-list xs)]) >(set-

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-09 Thread Alex Knauth
> On Jan 9, 2016, at 1:38 AM, David Storrs wrote: > > Related question: Perl has a capacity to change your delimiters on regexen > in order to avoid having to backwhack everything. The raw-string package allows this for strings: #lang raw-string/raw-string racket #\$ (pregexp $"\d") ; #px"\

Re: [racket-users] Pict3d general Racket help

2016-01-12 Thread Alex Knauth
This is because pict3d requires racket/struct, which was only added in racket version 6.3. If you have an older version, you'll get this error. There should probably be a version exception for older versions that doesn't require racket/struct. Or would it be better to change pict3d to not rely

Re: [racket-users] Pict3d general Racket help

2016-01-12 Thread Alex Knauth
I just added version exceptions for earlier versions of racket, pointing to a version that doesn't require racket/struct. So this should be fixed now. > On Jan 12, 2016, at 10:36 AM, Alex Knauth wrote: > > This is because pict3d requires racket/struct, which was only added in rac

Re: [racket-users] Racket performance tips

2016-01-17 Thread Alex Knauth
> On Jan 17, 2016, at 2:50 PM, Brian Adkins wrote: > > With built-in string-trim, the lowest of three runs was 10293. Using your > string-trim the lowest of three runs was 7618, so it reduced the runtime by > 26%. Would converting this into a `bytes-trim` function that only works with byte-s

Re: [racket-users] Prefix-in for macros

2016-01-22 Thread Alex Knauth
> On Jan 22, 2016, at 9:07 AM, brendan wrote: > > I was playing around with parser-tools, which has a convenient syntax in > which the elements of a grammar rule are bound in order to $1, $2, etc. This > led me to think about how the composability of non-hygienic macros could be > limited by

Re: [racket-users] list of macro & #lang resources

2016-01-27 Thread Alex Knauth
Racket: Metaprogramming Time! by Matthew Flatt http://www.infoq.com/presentations/racket Helped me a lot in understanding how phases work. I don't see that on your list. > On Jan 27, 2016, at 1:07 PM, Benjamin Greenman > wrote: > > The Racket Manifesto > http://www.ccs.neu.edu/home/matthias/ma

Re: [racket-users] [HtDP/2e & ISL+] Stepper and "seeming" accidental name capture

2016-01-28 Thread Alex Knauth
Would there be a way to support check-syntax arrows automatically in the stepper, so that we could see that they are really two different y's, because the arrows point to different places? Would that be possible? > On Jan 28, 2016, at 12:04 PM, Matthias Felleisen wrote: > > > Thanks for the b

Re: [racket-users] R6RS+horizontal panel

2016-01-29 Thread Alex Knauth
> On Jan 29, 2016, at 5:12 PM, Jean-Michel HUFFLEN wrote: > > Jens Axel Søgaard wrote: > >> In R6RS '(left top) will allocate a list consisting of mutable cons cells. >> In Racket '(left top) will allocate a list of immutable cons cells. > > OK, thanks. But a point is still obscure, for me.

Re: [racket-users] Expression-style printing and quotation: helpful or harmful?

2016-02-05 Thread Alex Knauth
isn't a list containing a function, it's a list containing a symbol. I'm guessing this printing style was chosen for the teaching languages because it makes sense and minimizes confusion. Alex Knauth > On Feb 5, 2016, at 10:00 PM, Alexis King wrote: > > It is my un

Re: [racket-users] Quasisyntax bug?

2016-02-12 Thread Alex Knauth
Looks like a bug to me. I also narrowed it down, so that it doesn't need the quote-syntax, and I also figured out that it does this before it even expands once, so we know it isn't expanding to itself infinitely or anything like that. So we know it's a loop within the implementation function its

[racket-users] Strange behavior with highlight-range method from framework

2016-02-22 Thread Alex Knauth
start end "dark green" #f 'low 'hollow-ellipse #:adjust-on-insert/delete? #t)) (define canvas (new editor-canvas% [parent frame] [editor text-editor])) (send frame show #true) Alex Knauth -- You received this message because you are subscribed to the Google Groups "

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

2016-03-05 Thread Alex Knauth
There's also this DrRacket plug-in which works with rackunit to highlight passing tests in green and highlight failing tests in red, as you type: https://github.com/miraleung/racketeer I thought it would be worth sharing. > On Mar 6, 2016, at 12:08 AM, Da

Re: [racket-users] predicate as an atom within a regexp?

2016-03-19 Thread Alex Knauth
There's a string-append match expander for that here, although it's pretty slow right now. http://docs.racket-lang.org/match-string/index.html <http://docs.racket-lang.org/match-string/index.html> Alex Knauth > On Mar 17, 2016, at 7:17 PM, Matthew Butterick <mailto:m

Re: [racket-users] Multiple namespaces in Racket

2017-10-12 Thread Alex Knauth
way around this? What I have so far: https://gist.github.com/AlexKnauth/b7d9f2e0af1c5b8e2186d6581b1f7e4d <https://gist.github.com/AlexKnauth/b7d9f2e0af1c5b8e2186d6581b1f7e4d> Alex Knauth -- You received this message because you are subscribed to the Google Groups "Racket Users" group. T

Re: [racket-users] let-immutable

2017-11-07 Thread Alex Knauth
27;t succeed in breaking your let-immutable because the internal-id will be tainted. Alex Knauth > (define-for-syntax (immutable-variable-transformer new-id) > (make-set!-transformer >(λ (stx) > (syntax-case stx (set!) >[(set! x rhs) > (raise-syntax-e

[racket-users] How does a macro properly expand to a define-runtime-path?

2017-11-10 Thread Alex Knauth
the macro path. Why? What am I doing wrong?) Alex Knauth -- 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.

Re: [racket-users] Interaction of Typed Racket with define/match?

2017-11-13 Thread Alex Knauth
) [((vector a b) (vector c d) e) (and (= a (+ c e)) (= b (+ d e)))])) Others: Does define/match do anything that would make Typed Racket see it differently from define + match*? It seems like define/match expands to define + match*/derived anyway. The only thing that's different

Re: [racket-users] pragmatics of exhaustiveness checking in TR

2017-12-09 Thread Alex Knauth
> On Dec 9, 2017, at 1:04 PM, 'John Clements' via users-redirect > wrote: > > TR doesn’t really do exhaustiveness checking, really, … except sorta. I’m > mostly just writing this to summarize my thinking and to see if there’s > something obvious I’m missing. The Utilities section of the TR

Re: [racket-users] REPL - last output capture?

2018-01-13 Thread Alex Knauth
> On Jan 13, 2018, at 12:56 PM, Michael Rice wrote: > > In Common Lisp it's *, **, ***. > > In Racket? > > Michael In Racket's XREPL, these are called ^, ^^, ..., ^, or you can use $1, $2, ..., $5. The XREPL documentation has more details here: https://docs.racket-lang.org/xrepl/index.

[racket-users] "deleting" syntax properties and macro expander cons-merging

2018-03-10 Thread Alex Knauth
fine-simple-macro (id-macro x) x) (define-syntax-parser get-prop [(_ x) #`'#,(syntax-property (local-expand #'x 'expression '()) 'prop)]) (define-syntax set-up (λ (stx) (syntax-property #`(id-macro #,(syntax-property #'(void) 'prop #f)) 'p

Re: [racket-users] "deleting" syntax properties and macro expander cons-merging

2018-03-11 Thread Alex Knauth
> On Mar 10, 2018, at 6:46 PM, Alex Knauth wrote: > > The macro expander merges syntax properties between the input of a macro and > the output of a macro using `cons`. That means that if there is an > identity-macro call like this: > > (identity-macro x) > > wh

Re: [racket-users] "deleting" syntax properties and macro expander cons-merging

2018-03-11 Thread Alex Knauth
> On Mar 11, 2018, at 2:31 PM, Matthew Flatt wrote: > > At Sun, 11 Mar 2018 11:27:06 -0400, Alex Knauth wrote: >> In the expander code I found this [1]: >> >> (define (syntax-property-remove s key) >> (if (hash-ref (syntax-props s) key

Re: [racket-users] Using match to decompose a nested hash

2018-03-20 Thread Alex Knauth
hing completely different that you never meant it to mean. For extra weirdness: #lang racket (define user (hash 'type 'dev 'id 112)) (match user [(hash-table 'type x 'id y) (displayln x)]) ;quote16: unbound identifier; ; also, no #%top syntax transformer is bound in:

Re: [racket-users] Using match to decompose a nested hash

2018-03-20 Thread Alex Knauth
> On Mar 20, 2018, at 11:51 PM, Alex Knauth wrote: > > > >> On Mar 19, 2018, at 11:37 AM, David Storrs wrote: >> >> This does not work: > >> (define user (hash 'name "bob" 'job (hash 'type 'dev 'id 112))) >&g

Re: [racket-users] Implementation of threading macros

2018-03-31 Thread Alex Knauth
The `~>` form provided by the `threading` package is a macro, and it treats parentheses differently than a normal function would. What you are looking for is probably the ~> *function*, provided by the `point-free` package. That has simpler behavior, doing what you expect with lambdas, curried

Re: [racket-users] let-syntax example?

2018-04-03 Thread Alex Knauth
nt two macros to communicate a compile-time value between them, you can have one of them generate a `let-syntax` or `define-syntax` to define that value, and have the other use `syntax-local-value` to get it. Alex Knauth > Thanks! > Kevin -- You received this message because you are subscr

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-17 Thread Alex Knauth
those typed higher-order values, and if the type system knows that through the `UntypedAny` type, the type system will know it is safe to make `cast` behave like `require/typed`. It will know it is safe to pass it only through the Untyped -> Typed boundary. Alex Knauth > On Apr 16, 201

Re: [racket-users] Unicode identifiers

2018-05-16 Thread Alex Knauth
> On May 16, 2018, at 6:37 AM, Jens Axel Søgaard wrote: > > Alternative 1: Use filtered-in to require renamed versions. > > ( <>filtered-in > > proc-expr require-s

Re: [racket-users] Re: From Clojure to Racket

2018-08-23 Thread Alex Knauth
;https://docs.racket-lang.org/collections/index.html> Since these libraries were partly inspired by Clojure's data structures and protocols, they should make it easier to convert your code. Alex Knauth > On Thursday, August 23, 2018 at 6:02:07 PM UTC+1, Ben Kovitz wrote: > Has anyone w

Re: [racket-users] Get contract from function

2018-08-24 Thread Alex Knauth
> On Aug 24, 2018, at 8:50 AM, Joao Pedro Abreu De Souza > wrote: > > Hi. I am contributing in a library that create functions to parse PEG(parsing > expression grammar). To implement a feature, I need to know the return's type > of a function. We are using racket, not typed-racket, so I thi

Re: [racket-users] (set 1) is not equal? to (set 1)

2018-10-18 Thread Alex Knauth
your example, `(make-base-namespace)` was evaluated twice to create two different namespaces, where in this one `(make-base-namespace)` was evaluated only once, so both eval calls are in the same namespace. Alex Knauth > -- > Tom -- You received this message because you are subsc

[racket-users] Doing file I/O from within a macro

2018-11-01 Thread Alex Knauth
)) (define-syntax m (λ (stx) (define tmp (make-temporary-file)) (display-to-file "hello there\n" tmp #:exists 'replace) #'(begin))) (m) ;open-output-file: forbidden (write) access to ;/var/folders/6f/5335m44s43g1zd2vqs7jmqshgp/T/unsaved editor-7-16_15411123141541112

Re: [racket-users] Doing file I/O from within a macro

2018-11-01 Thread Alex Knauth
be able to bike > the abstractions you news via the FFI but I guess it will be hard to get > right because DrRacket just kills off compilations effectively randomly. Okay, thanks. > Robby > > On Thu, Nov 1, 2018 at 5:57 PM Alex Knauth <mailto:alexan...@knauth.org>> wrote:

Re: [racket-users] How to refine types when filtering values

2018-12-24 Thread Alex Knauth
: (∀ (a) (-> (U a False) Any : #:+ a))) (define (truthy? v) v) However, you still need to use `inst` on `truthy?` when you pass it to filter: > (filter (inst truthy? Positive-Byte) '(1 2 3 #f)) - : (Listof Positive-Byte) '(1 2 3) Alex Knauth > Thanks, > Wanderley -- You

Re: [racket-users] Scribble examples for languages other than Racket

2019-01-24 Thread Alex Knauth
Would the `scribble-code-examples` package work for you? https://docs.racket-lang.org/scribble-code-examples/index.html <https://docs.racket-lang.org/scribble-code-examples/index.html> An example use of it might be: @code-examples[#:lang "plisqin" #:context #'here]|{ {wher

Re: [racket-users] type annotation example

2019-02-27 Thread Alex Knauth
really need to use 6.0, you can use (String -> Symbol) instead. However if you can upgrade, you probably should. A lot of things have improved in Typed Racket between 6.0 and now. Alex Knauth > Sam > > On Mon, Feb 25, 2019, 1:46 PM Brian Craft <mailto:craft.br...@gmail.com>

Re: [racket-users] macros and let/cc

2019-06-03 Thread Alex Knauth
> (or how it would know to use it unless it could interrogate the body list > looking for that value. That might be what I’d need to do here… I'm not sure what you mean by interrogate the body, but if you're referring to the syntax-parameterize needing access to the continuati

Re: [racket-users] Case and eof

2016-04-04 Thread Alex Knauth
#x27;s a big reason why I like the teaching languages better in terms of things making sense. It's also why I normally use `match` instead of `case` even when I *am* dealing with integers or symbols. Alex Knauth > On Mon, Apr 4, 2016 at 3:34 PM, rom cgb wrote: >> Hi, >>

Re: [racket-users] macros within expressions.

2016-04-06 Thread Alex Knauth
that behave like boxes, or make identifiers log something every time they're referenced, or ones that expand to more complicated macro calls. It's also a way of enforcing that a variable should be immutable. Alex Knauth -- You received this message because you are subscribed to the Google Gro

Re: [racket-users] What do you use macros for?

2016-04-08 Thread Alex Knauth
ledge at compile time, and DrRacket can still provide all those tools. Because of that, both programmers and DrRacket can understand programs. If this could change at runtime, most of this would go away. But to use laziness to create new binding constructs without macros, that's what you wo

Re: [racket-users] How can I differentiate between a here string and a "" string?

2016-04-20 Thread Alex Knauth
Jens Axel Soegaard's infix package does something similar. It solves part of this problem by using at-exp for longer strings, instead of using here strings. Because of that, it can tell the difference by using the `'scribble` syntax property that at-exp puts there. I'm not sure whether a simil

Re: [racket-users] One case of rest arguments on Typed Racket

2016-04-23 Thread Alex Knauth
;; even though this has type B. (apply fn args Since the hash table's type is (HashTable Fixnum Any), this function can't return B, it has to return Any. I tried making a better version using lists, but I think a perfect version would need to use exists ty

[racket-users] DrRacket crashing, preserved syntax properties, and (exn-message #t) ?

2016-04-23 Thread Alex Knauth
ons/Racket/2016-04-16/Racket v6.5.0.2/share/pkgs/macro-debugger/macro-debugger/view/stepper.rkt:400:31 .../more-scheme.rkt:261:28 /Applications/Racket/2016-04-16/Racket v6.5.0.2/share/pkgs/macro-debugger/macro-debugger/view/stepper.rkt:369:24 Does this mean anything? Alex Knauth -- You rec

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-24 Thread Alex Knauth
cro (syntax-parser [(name-parsing-macro arg1 "," arg2 "," arg3) #'(list arg1 arg2 arg3)])) ;; case 2: (definer-macro (name-parsing-macro x "," y "," z) (val-producing-macro)) (check-equal? x 1) (check-equal? y 2) (check-equal? z 3) Does this work

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alex Knauth
> On Apr 25, 2016, at 3:43 PM, Matthew Butterick wrote: > On Apr 24, 2016, at 7:58 PM, Alex Knauth wrote: >> One way to do this would be to make `(name-parsing-macro x "," y "," z)` a >> match-expander >> Does this work for you? Or is your ca

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alex Knauth
fine-simple-macro, not define-syntax-rule (define-simple-macro (id-maker _a "," _b "," _c) (_a _b _c)) (binding-form bar (id-maker x "," y "," z)) (bar) ; works, prints bar found x, etc. Actually I'm surprised that this worked; I expected it to be much mo

  1   2   3   >