Re: [racket-users] How to use dates (especially gregor) with Typed Racket?

2019-12-03 Thread Ben Greenman
The error is because gregor/time doesn't export a struct. But
nevermind that, because you're probably best off with an opaque type:

```
#lang typed/racket

(require/typed gregor/time
  [#:opaque Time time?]
  [time (->* [Integer] [Integer Integer Integer] Time)]
  [time->iso8601 (-> Time String)])

(require/typed gregor
  [current-time (->* [] [#:tz String] Time)])

(time->iso8601 (current-time))
;; "21:04:25.687808105"
```

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R6MhQP-Dt9eqnzf1cgZC%2BqmB0xuGq%2BVvAFkvf2YKSTOFg%40mail.gmail.com.


Re: [racket-users] Racket 7.5 DMG file does not open on OSX 10.11

2019-12-03 Thread 'John Clements' via Racket Users



> On Dec 3, 2019, at 2:29 PM, James Platt  wrote:
> 
> 
> On Nov 27, 2019, at 12:42 PM, Darth Vadør wrote:
> 
>> I am having the same problem, and I am pretty sure that this is because the 
>> new DMG uses the novel APFS format, which is not readable by our old HFS 
>> computers. 
>> As far as I know, HFS DMGs can be opened on new APFS Macs; would it be 
>> possible / a good idea to keep distributing Racket on an HFS DMG for our 
>> dinosaur machines? 
> 
> APFS has a number of new and improved features but I don't think any of them 
> are really important for a software distribution archive.  Note that macOS 
> does have zip built in.  As I understand it, the reason for dmg as the 
> official distribution format is just that it is supposed to have superior 
> integrity checking compared to zip.

It sounds to me like an easy solution to your problems would be a .tgz-bundled 
set, as e.g. we offer for Minimal Racket on the page

https://download.racket-lang.org/releases/7.5/

specifically at the link 

https://download.racket-lang.org/releases/7.5/installers/racket-minimal-7.5-x86_64-macosx.tgz

It looks to me like it would be fairly easy to generate this bundle for full 
racket, unless I’m missing something obvious. It would presumably appear on the 
“More Variants and Checksums” page along with the other tarballs. Is this 
something you’d like to see happen for the 7.6 release?

As far as the choice of .dmg for the standard distribution, it has two 
advantages that I’m aware of:
1) It allows us to create a easy installation path by specifying the way the 
disk window should look when we open it, as opposed to having an installer, and
2) It’s natively supported by Apple’s notarization workflow; I know that .tgz 
files don’t work, and I suspect that .zip files wouldn’t work either, though 
that’s just a guess.

John



> 
>> 
>> Long live 10-year-old Macs
> 
> Indeed.  The 2009 Mac Pro which I am using right now is among most likely 
> machines to be in use by the people who my company is developing software for 
> in Racket.  This Mac Pro, running El Capitan (macOS 10.11), is not just a 
> workable machine.  It's still a powerful machine by todays standards.  El 
> Capitan is the highest OS officially supported but it can run High Sierra 
> (10.13) just fine in VMWare.  Having said that, we also need to support the 
> newest machines so I will probably try setting up a VM with an even newer OS 
> or buy whatever is the cheapest laptop that can run Catalina.  For the Mac 
> Pro, I am considering installing Linux and running macOS only in virtual 
> machines.
> 
> If you want to test that the issue really is APFS then you might consider 
> installing a High Sierra (or possibly later) virtual machine.  High Sierra, 
> and up, can read APFS.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/1934E9FC-CE39-4C4E-BF3A-0DC37DBA2509%40biomantica.com.



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/6c748e88-faea-4dfc-985d-84d28b09e7be%40mtasv.net.


Re: [racket-users] Re: Racket 7.5 DMG file does not open on OSX 10.11

2019-12-03 Thread James Platt


On Nov 27, 2019, at 12:42 PM, Darth Vadør wrote:

> I am having the same problem, and I am pretty sure that this is because the 
> new DMG uses the novel APFS format, which is not readable by our old HFS 
> computers. 
> As far as I know, HFS DMGs can be opened on new APFS Macs; would it be 
> possible / a good idea to keep distributing Racket on an HFS DMG for our 
> dinosaur machines? 

APFS has a number of new and improved features but I don't think any of them 
are really important for a software distribution archive.  Note that macOS does 
have zip built in.  As I understand it, the reason for dmg as the official 
distribution format is just that it is supposed to have superior integrity 
checking compared to zip.

> 
> Long live 10-year-old Macs

Indeed.  The 2009 Mac Pro which I am using right now is among most likely 
machines to be in use by the people who my company is developing software for 
in Racket.  This Mac Pro, running El Capitan (macOS 10.11), is not just a 
workable machine.  It's still a powerful machine by todays standards.  El 
Capitan is the highest OS officially supported but it can run High Sierra 
(10.13) just fine in VMWare.  Having said that, we also need to support the 
newest machines so I will probably try setting up a VM with an even newer OS or 
buy whatever is the cheapest laptop that can run Catalina.  For the Mac Pro, I 
am considering installing Linux and running macOS only in virtual machines.

If you want to test that the issue really is APFS then you might consider 
installing a High Sierra (or possibly later) virtual machine.  High Sierra, and 
up, can read APFS.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1934E9FC-CE39-4C4E-BF3A-0DC37DBA2509%40biomantica.com.


Re: [racket-users] Re: GUI (get-directory)

2019-12-03 Thread James Platt


On Nov 25, 2019, at 1:29 PM, Stephen De Gabrielle wrote:

> Many packages contain an /examples folder, and adding examples is an easy way 
> to contribute.

I did not know that.  So, I guess the strategy is to find the git repository 
for the package and look there?  In any case, I haven't been finding these 
examples with a general web search.

> 
> There is also https://github.com/racket/racket/wiki/Artifacts
> 
>> This page captures useful code snippets that are too small to be a package.
>> 
>> Please contribute your own!
> 
> Though these might be better places in documentation, or in /examples

That artifacts wiki a good thing to know about.  Most of these are a little 
more complex than I am thinking are good for documentation but I may well 
contribute some small but useful code.  I sometimes create my own examples as I 
go because I often look back through my own code to refresh my memory on how to 
do something.  

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/D5A56D93-963F-412D-9CA6-7DE3A17F6148%40biomantica.com.


Re: [racket-users] GUI (get-directory)

2019-12-03 Thread James Platt
On Nov 21, 2019, at 6:27 PM, Alexis King wrote:

>> On Nov 21, 2019, at 11:21, James Platt  wrote:
>> 
>> If we can direct more of the energy of this community into, not just 
>> improving the documentation, but the way we do documentation, it would be a 
>> major improvement.  Requiring lots of parentheses doesn't bother me.  Lack 
>> of infix notation doesn't bother me.  Lack of documentation does.
> 
> Every so often I see this sentiment expressed, and I’ll be entirely honest: I 
> find it very surprising! I don’t at all want to suggest your experiences are 
> untrue, or that they’re somehow your fault or not worth fixing, but they’re 
> so contrary to my own that I must be missing something. I would go so far as 
> to say that my experience with Racket’s documentation is far and away the 
> best of every programming language I have ever used, even without adjusting 
> for its comparatively small community.

It is definitely true that poor documentation is a general problem with 
programming languages and the Racket Guide and Racket Reference are, indeed, 
among the best that I have seen.  I really like the fact that the Racket 
community explicitly recognizes the need to have both a guide and a reference. 
Documentation actually is a big problem almost everywhere these days.  

> 
> I will concede that racket/draw and racket/gui are particularly sparse in the 
> way of inline examples—perhaps something about the amount of context setup 
> often necessary—but as the main distribution goes, that feels more like an 
> exception than the norm! If you pick any section in the Datatypes chapter of 
> the Racket Reference, for example, virtually every binding has typeset 
> examples (using the scribble/example library you mention). Sections with 
> fewer inline examples usually at least have links to example-heavy companion 
> sections in the Guide. Even a library like pict, which is visual in the same 
> way racket/draw and racket/gui are, has typeset examples for nearly every 
> documented export.

A lot of what I have been working on in Racket is GUI related.  That might be 
part of the reason my experience has been so different than yours.  I have 
almost entirely been using the Racket Guide rather than the Racket Reference.  
I suppose I should start collecting examples of lack of examples.  As it 
happens, my next project is about creating stand-alone executables.  Look at 
the Racket Guide about raco distribute and there are no examples at all.  I'm 
looking here:  https://docs.racket-lang.org/raco/exe.html?q=raco%20distribute

I also have not been able to find Racket examples very easily with a web 
search.  I did some example searches just now to make sure I'm right about that 
and it looks like my default search engine, DuckDuckGo, has a particular 
problem with Racket.  DuckDuckGo, usually gets just as good, and sometimes 
better, results than Google, in my general experience.  However, I got better 
results with Startpage for a few Racket related searches.  For example, I 
recently needed to use a PBKDF in my Racket code.  Search for "racket pbkdf" 
(without the quotes) in DuckDuckGo and you don't get much of use but Google or 
Startpage get you straight to the most relevant material.  So I'll have to make 
sure to try Startpage for my Racket work from now on.  Maybe this part is not 
so bad as I thought.  

Something else which I am not able to find easily about creating standalone 
executables is an overall description of how to do this.  If I understand 
correctly, there are at least three methods.  There are command line tools, 
there is the "Create Executable" command in DrRacket or you can create and run 
a makefile.   Are there limitations to any of these compared to the others?  

The documentation probably belongs here:
https://docs.racket-lang.org/guide/exe.html

I do expect that this blog post will be helpful:
https://www.greghendershott.com/2017/04/racket-makefiles.html

I'm sure that I  can also find lots of examples of makefiles around which I can 
look through but it is nicer to have some official documentation.  I probably 
will create some documentation about this myself but I would want to run it by 
someone with more knowledge on the topic before contributing it to the official 
documentation.  It's easier to create a blog post and give the information on a 
this-worked-for-me basis.  What I would go ahead and add to the official 
documentation is a link to the DrRacket Create Executable documentation, which 
is missing at first link above.  


> I agree that it would be nice to make contributing small documentation 
> improvements more accessible, but your wording seems to suggest you feel 
> there is a deeper, systemic problem with the existing documentation. Could 
> you say more on what that is? Or, maybe better yet, could you point to some 
> other language’s documentation that you feel does things better that we might 
> take inspiration from? I, at least, would find that 

[racket-users] How to use dates (especially gregor) with Typed Racket?

2019-12-03 Thread Marc Kaufmann
Hi,

this is hopefully easier, but I can't figure out how to `(require/typed 
gregor)` inside a typed racket file. Here are my failed attempts (I want 
time to work, hence I try to import gregor/time):

```
#lang typed/racket

; Try to get time struct from gregor/time
(require/typed gregor/time
   [#:struct time ([hour : Integer] 
   [minute : Integer]
   [second : Integer]
   [nanosecond : Integer])])

; This just checks that the time structure isn't in gregor
(require/typed gregor
   [#:struct time ([hour : Integer] 
   [minute : Integer]
   [second : Integer]
   [nanosecond : Integer])]
   [current-time (->* () (#:tz String) time)])
```

These fail with errors of the kind 

"
only-in: identifier `struct:time' not included in nested require spec
at: gregor
in: (only-in gregor struct:time (time time2))
"

So, maybe I am wrong to think that time is a struct. But when I print one 
in the REPL, it says #, which I thought would mean it's a struct.

My next step was to check the type of it in the REPL with typed racket... 
but that doesn't work since requiring gregor in a REPL with typed/racket 
leads to the same errors (obviously, since how would it know anything 
more...). 

Hence, I fire up DrRacket, following the trail to the definition of the 
time structure and I find that the structure itself is never provided out, 
but only used to define the function `time?` and others. But that makes me 
wonder: how can I define the type for time so that I can use gregor inside 
typed/racket if I can't import the structure (which in my understanding 
defines the type of time)? I can't figure out what thing `(current-time)` 
is, apparently  `(struct Time (hms ns) ...)` but I don't see any contracts 
on hms or ns to figure out what they are... but even if I did, would I 
define my own structure `(struct my-time ([hms : HMS] [ns : NS])` and use 
that? 

Cheers,
Marc

PS: If any Vim users our there can tell me how to jump to definitions of 
required libraries I'd be ever so happy.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/fddb26f2-31d9-4228-b44f-73ea30d98220%40googlegroups.com.