[racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
Hi there, I've got another problem with typed racket. Let us say I have an assoc list with options for a program. These options could be of type String, Boolean, or Integer. Now in my program I want to check certain options but I don't know how to do without Typed Racket screaming at me. Here

[racket] db: SQL in clause

2014-11-30 Thread George Neuner
Hi all, I'm using Postgresql 9.3.5 and I keep getting a syntax error trying to pass a list of identifiers to an in clause of a select. (set! sql-cmd select * from contacts where id in $1 ) (set! result (query db sql-cmd (list 42 101))) I've tried : where id in $1 where id in

Re: [racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
Well, I should have added that I've found this: (: process (- OptList Void)) (define (process ol) (let ([s (optval 'size ol)]) (if (and s ( (cast s Integer) 0)) (displayln wrong value) (displayln ok))) ) but I didn't find this really nice. Actually, I was hoping for

Re: [racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
On Sun, 30 Nov 2014 09:25:57 -0500 Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I think this is exactly what you need. You could write ( (assert s integer?) 0) or (and s (integer? s) ( s 0)), which mostly do the same thing. But the fundamental issue is that this program is well-typed:

[racket] find-system-path under debugger

2014-11-30 Thread George Neuner
Hi all, I've noticed that (find-system-path 'run-file) works differently under the debugger vs the command line. When I start an application from the command line - either as a linked executable or as a script using racket file, (find-system-path 'run-file) gives me the start directory of

Re: [racket] Typed racket problem

2014-11-30 Thread Matthias Felleisen
Have you considered this: #lang typed/racket (define-type Myopt (U String Boolean Integer)) (define-type OptList (Listof (Pairof Symbol Myopt))) (: olist OptList) (define olist (list '(dir . .) '(verbose . #t) '(size . 12))) ; This is a fake type, where the filter flows

Re: [racket] Typed racket problem

2014-11-30 Thread Vincent St-Amour
At Sun, 30 Nov 2014 16:38:02 +0100, Manfred Lotz wrote: 1. You offered assert? as an alternative. Is this preferable in comparison to cast? Yes. Assertions are simple first order checks, and are quite inexpensive. Casts, on the other hand, use contracts and may require wrapping for mutable data

Re: [racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
No I hadn't considered the variant using type?. Thanks for this. Not quite sure if I'm happy about it as I would prefer to have the type checking at one place instead of providing a type each time I check/use options. -- Manfred On Sun, 30 Nov 2014 14:36:26 -0500 Matthias Felleisen

Re: [racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
On Sun, 30 Nov 2014 15:26:09 -0500 Thanks, Vincent. Vincent St-Amour stamo...@ccs.neu.edu wrote: At Sun, 30 Nov 2014 16:38:02 +0100, Manfred Lotz wrote: 1. You offered assert? as an alternative. Is this preferable in comparison to cast? Yes. Assertions are simple first order checks, and

Re: [racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
On Sun, 30 Nov 2014 22:21:14 +0100 Manfred Lotz manfred.l...@arcor.de wrote: No I hadn't considered the variant using type?. Thanks for this. Not quite sure if I'm happy about it as I would prefer to have the type checking at one place instead of providing a type each time I check/use

Re: [racket] Typed racket problem

2014-11-30 Thread Matthias Felleisen
In terms of cost, that's identical to what I had __and__ it locks in the number of variants you can deal with. In contrast, mine allows extensions at the point where you define Myopt; for the new fields, just pass in the additional type at the new call site. Now if you are sure that the 15

Re: [racket] find-system-path under debugger

2014-11-30 Thread Pierpaolo Bernardi
I think you need define-runtime-path instead. Here's an example of its use: ;; Access a file data.txt at run-time that is originally ;; located in the same directory as the module source file: (define-runtime-path sofa.dll (format sofa-~a-~a~a sofa-version arch )) P.

Re: [racket] Typed racket problem

2014-11-30 Thread Manfred Lotz
On Sun, 30 Nov 2014 17:47:23 -0500 Matthias Felleisen matth...@ccs.neu.edu wrote: In terms of cost, that's identical to what I had __and__ it locks in the number of variants you can deal with. I agree that in terms of cost there is no difference. Yes, it locks in the number of variants.

Re: [racket] find-system-path under debugger

2014-11-30 Thread George Neuner
define-runtime-path looks like it will work for scripts. I haven't yet understood how it interacts with creating a standalone executable - the documentation is pretty dense so I guess I'll have to try it. But, at least now I get the same result from a script under the debugger as when run

[racket] package-source require forms for new package system

2014-11-30 Thread Neil Van Dyke
Can I do `require` forms like this? (require http://code_man.cybnet.ch/racket/3d-model.zip) (require git://github.com/samth/abnf) Neil V. Racket Users list: http://lists.racket-lang.org/users