[racket] syntax/parse ellipses question

2010-06-11 Thread Eric Dobson
I'm trying to use the syntax/parse library, and am running into a weird problem when using ~or. It works without ellipses, but with ellipses it complains about a duplicated attribute. I would assume that the attributes with the same name in an ~or pattern were the same attribute that could just mat

Re: [racket] syntax/parse ellipses question

2010-06-11 Thread Eric Dobson
Thanks, that makes sense after looking very closely at the documentation. I was able to work around it by introducing a syntax-class, which had the added benefit of being more readable then nested ~or patterns. -Eric On Fri, Jun 11, 2010 at 3:56 PM, Ryan Culpepper wrote: > Eric Dobson wr

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

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

[racket] Objects, Contracts, and Equality

2010-08-22 Thread Eric Dobson
I am using the class system, and contracting objects. The documentation says that objects (without implementing equal<%>) are only equal? if they are eq?. My assumption was that when using equal?, the contract-wrapper objects would look through to the base value and compare them using equal? which

[racket] Weird class/c behavior

2010-08-29 Thread Eric Dobson
I am using class/c and am seeing behavior that I do not understand. I have two different contracts, one which has an extra contract on an unused initializer argument. The interesting behavior is that the two different contracts blame different sides for the same error. Can someone explain why this

[racket] Freeing FFI resources

2010-10-10 Thread Eric Dobson
I am dealing with a foreign library that has functions that return error messages in a char** input argument. These need to be explicitly freed by calling another function. I figured out how to get them into racket strings by using the _ptr and the _string ctype. But I didn't see a way to capture t

[racket] Writing type predicates in typed/racket

2010-11-06 Thread Eric Dobson
I am working with typed/racket and running into a problem on how to construct a type predicate. I know about define-predicate, but I don't think that works in my case. My code is as follows (Which does not type check): #lang typed/racket (define-type num-tree (Rec it (U Number (Pair it it ;(de

Re: [racket] Writing type predicates in typed/racket

2010-11-07 Thread Eric Dobson
(build-tree 15 0))) cpu time: 843 real time: 853 gc time: 0 - : Boolean #t > (time (branch? (build-tree 15 0))) cpu time: 831 real time: 837 gc time: 0 - : Boolean #t > -Eric On Sat, Nov 6, 2010 at 7:36 PM, Sam Tobin-Hochstadt wrote: > On Sat, Nov 6, 2010 at 6:52 PM, Eric Dobson wrote: &

[racket] Struct equality for foreign pointers

2010-11-22 Thread Eric Dobson
I am interfacing with a foreign library and have a datatype whose representation in racket is a cpointer, where equality is ptr-equal?. I want to make a struct encapsulating this using prop:equal+hash to make struct equality match the foreign library's equality operator. Is there a way to get somet

[racket] Compiling programs with embedded procedures

2010-12-26 Thread Eric Dobson
I am trying to understand how the expansion/compilation process deals with embedding procedures in the syntax of a program, and I have now constructed a program that returns different values when run in drracket, and racket. It also does not compile for me using raco make. I was wondering what peop

Re: [racket] Compiling programs with embedded procedures

2010-12-26 Thread Eric Dobson
:31:23 -0500, Eric Dobson wrote: >> I am trying to understand how the expansion/compilation process deals >> with embedding procedures in the syntax of a program, and I have now >> constructed a program that returns different values when run in >> drracket, and racket. It a

[racket] PLaneT hard/development links and multiple versions of racket

2011-01-08 Thread Eric Dobson
I currently am using planet hardlinks for some libraries I am working on, but this feature does not seem to work well with multiple versions of racket. Normally each version of racket keeps its own planet cache, but this does not happen for hardlinks and thus the compiled directory has the wrong ve

[racket] Confusing behavior with continuation-marks

2011-01-14 Thread Eric Dobson
I was looking at the documentation on how continuation-marks work, and the documented behavior is different than what I observed. The following programs add a continuation mark, then a prompt, then try to look at the current continuation marks. According to the documentation I would expect the pro

Re: [racket] Confusing behavior with continuation-marks

2011-01-15 Thread Eric Dobson
ation was wrong, because the prompt-tag argument is >   actually the fourth argument to `continuation-mark-set-first', and >   the third argument is a default result for when the mark isn't >   found (which explains the result in the last two tests). > > These problems are now

[racket] Contract error messages with ->i

2011-02-22 Thread Eric Dobson
I am adding contracts to one of my libraries using the ->i combinator and using the pre-condition expression. The problem I have is that if I return false, the contract library just tells me that the precondition failed. Is there any mechanism to attach more information so that I can explain why th

Re: [racket] Contract error messages with ->i

2011-02-22 Thread Eric Dobson
2, 2011 at 6:05 PM, Eric Dobson wrote: >> I am adding contracts to one of my libraries using the ->i combinator >> and using the pre-condition expression. The problem I have is that if >> I return false, the contract library just tells me that the >> precondition fai

[racket] Dynamic requiring syntax-transformers

2011-04-19 Thread Eric Dobson
I am trying to find a way to get a hold of a syntax-transformer from an exported syntax binding of a module. I cannot seem to do this with dynamic require because it wants to return the result of calling the syntax transformer. Is there anyway to achieve this? My end goal is to have the value of th

Re: [racket] Predicates for instantiated types in Typed Racket

2011-06-17 Thread Eric Dobson
This works for me on HEAD, but not 5.1.1. I submitted a patch that made it generate flat contracts instead of regular contracts about a month ago, so I think it is fixed now. https://github.com/plt/racket/commit/613e121783d34c3e2cc4904f3e4f43639ab925b3 -Eric On Fri, Jun 17, 2011 at 3:05 PM, Sam

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

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

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

[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

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

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

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

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

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

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

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

Re: [racket] Applications on OS X

2012-12-30 Thread Eric Dobson
end frame show #t) > > in the function for `application-file-handler'? > > I get a frame when I add that. > > At Sun, 30 Dec 2012 09:04:36 -0800, Eric Dobson wrote: > > I'm trying to make an application on os X and get it to respond to drag > and >

[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

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

  1   2   >