Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
p #xFF 1 _grpc-slice/ffi))) (grpc-slice p)) (define s (make-grpc-slice)) (grpc-slice-length s) (grpc-slice-length (begin0 s (set! s #f))) On Tue, Oct 3, 2017 at 7:55 PM, Eric Dobson wrote: > Parsing it out in atomic mode probably will work, I'll look at that. The > callback me

Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
es? > > If not, then I don't have a better idea than the approach you describe. > I don't quite follow why you'd need new functionality from wills, since > a will procedure on a cpointer already receives the cpointer back when > there are otherwise no references to th

[racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
I'm dealing with some foreign apis that want to be passed long lived output pointers to structs. The apis eventually call back indicating that the struct has been filled in appropriately and then I want to read out the values and deallocate the structs. I'm using atomic interior memory for these st

Re: [racket-users] Safely allocating memory in places enabled world

2017-10-02 Thread Eric Dobson
George: I don't see that invariant for java in anything that I search for on Java finalizers. Do you have a reference? In particular java only has one finalizer per object (the finalize method) and across objects the references I found seem to imply that there is no guaranteed order? https://en.wi

[racket-users] Safely allocating memory in places enabled world

2017-09-30 Thread Eric Dobson
I'm trying to write some racket code which interfaces with a foreign library and provides a safe interface. Some of the functions I'm calling allocate memory and need to have this explicitly freed by the caller. The 'allocator' binding from ffi/unsafe/alloc seems to solve this problem, but I'm runn

[racket-users] Problems connecting to mirror.racket-lang.org

2016-12-22 Thread Eric Dobson
I have been downloading racket in my continuous builds for a while from http://mirror.racket-lang.org/installers/6.6/racket-minimal-6.6-x86_64-macosx.tgz but today it stopped working. Is this just a transient error with the server or should I change my urls? I noticed that the new urls on the pag

[racket-users] Slow expansion. (Likely of match)

2016-03-23 Thread Eric Dobson
I'm seeing slow expansion (on the order of hundreds of milliseconds) for the following program: https://gist.github.com/endobson/e165edf224b4028db48d It is a single function of generated code. Similar functions that don't use match as extensively are much faster < 10 milliseconds. I'm trying to u

Re: [racket-users] time_t and size_t ffi types

2015-06-20 Thread Eric Dobson
That seems to be defined as _uintptr which could be different than 'size_t' in C, but is probably a better choice than '_int64'. On Tue, Jun 16, 2015 at 9:55 AM, Marc Burns wrote: > What about _size in ffi/unsafe ? > > On Jun 14, 2015, at 1:39 PM, Eric Dobson

[racket-users] time_t and size_t ffi types

2015-06-16 Thread Eric Dobson
I'm currently on working on bindings to a foreign library that has elements in structs that are defined as time_t and size_t. I couldn't find anything in the core ffi types that corresponded to these, so currently I am using int64_t as that was what I found was correct for the system I'm currently

Re: [racket] source locations of syntax objects in a required file

2015-03-08 Thread Eric Dobson
For an example match does this: https://github.com/plt/racket/blob/master/racket/collects/racket/match/gen-match.rkt#L36 Added in this commit https://github.com/plt/racket/commit/fc8ed9772a701062dff2b928fb99d90e01b7f177 On Sun, Mar 8, 2015 at 2:01 PM, Robby Findler wrote: > Syntax object const

Re: [racket] FFI and C header defines

2015-02-06 Thread Eric Dobson
I wrote something similar for my LLVM bindings, after running into many issues with Dave's code. It follows the c spec not c++, and doesn't support gcc extensions which many libaries use. It is no where near production quality, but may give you a starting point: https://github.com/shekari/racket-l

[racket] Starting a place with breaks disabled

2014-11-07 Thread Eric Dobson
I'm trying to figure out how to reliably kill a place silently. The current code I have starts up a place and nearly immediately sets a break handler that quietly exits, the issue is that there is a fairly long gap where the place is started and still doing import resolution. If the place revieves

Re: [racket] Deadlock with FIFO files

2014-10-26 Thread Eric Dobson
eue() on FIFOs only in June. I'll disable it > again. > > At Sat, 25 Oct 2014 21:06:54 -0700, Eric Dobson wrote: >> I'm attempting to use FIFOs as a simple IPC mechanism and I'm getting >> into a deadlock. I've simplified my program to the following and am

[racket] Deadlock with FIFO files

2014-10-25 Thread Eric Dobson
I'm attempting to use FIFOs as a simple IPC mechanism and I'm getting into a deadlock. I've simplified my program to the following and am still getting deadlocks. I believe that this shouldn't have an issues, but I might be wrong about that. Am I doing something wrong, or might this be a bug in the

Re: [racket] Help debugging a ffi crash

2014-09-28 Thread Eric Dobson
} CXString; > > If that's right, I'm a little surprised that `cursor-spelling` works > --- but when you get representation wrong, strange things can happen, > including something working when it shouldn't. > > Am I looking at the right library/definitions? > > At

[racket] Help debugging a ffi crash

2014-09-28 Thread Eric Dobson
I'm trying to debug an FFI crash that I'm seeing, and because it is dealing with C code the error just presents as a segfault. I believe I have tracked down what is causing the problem, but don't understand how it could be doing so. I have two racket functions which take a "cursor" (the foreign li

Re: [racket] on reversing a list by way of sort

2014-09-15 Thread Eric Dobson
On Mon, Sep 15, 2014 at 8:50 PM, Asumu Takikawa wrote: > On 2014-09-15 18:57:51 -0700, Matthew Butterick wrote: >> Mike Bostock's visual demonstration of why naive sorting functions are false >> friends. As he and Henglein point out, transitivity of the comparator is >> essential. >> >> http://bos

Re: [racket] the type of range

2014-07-15 Thread Eric Dobson
The issue with random testing is that it can only catch for bugs in programs that can be generated. We currently have a small set of primitives as allowed functions, and they are only numeric ones. Thus we cannot currently generate programs with lists which would be required for adding range. This

[racket] Syntax objects and pairs

2014-07-06 Thread Eric Dobson
What should the following program return? #lang racket (syntax? (cdr (syntax-e #'(2 . () If I just run the program with 'racket' I get #t. If I compile it with 'raco make' and run it again I get #f. I'm trying to figure out how to type this in TR, and thought I fully understood how pairs and

Re: [racket] FW: q about code for partitions

2014-06-29 Thread Eric Dobson
Vincent: exact-zero? is defined through 'make-predicate' which uses contract machinery to generate the function. I filed a couple of bugs tracking some of the slowness issues. There is no `contract` form though so I doubt that the coach will find it. http://bugs.racket-lang.org/query/?cmd=view%20a

Re: [racket] FW: q about code for partitions

2014-06-28 Thread Eric Dobson
I took a look and for a while nothing I did sped it up, (likely already racket was doing the optimizations I was doing by hand). But I got a factor of 4 speed up on the vector code over the hash code by not checking for exact 0, but instead using #f as the sentinal value. Growing the vector by a a

[racket] Difference in speed accessing fields of a struct with gen:equal+hash

2014-06-23 Thread Eric Dobson
I added gen:equal+hash to a struct type and noticed that accessing fields of the struct got slower, even though I never used equal? or hash functions. Is this expected? And if so what is the cause of it? #lang racket (struct foo (x) #:transparent) (struct bar (x) #:transparent #:methods g

Re: [racket] 3D Plot example doesn't work in Typed Racket

2014-05-31 Thread Eric Dobson
This should now be fixed at HEAD. On Fri, May 30, 2014 at 8:25 PM, Greg Hendershott wrote: > Thanks, Neil and Alexander! > > (At one point I actually did try `list` instead of `vector`, but that > uncovered an additional typecheck problem that I conflated with this. > All set now.) >

Re: [racket] 3D Plot example doesn't work in Typed Racket

2014-05-30 Thread Eric Dobson
I know what the bug is and it should be pretty simple to fix, but please file a bug for tracking purposes. On Fri, May 30, 2014 at 1:44 PM, Neil Toronto wrote: > This is one case in which Typed Racket could do better inference. I'm not > sure what the difference is between Listof and Sequenceof t

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

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

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

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

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

[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

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

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

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

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

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

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

[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 ...)) #

[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

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

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] [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] 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] 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"

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

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

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

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

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

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

[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] 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] Understanding future syncronization

2012-12-31 Thread Eric Dobson
I am playing around with futures currently, and am trying to understand how to make my programs faster. The future visualizer is wonderful in understanding whats going on, but it lead me down a track which made my program slower. The issue is that void primitive needs to synchronize with the main

  1   2   >