Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-03 Thread Daniel Feltey
> It apparently doesn't run the defs _at all_. The interactive pane will > not recognize _any_ of the variables or functions that appear to be > defined in the definition pane and should form the environment (or scope > or whatever the correct word) after I click on the "Run" button. And I > don't

Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-03 Thread Daniel Feltey
Just one more question, for clarification. Are you using the `lambda` form in BSL? I ask because several examples in this thread have been using `lambda`, but I don't think that lambda expressions are actually valid in either of the beginning student languages, though I would expect you to recei

Re: [racket] TLS "atom?" definition for Scheme does not work in DrRacket

2015-03-03 Thread Daniel Feltey
> Just one more question, for clarification. Are you using the `lambda` form in > BSL? I ask because several examples in this thread have been using `lambda`, > but I > don't think that lambda expressions are actually valid in either of the > beginning student languages, though I would expect y

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 modules

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] 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 t

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]: http://docs.racket-lang.org/reference/sequences.html?q=in-lines#%28def._%2

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 f

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 th

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- > contracts.html#%28def._%28%28lib._racket%2Fcontract% > 2Fprivate%2Fmi

[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)) #:pro

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 chape

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 as parameters two list

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 (pri

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 assum

[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 no

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) > (sh

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 "edit

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 an

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

2017-03-22 Thread Daniel Feltey
rom github, I'd 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 wrote: > I've started working on adding this refactor

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 wrote: > I think I've finally got something working within DrRacket

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 9

[racket] Confused about define-values(-for-export) forms in define-signature

2014-03-31 Thread Daniel Feltey
The define-signature form allows define-values and define-values-for-export forms in its body. According to the documentation the define-values form should prefix any unit that imports the signature, and define-values-for-export should suffix any unit that exports the signature, but the actual b

[racket] Redex: exponential runtime with certain judgments

2014-07-24 Thread Daniel Feltey
I've been implementing a type system with subtyping using Redex's judgment forms and noticed that checking whether my typing judgment would hold was taking longer than seemed reasonable (5 - 10 minutes in some cases). Ultimately I tracked the bug down to a clause in the subtyping judgment that

Re: [racket] Typed Racket frustration

2014-10-30 Thread Daniel Feltey
> I wouldn't expect the type checker to support all working plain Racket > code. But I do expect Typed Racket to provide equivalent (though > possibly syntactically different) APIs for common tasks such as > creating an immutable hash table from key-value pairs. > > I suppose the problem with hash

[racket] language-info in #lang typed/racket files vs. (module _ typed/racket ...) files

2014-11-24 Thread Daniel Feltey
I'm trying to use `module->language-info` to determine if a module I am requiring is written in typed/racket or racket, since if the module is implemented in racket `module->language-info` will return #f, but a vector if the module was typed. The problem I'm running into is that with files of

Re: [racket] Problem with structs and #lang racket/signature

2015-02-04 Thread Daniel Feltey
Looking at the expansion in the macro stepper of 1. ;; --- #lang racket/signature (struct foo (bar)) 2. ;; --- #lang racket (define-signature foo^ ((struct foo (bar It looks like in the first case a un