Re: [racket] Typed Racket procedure wrapping?

2013-02-05 Thread Eric Dobson
I don't get why TR should use a custom contract instead of case-> providing better error messages. You get the same error message with: #lang racket (define/contract (f) (case->) 2) (f 2) ;(f) On Tue, Feb 5, 2013 at 8:10 PM, Matthias Felleisen wrote: > > On Feb 5, 2013, at 4:17 PM, Asumu Taki

[racket] Module Availability

2013-02-08 Thread Eric Dobson
I'm trying to understand why TR requires a module that it doesn't actually use in the file that requires it. The requirement is unstable/contract in typed-racket/type-racket.rkt. Without it tests/typed-racket/succeed/succed-cnt.rkt fails. But when I try to reduce the test case to not use TR, I can

Re: [racket] Module Availability

2013-02-08 Thread Eric Dobson
et it works. On Fri, Feb 8, 2013 at 9:35 AM, Sam Tobin-Hochstadt wrote: > On Fri, Feb 8, 2013 at 12:26 PM, Eric Dobson > wrote: > > I'm trying to understand why TR requires a module that it doesn't > actually > > use in the file that requires it. > >

Re: [racket] require/typed to a struct type

2013-02-08 Thread Eric Dobson
Its the same reason that this program gives an error. #lang racket (define/contract (f x) (my-struct? . -> . number?) 1) (struct my-struct ()) (f (my-struct)) Do you expect this to work? We could replace uses of my-struct? with (lambda (x) (my-struct? x)) but I wonder if the optimizer wil

Re: [racket] Racket without thread-local storage?

2013-02-25 Thread Eric Dobson
Racket's thread cells are local to 'Racket Threads', so I doubt that they map to OS level thread local storage, and thus would work fine. On Mon, Feb 25, 2013 at 8:07 PM, Neil Toronto wrote: > On 02/25/2013 06:17 PM, Matthew Flatt wrote: > >> At Tue, 26 Feb 2013 01:30:18 +0100, Juan Francisco Ca

Re: [racket] Typed Racket, Generics Support

2013-03-08 Thread Eric Dobson
I cannot speak for the other TR devs but this is nowhere on my radar, I'm currently dealing with all the open bugs (and there are a lot of these). On Fri, Mar 8, 2013 at 8:31 AM, Ray Racine wrote: > The possibility(s) of TR support for Generics is salivating. Any current > activity in this direc

Re: [racket] code review request for LRU code

2013-03-12 Thread Eric Dobson
Why cannot that contract be checked? It seems that since the or/c is the unwrapping of the parametric contracts it should be possible, since the first order checks should differentiate them. On Tue, Mar 12, 2013 at 8:46 PM, Asumu Takikawa wrote: > On 2013-03-12 13:16:02 -0700, Danny Yoo wrote: >>

Re: [racket] Rounding

2013-03-16 Thread Eric Dobson
The docs say that it is round to even, which is the standard for floating point numbers [1]. You can write your own rounding operator that rounds .5 up if need be. ;; Untested (define (my-round n) (let ((r (round n))) (if (= .5 (- n r)) (add1 r) r))) [1] http://en.wikipedia.org/wiki/Rounding#Ro

[racket] Marking dependencies on dynamically required modules.

2013-03-19 Thread Eric Dobson
I have two files a.rkt and b.rkt, a.rkt dynamically requires b.rkt at syntax time. a.rkt: #lang racket (require (for-syntax compiler/cm-accomplice)) (define-syntax (go stx) (dynamic-require "b.rkt" #f) #''success) (go) b.rkt: #lang racket (when #f (error 'this-might-break)) If I compile

Re: [racket] Marking dependencies on dynamically required modules.

2013-03-20 Thread Eric Dobson
It looks like these get turned into collects paths automatically (for paths in collects dir), and other modules that are required normally have the complete path already in deps and this is no different. So cm-accomplice will solve my issue. On Tue, Mar 19, 2013 at 10:29 PM, Eric Dobson wrote

[racket] Understanding raco make and its correctness guarantees

2013-03-20 Thread Eric Dobson
I'm trying to understand what are the guarantees that raco make is meant to provide. I'm going to limit this to simple programs, no fancy dynamic requires, or trying to trick the compiler. In the following scenario: 1. Edit files 2. run 'raco make ' 3. Change files I expect all of these to have th

Re: [racket] Understanding raco make and its correctness guarantees

2013-03-21 Thread Eric Dobson
ore > recompiles a.rkt AND b.rkt. > > Version 3 should as far as i understand never differ, assumed raco make > works. > > Tobias > > > > On Thu, 21 Mar 2013 06:23:24 +0100, Eric Dobson > wrote: > >> I'm trying to understand what are the guarantees t

Re: [racket] Understanding raco make and its correctness guarantees

2013-03-21 Thread Eric Dobson
wrote: > Or use DrRacket and turn on the auto compilation feature. Or set up > compiler/cm yourself to do that. > > Robby > > > On Thu, Mar 21, 2013 at 10:16 AM, Eric Dobson > wrote: >> >> That doesn't explain why I can get the same behavior as the macro w

Re: [racket] Understanding raco make and its correctness guarantees

2013-03-21 Thread Eric Dobson
rkt > I would really love to see this functionality as a command line option to > the console racket > > Tobias > > > > > > On Thu, 21 Mar 2013 16:31:51 +0100, Eric Dobson > wrote: > >> So anyone who just uses the command line tools is out of luck? I like >&g

Re: [racket] C++ FFI

2013-04-04 Thread Eric Dobson
Write a C wrapper. Thats what llvm does, and how my racket bindings use it. On Wed, Apr 3, 2013 at 8:16 PM, Vehm Stark wrote: > This was discussed on the PLT Scheme list back in 2006 but I wonder if > anyone has any new advice for doing FFI with a C++ library. > > Racket Us

[racket] Testing macro helpers

2013-04-06 Thread Eric Dobson
I am trying to test a helper to a macro. It generates a syntax object with bindings at phase-1, this is then returned by the macro and it correctly evaluates. Is there a way to not go through the macro, but still evaluate the syntax-object with those bindings it has at phase-1 relative to the helpe

Re: [racket] Testing macro helpers

2013-04-06 Thread Eric Dobson
Ryan Culpepper wrote: > On 04/07/2013 01:24 AM, Eric Dobson wrote: >> >> I am trying to test a helper to a macro. It generates a syntax object >> with bindings at phase-1, this is then returned by the macro and it >> correctly evaluates. Is there a way to not go through

Re: [racket] Testing macro helpers

2013-04-07 Thread Eric Dobson
hase 1. > > Robby > > > On Sun, Apr 7, 2013 at 1:47 AM, Eric Dobson wrote: >> >> The issue with that is that it runs the code (compute) at phase1, when >> I need to run that code at phase 0, otherwise compiling the module >> runs the tests. I'm willing

Re: [racket] Typed Racket generalization and inference for containers

2013-04-07 Thread Eric Dobson
This is already fixed at HEAD, https://github.com/plt/racket/commit/1334e8dcc77854ac826306d3f6a36150cb0bf0c1 has the fix. On Sun, Apr 7, 2013 at 7:47 AM, Sam Tobin-Hochstadt wrote: > On Sun, Apr 7, 2013 at 10:18 AM, Andrey Larionov wrote: >> Hello, Racket community. >> I'm a newbie and just star

Re: [racket] Using syntax/parse, how to accept keyword arguments in any order yet not allow duplicates?

2013-04-07 Thread Eric Dobson
You want ~once. See http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7eonce%29%29 and http://docs.racket-lang.org/syntax/More_Keyword_Arguments.html?q=syntax-parse. On Sun, Apr 7, 2013 at 5:23 PM, Scott Klarenbach wrote: > Hi t

Re: [racket] fingertree / nested datatype

2013-04-10 Thread Eric Dobson
Quick answer is to replace (define-type (Fingertree a) (U Empty (Single a) (Deep a))) With (struct: (a) Fingertree ((v : (U Empty (Single a) (Deep a) Still looking into understanding what is going on, but I believe you will need to introduce a Rec somewhere to get it how you want. On Wed, Apr

Re: [racket] fingertree / nested datatype

2013-04-10 Thread Eric Dobson
one does not. I understand why this works in the implementation, but don't know the theoretical reason why the implementation prevents it, since Indirect and Deep should be isomorphic. On Wed, Apr 10, 2013 at 9:43 PM, Eric Dobson wrote: > Quick answer is to replace > (define-type (Finge

Re: [racket] fingertree / nested datatype

2013-04-11 Thread Eric Dobson
Sam: Currently all the fail tests for TR pass if this check is removed, can you add one that exposes the issues around subtyping? On Thu, Apr 11, 2013 at 6:33 AM, Anthony Carrico wrote: > On 04/11/2013 09:26 AM, Sam Tobin-Hochstadt wrote: >> This is indeed something we've run into before. See sec

Re: [racket] fingertree / nested datatype

2013-04-13 Thread Eric Dobson
I believe this is the issue that the the check is trying to prevent. Sam, can you explain how the indirection is supposed to solve this? What is currently happening is we ask: (subtype (Deep Number) (Deep Any)), which computes (subtype (Indirect (List Number)) (Indirect (List Any))), which then c

[racket] syntax-parse and matching ordered optional keyworded expressions

2013-05-05 Thread Eric Dobson
I'm trying to improve the struct: form in TR, and one of the things I need to do is match a sequence of keyworded expressions, add annotations on the expressions, and then put them back into the same order. I can either do a large ~or clause and have optional constraints on each clause, but If I d

Re: [racket] syntax-parse and matching ordered optional keyworded expressions

2013-05-05 Thread Eric Dobson
> output for that keyword. > You could also trust that syntax-parse will parse your dotted ~or in order > and have ~do forms that populate a data structure via mutation and bump up a > counter each time. > > -Ian > ----- Original Message - > From: "Eric Dobson"

Re: [racket] TR: struct: #:prefab option

2013-05-06 Thread Eric Dobson
Couldn't this be solved by protecting the struct on export? #lang racket/load (module foo racket (struct foo (f) #:prefab) (define x (foo (lambda (x) (* 3.3 x (provide/contract (x (struct/c foo (-> number? number?) (module bar racket (require 'foo) (struct foo (f) #:prefab) ((

Re: [racket] [Typed Racket] "define-predicate" in Racket 5.3.4

2013-05-09 Thread Eric Dobson
That definitely looks like a bug. Can you file one either using the bug report tool in the menus or at bugs.racket-lang.org. No you cannot define a predicate like that, because you cannot tell a functions type with a first order check. But you can use cast, so (cast (Boolean -> Boolean)) should w

Re: [racket] [Typed Racket] define-predicate for union with functions

2013-05-20 Thread Eric Dobson
No, you cannot define predicates for function types. If you explain the problem you have, we might be able to explain another solution that will work. On Mon, May 20, 2013 at 1:32 AM, Paul Leger wrote: > Hi all, > Maybe, this question is very easy. In the following code, I try > defining a

Re: [racket] Thought about namespaces

2013-05-26 Thread Eric Dobson
Try using make-empty-namespace instead of make-base-empty-namespace. It won't work but will explain why the add1 procedures are the same when you do get it to work, with the change below. (define-namespace-anchor anchor) (define (get-from-fresh-namespace var) (let ((namespace (make-empty-namespa

[racket] disappeared-use syntax property

2013-05-28 Thread Eric Dobson
Is it 'wrong' to add a disappeared-use property onto a syntax object even if the use wasn't actually disappeared? Its not very obvious what semantics these syntax properties are supposed to have. The situation I'm in is that the code that determines examines the bindings is somewhat separate from

[racket] syntax-parse, macros, and literal-sets

2013-05-29 Thread Eric Dobson
I was writing a macro that generated a literal-set and ran into some confusing behavior which I have distilled to the following program. #lang racket (require syntax/parse (for-syntax syntax/parse)) (define-syntax (define-ls1 stx) (syntax-parse stx ((_ name:id (lit:id ...)) #

Re: [racket] syntax-parse, macros, and literal-sets

2013-05-30 Thread Eric Dobson
its unhygienic I'm not so sure now. On Thu, May 30, 2013 at 3:49 AM, Ryan Culpepper wrote: > On 05/29/2013 03:30 AM, Eric Dobson wrote: >> >> I was writing a macro that generated a literal-set and ran into some >> confusing behavior which I have distilled to the foll

Re: [racket] syntax-parse, macros, and literal-sets

2013-05-30 Thread Eric Dobson
t 9:43 AM, Carl Eastlund wrote: > On Thu, May 30, 2013 at 12:25 PM, Eric Dobson > wrote: >> >> Why do literal-sets have to be unhygienic? I expected them to work >> like literal lists which you say are hygienic. Also literal-sets are >> not documented as b

[racket] Lazy syntax class attributes

2013-05-30 Thread Eric Dobson
I'm working on code (TR optimizer) that needs to match some expressions and then compute an attribute based on the expression. I would like to abstract this out as a syntax class. Example is below: #lang racket (require syntax/parse) (define-syntax-class slow (pattern e:expr #:with v

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Eric Dobson
27;(complicated (form e.v))) > > where force-all is defined via a begin in the slow syntax class? > > -- Matthias > > > On May 31, 2013, at 2:47 AM, Eric Dobson wrote: > >> I'm working on code (TR optimizer) that needs to match some >> expressions and then com

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Eric Dobson
> rhs ...) ...) > > This way you can make the attributes promises (at compile time) to later > force when using them in rhs ... > > Too much? > -Ian > - Original Message - > From: "Eric Dobson" > To: "Matthias Felleisen" > Cc: users@racket

Re: [racket] Lazy syntax class attributes

2013-06-01 Thread Eric Dobson
I would say not to implement this just on my behalf. I think it would be weird for pattern variables to act differently if they came from syntax-parse versus from with-syntax. On Fri, May 31, 2013 at 2:17 PM, Sam Tobin-Hochstadt wrote: > On Fri, May 31, 2013 at 4:42 PM, Ryan Culpepper wrote: >>

Re: [racket] syntax-parse, macros, and literal-sets

2013-06-01 Thread Eric Dobson
wrote: > This might answer some of your questions: > http://macrologist.blogspot.com/2011/09/syntax-parse-and-literals.html > > Ryan > > > > On 05/31/2013 02:30 AM, Eric Dobson wrote: >> >> Ok given the complexities of literal-sets and hygiene, I think I will &g

Re: [racket] Lazy syntax class attributes

2013-06-05 Thread Eric Dobson
All I've done now is turn > some error cases into non-error cases. > > Ryan > > > > On 06/01/2013 11:55 AM, Eric Dobson wrote: >> >> I would say not to implement this just on my behalf. I think it would >> be weird for pattern variables to act differently if

Re: [racket] Lazy syntax class attributes

2013-06-09 Thread Eric Dobson
ce a small test case. The basic code is that #'(op.unsafe e1.opt e2.opt) seems to force e1.opt first sometimes and sometimes e2.opt is forced first. Could this be a hash iteration order issue in the internals of syntax/parse? On Wed, Jun 5, 2013 at 4:58 PM, Eric Dobson wrote: > I started

Re: [racket] Lazy syntax class attributes

2013-06-09 Thread Eric Dobson
x27;(a b c d e f g) endobson@yggdrasil () ~/proj/racket/plt % raco make ~/tmp/tmp.rkt (0) c d e f g a b What does the syntax-parse API guarantee about this? On Sun, Jun 9, 2013 at 10:55 AM, Eric Dobson wrote: > I'm seeing something which looks like on different runs of my program > diffe

[racket] Syntax parse and not enough forms

2013-07-20 Thread Eric Dobson
I'm trying to improve the error messages for some macros and it seems like in some cases syntax-parse cannot give a good error message and just returns "bad syntax". The main issue I'm dealing with is when the use does not have as many subforms as the macro requires. I think I understand why it is

Re: [racket] Best Way to Really Understand the Compilation and Execution Model?

2013-08-05 Thread Eric Dobson
I don't think expanding into a define and a define-for-syntax will work. If I understand Nick correctly then Arc doesn't have phases and state should be shared across the uses in macros and uses in the program. I.e. (define cdr/only-once (let ((state #f)) (lambda (list) (if state

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-06 Thread Eric Dobson
I'm assuming you mean parametric contracts instead of polymorphic. But not sure why those would be the correct solution, I think any/c would work, I'm not seeing a case where wrapping the value would protect anything. I don't see a fundamental limitation to doing this either. On Tue, Aug 6, 2013

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Eric Dobson
at 6:13 AM, Asumu Takikawa wrote: > On 2013-08-06 21:53:14 -0700, Eric Dobson wrote: >> I'm assuming you mean parametric contracts instead of polymorphic. But >> not sure why those would be the correct solution, I think any/c would >> work, I'm not seeing a case where wra

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Eric Dobson
: > On 2013-08-07 08:18:41 -0700, Eric Dobson wrote: >> Ok, now I'm not so sure it is possible. Can you give what you think >> the contracts should be for your posn example? The issue that I see is >> that the parametricity is shared across different functions and I

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-07 Thread Eric Dobson
2013-08-07 08:42:53 -0700, Eric Dobson wrote: >> What is (posn X Y)? If you mean the obvious (struct/c posn X Y) you >> will run into issues with the fact that posn is immutable and >> therefore the contracts on its fields need to be flat or chaperone >> contracts, and param

Re: [racket] property pict-convertible in typed racket

2013-09-13 Thread Eric Dobson
Currently we do not have a safe way of checking #:property options in TR, so writing the struct in R and requiring it is the only solution right now. On Fri, Sep 13, 2013 at 12:42 AM, Daniele Capo wrote: > Hello, > > in a personal project I'm working on I've some structure that has to be > printe

[racket] Lifting submodules

2013-09-13 Thread Eric Dobson
I want to write a macro which generates submodules and then possibly requires them. This is so that can easily use another language (TR) for the expression. If all uses of the macro are at the top-level/module-level this is easy and I can expand out to something like: (begin (module new-mod type

Re: [racket] Lifting submodules

2013-09-13 Thread Eric Dobson
eisen wrote: > > Lift the module definition to top and require in the expression position? > > > On Sep 13, 2013, at 12:08 PM, Eric Dobson wrote: > >> I want to write a macro which generates submodules and then possibly >> requires them. This is so that can easily u

[racket] Why does rackunit show the stack trace of check failures?

2013-10-08 Thread Eric Dobson
I'm trying to clean up the output of some test cases so they are easier to debug when the go wrong. One of the issues is that the rackunit text ui always wants to print the stack trace of check failures. I never find these useful since they just show frames of the test code, not the code under test

[racket] Changing the pretty print columns when running raco expand

2013-11-07 Thread Eric Dobson
I use raco expand a bunch when debugging macros to see the final output and see why it doesn't match up with my expectations. One issue I have is that the pretty printer decides to only use 80ish columns when my terminal is 200 wide, this makes the output really ugly and hard to read. If this was a

Re: [racket] Changing the pretty print columns when running raco expand

2013-11-07 Thread Eric Dobson
I know about the macro stepper and it doesn't work for my use case. I don't have a simple macro, I have the entire TR typechecker/optimizer. Thus splitting it out into its own module is not feasible. Also because of how TR works there is one major macro application and the macro stepper cannot see

[racket] Discrepency in Commandline Documentation

2013-11-25 Thread Eric Dobson
The documention for the commandline racket implies that the following two command lines should have the same behavior. racket -v -e "(read-eval-print-loop)" racket -i -q But on my machine I'm seeing different behavior with regards to terminal settings. Without interactive mode I don't get the ech

[racket] Test for async-channel being full

2013-11-29 Thread Eric Dobson
I'm trying to make a custom output port that is backed by a async-channel. One of the operations that ports need to provide is an event that is ready when progress on the event can be made. But since I cannot tell if the async-channel is full and put would not block without actually sending a value

[racket] Timing of parallel compile

2013-12-03 Thread Eric Dobson
I'm trying to understand why my compiles are as slow as they are and see if there are any easy gains to make them faster. If I just want a serial compile then I can use 'managed-compile-zo' and look at the compile/cm logger to get information. But if I want to do a parallel compile, then the mana

Re: [racket] Test for async-channel being full

2013-12-03 Thread Eric Dobson
rning > a boolean to indicate success. > > Robby > > > On Mon, Dec 2, 2013 at 11:24 PM, David T. Pierson wrote: >> >> On Fri, Nov 29, 2013 at 12:23:42PM -0800, Eric Dobson wrote: >> > I'm trying to make a custom output port that is backed by a >> > a

[racket] Detecting that a place channel is unreachable

2013-12-06 Thread Eric Dobson
Is there a way to determine if a place channel is unreachable? My experiments with will executors seem to show that they trigger even if the place channel is reachable from another place. Is there a way to determine that all other places don't have access to the value, I assume that it has to be po

Re: [racket] Detecting that a place channel is unreachable

2013-12-07 Thread Eric Dobson
add a trigger. > > At Fri, 6 Dec 2013 23:53:04 -0800, Eric Dobson wrote: >> Is there a way to determine if a place channel is unreachable? My >> experiments with will executors seem to show that they trigger even if >> the place channel is reachable from another place. Is ther

Re: [racket] Generating comparable symbols

2014-01-14 Thread Eric Dobson
I'm not sure what you mean by random, but does gensym do what you want? http://docs.racket-lang.org/reference/symbols.html?q=gensym#%28def._%28%28quote._~23~25kernel%29._gensym%29%29 On Tue, Jan 14, 2014 at 11:18 PM, Marco Morazan wrote: > Is there a built-in function to generate (random) symbol

Re: [racket] Getting an expression to type

2014-01-26 Thread Eric Dobson
That is definitely a bug, not sure exactly what is going wrong though. Can you file a bug for this? In terms of getting your program to run, if you replace '(not (parameter? p))' with 'number?' it should work. On Sun, Jan 26, 2014 at 10:08 AM, Spencer Florence wrote: > I'm having difficulty gett

Re: [racket] Getting an expression to type

2014-01-26 Thread Eric Dobson
A B) ((A -> B) -> (A -> B))), which I can't > check for with a predicate as far as I know. > > > On Sun, Jan 26, 2014 at 2:31 PM, Eric Dobson > wrote: >> >> That is definitely a bug, not sure exactly what is going wrong though. >> Can you file a bug for t

Re: [racket] typed/racket and contract boundaries

2014-01-27 Thread Eric Dobson
This is likely a bug, but I cannot reproduce using the following program. Do you have a small test case? #lang racket/load (module typed typed/racket (provide foo) (: foo (Number -> Number)) (define (foo x) (add1 x))) (module untyped racket (require 'typed) (foo 4)) (require 'untyped)

Re: [racket] macro for define-values?

2014-02-24 Thread Eric Dobson
Does this do what you want? (Note its untested.) (define-syntax-rule (ref name ...) (begin (define name (void)) ...)) Using define-values is tricky as you saw, because you need to refer to name in the body to get the right duplication but then not use it. On Mon, Feb 24, 2014 at 10:23 PM,

Re: [racket] another weird typed racket error

2014-04-20 Thread Eric Dobson
The following annotation makes it work for me. #lang typed/racket (require plot/typed plot/typed/utils) (: vsum ((Listof (Vectorof Real)) -> (Vectorof Real))) (define (vsum vs) (apply (ann vector-map (-> (-> Real * Real) (Vectorof Real) * (Vectorof Real))) + vs)) I'm not sure why apply is g

Re: [racket] typed racket error

2014-04-20 Thread Eric Dobson
On Sun, Apr 20, 2014 at 10:39 AM, Alexander D. Knauth wrote: > I’m trying to make a multiplication function that can take either all > numbers or all numbers and one vector, and have it not matter what order > they come in. To do this, I’m using match with list-no-order: > #lang typed/racket > >

Re: [racket] filters in typed racket

2014-05-10 Thread Eric Dobson
I have been working on fixing the feature that does the checking if a certain type meets the expectations, and there are tons of bugs in it for the edge cases. I'm guessing you are just triggering one of those right now, so I would file a bug. In terms of docs, they were just added and so are visi

Re: [racket] filters in typed racket

2014-05-10 Thread Eric Dobson
The point of Opaque types are that they are opaque and you cannot see into them. Thus making them subtypes is against what they are supposed to do. You want Refinement types which are similar, but get you subtyping. They are unsound, and thus are still in experimental. The unsoundness is very hard

Re: [racket] filters in typed racket

2014-05-10 Thread Eric Dobson
ith-length-1?)) > And it gave me this error: > . Type Checker: parse error in type; > expected a predicate for argument to Refinement > given: Nothing in: (Refinement string-with-length-1?) > Even though I declared that string-with-length-1? has the type (Any -> > Boolean : #:+

Re: [racket] math/matrix

2014-05-11 Thread Eric Dobson
Where are you seeing the slowness in that code? For me the majority of the time is spent in matrix-solve, and since that is another module it doesn't matter what you write your module in. In untyped racket, (set the first line to #lang typed/racket/no-check), it is much slower. 36 seconds to creat

Re: [racket] math/matrix

2014-05-11 Thread Eric Dobson
Where is the time spent in the algorithm? I assume that most of it is in the matrix manipulation work not the orchestration of finding a pivot and reducing based on that. I.e. `elim-rows!` is the expensive part. Given that you only specialized the outer part of the loop, I wouldn't expect huge perf

Re: [racket] occurrence typing for case?

2014-05-11 Thread Eric Dobson
On Sun, May 11, 2014 at 4:10 PM, Alexander D. Knauth wrote: > It seems like case doesn’t do occurrence typing, when it seems like it would > be easiest for case, because of singleton types. > For example: > #lang typed/racket > > (define (f x) > (case x > [(thing) (g x)] > )) > > (: g ('

Re: [racket] occurrence typing for case?

2014-05-11 Thread Eric Dobson
ds to be done to fix it. On Sun, May 11, 2014 at 5:54 PM, Alexander D. Knauth wrote: > > On May 11, 2014, at 7:41 PM, Eric Dobson wrote: > > The issue is that there is a temporary variable that has the same > value as x and TR cannot see that they point to the same location. > Y

Re: [racket] occurrence typing for case?

2014-05-11 Thread Eric Dobson
oring my filters, then > shouldn’t (-> Any Boolean : Type) be a subtype of (-> Any Boolean)? > > On May 11, 2014, at 8:54 PM, Alexander D. Knauth > wrote: > > > On May 11, 2014, at 7:41 PM, Eric Dobson wrote: > > The issue is that there is a temporary variable t

[racket] Typed Racket macros in untyped code

2011-09-15 Thread Eric Dobson
Currently macros written from Typed Racket can not be used in the untyped world. Example: #lang racket/load (module t typed/racket (provide foo) (define-syntax (foo stx) #'(+ 2 1))) (module u racket (require 't) (displayln (foo))) (require 'u) This was brought up on the list a whil

Re: [racket] plai test/exn

2011-09-19 Thread Eric Dobson
Also IIRC test/exn only works on errors raised using 'error' from PLAI, which is different from 'error' from racket/base. -Eric On Mon, Sep 19, 2011 at 2:49 PM, John Clements wrote: > > On Sep 19, 2011, at 1:47 PM, Jeremy Kun wrote: > >> Not sure if this is a bug, but it doesn't match the docume

Re: [racket] plai test/exn

2011-09-19 Thread Eric Dobson
ammers is > crashing down before my eyes! I might as well be coding in C. > But seriously, this should be in the docs. > > Jeremy > > > On Mon, Sep 19, 2011 at 5:12 PM, Jay McCarthy > wrote: >> >> And that's what it means by "user code" >>

[racket] Confusion with syntax marks

2011-10-01 Thread Eric Dobson
I am playing around with syntax marks and have a program whose output confuses me. #lang racket (require (for-syntax racket/syntax)) (define-for-syntax marker (make-syntax-introducer)) (define-syntax (mark stx) (syntax-case stx () ((_ arg ...) (marker #'(begin arg ...) (define foo '

Re: [racket] Confusion with syntax marks

2011-10-08 Thread Eric Dobson
Thanks. That is what I eventually figured out I needed to do. Also the original problem was a bug in the Macro Stepper, pr12248, which only added to my confusion. -Eric On Oct 8, 2011, at 12:18 PM, Marco Maggi wrote: > Eric Dobson wrote: > >> I am playing around with syntax mar

Re: [racket] DrRacket for OS Lion

2011-11-25 Thread Eric Dobson
Racket 5.2 is the newest released version and fixed a couple of bugs for Lion. It is available at http://racket-lang.org/download/. Nightly versions are available at http://pre.racket-lang.org/installers/. Hope that helps, Eric On Nov 24, 2011, at 7:44 AM, Rita Moreira wrote: > Good afternoon

Re: [racket] help: racket does not work

2011-11-25 Thread Eric Dobson
The GUI editor is called DrRacket and is included with the Racket distribution. It should be in the same folder as the racket executable/binary. If you are running it from the command line, it would be drracket. The racket executable is for running scripts and a command line repl. -Eric On No

Re: [racket] Different mutable vectors for each thread

2012-07-14 Thread Eric Dobson
I think thread-cells are enough, you just need to do the allocation yourself. #lang racket (define get-thread-local-vector (let () (define vector-cell (make-thread-cell #f)) (lambda () (or (thread-cell-ref vector-cell) (let ((vec (vector 0 1))) (thread-cell-s

Re: [racket] how to define-predicate for a recursive type?

2012-08-08 Thread Eric Dobson
No, my change does not solve that, but I'll try looking into it. The issue is in how recursive contracts are generated. On Wed, Aug 8, 2012 at 12:11 PM, Sam Tobin-Hochstadt wrote: > I think this will be fixed soon, once I merge Eric's pull request > https://github.com/plt/racket/pull/121 . > >

Re: [racket] TR Keyword Args (Lil Help)

2012-08-10 Thread Eric Dobson
It looks like there is an issue with turning case lambdas with keywords into a contract. If you drop the one argument case for function, it should work. On Thu, Aug 9, 2012 at 4:01 PM, Ray Racine wrote: > The following sample works well enough that I can do something similar for > each of my cu

Re: [racket] Thread creation slow?

2012-08-10 Thread Eric Dobson
When I played around with it, I remember that the issue was that threads created a lot of garbage, and made collecting garbage slow. I could create about 400 times as many boxes in a chain and get the same gc time. This lead to a quadratic(ish) runtime for creating a bunch of threads, as each lat

Re: [racket] how to define-predicate for a recursive type?

2012-08-10 Thread Eric Dobson
This should be fixed in HEAD now. On Wed, Aug 8, 2012 at 8:37 PM, Eric Dobson wrote: > No, my change does not solve that, but I'll try looking into it. The > issue is in how recursive contracts are generated. > > > > On Wed, Aug 8, 2012 at 12:11 PM, Sam Tobin-Hochstadt &

Re: [racket] TR - Require of a struct: defined in a submodule in a submodule.

2012-08-28 Thread Eric Dobson
Possibly, how is it not working for you? With: #lang typed/racket/base (module mytypes racket/base (provide S) (struct S ())) (module tyuser racket/base (require (submod ".." mytypes)) (define (mkS value) (S))) (note submodules are now in plain racket) I get: tmp.rkt:17:5:

Re: [racket] TR - Back patching avoidance in struct:

2012-08-28 Thread Eric Dobson
You can get something like this with shared or make-reader-graph, but not for custom structure types. Also I don't know how well they work in TR. You could also use promises and then write a wrapper, that did the forcing on every access. http://docs.racket-lang.org/reference/shared.html?q=shared#(

Re: [racket] Macro question - `let' without inferring name?

2012-09-05 Thread Eric Dobson
How about: (define-syntax (m stx) (syntax-case stx () [(m expr) #'(let ([t (values expr)]) ;; t)])) Which seems to work for me. On Wed, Sep 5, 2012 at 8:56 PM, Erik Silkensen wrote: > Hi, > > I'm wondering if there's any way to have a macro like > > (define-syn

Re: [racket] What am I doing wrong in this typed racket program?

2012-09-18 Thread Eric Dobson
I have done some work in this area, and my patches are currently sitting on github waiting for comments. (And also some cleanup by me). I believe that the current version in my pull request will give a static error here. https://github.com/plt/racket/pull/139 On Tue, Sep 18, 2012 at 5:38 PM, Mat

Re: [racket] Why this code snippet from document does not work?

2012-11-16 Thread Eric Dobson
This example runs fine for me, but likely would not run fine on older versions of racket (before submodules were released). I believe 5.3 added support for submodules and 5.3.1 was released recently. What version of racket are you running? Running (version) will tell you. On Fri, Nov 16, 2012 a

Re: [racket] A type that can't be converted to a contract

2012-11-17 Thread Eric Dobson
Its even simpler than that because the cases in case-> are ordered. There are some intricacies when the first order checks of non flat contracts overlap, but with non overlapping first order checks for higher order contracts or only flat contracts it should be doable. I don't have a lot of time fo

[racket] CFRunLoopGetMain on Os X

2012-12-08 Thread Eric Dobson
I'm trying to do some OS X programming and one of the api's I'm using requires a CFRunLoop. Using CFRunLoopGetMain works fine if I require racket/gui/base, but not otherwise (The loop does not seem to be running). The problem with this is that this starts up a gui application in the dock and change

Re: [racket] CFRunLoopGetMain on Os X

2012-12-08 Thread Eric Dobson
AM, Matthew Flatt wrote: > I think you mostly want `mred/private/wx/cocoa/queue', but some > refactoring or parameterization may be needed to get it in the right > form. > > At Sat, 8 Dec 2012 01:44:54 -0800, Eric Dobson wrote: > > I'm trying to do some OS X progra

[racket] Using _fun for callbacks

2012-12-08 Thread Eric Dobson
I am trying to write the ctype for a cfunction and it seems I need to write a different version depending on if it is going to get called racket->c or c->racket. I'm not sure how to write the second version. The (simplified) type of the function is void f(int count, char** strings); So for racket

Re: [racket] Why begin0 doesn't expands to begin ?

2012-12-14 Thread Eric Dobson
begin0 is for exactly the case you ignore, multiple values. You cannot know the number of values the first expression will return statically so if you did a translation to begin it would need to allocate them in a list on the heap and then use (apply values ...) later. With begin0 as a primitive y

[racket] Raco link causing problems when building racket

2012-12-26 Thread Eric Dobson
I am working on developing a planet2 package, and so have a local directory on my system linked as a collection root. endobson@yggdrasil () ~/proj/racket/websocket % raco link -d . endobson@yggdrasil () ~/proj/racket/websocket % raco link --list User links: collection: "racket-llvm" path: "/User

Re: [racket] TR define-new-type, Value Types

2012-12-28 Thread Eric Dobson
Do refinement types work for what you want? http://docs.racket-lang.org/ts-reference/Experimental_Features.html?q=refinement#(form._((lib._typed-racket/base-env/prims..rkt)._declare-refinement)) #lang typed/racket (declare-refinement even?) (: two (Refinement even?)) (define two (let ((x 2))

[racket] Applications on OS X

2012-12-30 Thread Eric Dobson
I'm trying to make an application on os X and get it to respond to drag and drop/giving it a file. But I cannot get either application-start-empty-handler or application-file-handler to get called. Am I doing something wrong? The documentation says that they should be called. It also says that the

  1   2   >