Re: [racket-users] Dozens and dozens of interdependent modules, better to use include?

2015-05-28 Thread Daniel Feltey
If the issue you're facing is mutual dependencies between modules, then using units[1] is one possible solution. Units are first-class modules that allow cyclic linking, and would avoid the need to use include. In particular using #lang racket/unit [2] may be useful to convert each the

Re: [racket-users] Long-term Runtime session state

2015-10-13 Thread Daniel Feltey
> I just never found any good docs on how to do that. Near as I can tell, runtime linking of a unit is even MORE verbose and persnickety than just > manually typing in all the procedures you want to pass to a callback Some of the verbosity of units can be reduced using the "inference" features

Re: [racket-users] Redex: call for alpha-equivalence beta testers

2015-09-19 Thread Daniel Feltey
> and then get Paul's version: > > cd redex > git remote add paul https://github.com/paulstansifer/redex-1.git > git checkout public > raco setup This didn't quite work for me the first time I tried it, I needed to run `git fetch paul` before the checkout to make it work. Looking forward

Re: [racket-users] read-line reads only a character at a time from file.

2015-12-17 Thread Daniel Feltey
I think the issue is that `read-line` is returning a string, so in every iteration of the for loop line is bound to a single character from that string, I think you may want to use `in-lines`[1] instead of `read-line`. [1]:

Re: [racket-users] Cycle in loading. Units, (sub)modules, files...

2016-01-08 Thread Daniel Feltey
This doesn't quite answer your question, but another possibility that would allow you to separate the a@ and b@ unit implementations in separate files is to put all of your signature definitions in a single file that will be required by both "a.rkt" and "b.rkt". In my experience, this strategy is

Re: [racket-users] why this error?

2016-04-26 Thread Daniel Feltey
Can you give a little more context? I tried running your program in DrRacket and it seems to work, or at least I don't get the error you're seeing. Dan On Tue, Apr 26, 2016 at 7:39 PM, Andreas Petrou wrote: > My code is here:) > ;3.) A function called allDiff? that takes

Re: [racket-users] Re: Mixin questions

2016-08-10 Thread Daniel Feltey
When you write (mixin (drracket:unit:frame<%>) (drracket:unit:tab<%>) ;; body ...) This produces a function that takes classes which implement the drracket:unit:frame<%> interface and produces classes that implement the drracket:unit:tab<%> interface. In the body of the mixin you can only

[racket-users] Mixin questions

2016-08-11 Thread Daniel Feltey
If you want to inherit from both the frame and the tab in the mixin you would write something like: (mixin (drracket:unit:frame<%> drracket:unit:tab<%>) () ;; body ...) In this case the mixin will only work on classes that implement both the tab and the frame interfaces, and you can

Re: [racket-users] Question on contracts -- check equal length of args

2016-07-15 Thread Daniel Feltey
Here's a version that uses a #:pre condition: #lang racket (define/contract (tau l m) (->i ([list1 (listof (and/c exact-integer? (>/c 0)))] [list2 (listof (and/c exact-integer? (>/c 0)))]) #:pre (list1 list2) (= (length list1) (length list2)) [_ number?]) (begin

Re: [racket-users] Predictable random...so to say

2016-12-02 Thread Daniel Feltey
I think something like this works: ;; shuffle/seed : list? integer -> list? (define (shuffle/seed lst seed) (random-seed seed) (shuffle lst)) > (define a-list (list 1 2 3 4 5 6 7 8 9 10)) > (shuffle/seed a-list 0) '(3 4 9 8 5 1 10 7 6 2) > (shuffle/seed a-list 0) '(3 4 9 8 5 1 10 7 6 2) >

Re: [racket-users] refactoring help/tools?

2017-03-23 Thread Daniel Feltey
For those not tracking the DrRacket github repo, this feature is now available in the Racket snapshot builds. https://plt.eecs.northwestern.edu/snapshots/ Thanks, Dan On Wed, Mar 22, 2017 at 5:17 PM, Daniel Feltey <dfel...@ccs.neu.edu> wrote: > I think I've finally got something worki

Re: [racket-users] refactoring help/tools?

2017-03-22 Thread Daniel Feltey
appreciate any feedback you might on the tool or how it could be improved. [1]: https://github.com/racket/drracket/commit/10ac8e7d91c4d7ae7ba2dc6d929a7ec7ed9fe186 Thanks Dan On Mon, Mar 13, 2017 at 9:43 PM, Daniel Feltey <dfel...@ccs.neu.edu> wrote: > I've started working on adding this re

Re: [racket-users] What is meant to be the public API of ‘drracket:rep:text<%>’ ?

2017-04-09 Thread Daniel Feltey
I think the intention of the docs is that `drracket:rep:text<%>` is the interface for all of the methods listed under the `drracket:rep:text%` class. It looks like at the very least it extends the `racket:text<%>` interface, this is likely just an oversight in the documentation. Dan On Sun, Apr

Re: [racket-users] racket/gui -- How to implement a text% area with line number displayed?

2017-03-08 Thread Daniel Feltey
The easiest way to do this is to use the text:line-numbers-mixin in the framework. Here's an example of an editor with line numbers: #lang racket (require racket/gui framework) (define text (new (text:line-numbers-mixin text:standard-style-list%))) (define frame (new frame% [label

Re: [racket-users] refactoring help/tools?

2017-03-13 Thread Daniel Feltey
I've started working on adding this refactoring to DrRacket[1], it's not quite as full-featured(and is definitely still a bit buggy) as what racket-mode in emacs seems to allow, but it's a first step and I'd appreciate suggestions or requests on how DrRacket can better support developers editing

Re: [racket-users] unexpected behavior of parametric polymorphism in Typed Racket

2017-11-28 Thread Daniel Feltey
Sorry for the late reply to this thread, I tried to send this message yesterday, but ran into problems with my email setup. > I'm starting to think that my base assumption (that Typed Units are more or > less equivalent to ML signatures, structures, and functors) is way off. The intent is that

Re: [racket-users] What am I misunderstanding about flat-contract-with-explanation?

2018-01-05 Thread Daniel Feltey
Are you using a recent version of Racket? I see the same error in Racket 6.8, but not in more recent releases. Dan On Fri, Jan 5, 2018 at 2:15 PM, David Storrs wrote: > https://docs.racket-lang.org/reference/data-structure- >

[racket-users] Understanding prop:impersonator-of

2018-01-25 Thread Daniel Feltey
I'm trying to understand the use of the prop:impersonator-of struct property, but the following program doesn't work the way I would have expected: #lang racket (struct our-impersonate-proc (f orig) #:property prop:impersonator-of (lambda (x) (displayln 'hi) (our-impersonate-proc-orig x))

Re: [racket-users] Prefab and contracts

2018-03-20 Thread Daniel Feltey
The same behavior occurs with vectors, the program (define v (vector 1 2)) (define/contract vc (vectorof integer?) (vector 1 2)) (place-message-allowed? v) (place-message-allowed? vc) Produces: #t #f I think the issue here is that both contracted vectors and structs are wrapped in