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

2015-09-23 Thread Alexander D. Knauth
I'm trying to add inheritance to generic interfaces: https://github.com/AlexKnauth/racket/tree/gen-extends But it's in a weird state where it's passing some of the time, (seemingly depending on how exactly I fiddle with it, compile it, rest

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

2015-09-23 Thread Alexander D. Knauth
> On Sep 23, 2015, at 8:53 AM, Marc Kaufmann wrote: > #lang racket/base > > (require scribble/base > scribble/core) > > (provide equation*) > > (define (mymath start end . strs) > (make-element (make-style "relax" '(exact-chars)) `(,start ,@strs ,end))) > > (define (equation* . strs

Re: [racket-users] Scribble: line comment swallows paragraph break

2015-09-17 Thread Alexander D. Knauth
I forgot to include the list: > On Sep 17, 2015, at 10:57 AM, Alexander D. Knauth > wrote: > > Is there any reason why > #lang at-exp racket > '@stuff{ > Hello @; John > > World > } > Shouldn't produce > '(stuff "Hello " &

Re: [racket-users] Macro-generating macros

2015-09-04 Thread Alexander D. Knauth
> On Sep 4, 2015, at 4:26 AM, Konrad Hinsen wrote: > > Brian Mastenbrook writes: > >> It's a capture problem. In the first case, you're just binding the >> name "send" locally and all is well. In the second case, you're >> trying to introduce a binding for "send" that you didn't get from >> the

Re: [racket-users] Lost in ellipsis depths

2015-09-02 Thread Alexander D. Knauth
> On Sep 2, 2015, at 7:09 AM, Konrad Hinsen wrote: > > Konrad Hinsen writes: > >> In fact, what I want is do something like map over the ellipsis pattern, >> but I haven't seen any example for doing this. > > Well, map actually works: > > (syntax-parse #'(foo a b c) >[(f:id s:id ...) >

Re: [racket-users] Creating a language that extends typed/racket

2015-08-30 Thread Alexander D. Knauth
> On Aug 30, 2015, at 6:31 PM, Alexis King wrote: > > (Disclaimer: I think this question may have been visited before on this > mailing list, but I couldn’t find any resolution, so I’m going to ask again.) Yes. What came out of it was this, which they got to work: https://github.com/khinsen/ra

Re: [racket-users] unclear about this `parameterize` behavior

2015-08-30 Thread Alexander D. Knauth
To add to that a little bit, this is what I found: #lang multi-file #file param.rkt #lang racket (provide my-param) (define my-param (make-parameter 'default)) #file param-test.rkt #lang racket (require "param.rkt") (define-namespace-anchor a) (parameterize ([current-namespace (make-base-namespace

Re: [racket-users] (set-implements? (mutable-set) 'set-add)

2015-08-24 Thread Alexander D. Knauth
Was it this commit here? https://github.com/plt/racket/commit/606a94621253391536e9c89c573dc70fd28efbe6 On Aug 24, 2015, at 5:50 PM, Alexander D. Knauth wrote: > It seems to me that (set-implements? (mutable-set) 'set-add) should return > #f, and in 6.1.1 (and I think 6.2),

[racket-users] (set-implements? (mutable-set) 'set-add)

2015-08-24 Thread Alexander D. Knauth
It seems to me that (set-implements? (mutable-set) 'set-add) should return #f, and in 6.1.1 (and I think 6.2), that's true. But in the latest snapshots, it produces #t. It seems like it's implemented as an error message instead of not implemented at all, and `set-implements?` can't tell the dif

Re: [racket-users] My son's game in Racket

2015-08-24 Thread Alexander D. Knauth
Or something like this, with the rackjure package: (require rackjure/threading 2htdp/image) (~>> background-img (place-image image-1 x y) ; the background-img will be inserted as the last argument, because that's what ~>> does (place-image image-2 x y) ; the background + image-1 will be

Re: [racket-users] macro-generate attribute access?

2015-08-22 Thread Alexander D. Knauth
Does this get you what you want? #lang racket (require (for-syntax syntax/parse racket/syntax)) (define-syntax (define-stuff stx) (syntax-parse stx [(_ attr-name macro-name) #:with c.attr-name (format-id #'c "~a.~a" #'c #'attr-name) #'(begin (begin-for-syntax (define-

[racket-users] DrRacket crashing?

2015-08-21 Thread Alexander D. Knauth
I have no idea what's been happening, but in the past half hour or so DrRacket has crashed on me (I think) 6 times. I don't know if this will help but here is what was in the error window that my computer gave me: Process: DrRacket [20469] Path:/Applications/Racket/*/DrRacket

Re: [racket-users] Match value of symbol vs. binding to it

2015-08-17 Thread Alexander D. Knauth
On Aug 18, 2015, at 1:18 AM, Brian Adkins wrote: > On Tuesday, August 18, 2015 at 1:13:16 AM UTC-4, Alex Knauth wrote: >> Is == what you're looking for? >> Or do you want a version of == that uses string=? ? > > I'm not sure what you're suggesting. I basically want a way to inject the > value

Re: [racket-users] Match value of symbol vs. binding to it

2015-08-17 Thread Alexander D. Knauth
Is == what you're looking for? Or do you want a version of == that uses string=? ? On Aug 18, 2015, at 12:55 AM, Brian Adkins wrote: > Consider the following: > > (define x "abc") > (match '(1 "abc") > [ (list 1 y) #:when (string=? y x) #t ] > [ _ #f ]) > > Is there a way to accomplish the s

Re: [racket-users] macro making a struct with a macro

2015-08-17 Thread Alexander D. Knauth
...) ...) >(define (some-interface-function ...) ...) ...]) > > Essentially all it had to do was grab the struct name automatically, just one > more level of indirection. It seemed straightforward but in my example code > the methods defined for the generic interface were not s

Re: [racket-users] macro making a struct with a macro

2015-08-17 Thread Alexander D. Knauth
Are you looking for a macro like this: #lang racket (require syntax/parse/define (for-syntax racket/syntax)) (define-simple-macro (define-struct-fields struct:id (field:id ...) v:expr) #:with s (generate-temporary #'struct) #:with [struct-field ...] (for/list ([field (in-list (syntax->list #'

[racket-users] pkg version exceptions: ranges of versions?

2015-08-16 Thread Alexander D. Knauth
Is there a way to create a version exception for a range of versions, instead of for a single version? -- 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-us

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Alexander D. Knauth
%module-begin > (module sub-id racket/base > (define x 2) > (provide x)) > (require 'sub-id) > (provide (all-from-out 'sub-id)) > body ...))]))) > > On Sat, Aug 15, 2015 at 9:56 PM, Alexander

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Alexander D. Knauth
On Aug 15, 2015, at 11:53 PM, Alexander D. Knauth wrote: > Does this work? > (define-syntax my-module-begin > (lambda (stx) >(syntax-case stx () > [(_ body ...) > (with-syntax ([sub-id (datum->syntax stx ''sub)]) > #'(#%module-be

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Alexander D. Knauth
utomatically runs test >> submodules). Thus obviating the need for a wrapper module. >> >> >> >> >> >> On Aug 15, 2015, at 5:08 PM, Matthew Butterick wrote: >> >>> Probably the wiser option. I'll see if I can adapt that

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Alexander D. Knauth
, at 5:08 PM, Matthew Butterick wrote: > >> Probably the wiser option. I'll see if I can adapt that solution. >> >> >> On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth >> wrote: >> >>> What kind of funny stuff? >>> By the way, this

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Alexander D. Knauth
What kind of funny stuff? By the way, this sounds sort of like this http://www.mail-archive.com/racket-users@googlegroups.com/msg28020.html Solution: http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html Although it could be a completely different problem, I don't know. On Aug

Re: [racket-users] Export indentation preferences in a package's info.rkt?

2015-08-09 Thread Alexander D. Knauth
I would really like to have such a feature. On Aug 9, 2015, at 1:23 PM, Jack Firth wrote: > I find it irritating when I have to repeatedly add various macros exported by > libraries to their proper group in the Indenting section of DrRacket's > settings so that they're properly formatted. Is

Re: [racket-users] Communicating between macros *without* mutation, problems with multiple modules?

2015-08-07 Thread Alexander D. Knauth
; so you end up with a duplicate definition of that identifier. That is, > the `next-next` identifier created by `(add id b)` is never bound in > the same was that `c` is never bound above for `(define (b) c)`. > > > At Fri, 7 Aug 2015 22:02:48 -0500, "Alexander D. Knauth&qu

[racket-users] Communicating between macros *without* mutation, problems with multiple modules?

2015-08-07 Thread Alexander D. Knauth
Hi. I have been trying to create a macro that communicates without using mutation, but I'm having problems with communicating across multiple modules. I have three files: macro.rkt: #lang racket (provide start add) (require (for-syntax syntax/parse racket/match racket/syntax)) (begin-for-synta

Re: [racket-users] #lang languages and REPL

2015-08-07 Thread Alexander D. Knauth
On Aug 7, 2015, at 4:35 PM, Alexander D. Knauth wrote: > The definition of x in `my-module-begin` doesn't work because it comes from > the macro's scope, not from the module's scope. > See > http://docs.racket-lang.org/reference/syntax-model.html#%28part._macro-int

Re: [racket-users] #lang languages and REPL

2015-08-07 Thread Alexander D. Knauth
module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([x-id (datum->syntax stx 'x)]) #'(#%module-begin (define x 2) body ...))]))) Hope this helps! Alex Knauth > Thanks for any insight here, I seem to have

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

2015-08-07 Thread Alexander D. Knauth
On Aug 7, 2015, at 12:27 PM, Michael Titke wrote: > I always suspected this to be a logical joke of forcing people to write their > own quantifiers and to not let them fall for predicate logic. > > The best thing about a logic scheme declaring everything but really > everything to be true whe

Re: [racket-users] #lang languages and REPL

2015-08-07 Thread Alexander D. Knauth
That sounds weird. You shouldn't need to do anything special with #%top-interaction or anything, so I'm not sure what's going on. How are you defining it? Can you show us some of the source code? On Aug 7, 2015, at 1:09 PM, Deren Dohoda wrote: > I have a #lang I'm working on and everything se

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

2015-08-06 Thread Alexander D. Knauth
I believe this pull request is about solving that problem: https://github.com/plt/racket/pull/928 Either through modifying `and` and `or`, or providing variations that can be used with apply and foldr (or other higher-order functions). On Aug 6, 2015, at 10:09 AM, sagyo12341...@gmail.com wrote:

Re: [racket-users] Distinct instantiations of modules

2015-08-06 Thread Alexander D. Knauth
I think namespace-attach-module is one way to do this: #lang racket (module a racket (define ns (make-base-namespace)) (namespace-attach-module (current-namespace) 'racket/promise ns) (parameterize ((current-namespace ns)) (namespace-require 'racket)) (define *promise? (namespace-variable-

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-29 Thread Alexander D. Knauth
Would it be easier using match? (define (xexpr->tok-tree an-xexpr) (match as-xexpr ['() '()] [(not (cons _ _)) (tok-make ...)] [(list tag) (list tag)] [(list-rest tag (? is-at-list at-list) r2) ] )) On Jul 29, 2015, at 7:56 AM, Thomas Lynch wrot

Re: [racket-users] Question : Local Definition

2015-07-24 Thread Alexander D. Knauth
On Jul 25, 2015, at 12:20 AM, Alexander D. Knauth wrote: > > On Jul 24, 2015, at 11:29 PM, sagyo12341...@gmail.com wrote: > >> Nice to meet you. >> >> >> I'm a racket beginner and I'm not a English speaker. Please forgive my poor >> skills.

Re: [racket-users] Question : Local Definition

2015-07-24 Thread Alexander D. Knauth
On Jul 24, 2015, at 11:29 PM, sagyo12341...@gmail.com wrote: > Nice to meet you. > > > I'm a racket beginner and I'm not a English speaker. Please forgive my poor > skills. > > In racket tutorials or HtDP, it uses some local definitions, as follows: > > (define (f x) > (local [((define g x)

Re: [racket-users] Macro to extract select subexpressions into other locations

2015-07-21 Thread Alexander D. Knauth
Oh. I checked that that the expressions were accumulating in the definition of extract-expression, but I didn't check that it expanded in the right order to do what you want. So this doesn't actually work. On Jul 21, 2015, at 3:08 PM, Alexander D. Knauth wrote: > Here's

Re: [racket-users] Macro to extract select subexpressions into other locations

2015-07-21 Thread Alexander D. Knauth
Here's a macro that does something similar: #lang at-exp racket (require (for-syntax syntax/parse racket/contract )) (begin-for-syntax (define (get-extracted-exprs-box extracted-exprs-id) (syntax-local-value extracted-exprs-id)) (define (get-extr

Re: [racket-users] Macro introduce identifiers in the new expander

2015-07-20 Thread Alexander D. Knauth
I don't really know what's going on, but this might help: ;; It seems to be introducing the definition correctly, but not the use: ;; this works (let () (def) ; no difference between (def) and (define id 5) id) ;; this doesn't (let () (def) (use)) ; but there is a difference between (use)

Re: [racket-users] Current snapshot: problem with generic interfaces and contracts

2015-07-19 Thread Alexander D. Knauth
On Jul 19, 2015, at 10:34 PM, Alexander D. Knauth wrote: > This is a simplified example of something that worked in racket version > 6.2.0.4 from 2015-06-08, but is now broken in version 6.2.900.4 from > 2015-07-17. > > gen-foo.rkt: > #lang racket > (provide gen:foo foo

[racket-users] Current snapshot: problem with generic interfaces and contracts

2015-07-19 Thread Alexander D. Knauth
This is a simplified example of something that worked in racket version 6.2.0.4 from 2015-06-08, but is now broken in version 6.2.900.4 from 2015-07-17. gen-foo.rkt: #lang racket (provide gen:foo foo? foo/c (contract-out [bar (foo? . -> . any/c)])) (require racket/generic) (define-generics foo

[racket-users] Is there a sequence combinator with a for*-like behavior?

2015-07-12 Thread Alexander D. Knauth
I'm wondering if there's anything I can use so that (for/whatever ([(v1 v2 v3) (in-for*-sequence seq1 seq2 seq3)]) ) Would be equivalent to (for*/whatever ([v1 seq1] [v2 seq2] [v3 seq3]) ) The reason I want this because with using for*, I'm constrained by the syntax, and I can't us

Re: [racket-users] How to specify fallbacks for generic interfaces without going into an infinite loop?

2015-07-06 Thread Alexander D. Knauth
ic gen-b b) > > (define (a foo) > (displayln "a-fallback") > (gen-b foo)) > (define (b foo) > (displayln "b-fallback") > (gen-a foo))]) > > (struct foo-struct () > #:methods gen:foo > [(define (a foo) 1)]) > > (b (foo-struct)) >

[racket-users] How to specify fallbacks for generic interfaces without going into an infinite loop?

2015-07-06 Thread Alexander D. Knauth
What is the proper way to do this? This goes into an infinite loop: #lang racket/base (require racket/generic) (define-generics foo (a foo) (b foo) (c foo) #:fallbacks [(define (a foo) (displayln "a-fallback") (b foo)) (define (b foo) (displayln "b-fallback") (a foo

Re: [racket-users] help please on git/github pull request

2015-07-02 Thread Alexander D. Knauth
On Jul 2, 2015, at 1:53 PM, John Clements wrote: > >> On Jul 2, 2015, at 7:31 AM, Alexander D. Knauth wrote: >> After you resolve them you will (I think) need to `git add` the files that >> you resolved conflicts for, then >> `git rebase --continue`, and then

Re: [racket-users] help please on git/github pull request

2015-07-02 Thread Alexander D. Knauth
On Jul 2, 2015, at 6:34 AM, Tim Brown wrote: > Folks, > > I have two pull requests related to my separation of "net/url-string" > from "net/url". > > plt/racket #948 implementation of the separation > racket/net #4test and documentation of the above > > My problem is that I have been wor

Re: [racket-users] generalised set! in Racket

2015-07-01 Thread Alexander D. Knauth
On Jul 1, 2015, at 4:27 AM, Alexey Cherkaev wrote: > Hi all, > > Thanks to all replies, at the moment I would tend to agree that generalised > `set!` might not be such a great idea after all: > The notion of 'place' is essentially a pointer to a memory location, but it > is not the first-clas

Re: [racket-users] generalised set! in Racket

2015-06-30 Thread Alexander D. Knauth
On Jun 30, 2015, at 5:34 PM, 'John Clements' via Racket Users wrote: > Specifically, one of the basic ideas of algebraic languages is that programs > are compositional. Specifically, if I write (a (b x) c), then the meaning of > this term depends on the meanings of a, (b x), and c. That is, I

Re: [racket-users] generalised set! in Racket

2015-06-29 Thread Alexander D . Knauth
On Jun 29, 2015, at 5:56 AM, Alexey Cherkaev wrote: > For example, I was thinking of defining syntax to access my implementation of > multidimensional arrays > as > > (define-syntax aref > (syntax-rules (set!) >[(set! (aref ?a ?i ...) ?v) (array-set! ?a ?i ... ?v)] >[(aref ?a ?i ...)

Re: [racket-users] Fast way to map over a list many times, changing ONE element each time?

2015-06-26 Thread Alexander D. Knauth
Is there a split-at-reverse anywhere, equivalent to split-at except that the first return value is reversed? If not, should that be added somewhere like srfi/1? I’m asking because wanted to be able to write functions like: (define ((drop-lens n) lst) (define-values [fst-lst rst-lst] (split-at-

Re: [racket-users] try a new macro expander

2015-06-25 Thread Alexander D. Knauth
erlooked `splicing-local`, and I'll repair it. Thanks for the > report! > > At Wed, 24 Jun 2015 20:27:39 -0400, "Alexander D. Knauth" wrote: >> I’ve just found something that I expected to work, but didn’t: >> >> #lang racket/base >> (require racket/

Re: [racket-users] try a new macro expander

2015-06-24 Thread Alexander D. Knauth
I’ve just found something that I expected to work, but didn’t: #lang racket/base (require racket/splicing (for-syntax racket/base)) (splicing-local [(define x 1)] (define-syntax outer-x (make-rename-transformer #'x))) outer-x ;. outer-x: unbound identifier in module in: outer-x This works

Re: [racket-users] Closing big-bang windows

2015-06-21 Thread Alexander D. Knauth
On Jun 21, 2015, at 10:18 PM, Neil Toronto wrote: > I'm working on a `big-bang3d` game intended to expose shortcomings in > universe-style programs when used at a larger scale than in the classroom. > Here are my main criticisms so far: > > 1. Adding new state is painful. Every time I add a l

Re: [racket-users] Defining contracts sanely

2015-06-21 Thread Alexander D. Knauth
On Jun 21, 2015, at 5:41 AM, Aidan Gauland wrote: > Say I want to define a flat contract for the "freshness" field of my > fish class, so I define a contract for it like so: > > (define/contract fish-freshness/c > (-> any/c > boolean?) > (flat-named-contract 'fish-freshness/c >(lambd

Re: [racket-users] Macro-introducing macros with inter-macro communication channel

2015-06-20 Thread Alexander D. Knauth
On Jun 19, 2015, at 7:44 PM, Thomas Dickerson wrote: > I was intending for that example to have the variables be defined outside the > macro, but being able to create the (set! ...) forms outside should mean I > could also hypothetically create let/define-values forms. This is why I > origin

Re: [racket-users] Reporting Simple Bugs and Fixing Them

2015-06-20 Thread Alexander D. Knauth
On Jun 20, 2015, at 12:39 PM, Kartik Singhal wrote: > On Friday, June 19, 2015 at 7:14:56 AM UTC+5:30, Alex Knauth wrote: >> Also, if you’re interested, I found this blog post helpful: >> http://www.greghendershott.com/2013/04/a-guide-for-infrequent-contributors-to-racket.html >> Although for th

Re: [racket-users] Macro-introducing macros with inter-macro communication channel

2015-06-19 Thread Alexander D. Knauth
Are the x, y, and z variables meant to be defined outside the macro by the user as in: (let ([x “something”] [y “something else”] [z “and something else”]) (Loop ….)) ? Or should the Loop macro create a (let ([x 0] [y 0] [z 0]) ….) for you instead? On Jun 19, 2015, at 5:58 PM, Thomas Dickerson

Re: [racket-users] Reporting Simple Bugs and Fixing Them

2015-06-18 Thread Alexander D. Knauth
You could probably use either one, but a github pull request would be more helpful, I think. Also, if you’re interested, I found this blog post helpful: http://www.greghendershott.com/2013/04/a-guide-for-infrequent-contributors-to-racket.html Although for the HTDP student languages you’d want to

Re: [racket-users] DrRacket rendering issues OS X

2015-06-17 Thread Alexander D. Knauth
One data point: I’m using DrRacket version 6.2.0.4--2015-06-08 with OS X Version 10.9.5, and if I remember correctly it was a Racket plus Tests 64-bit installation. I tried those steps, and it worked fine, with no weird black areas, though I do remember occasionally getting similar small black ar

[racket-users] 3d-syntax and sharing values between "read-time" and run-time?

2015-06-15 Thread Alexander D. Knauth
I just tried doing something for Asumu Takikawa’s `#lang clojure` with reading sets. In the reader module #{1 2 3} is read, and the reader returns a syntax object created with (datum->syntax … (list->set …) …) And then if I write (quote #{1 2 3}), it actually works? I’m a bit pleasantly surpri

Re: [racket-users] iso-recursive types not allowed in TR?

2015-06-15 Thread Alexander D. Knauth
On Jun 13, 2015, at 8:18 AM, Hendrik Boom wrote: > On Fri, Jun 12, 2015 at 06:06:05PM -0700, 'John Clements' via users-redirect > wrote: >> On Jun 12, 2015, at 5:52 PM, Alexander D. Knauth >> wrote: >>> On Jun 12, 2015, at 8:30 PM, 'Joh

Re: [racket-users] iso-recursive types not allowed in TR?

2015-06-13 Thread Alexander D. Knauth
On Jun 13, 2015, at 12:18 AM, 'John Clements' via users-redirect wrote: > Okay, I shouldn’t change topics, but while I’ve got you (guys): it looks like > (module+ test …) now works in TR, but not when there are imported bindings… > suppose I have foo.rkt: I’ve run into similar problems with

Re: [racket-users] iso-recursive types not allowed in TR?

2015-06-12 Thread Alexander D. Knauth
On Jun 12, 2015, at 8:30 PM, 'John Clements' via users-redirect wrote: > Here’s the type I want to write: > > (define-type (HuffJsexpr T) > (U T (HashTable Symbol HuffJsexpr))) Do you mean this? (define-type (HuffJsexpr T) (U T (HashTable Symbol (HuffJsexpr T #lang typed/racket (defi

Re: [racket-users] System Scheme (RnRS): Shared Secret Generator

2015-06-12 Thread Alexander D. Knauth
On Jun 12, 2015, at 9:35 AM, Michael Titke wrote: > On 12/06/2015 13:21, Konrad Hinsen wrote: >> Seeding is provided for two use cases: 1) Reproducibility, ... 2) "Real" >> randomization, by setting the seed from some unpredictable source, such as >> the system time. In both cases, the idea i

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Alexander D. Knauth
I have never worked with a canvas% before (I have worked with a lot of other racket gui stuff), so I have no idea what’s going on, but watch what happens with this: #lang racket (require racket/gui/base) (define frame (new frame% [label "Example"] [width 300]

Re: [racket-users] How to check for existing definitions

2015-05-31 Thread Alexander D. Knauth
On May 24, 2015, at 3:20 AM, Michael Tiedtke wrote: > I can of course use /version/ to check for Racket's version but this doesn't > take > patches or third party libraries/modules into account. I was just re-reading this, and for your particular use case this has been answered already by L

Re: [racket-users] Capturing sets of options in a splicing syntax class?

2015-05-27 Thread Alexander D. Knauth
Does this work for what you want to do? #lang racket (require syntax/parse) (define-syntax ~opts (pattern-expander (lambda (stx) (syntax-case stx () [(opts [kw id] ...) (with-syntax ([ooo (quote-syntax ...)]) #'(~seq (~or (~optional (~and (~seq kw) (~seq id ooo)

Re: [racket-users] How to check for existing definitions

2015-05-27 Thread Alexander D. Knauth
On May 27, 2015, at 6:13 AM, Michael Tiedtke wrote: > I'm a little bit astonished that Racket doesn't offer a defined? primitve > when it's not > possible to implement it with macros because of the strange compile-time > behavior. Here’s a fairly useless macro that can tell if a given identi

Re: [racket-users] Flower Garden: Open Flowers

2015-05-25 Thread Alexander D. Knauth
You could also try other options for package sources, which includes things like .zip files and .plt files, in addition to github repositories. http://docs.racket-lang.org/pkg/Package_Concepts.html#%28part._concept~3asource%29 I have no experience with using anything other than a github repositor

Re: [racket-users] test amazes me

2015-05-24 Thread Alexander D. Knauth
Look at what this does: #lang racket (require test-engine/racket-tests) (check-expect 1 1) (check-expect 2 2) (check-expect 3 3) (check-expect (displayln "hello") (displayln "world")) (test) (test) Welcome to DrRacket, version 6.2.0.3--2015-05-17(542b960/a) [3m]. Language: racket [custom]; memory l

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-24 Thread Alexander D. Knauth
Also opaque types might help you: http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._require%2Ftyped%29%29 http://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fbase-types-extra..rkt

[racket-users] Is there a way to access test submodule from repl in DrRacket?

2015-05-23 Thread Alexander D. Knauth
Is there a way to access definitions in the test submodule from the repl in DrRacket as if I were in the repl of the test submodule? I tried these and they didn’t work: #lang racket (require racket/enter) (module+ test (define x 3)) > (enter! (submod "try-repl-submod-test.rkt" test)) > x x: u

Re: [racket-users] Typed racket equivalent of Haskell newtype?

2015-05-23 Thread Alexander D. Knauth
As far as I know, this doesn’t exist in typed racket currently, but I’m wondering: (I’m thinking of seeing if I can implement this when I have time this summer) How should sub-typing interact with this? Should it be a completely separate type, not related by sub-typing at all, or should the ne

Re: [racket-users] racket versus racket/base

2015-05-23 Thread Alexander D. Knauth
It sounds to me like you're understanding this perfectly. racket provides all of racket/base for-syntax. On May 23, 2015, at 1:52 PM, Jos Koot wrote: > This works: > > #lang racket > (define-syntax (x y) (syntax-case y () (_ (syntax (quote monkey) > x ; -> monkey > > This does not work >

[racket-users] Is there a way for a function to tell how many values it's caller expects? (the continuation expects?)

2015-05-22 Thread Alexander D. Knauth
Is there a way for a function to tell how many values it’s caller expects it to return? I’ve tried this and it didn’t work: #lang racket (define (show-k-arity) (let/ec k (error 'print-k-arity "the arity of k is ~v" (procedure-arity k (let-values ([(x y) (show-k-arity)]) (void)) -- Yo

Re: [racket-users] disappeeraing binding arrows

2015-05-22 Thread Alexander D. Knauth
Oh, I thought you were talking about the arrows within the *use* of stx-case. I just realized they don’t work within the *definition* of the second version of stx-case. That is weird. On May 22, 2015, at 3:37 PM, Alexander D. Knauth wrote: > For me the arrows seem to work fine for b

Re: [racket-users] disappeeraing binding arrows

2015-05-22 Thread Alexander D. Knauth
For me the arrows seem to work fine for both versions. I tried it with racket version 6.1.1 and a racket snapshot build version 6.2.0.3--2015-05-17. Which arrows aren’t working for you? On May 22, 2015, at 1:40 PM, Jos Koot wrote: > Below two versions of a very stripped version of a macro I hav

Re: [racket-users] test submodules vs tests in separate file

2015-05-22 Thread Alexander D. Knauth
On May 22, 2015, at 8:19 AM, Robby Findler wrote: > Contracts mediate boundaries between parts of your program and sometimes > tests should go across the boundary (to help test the contracts) and > sometimes they should go inside (to test internal functions). You have to > pick one or the oth

Re: [racket-users] test submodules vs tests in separate file

2015-05-22 Thread Alexander D. Knauth
If you want to have the contracts enforced in the test submodule, all you have to do is add (require (submod “..”)) to the submodule. You don’t need to use define/contract, and you don’t need to use module* instead of module+. You can just use #lang racket (provide (contract-out ; convert

Re: [racket-users] Scribble abstraction to attach styles

2015-05-21 Thread Alexander D. Knauth
I don’t know if there’s a better more general solution, but does this do what you want? @(define exercise-style (make-style "exercise" (list (attributes '([style . "margin-left: 0em"]) @(define question-style (make-style "question" (list (attributes '([style . "margin-left: 0em"]) @(defi

Re: [racket-users] Doing pattern matching by reader macro

2015-05-20 Thread Alexander D. Knauth
Here’s one way to do something like that with a macro: https://github.com/AlexKnauth/define-match-spread-out/blob/master/define-match-spread-out/main.rkt And using it: https://github.com/AlexKnauth/define-match-spread-out/blob/master/define-match-spread-out/tests/test.rkt On May 18, 2015, at 9:39

Re: [racket-users] Re: Specifying a contract for the end of a list

2015-05-20 Thread Alexander D. Knauth
Would an append/c combinator be a good generalization of this? I’ve already made an append/c combinator that works with just flat-contracts, but is there a good way to make it work for chaperone contracts? https://github.com/AlexKnauth/match-string/blob/master/match-string/main.rkt#L205 http://p

Re: [racket-users] Strange behaviour of the eq? operator in racket repl

2015-05-18 Thread Alexander D. Knauth
On May 18, 2015, at 1:19 AM, Michael Tiedtke wrote: > I'm new to Racket but even R5RS is rather clear about this issue: > > (citation from doc/r5rs/r5rs-std/r5rs-Z-H-9.html) >> (eq? 2 2) ===> unspecified In Racket, (eq? 2 2) is specified as true. It says here: http://docs.racket-lang.org/

Re: [racket-users] little problem with comma (unquote)

2015-05-14 Thread Alexander D. Knauth
Do you want this: #lang racket (define f 'insertar-empleado) (define exp `(embed/url ,f)) (define (make-func) (define str `(define (func) ,(list 'unquote exp))) str) (display (make-func)) ? On May 14, 2015, at 2:41 PM, Héctor Mc wrote: > Hi for all > I'm trying generate a function f

Re: [racket-users] Getting a sandboxed evaluator to work with a custom #lang's reader

2015-05-12 Thread Alexander D. Knauth
I managed to put this together: https://github.com/AlexKnauth/scribble-code-examples On May 12, 2015, at 7:10 AM, Alexis King wrote: > Continuing my attempts to make a working meta-language, I'm now working on > improving the documentation. I'd like to be able to use “interaction” from > scrib

Re: [racket-users] Getting a sandboxed evaluator to work with a custom #lang's reader

2015-05-12 Thread Alexander D. Knauth
Is there a way to show examples in scribble docs that uses code? If there’s not, would something like this be good: @code-examples[#:lang “at-exp racket”]|{ (+ 1 2) @+[1 2] }| Renders as: Examples: > (+ 1 2) 3 > @+[1 2] 3 ? On May 12, 2015, at 7:10 AM, Alexis King wrote: > Continuing my

Re: [racket-users] Why doesn't my readtable extension work in the REPL?

2015-05-11 Thread Alexander D. Knauth
On May 11, 2015, at 4:22 PM, Alexis King wrote: > I’ve gotten my curly-fn meta-language working, and it works great within a > module. However, evaluating #{+ 2} within the REPL just evaluates as a plain > old vector, ignoring my readtable extension. > > What gives? Using @-expression syntax

[racket-users] testing with scope-set expander on Travis CI?

2015-05-10 Thread Alexander D. Knauth
I want to test some of my packages on travis with the Matthew Flatt's scope-set expander. Right now I’m using Greg Hendershott’s way of setting up the .travis.yml, described here: http://www.greghendershott.com/2013/07/using-travis-ci-for-racket-projects.html I tried modifying that to support t

[racket-users] another strange typed racket error

2015-05-09 Thread Alexander D. Knauth
I have been getting an error with one of my packages, and I finally figured out a minimal example of how it breaks. If I have these files: tr-submod-error/lib.rkt: #lang typed/racket (provide x) (define x : Natural 3) (module* untyped racket/base (require (submod "..")) (provide (all-from-ou

Re: [racket-users] strange typed-racket contract error

2015-05-08 Thread Alexander D. Knauth
: 3.141592653589793 in: #f contract from: (interface for pi) blaming: (interface for pi) (assuming the contract is correct) at: unsaved-editor:3.28 So should require/typed produce a syntax error about being used in an untyped context? On May 8, 2015, at 5:44 PM, Alexander D. Knauth wrote: > T

Re: [racket-users] strange typed-racket contract error

2015-05-08 Thread Alexander D. Knauth
Tobin-Hochstadt wrote: > This appears to be a bug -- my guess is that the contract isn't > actually generated, and thus turns into `#f` -- that's what > `require/typed` expands to, before TR inserts the real contract. > > Sam > > On Fri, May 8, 2015 at 5:26 PM, Ale

[racket-users] strange typed-racket contract error

2015-05-08 Thread Alexander D. Knauth
I have this file: #lang typed/racket (provide x) (define x : Natural 3) (module* main racket/base (require typed/racket/base) (require/typed (submod "..") [x Natural])) I get this strange error message: . . ../../../../../Applications/Racket/April-24/Racket v6.2.0.2/collects/

Re: [racket-users] performance with freeze from 2htdp/image on very complex images

2015-05-06 Thread Alexander D. Knauth
nside the library. (I tried > to cut some corners in add-line but to no avail.) > > Sorry, > Robby > > > > On Mon, May 4, 2015 at 10:33 PM, Alexander D. Knauth > wrote: >> >> On May 4, 2015, at 6:02 PM, Robby Findler >> wrote: >> >> Another

Re: [racket-users] Syntax parameters and renaming

2015-05-06 Thread Alexander D. Knauth
In case you find it interesting, here’s a macro in the implementation of syntax-parse that is similar in spirit: http://git.racket-lang.org/plt/blob/HEAD:/racket/collects/syntax/parse/private/runtime.rkt#l42 On May 6, 2015, at 1:21 AM, Jack Firth wrote: > I find that 99% of the time when I'm us

Re: [racket-users] performance with freeze from 2htdp/image on very complex images

2015-05-05 Thread Alexander D. Knauth
On May 5, 2015, at 10:06 AM, Robby Findler wrote: > One of the issues is that the racket/draw version is not doing the > cropping that the 2htdp/image version is doing. Changing the > "scene+line" call in utils.rkt to "add-line" cuts the freeze time in > half for me (using size 242 instead of 72

Re: [racket-users] performance with freeze from 2htdp/image on very complex images

2015-05-04 Thread Alexander D. Knauth
On May 4, 2015, at 6:02 PM, Robby Findler wrote: > Another approach here would be to help me do performance debugging of > 2htdp/image :). You could write the code directly as imperative calls > to the dc<%> interface and see how that compares. If there's a > significant difference, that suggest

Re: [racket-users] performance with freeze from 2htdp/image on very complex images

2015-05-04 Thread Alexander D. Knauth
On May 4, 2015, at 6:02 PM, Robby Findler wrote: > It certainly can lose sharpness if you scale (as the freezing process > is basically just rendering them into bitmaps and then drawing the > bitmaps and scaling the bitmaps looses quality because the scaling for > process of bitmaps doesn't have

Re: [racket-users] performance with freeze from 2htdp/image on very complex images

2015-05-04 Thread Alexander D. Knauth
On May 4, 2015, at 12:49 AM, gfb wrote: > Those are beautiful. Thanks! > First, make sure in Choose Language / Show Details that it's set to "No > debugging or profiling", and that "Preserve stacktrace" not set. Already have that, but thanks for checking. > The 2htdp/image library has immut

[racket-users] performance with freeze from 2htdp/image on very complex images

2015-05-03 Thread Alexander D. Knauth
I’m trying to use 2htdp/image to generate images of fractals. But while generating the images is “relatively” quick, it is freezing the images that’s taking a long time. For the most complicated one, I started it running two nights ago, and the freeze operation on it still hasn’t finished. For

Re: [racket-users] Rosetta Code: Level 1st (that's FIRST) with TCL

2015-04-29 Thread Alexander D. Knauth
Would it make sense to implement solutions for #lang sweet-exp racket ? Alex Knauth On Apr 28, 2015, at 7:38 PM, Tim Brown wrote: > Folks, > > I've just done a quick burst of cherry picking tasks on Rosetta > Code (www.rosettacode.org). I took a quick look at: > * http://rosettacode.org/wiki/C

Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-26 Thread Alexander D. Knauth
Well probably check-equal?, check-match, check-pred, check, and check-exn would be the main ones, with check-equal? probably being the most important, but what would be really cool would be something that could generalize over all rackunit checks, so that even checks defined with define-check, d

Re: off-topic --- Re: [racket-users] Racketeer - Continuous Testing Plugin for DrRacket

2015-04-26 Thread Alexander D. Knauth
On Apr 26, 2015, at 2:39 PM, Matthias Felleisen wrote: > > On Apr 26, 2015, at 9:18 AM, Alexander D. Knauth wrote: > >> I wanted to see if it could work for tests within (module+ test …), and it >> does (even though check-expect doesn’t, which is weird for check-expec

  1   2   3   4   5   >