typed

How to do define-for-syntax in typed racket?

混江龙づ霸主 提交于 2021-01-28 19:37:58
问题 This works #lang racket (begin-for-syntax (define (foo n) (+ n 3))) So I would also expect this to work #lang typed/racket (: foo : Real -> Real) (define-for-syntax (foo n) (+ n 3)) But if fails with ; :: undefined; ; cannot reference an identifier before its definition After that I tried each of the following in turn in typed/racket (define-for-syntax (foo (n : Real)) : Real (+ n 3)) (begin-for-syntax (: foo (-> Real Real)) (define (foo n) (+ n 3))) (begin-for-syntax (define (foo (n : Real))

Typed racket require module repeated evaluation

こ雲淡風輕ζ 提交于 2021-01-05 07:22:46
问题 This is a follow-on to this answer to this question. When this code is saved to a file and run from the command line, it prints 13 three times. Twice I can understand, but three times? Why? When I run it from racket-mode in emacs it prints 13 five times! And when I run it in DrRacket it prints 13 seven times! The behaviour is also different in vanilla Racket? Changing #lang typed/racket to #lang racket prints 13 once from the command line, twice from emacs and three times from DrRacket. What

Typed AS3 JSON Encoder and Decoder?

[亡魂溺海] 提交于 2019-12-31 02:09:25
问题 I need to encode and Decode AS3 Objects in a typed manner. http://code.google.com/p/as3corelib/ only supports untyped encoding and decoding. http://code.google.com/p/ason/ supports some kind of typed objects but is not very robust, e.g. it fails on Date Objects. Any Recommendations ? To make it clear: It MUST be JSON and it MUST be strong typed and robust. 回答1: JSON is built in in AS3. The preferred method to transmit data over the wire is AMF, which does provide you typed objects. If you

Arraylist in parcelable object

落花浮王杯 提交于 2019-12-17 17:37:05
问题 I have seen many parcelable examples so far, but for some reason I can't get it to work when it gets a bit more complex. I have a Movie object, which implements Parcelable. This book object contains some properties, such as ArrayLists. Running my app results in a NullPointerException when executing the ReadTypedList ! I'm really out of ideas here public class Movie implements Parcelable{ private int id; private List<Review> reviews private List<String> authors; public Movie () { reviews = new

saving a records containing a member of type string to a file (Delphi, Windows)

爷,独闯天下 提交于 2019-12-08 22:35:59
问题 I have a record that looks similar to: type TNote = record Title : string; Note : string; Index : integer; end; Simple. The reason I chose to set the variables as string (as opposed to an array of chars) is that I have no idea how long those strings are going to be. They can be 1 char long, 200 or 2000. Of course when I try to save the record to a type file (file of...) the compiler complains that I have to give a size to string. Is there a way to overcome this? or a way to save those records

statically/dynamically typed vs static/dynamic binding

喜欢而已 提交于 2019-12-03 17:47:45
问题 everyone what is the difference between those 4 terms, can You give please examples? 回答1: Static and dynamic are jargon words that refer to the point in time at which some programming element is resolved. Static indicates that resolution takes place at the time a program is constructed. Dynamic indicates that resolution takes place at the time a program is run. Static and Dynamic Typing Typing refers to changes in program structure that are due to the differences between data values: integers

statically/dynamically typed vs static/dynamic binding

人走茶凉 提交于 2019-12-03 06:27:02
everyone what is the difference between those 4 terms, can You give please examples? Static and dynamic are jargon words that refer to the point in time at which some programming element is resolved. Static indicates that resolution takes place at the time a program is constructed. Dynamic indicates that resolution takes place at the time a program is run. Static and Dynamic Typing Typing refers to changes in program structure that are due to the differences between data values: integers, characters, floating point numbers, strings, objects and so on. These differences can have many effects,

Simply typed lambda calculus with failure, in Haskell

一笑奈何 提交于 2019-12-01 18:14:36
问题 I'm a newcomer to Haskell, so apologies if this question doesn't make too much sense. I want to be able to implement simply typed lambda expressions in Haskell in such a way that when I try to apply an expression to another of the wrong type, the result is not a type error, but rather some set value, e.g. Nothing. At first I thought using the Maybe monad would be the right approach, but I've not been able to get anything working. I wondered what, if any, would be the correct way to do this.

Arraylist in parcelable object

别等时光非礼了梦想. 提交于 2019-11-28 04:31:02
I have seen many parcelable examples so far, but for some reason I can't get it to work when it gets a bit more complex. I have a Movie object, which implements Parcelable. This book object contains some properties, such as ArrayLists. Running my app results in a NullPointerException when executing the ReadTypedList ! I'm really out of ideas here public class Movie implements Parcelable{ private int id; private List<Review> reviews private List<String> authors; public Movie () { reviews = new ArrayList<Review>(); authors = new ArrayList<String>(); } public Movie (Parcel in) { readFromParcel(in