[racket-users] rel-string module path suffix not added automatically?

2019-08-20 Thread Štěpán Němec


  Hello,

I notice that (require "../file.rkt") inside a module (#lang racket,
v7.4) works, but (require "../file") doesn't ("no such file or
directory" error).

As per ,
'If the path has no suffix, ".rkt" is added automatically.'

Does the documentation differ from actual behaviour or am I missing
something?

  Thank you,

  Štěpán

-- 
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/87zhk3k3nc.fsf%40gmail.com.


Re: [racket-users] (curry map string->number) in Typed Racket

2019-08-28 Thread Štěpán Němec
On Thu, 22 Aug 2019 16:40:03 -0400
Jon Zeppieri wrote:

> (curry (inst map (U Complex False) String)
>  string->number)
>
> ... typechecks, but in your expression, you're going to need to handle
> the possibility that the pattern variables in `list-rest` pattern are
> #f.

Many thanks for the help. I find it quite confusing, though: I'd expect
something like "(inst map (-> String (U Complex False)) (Listof String))",
which apparently means something else...

Does that mean that for higher-order function parameters, inst expects
only the return type signature, not that of the function itself? But
what about the String instead of (Listof String)? Or is this some kind
of special case for functions like map? Is it documented somewhere?

And more generally, could you recommend any good learning resources (or
good non-trivial code examples) of Typed Racket usage? I have read the
guide and consulted the reference, but keep hitting the wall...

Thanks,

  Štěpán

-- 
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/87ftllhaq5.fsf%40gmail.com.


Re: [racket-users] (curry map string->number) in Typed Racket

2019-08-28 Thread Štěpán Němec
On Wed, 28 Aug 2019 09:23:03 -0400
Jon Zeppieri wrote:

[...]

>> Does that mean that for higher-order function parameters, inst expects
>> only the return type signature, not that of the function itself?
>
> The main point here is that `inst` needs substitutions for the type
> _variables_, not for the types of the function arguments.

Oh, _now_ it makes sense! I see now that I really misunderstood even the
example in the reference entry for `inst`: I took "(inst cons Integer
Integer)" to mean "two Integer args" (which of course would only account
for the (Pairof a b) case and doesn't make sense in the context) instead
of "two Integer type variables".

Thank you for the detailed explanation!

-- 
Štěpán

-- 
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/87blw9gzo0.fsf%40gmail.com.


Re: [racket-users] rel-string module path suffix not added automatically?

2019-08-21 Thread Štěpán Němec


[resending to the list; I originally posted via Gmane but the
mail-to-news direction doesn't seem to work, sorry for the
duplication/confusion]

On Wed, 21 Aug 2019 06:39:42 +0200
Matthew Flatt wrote:

> It looks to me like the Guide documentation is wrong there. A ".rkt"
> suffix is added for an identifier-form path, like `racket/base`, but
> not for a relative-path string like "../file".

Thank you for the clarification! I hope someone can correct the
documentation (I would submit a patch same as I'm going to do with some
trivial typos I stumbled upon, but here perhaps some more sophisticated
action is required).

-- 
Štěpán

-- 
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/8736hukgpp.fsf%40gmail.com.


[racket-users] (curry map string->number) in Typed Racket

2019-08-22 Thread Štěpán Němec


I have a hard time persuading Typed Racket to accept the expression
"(curry map string->number)". No amount of type annotations or added
`inst`s (as recommended by the guide[1]) I could come up with seem to
help.

Is there a way to make it work?

[1] 
https://docs.racket-lang.org/ts-guide/caveats.html#%28part._.Type_inference_for_polymorphic_functions%29

Here's an example with a bit more context (solely for illustration
purposes; I couldn't make the simple expression above work even
isolated):

(match-let ([(pregexp "#\\d+ +@ +(\\d+),(\\d+): +(\\d+)x(\\d+)"
  (list-rest _ (app (curry map string->number)
(list x y dx dy
 "#1299 @ 414,871: 29x11"])
  x)

Thank you,

  Štěpán

-- 
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/8736hths88.fsf%40gmail.com.