Re: [racket] something like a prop:object-name?

2015-03-18 Thread Sam Tobin-Hochstadt
Well, relatively soon turned out over-optimistic, but this is now merged. Sam On Mon, Jul 14, 2014 at 11:09 AM Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I've now generalized this to be a function or a slot in the struct. I hope to get it merged relatively soon. Sam On Sat, Jul 12

Re: [racket] the typed Values restriction

2015-03-18 Thread Sam Tobin-Hochstadt
Type variables range only over types, and `(Values A B)` isn't a type. If your program type checked, then the following program would too: (: my-force : (All (A) (- A) - A)) (define (my-force f) (let ([tmp : A (f)]) tmp)) (my-force (lambda () (values (void) (void))) but this program has a

Re: [racket] the typed Values restriction

2015-03-18 Thread Sam Tobin-Hochstadt
If you want the continuation-passing-style version, you'll need to explicitly handle the multiple-ness of multiple values: #lang typed/racket (: my-force (All (A ...) (- (- (Values A ...)) (Values A ... (define (my-force x) (x)) (ann (my-force (lambda () (values (void) (void (Values

Re: [racket] the typed Values restriction

2015-03-18 Thread Sam Tobin-Hochstadt
can be a little confusing. For example, using Values as an expression produces the error “type name used out of context,” but it isn’t really a type. Yes, this is a good idea. Sam On Mar 18, 2015, at 14:01, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Type variables range only over

Re: [racket] Crowdsourcing Pict3D's design

2015-03-12 Thread Sam Tobin-Hochstadt
What do browsers do to implement mouse lock on Macs? On Thu, Mar 12, 2015, 8:13 PM Neil Toronto neil.toro...@gmail.com wrote: This is what I ended up doing, as well as disabling mouse look on OS X. I used Firefox's autoscroll as inspiration, and I think I've made it usable enough. Let me know

Re: [racket] typed racket: how to define a binding as both a runtime var and a type?

2015-03-06 Thread Sam Tobin-Hochstadt
Indeed, this was a bug introduced by the levels of indirection I added to put contracts into submodules. I'll push a fix when the tests finish. Thanks for finding this. Sam On Sun, Feb 22, 2015 at 3:12 PM Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: This looks like a bug to me. Sam

Re: [racket] raco exe: unknown module

2015-03-06 Thread Sam Tobin-Hochstadt
This is now fixed, thanks mostly to more debugging by Matthew. Sam On Tue, Mar 3, 2015 at 9:38 AM, Dmitry Pavlov dpav...@ipa.nw.ru wrote: On 03/03/2015 01:59 AM, Alexander D. Knauth wrote: Could submodules be causing it? try.rkt: #lang typed/racket/base (provide x) (define x : Integer

Re: [racket] windows-1252 charset decoding

2015-03-04 Thread Sam Tobin-Hochstadt
On Wed, Mar 4, 2015 at 3:06 PM John Clements johnbcleme...@gmail.com wrote: I see that the documentation suggests that (entity-charset) is supposed to return a symbol. However, it nearly always returns a string. In particular, it appears to me that it returns a symbol only when it returns its

Re: [racket] racket-mode

2015-02-28 Thread Sam Tobin-Hochstadt
Having spent a bunch of time writing Python over the last year (while building Pycket [1]), the debugger is the one thing I wish I had in Racket. This isn't because it interacts with C (I've not used any C extensions), but because it makes debugging much faster than when I have to use printf (my

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-27 Thread Sam Tobin-Hochstadt
At a minimum, we could (a) log a warning and (b) put a note in the docs suggesting that people use Neil's library for floats. Sam On Fri, Feb 27, 2015 at 8:33 AM, Robby Findler ro...@eecs.northwestern.edu wrote: Should we consider making in-range signal an error for floats? I guess backwards

Re: [racket] try-racket alternative

2015-02-25 Thread Sam Tobin-Hochstadt
This is really nicely done! I hope your daughters are enjoying Racket as well. :) Sam On Wed, Feb 25, 2015 at 4:11 PM, Floyd Arguello floyd.argue...@gmail.com wrote: I found that my daughters had a lot of questions when they went through the tutorial at http://try-racket.org/ - what’s a

Re: [racket] typed racket: how to define a binding as both a runtime var and a type?

2015-02-22 Thread Sam Tobin-Hochstadt
This looks like a bug to me. Sam On Sun, Feb 22, 2015, 2:49 PM Alexander D. Knauth alexan...@knauth.org wrote: Using #:omit-define-syntaxes doesn’t work because then when other modules import it it forgets about the type: def.rkt: #lang typed/racket (provide x) (define-type x 'x

Re: [racket] scribble indentation in drracket

2015-02-21 Thread Sam Tobin-Hochstadt
The list of contributors is an unfortunate GitHub issue -- if a file is moved, commits from before the move aren't used to compute that list. If you click on blame on the page, it'll show the expected authorship. Sam On Sat, Feb 21, 2015, 10:11 PM Robby Findler ro...@eecs.northwestern.edu wrote:

Re: [racket] Documentation coverage?

2015-02-19 Thread Sam Tobin-Hochstadt
On Thu, Feb 19, 2015 at 4:49 PM, Jack Firth jackhfi...@gmail.com wrote: I've been using the new Racket code coverage tool that integrates with Coveralls (thank you Spencer Florence!) and I was wondering - would a similar tool that reports how many exported bindings of a module have Scribble

Re: [racket] read-syntax for an entire .rkt file

2015-02-18 Thread Sam Tobin-Hochstadt
On Wed, Feb 18, 2015 at 10:22 PM, Thomas Gilray thomas.gil...@gmail.com wrote: Hi everyone, I am trying to figure out how to use read-syntax on a port for an entire .rkt file. I then want to call (expand ...) on this and get back a (begin ...) or (module ...) for the entire file in fully

Re: [racket] Question about Typed Racket

2015-02-12 Thread Sam Tobin-Hochstadt
I don't think you're doing anything wrong, and I expect that this case [1] needs a bit of generalization to handle polymorphic structs. [1] https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/typecheck/tc-app/tc-app-hetero.rkt#L82-L83 Sam On Thu, Feb 12, 2015 at

Re: [racket] Typed Racket frustration

2015-02-07 Thread Sam Tobin-Hochstadt
On Fri, Feb 6, 2015 at 5:16 PM, Matthew Butterick m...@mbtype.com wrote: On Oct 29, 2014, at 10:39 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: As for documenting this, the types, which you can print at the REPL, are the best documentation. Just recently, Asumu added tooltips so

Re: [racket] forward pointer declarations

2015-02-02 Thread Sam Tobin-Hochstadt
Maybe a ctype which is a delay node, along the lines of 'recursive-contract', is the right thing here. Sam On Mon, Feb 2, 2015, 8:05 AM Anthony Carrico acarr...@memebeam.org wrote: On 02/02/2015 01:17 AM, Matthew Flatt wrote: It's also valid to reference `wl_interface-pointer` directly: ...

Re: [racket] Untyped arithmetics performance

2015-01-26 Thread Sam Tobin-Hochstadt
need to write another program to debug the source code. The program should be in the same directory of medic programs: #lang racket (require medic/core) (medic /tmp/med.rkt) (debug /tmp/src.rkt) On Mon, Jan 26, 2015 at 11:42 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Hi Xiangqui

Re: [racket] Untyped arithmetics performance

2015-01-26 Thread Sam Tobin-Hochstadt
Hi Xiangqui, I just tried to run this, but it didn't show anything. I put this in /tmp/src.rkt: #lang racket (for/fold ([v 0]) ([x (in-range 100)]) (+ v (/ x 100))) (for/fold ([v 0]) ([x (in-range 100)]) (+ v (/ x (- 100 x and this in /tmp/med.rkt: #lang medic (layer layer1

Re: [racket] machine states diagrams

2015-01-25 Thread Sam Tobin-Hochstadt
On Sun, Jan 25, 2015 at 5:09 PM, Catonano caton...@gmail.com wrote: 2014-12-02 17:03 GMT+01:00 Jens Axel Søgaard jensa...@soegaard.net: Here is an example drawing a simple state machine with MetaPict. It shows a little state machine that accepts numbers with an even number of zeros in its

Re: [racket] Typed Racket frustration

2015-01-24 Thread Sam Tobin-Hochstadt
On Sat, Jan 24, 2015 at 12:06 PM, Matthew Butterick m...@mbtype.com wrote: Of course, developer time is limited, so I'm always reluctant to post comments amounting to it would be nice if someone else did such-and-such for me ... In this case I simply don't have the experience with TR to know

Re: [racket] Typed Racket frustration

2015-01-24 Thread Sam Tobin-Hochstadt
)) (mb-hash xs) ; '#hash((width . 10) (foo . bar) (zam . 42)) ;;; On Sat, Jan 24, 2015 at 9:27 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: On Sat, Jan 24, 2015 at 12:06 PM, Matthew Butterick m...@mbtype.com wrote: Of course, developer time

Re: [racket] Macros in slideshow

2015-01-21 Thread Sam Tobin-Hochstadt
Also, there are some more modern alternatives to `with-steps`. I particularly like the `staged` and `slide/staged` macros, which you can read about here: http://docs.racket-lang.org/unstable-gui/Slideshow_Presentations.html#%28part._.Staged_.Slides%29 Sam On Wed Jan 21 2015 at 9:47:28 AM Matthew

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Sam Tobin-Hochstadt
This is a correct improvement to Typed Racket -- I'll make it shortly. Sam On Mon, Jan 19, 2015 at 8:41 AM, Alexander D. Knauth alexan...@knauth.org wrote: I managed to fix this for your example by inserting these 3 lines into typed-racket/types/remove-intersect.rkt after line 67:

Re: [racket] JSExprs and hashtables

2015-01-19 Thread Sam Tobin-Hochstadt
On Mon Jan 19 2015 at 10:03:51 AM Benjamin Greenman bl...@cornell.edu wrote: On Mon, Jan 19, 2015 at 9:58 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: hash-table-specific limitation I thought this was a 'possibly-mutable data structures' limitation. There's also that limitation

Re: [racket] TR: Polymorphic types

2015-01-17 Thread Sam Tobin-Hochstadt
On Sat, Jan 17, 2015 at 9:20 PM, Jordan Johnson j...@fellowhuman.com wrote: Hi all, In playing with TR this evening, I found (define-type (Foo A) (U A (List 'foo (Foo A (define-predicate foo? Foo) generates the error “Type Foo could not be converted to a contract: cannot

Re: [racket] How can I use the results of a pattern match to produce a value in a match-expander?

2015-01-16 Thread Sam Tobin-Hochstadt
I also answered on SO, but you just want to do more in the `app` pattern: #lang racket (struct foo (a b c) #:transparent) (define-match-expander foo-string (λ (stx) (syntax-case stx () [(_ result) #'(app (λ (v) (apply (λ (_ a b c) (foo a b c))

Re: [racket] Little Schemer, lat?

2015-01-08 Thread Sam Tobin-Hochstadt
I think you want to use `(Listof Any)`. Sam On Thu, Jan 8, 2015 at 6:18 PM, Daniel Prager daniel.a.pra...@gmail.com wrote: I was surprised that cdr upsets the type-checker? How to fix? #lang typed/racket (: atom? (- Any Boolean)) (define (atom? a) (or (symbol? a) (boolean? a) (number?

Re: [racket] Github API in Racket

2014-12-12 Thread Sam Tobin-Hochstadt
Hi Animesh, You're on the right track in using the API for getting data from github. I've written a wrapper already that covers some parts of the github api, but far from all of it. You can see the code here: https://github.com/samth/github.rkt and you can install it with `raco pkg install

Re: [racket] Run-time record access

2014-12-10 Thread Sam Tobin-Hochstadt
You can generate a struct-accessor-procedure using struct-info, and use that with integer indexes. Sam On Wed Dec 10 2014 at 2:00:34 PM Benjamin Greenman bl...@cornell.edu wrote: Ok, thank you. Is struct-vector the best way to access fields positionally? On Wed, Dec 10, 2014 at 7:30 AM,

Re: [racket] pdf-dc%: Generating a pdf with image embedded in jpeg format?

2014-12-08 Thread Sam Tobin-Hochstadt
If you go to github advanced search, you can enter racket as the user, and search for pdf-dc%. You may then have to click on results for code. The results aren't ordered the way I'd order them :), but it finds everything. Sam On Mon, Dec 8, 2014 at 3:16 PM, Jens Axel Søgaard

Re: [racket] Curious error messages

2014-12-04 Thread Sam Tobin-Hochstadt
On Thu Dec 04 2014 at 9:36:08 AM Robby Findler ro...@eecs.northwestern.edu wrote: On Wed, Dec 3, 2014 at 10:30 PM, Prabhakar Ragde plra...@uwaterloo.ca wrote: I'm currently using Racket 6.1. For some time now, when editing Scribble files in DrRacket, I've been getting file has changed on

Re: [racket] Curious error messages

2014-12-04 Thread Sam Tobin-Hochstadt
, Dec 4, 2014 at 10:34 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: On Thu Dec 04 2014 at 9:36:08 AM Robby Findler ro...@eecs.northwestern.edu wrote: On Wed, Dec 3, 2014 at 10:30 PM, Prabhakar Ragde plra...@uwaterloo.ca wrote: I'm currently using Racket 6.1. For some time now

Re: [racket] eval question

2014-11-20 Thread Sam Tobin-Hochstadt
On Thu Nov 20 2014 at 10:42:08 AM Benjamin Greenman bl...@cornell.edu wrote: But why does eval's default namespace include + but not expt? It doesn't include either `+` or `expt`. The initial value for `current-namespace` inside a module is an empty namespace. Sam

Re: [racket] using struct-copy with struct subtypes?

2014-11-17 Thread Sam Tobin-Hochstadt
Unfortunately, you can't really do this in a general way for structs. There are a couple possible solutions: - use objects/classes and implement a `clone` or a `replace` method - use generics, with a `clone` or `replace` generic function Sam On Mon, Nov 17, 2014 at 12:22 PM, Matthew Butterick

Re: [racket] Polymorphic types and curried functions

2014-11-13 Thread Sam Tobin-Hochstadt
That's really cool. Sam On Thu, Nov 13, 2014 at 6:28 PM, Jack Firth jackhfi...@gmail.com wrote: That was my general approach, however I had to do a bit more analysis. That macro expands (:/c f (A B) (- B (- A B)) to (: f (All (A) (- B (All (B) (- A B). I’ve come up with something that

Re: [racket] Defining a typed language

2014-10-31 Thread Sam Tobin-Hochstadt
On Fri, Oct 31, 2014 at 5:57 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Sam Tobin-Hochstadt writes: The rule is that for anything like: (module m lang (form ...)) `form` is expanded until it either produces `#%plain-module-begin` or another core form

Re: [racket] Typed Racket frustration

2014-10-30 Thread Sam Tobin-Hochstadt
a b)) (- a b (HashTable a b)) )) On Oct 30, 2014, at 7:53 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Sam Tobin-Hochstadt writes: This isn't a different version of `hash` -- instead, it's the same version, with a type that doesn't accept every working untyped Racket program

Re: [racket] Defining a typed language

2014-10-30 Thread Sam Tobin-Hochstadt
On Wed, Oct 29, 2014 at 5:50 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Sam Tobin-Hochstadt writes: This suggests that if I want my single-form module to be handled exactly like a multi-form module, my single form must expand to something else than #%plain-module-begin. Fine

Re: [racket] Typed Racket frustration

2014-10-29 Thread Sam Tobin-Hochstadt
On Wed, Oct 29, 2014 at 12:32 PM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Of course, the Type Checker can't be wrong, so let's ask it what the type of hash is: ≻ hash - : (All (a b) (- (HashTable a b))) #procedure:hash Right, no arguments. So Typed Racket's hash is a

Re: [racket] Defining a typed language

2014-10-28 Thread Sam Tobin-Hochstadt
On Tue, Oct 28, 2014 at 10:30 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Konrad Hinsen writes: I have added lots of comments to my minimalistic typed language implementation, in the hope that future language definers will be able to pick up from there:

Re: [racket] Defining a typed language

2014-10-27 Thread Sam Tobin-Hochstadt
I think what happens here is that the `require` that Konrad added was getting the correct state initialized, but because of hygiene wasn't the `require` that was binding the references to `foo`. Then Evan's changes meant that the state and the binding were coming from the correct place, and it

Re: [racket] Defining a typed language

2014-10-27 Thread Sam Tobin-Hochstadt
I don't understand that, unfortunately. Sam On Mon, Oct 27, 2014 at 5:43 AM, Alexander D. Knauth alexan...@knauth.org wrote: I had made a pull request about this that was almost the same, but something really weird was happening with require that I don’t understand. I had tried it with

Re: [racket] FFI crashing Racket

2014-10-19 Thread Sam Tobin-Hochstadt
It appears, from some quick googling, that createIndex enables multithreading in clang, which might explain this, depending on the threading libraries used. Sam On Oct 19, 2014 9:24 AM, Matthew Flatt mfl...@cs.utah.edu wrote: It appears that calling clang_createIndex() sets the handler for

Re: [racket] Defining a typed language

2014-10-17 Thread Sam Tobin-Hochstadt
You should keep the original require and provide, and add the new inserted require as an extra. Does that work? Sam On Oct 17, 2014 6:38 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Sam Tobin-Hochstadt writes: My suggestion is to have your `test-lang` language use `#%module-begin

Re: [racket] Defining a typed language

2014-10-17 Thread Sam Tobin-Hochstadt
Hmm, that surprises me; I'll take a look. Sam On Oct 17, 2014 8:25 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Sam Tobin-Hochstadt writes: You should keep the original require and provide, and add the new inserted require as an extra. Does that work? That's easy to check

Re: [racket] Defining a typed language

2014-10-16 Thread Sam Tobin-Hochstadt
On Thu, Oct 16, 2014 at 11:41 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Konrad Hinsen writes: After a closer look at the language definition mechanism, I came to the conclusion that the language here is actually s-exp, with my module merely providing the initial bindings.

Re: [racket] Argument type conventions

2014-10-09 Thread Sam Tobin-Hochstadt
That's really cool. Nicely done. Sam On Thu, Oct 9, 2014 at 5:00 PM, Jack Firth jackhfi...@gmail.com wrote: Following from a discussion on the list a few days ago, I’ve created a package for Typed Racket that lets you define function arguments to have some types by default, like so: #lang

Re: [racket] Cyclic data structures in Typed Racket

2014-09-30 Thread Sam Tobin-Hochstadt
On Tue, Sep 30, 2014 at 8:50 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: If I convert the outer module to plain Racket and use a plain require, this works fine. Are the rules for module references different in Typed Racket? No, there's a problem with submodules and Typed Racket. I

Re: [racket] Cyclic data structures in Typed Racket

2014-09-29 Thread Sam Tobin-Hochstadt
I recommend doing the mutation yourself, and not using `shared`. That's the most obvious solution. The reason that your `require/typed` doesn't work is that it creates new versions of the placeholder functions, but those aren't the ones that `shared` uses internally, so Typed Racket doesn't use

Re: [racket] Cyclic data structures in Typed Racket

2014-09-29 Thread Sam Tobin-Hochstadt
once you've created it to a new version of `foo`, using hash tables to track cycles. That's basically how `shared` works, although I haven't tried implementing it in TR and it might not be possible. Sam On Mon, Sep 29, 2014 at 12:33 PM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Sam Tobin

Re: [racket] typed racket, filters, and polymorphism

2014-09-28 Thread Sam Tobin-Hochstadt
, at 6:19 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: No, I don't think you can do this. Can you say more about what you're trying to accomplish? Sam On Thu, Sep 25, 2014 at 6:15 PM, Alexander D. Knauth alexan...@knauth.org wrote: Do any of you have any advice for getting a function

Re: [racket] typed racket, filters, and polymorphism

2014-09-28 Thread Sam Tobin-Hochstadt
typing in the guard or something like that. On Sep 28, 2014, at 11:48 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Why not do this with the type, instead of making this polymorphic? Sam On Fri, Sep 26, 2014 at 7:35 PM, Alexander D. Knauth alexan...@knauth.org wrote: Is it possible

Re: [racket] typed racket and generic interfaces, is there a workaround using properties?

2014-09-27 Thread Sam Tobin-Hochstadt
On Sat, Sep 27, 2014 at 9:11 PM, Anthony Carrico acarr...@memebeam.org wrote: On 09/27/2014 09:49 AM, Alexander D. Knauth wrote: Like this, I think: (but for some reason it seems to print it 3 times?) #lang typed/racket (struct foo () #:transparent #:property prop:custom-write (lambda

Re: [racket] typed racket, filters, and polymorphism

2014-09-25 Thread Sam Tobin-Hochstadt
No, I don't think you can do this. Can you say more about what you're trying to accomplish? Sam On Thu, Sep 25, 2014 at 6:15 PM, Alexander D. Knauth alexan...@knauth.org wrote: Do any of you have any advice for getting a function like this to type-check? #lang typed/racket (: check-int :

Re: [racket] canonical index of Racket courses? [was: Summer programs learning Racket for a student]

2014-09-17 Thread Sam Tobin-Hochstadt
I've now created a wiki page for this, with some initial content: https://github.com/plt/racket/wiki/Courses-using-Racket If you teach (or know of) a course using Racket/HtDP/etc, please add it there. Sam On Tue, Sep 16, 2014 at 8:43 PM, Matthias Felleisen matth...@ccs.neu.edu wrote: You're

Re: [racket] Best typed/racket representation for bitfield of width 125?

2014-09-06 Thread Sam Tobin-Hochstadt
If you type check the file on a 64-bit system like yours, but then ran it on a 32-bit system, the fixnum range would change, making that number into a bignum. Sam On Sep 6, 2014 8:37 AM, John Clements johnbcleme...@gmail.com wrote: Is this a bug, or just a known limitation of typed racket? It

Re: [racket] fl vs. unsafe-fl

2014-09-03 Thread Sam Tobin-Hochstadt
On Tue, Sep 2, 2014 at 12:13 PM, Dmitry Pavlov dpav...@ipa.nw.ru wrote: I agree with you; however, I think I am in an unlucky situation. I actually have to write code that works with flonums or (optionally) with extflonums. As Extflonums are not part of the numeric tower, Typed Racket will

Re: [racket] fl vs. unsafe-fl

2014-09-02 Thread Sam Tobin-Hochstadt
On Tue, Sep 2, 2014 at 11:53 AM, Dmitry Pavlov dpav...@ipa.nw.ru wrote: The best thing about Typed Racket is that you can delegate that problem. Not only do you not need to write unsafe-fl+, you don't even need to write fl+. You can write +. Typed Racket will determine if + can safely be

Re: [racket] package builds, updated daily

2014-08-22 Thread Sam Tobin-Hochstadt
On Fri, Aug 22, 2014 at 8:53 AM, Matthew Flatt mfl...@cs.utah.edu wrote: The site http://pkg-build.racket-lang.org/ reports the result of a daily build of all packages that are listed at pkgs.racket-lang.org. The builds use the current release of Racket (version 6.1), and the site

Re: [racket] Struct match magick

2014-08-19 Thread Sam Tobin-Hochstadt
On Tue, Aug 19, 2014 at 8:32 AM, Roman Klochkov kalimeh...@mail.ru wrote: #lang racket (require (for-syntax racket racket/struct-info)) (struct foo (a b)) (set! foo-a (let ([old foo-a]) (λ (x) (displayln x) (old x (define t (foo 1 2)) (displayln Before change)

Re: [racket] Persistent struct API

2014-08-19 Thread Sam Tobin-Hochstadt
own match-expander. 3) Don't mimic struct. Maybe classes. What would you advice? What is more correct? Tue, 19 Aug 2014 09:35:48 -0400 от Sam Tobin-Hochstadt sa...@cs.indiana.edu: On Tue, Aug 19, 2014 at 8:32 AM, Roman Klochkov kalimeh...@mail.ru wrote: #lang racket (require (for-syntax

Re: [racket] bug? bit-vector equal problem

2014-08-19 Thread Sam Tobin-Hochstadt
On Tue, Aug 19, 2014 at 10:44 PM, Greg Hendershott greghendersh...@gmail.com wrote: But, you say, you're using equal? Although I'm not familiar with gen:equal+hash, it must be that equal? checks for and uses that. Yep:

Re: [racket] reference #:when clause in for/list?

2014-08-17 Thread Sam Tobin-Hochstadt
This is what 'in-value' is for. Sam On Aug 17, 2014 5:07 AM, Mark Wallace lotab...@gmail.com wrote: Consider the following pseudocode: (for/list ([i ...] #:when very complecated expr E) reference to the above expr E) Can I bind that expression E and reference in the body of

Re: [racket] Puzzled about type inference

2014-08-12 Thread Sam Tobin-Hochstadt
[rather late] Typed Racket knows quite a bit about the types of expressions, not just constants, even when type checking fails. I think we could use a logging mechanism similar to the one that allows check syntax to work even when type checking fails to communicate types of sub-expressions to

Re: [racket] Puzzled about type inference

2014-08-12 Thread Sam Tobin-Hochstadt
: That would be great. I think you'd just want to tell check syntax at this position, here is a string to show the user. Is that ok? (And you'd put newlines in the string to format it, I guess?) Robby On Tue, Aug 12, 2014 at 8:55 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: [rather late

Re: [racket] Puzzled about type inference

2014-08-12 Thread Sam Tobin-Hochstadt
that DrRacket might want to line-break things differently, or otherwise render things more interestingly. Sam On Tue, Aug 12, 2014 at 12:36 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I think that it would work better to: a. Associate the information with a syntax object rather than

Re: [racket] Puzzled about type inference

2014-08-04 Thread Sam Tobin-Hochstadt
Here's how I would annotate the original program, using Matthias' type definitions: ``` #lang typed/racket (: 1+ (Nonnegative-Integer - Positive-Integer)) (define (1+ n) (+ n 1)) ;; entirely unnecessary but helped me read; IGNORE (define-type (Maybe α) (U False α)) (define-type NI

Re: [racket] serialization of math/array

2014-07-29 Thread Sam Tobin-Hochstadt
complains about a non serializable value. Is this correct and would it be possible to add this property options with little effort? Berthold On 24.07.2014, at 14:52, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: On Thu, Jul 24, 2014 at 7:21 AM, Berthold Bäuml berthold.bae...@dlr.de wrote

Re: [racket] is there anything like a let/contract?

2014-07-29 Thread Sam Tobin-Hochstadt
Wouldn't this be, basically: (define-syntax-rule (let/contract ([x con e]) body ...) (let ([x (with-contract 'x #:result con e)]) body ...)) Sam On Tue, Jul 29, 2014 at 11:22 AM, Alexander D. Knauth alexan...@knauth.org wrote: Is there anything like a let/contract”?

Re: [racket] serialization of math/array

2014-07-24 Thread Sam Tobin-Hochstadt
23, 2014 at 11:52 AM, Matthias Felleisen matth...@ccs.neu.edu wrote: Let's assume we serialize arrays of numbers, which is what I assume the background to the question is. In that case, the answer isn't all that obvious to me. On Jul 23, 2014, at 11:47 AM, Sam Tobin-Hochstadt sa

Re: [racket] serialization of math/array

2014-07-23 Thread Sam Tobin-Hochstadt
Unfortunately, I think that strategy would incur substantial overhead for things like serialization of large arrays. Sam On Wed, Jul 23, 2014 at 11:28 AM, Matthias Felleisen matth...@ccs.neu.edu wrote: On Jul 23, 2014, at 11:10 AM, Neil Toronto neil.toro...@gmail.com wrote: On 07/16/2014

Re: [racket] serialization of math/array

2014-07-23 Thread Sam Tobin-Hochstadt
That really depends what the contracts are, and if they're first-order. Sam On Wed, Jul 23, 2014 at 11:45 AM, Matthias Felleisen matth...@ccs.neu.edu wrote: Will these costs dominate the cost of I/O here? On Jul 23, 2014, at 11:37 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote

Re: [racket] typed racket and unions of vector types

2014-07-23 Thread Sam Tobin-Hochstadt
This could be made to typecheck via a variety of methods: - We could add something ad-hoc to `vector-ref`. - We could add use-site variance to Typed Racket, so that it could tell that `vector-ref` is covariant (while `vector-set!` would be contra-variant). - We could do something less ad-hoc that

Re: [racket] serialization of math/array

2014-07-23 Thread Sam Tobin-Hochstadt
, the answer isn't all that obvious to me. On Jul 23, 2014, at 11:47 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: That really depends what the contracts are, and if they're first-order. Sam On Wed, Jul 23, 2014 at 11:45 AM, Matthias Felleisen matth...@ccs.neu.edu wrote

Re: [racket] identifier-binding source-id vs. nominal-source-id

2014-07-22 Thread Sam Tobin-Hochstadt
On Tue, Jul 22, 2014 at 4:42 PM, Greg Hendershott greghendersh...@gmail.com wrote: p.s. I guess the tl'dr version of all that would be: Given an identifier symbol from a source file, is there a reliable way to find the name used in its definition? Even following an arbitrarily long series of

Re: [racket] weird typed racket error

2014-07-14 Thread Sam Tobin-Hochstadt
This version with `for/fold` works for me: (for/fold : (U Index #f) ([k : (U Index #f) #f]) ([i : Index (ann (in-range 5) (Sequenceof Index))]) i) Sam On Sun, Jul 13, 2014 at 11:15 PM, Alexander D. Knauth alexan...@knauth.org wrote: On Jul 13, 2014, at 8:23 PM, Sam Tobin-Hochstadt sa

Re: [racket] something like a prop:object-name?

2014-07-14 Thread Sam Tobin-Hochstadt
the object-name of the function, or something refined. The struct itself could be used for potentially every function a user writes, rendering object-name overly vague. -Ian - Original Message - From: Sam Tobin-Hochstadt sa...@cs.indiana.edu To: Matthew Flatt mfl...@cs.utah.edu Cc: Racket

Re: [racket] weird typed racket error

2014-07-13 Thread Sam Tobin-Hochstadt
Probably, what's going on here is that `for/last` has a hidden loop variable that starts off as `#f` and Typed Racket infers that to have type `False`. If that's the case, there's nothing you can really do other than rewrite this as `for/fold`. Sam On Sun, Jul 13, 2014 at 7:57 PM, Alexander D.

Re: [racket] something like a prop:object-name?

2014-07-12 Thread Sam Tobin-Hochstadt
This doesn't count as soon, but I finally cleaned up my patch for this: https://github.com/plt/racket/pull/729 It's not as general as what Alexander envisioned, so it should probably be generalized. Sam On Wed, Apr 30, 2014 at 5:13 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I've

Re: [racket] weird build failed after changing one character in docs that shouldn't affect anything

2014-07-11 Thread Sam Tobin-Hochstadt
Those nondeterministic errors are in the Racket test suite, so probably they wouldn't happen in the rackjure tests. Sam On Jul 11, 2014 8:10 PM, Robby Findler ro...@eecs.northwestern.edu wrote: No. But there are non-deterministic failures that travis sometimes finds, elsewhere in Racket. I

Re: [racket] Struct fields in struct-info + match enhancements

2014-07-09 Thread Sam Tobin-Hochstadt
) I'm not entirely sure how to get this all to work. I'd need some mflatt guidance. -Ian - Original Message - From: Sam Tobin-Hochstadt sa...@cs.indiana.edu To: J. Ian Johnson i...@ccs.neu.edu Cc: users users@racket-lang.org Sent: Wednesday, May 14, 2014 1:18:58 PM GMT -05:00 US/Canada

Re: [racket] Lunch choosing program ported from Haskell to Racket

2014-07-07 Thread Sam Tobin-Hochstadt
On Mon, Jul 7, 2014 at 9:17 PM, Brian Adkins racketus...@lojic.com wrote: The various match-lambdas got me closer. I haven't found one w/o an extra set of [ ] or ( ) yet, but if I don't, I think I can make a macro for it after gaining some experience to allow the following: (define foo

Re: [racket] A safe version of unsafe-struct-ref [for Whalesong]

2014-07-03 Thread Sam Tobin-Hochstadt
GMT+02:00 Sam Tobin-Hochstadt sa...@cs.indiana.edu: The output of `match` when it uses `unsafe-struct-ref` can't be faithfully implemented safely. In particular, `match` has access to the accessor function, which may give you results that you can't get from safe reflection such as `struct

Re: [racket] typed and racket/date

2014-06-27 Thread Sam Tobin-Hochstadt
You should use `(require typed/racket/date)` instead. There's a list of already-typed libraries in the documentation here: http://docs.racket-lang.org/ts-reference/Libraries_Provided_With_Typed_Racket.html but I see that it doesn't mention `racket/date`. Sam On Fri, Jun 27, 2014 at 1:49 PM,

Re: [racket] Typed racket and apply

2014-06-27 Thread Sam Tobin-Hochstadt
I would write the program this way: #lang typed/racket (: exit-with-error-msg : String Any * - Any) (define (exit-with-error-msg m . e) (apply eprintf m e) (exit 1)) Note that we explicitly require at least one argument, the format string. In your program, Typed Racket can't tell that

Re: [racket] Typed racket and hash table

2014-06-27 Thread Sam Tobin-Hochstadt
On Fri, Jun 27, 2014 at 3:32 PM, Manfred Lotz manfred.l...@arcor.de wrote: Argument 3: Expected: (- b) Given:False This is the key part of the error message: you have to provide a function as the third argument, and you provided `#f`. I'd just change that to (lambda () #f). Sam

Re: [racket] Typed racket and hash table

2014-06-27 Thread Sam Tobin-Hochstadt
...@arcor.de wrote: On Fri, 27 Jun 2014 15:49:14 -0400 Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: On Fri, Jun 27, 2014 at 3:32 PM, Manfred Lotz manfred.l...@arcor.de wrote: Argument 3: Expected: (- b) Given:False This is the key part of the error message: you have to provide

Re: [racket] Typed racket and hash table

2014-06-27 Thread Sam Tobin-Hochstadt
On Fri, Jun 27, 2014 at 4:08 PM, Manfred Lotz manfred.l...@arcor.de wrote: On Fri, 27 Jun 2014 15:59:47 -0400 Alexander D. Knauth alexan...@knauth.org wrote: Are you sure you meant hash-ref! and not just hash-ref”? Well I thought hash-ref! is the way to go because I just wanted #f in case

Re: [racket] Typed racket and command line parameters

2014-06-22 Thread Sam Tobin-Hochstadt
Fortunately, one of those casts can be eliminated with a bit of type annotation on `NUM`. Full code here: https://gist.github.com/samth/48bf2ccb2c510c75017e (define parms (command-line #:program mypgm #:once-each [(-v --verbose) Show verbose output (opt-verbose-mode #t)] [(-m

Re: [racket] help me speed up string split?

2014-06-18 Thread Sam Tobin-Hochstadt
I'll stick to for/list + in-port + read Note that this combination is nicely packaged up as `(port-list)`, and there's a couple optional arguments and also `file-list` for other versions of this. Sam Racket Users list: http://lists.racket-lang.org/users

Re: [racket] help me speed up string split?

2014-06-18 Thread Sam Tobin-Hochstadt
On Wed, Jun 18, 2014 at 7:33 PM, Ryan Davis zenspi...@gmail.com wrote: On Jun 18, 2014, at 15:55, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I'll stick to for/list + in-port + read Note that this combination is nicely packaged up as `(port-list)`, and there's a couple optional

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Sam Tobin-Hochstadt
This is exactly what predicates are for, in general. However, you can't have predicates that check things about functions -- there's no information there at runtime to look at. Typed Racket functions are just plain Racket functions. We could add some extra metadata to every value that held its

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Sam Tobin-Hochstadt
On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth alexan...@knauth.org wrote: Typed Racket functions are just plain Racket functions. We could add some extra metadata to every value that held its type, It wouldn’t have to be every value, it could just put that information in for

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Sam Tobin-Hochstadt
On Mon, Jun 16, 2014 at 3:29 PM, Alexander D. Knauth alexan...@knauth.org wrote: On Jun 16, 2014, at 3:13 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth alexan...@knauth.org wrote: Typed Racket functions are just plain Racket

Re: [racket] Racketcon website video archives

2014-05-28 Thread Sam Tobin-Hochstadt
Sorry about that; I'll fix it. In case you're looking for it, the correct link is https://www.youtube.com/watch?v=C88L4u306Ro Sam On Wed, May 28, 2014 at 4:43 PM, Evan Donahue emdon...@gmail.com wrote: I can't seem to find out who in particular maintains the racket website, so in the hopes

Re: [racket] Plot is voracious

2014-05-21 Thread Sam Tobin-Hochstadt
Changing the default behavior like that seems like it would potentially break a lot of people's plots. Sam On Wed, May 21, 2014 at 1:22 PM, Robby Findler ro...@eecs.northwestern.edu wrote: How about adding yet another argument to plot #:errors-go-to-nan or something like that, such that plot's

Re: [racket] the definition of 'form'?

2014-05-16 Thread Sam Tobin-Hochstadt
I don't think this is really what Norman wants. Instead, I think he's looking for a definition of `form` as it appears in various error messages that mention form. Sam On Fri, May 16, 2014 at 1:52 PM, Ryan Culpepper ry...@ccs.neu.edu wrote: If you refer to the Syntax Model section of the

Re: [racket] Struct fields in struct-info + match enhancements

2014-05-14 Thread Sam Tobin-Hochstadt
On Wed, May 14, 2014 at 12:35 PM, J. Ian Johnson i...@ccs.neu.edu wrote: tl;dr if you use struct-info in your programs, I might break them. Please continue reading. I had a PR a while ago suggesting a change to struct-copy due to its unhygienic nature with fields. It did not go through

  1   2   3   4   5   6   7   >