[racket-users] Thank you Racket!

2018-08-24 Thread Jérôme Martin
I just read the article by Matt that was posted on Hacker News 
(http://felleisen.org/matthias/OnHtDP/index.html) and I wanted to take the 
time to thank you all in the PLT/Racket team.

Thank you for trying (and achieving!) to bring a new approach to teaching 
computer science. Improving teaching methods is a hard process and you have 
the courage and will to fight for it, against all odds.
I'm glad some people are here to train students into a broader approach to 
program design and eventually become way better programmers than we are.

I discovered Racket one year ago and had the feeling I finally found the 
language, and most importantly the community, that brings me hope and make 
me feel like computer science is more than just about computers.
You are making a language that feels like writing code is actually a form 
of art sometimes, and it makes me see my profession with a new eye.

(define congrats (map thank plt-team))

I wish all of you a great time teaching with Racket.

I'll be sticking around improving some libs (especially web-server).

See you around folks :)

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Matthias Felleisen


For everyone else, the essay is NOT about Turing/the language or Turing/the man 
but Turing, the concept. 

And because it is true that we have monopoly power over students here, not a 
single required course forces students to use Racket. In our freshman course we 
use the teaching languages, explicitly clarify that they are useless for the 
real world, and that we do so to focus on the importance of problem solving, 
code design, and attitude about code design. In PL, we use #lang plai with a 
similar explanation. 

— Matthias





> On Aug 24, 2018, at 10:50 AM, Sanjeev Sharma  wrote:
> 
> "Turing is useless" ... 
> 
> While I worked as a programmer I used to complain quite bitterly about 
> university comp sci departments that had NIH (not invented here) syndrome and 
>  a captive audience. 
> 
> I learned Turing as my 2nd programming language.  I'm sure the only reason it 
> could have been taught is the profs & grad students that "invented" (added a 
> few trivial things to Pascal) Turing had great political pull at University 
> of Toronto in that decade. 
> 
> On Friday, August 24, 2018 at 9:02:47 AM UTC-4, Matthias Felleisen wrote:
> 
> > On Aug 24, 2018, at 5:50 AM, Jérôme Martin  wrote: 
> > 
> > I just read the article by Matt that was posted on Hacker News 
> > (http://felleisen.org/matthias/OnHtDP/index.html) and I wanted to take the 
> > time to thank you all in the PLT/Racket team. 
> > 
> > Thank you for trying (and achieving!) to bring a new approach to teaching 
> > computer science. Improving teaching methods is a hard process and you have 
> > the courage and will to fight for it, against all odds. 
> > I'm glad some people are here to train students into a broader approach to 
> > program design and eventually become way better programmers than we are. 
> > 
> > I discovered Racket one year ago and had the feeling I finally found the 
> > language, and most importantly the community, that brings me hope and make 
> > me feel like computer science is more than just about computers. 
> > You are making a language that feels like writing code is actually a form 
> > of art sometimes, and it makes me see my profession with a new eye. 
> > 
> > (define congrats (map thank plt-team)) 
> > 
> > I wish all of you a great time teaching with Racket. 
> > 
> > I'll be sticking around improving some libs (especially web-server). 
> > 
> > See you around folks :) 
> 
> 
> I am glad you found us. Spread the word and stay around — Matthias 
> 
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Get contract from function

2018-08-24 Thread Alex Knauth


> On Aug 24, 2018, at 8:50 AM, Joao Pedro Abreu De Souza  
> wrote:
> 
> Hi. I am contributing in a library that create functions to parse PEG(parsing 
> expression grammar). To implement a feature, I need to know the return's type 
> of a function. We are using racket, not typed-racket, so I think that I need 
> to get the contract or something like that. I dont see in the reference and 
> guide how to do that. Can anyone give me a direction?

There's the `value-contract` function [1].

> (define/contract (f x)
(-> integer? integer?)
x)
> (value-contract f)
(-> integer? integer?)

However, it doesn't work on everything (only values that had to be *wrapped* in 
chaperones because of higher-order properties), so might be less useful than 
you think. Also, it only works on functions that were explicitly wrapped with 
contracts, while most "base" functions do error checking themselves without a 
contract wrapper. So `value-contract` doesn't work on functions like that:

> (value-contract string-length)
#f
> (value-contract sqrt)
#f

Also, contracts are *extensible* in a way that types are not, which makes them 
more flexible but harder to analyze in general. Users can define new contracts 
and contract combinators that can "do" anything. With types it's about what the 
type "is" and its relationships to other types and language forms. But with 
contracts it's about what they "do" when a value comes along that it can check. 
So someone could create a new contract that checks their function, and 
`value-contract` would return it, but it wouldn't be an `->` contract, and your 
library wouldn't be able to analyze it.

So can you give more details about what you would need to use it for?

  [1]: 
https://docs.racket-lang.org/reference/contract-utilities.html#(def._((lib._racket%2Fcontract%2Fprivate%2Fguts..rkt)._value-contract))
 



> -- 
> 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 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Get contract from function

2018-08-24 Thread Robby Findler
Perhaps object-contract?

Note that this might not return a contract, however, in which case,
the function might return anything.

Robby

On Fri, Aug 24, 2018 at 7:50 AM Joao Pedro Abreu De Souza
 wrote:
>
> Hi. I am contributing in a library that create functions to parse PEG(parsing 
> expression grammar). To implement a feature, I need to know the return's type 
> of a function. We are using racket, not typed-racket, so I think that I need 
> to get the contract or something like that. I dont see in the reference and 
> guide how to do that. Can anyone give me a direction?
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Matthias Felleisen


> On Aug 24, 2018, at 5:50 AM, Jérôme Martin  
> wrote:
> 
> I just read the article by Matt that was posted on Hacker News 
> (http://felleisen.org/matthias/OnHtDP/index.html) and I wanted to take the 
> time to thank you all in the PLT/Racket team.
> 
> Thank you for trying (and achieving!) to bring a new approach to teaching 
> computer science. Improving teaching methods is a hard process and you have 
> the courage and will to fight for it, against all odds.
> I'm glad some people are here to train students into a broader approach to 
> program design and eventually become way better programmers than we are.
> 
> I discovered Racket one year ago and had the feeling I finally found the 
> language, and most importantly the community, that brings me hope and make me 
> feel like computer science is more than just about computers.
> You are making a language that feels like writing code is actually a form of 
> art sometimes, and it makes me see my profession with a new eye.
> 
> (define congrats (map thank plt-team))
> 
> I wish all of you a great time teaching with Racket.
> 
> I'll be sticking around improving some libs (especially web-server).
> 
> See you around folks :)


I am glad you found us. Spread the word and stay around — Matthias

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Get contract from function

2018-08-24 Thread Joao Pedro Abreu De Souza
Hi. I am contributing in a library that create functions to parse
PEG(parsing expression grammar). To implement a feature, I need to know the
return's type of a function. We are using racket, not typed-racket, so I
think that I need to get the contract or something like that. I dont see in
the reference and guide how to do that. Can anyone give me a direction?

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Sanjeev Sharma
"Turing is useless" ... 

While I worked as a programmer I used to complain quite bitterly about 
university comp sci departments that had NIH (not invented here) syndrome 
and  a captive audience. 

I learned Turing as my 2nd programming language.  I'm sure the only reason 
it could have been taught is the profs & grad students that "invented" 
(added a few trivial things to Pascal) Turing had great political pull at 
University of Toronto in that decade. 

On Friday, August 24, 2018 at 9:02:47 AM UTC-4, Matthias Felleisen wrote:
>
>
> > On Aug 24, 2018, at 5:50 AM, Jérôme Martin  > wrote: 
> > 
> > I just read the article by Matt that was posted on Hacker News (
> http://felleisen.org/matthias/OnHtDP/index.html) and I wanted to take the 
> time to thank you all in the PLT/Racket team. 
> > 
> > Thank you for trying (and achieving!) to bring a new approach to 
> teaching computer science. Improving teaching methods is a hard process and 
> you have the courage and will to fight for it, against all odds. 
> > I'm glad some people are here to train students into a broader approach 
> to program design and eventually become way better programmers than we are. 
> > 
> > I discovered Racket one year ago and had the feeling I finally found the 
> language, and most importantly the community, that brings me hope and make 
> me feel like computer science is more than just about computers. 
> > You are making a language that feels like writing code is actually a 
> form of art sometimes, and it makes me see my profession with a new eye. 
> > 
> > (define congrats (map thank plt-team)) 
> > 
> > I wish all of you a great time teaching with Racket. 
> > 
> > I'll be sticking around improving some libs (especially web-server). 
> > 
> > See you around folks :) 
>
>
> I am glad you found us. Spread the word and stay around — Matthias 
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Sanjeev Sharma
I didn't realize (though I should have) that the comment could be taken 
that way. 

I realize you were not writing anything about the Turing language, but the 
title of the essay triggered some memories for me of what my classmates and 
later my professional colleagues used to talk about.  And for some reason 
this time the title made me laugh (I've read it before and did not have 
that reaction). 

I've been using Racket for all my hobbyist programming for a while so 
there's no possibility that it could not be taught on its own merits 
instead of through influence. 

On Friday, August 24, 2018 at 11:00:30 AM UTC-4, Matthias Felleisen wrote:
>
>
> For everyone else, the essay is NOT about Turing/the language or 
> Turing/the man but Turing, the concept. 
>
> And because it is true that we have monopoly power over students here, not 
> a single required course forces students to use Racket. In our freshman 
> course we use the teaching languages, e
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Let's organize a Scheme European Event at FOSDEM 2019

2018-08-24 Thread amz3
Hello *Racketeers,*

Let's organize a Scheme event at FOSDEM 2019 in Bruxelles.

I started a page on the wiki @ http://community.schemewiki.org/?FOSDEM2019

You can edit the wiki page. The goal of that page is to gather enough talk 
ideas to be able to submit a proposal for a developer room at FOSDEM. See 
the CFP https://fosdem.org/2019/news/2018-08-10-call-for-participation/


Best regards,


Amirouche aka. amz3

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Neil Van Dyke

Ben Kovitz wrote on 08/24/2018 10:04 PM:
I noticed the separate User's Guide and Reference, and indeed that's 
one reason I'm considering Racket for practical use right now.


The separation of a Guide is good for a read-through, like on the train, 
when first exposed to a system.  *But*, for day-to-day looking up things 
while actively using Racket, I often/usually end up needing both Guide 
and Reference, and the separation is actually a big burden.  And, if I'm 
following links among multiple things within the manual, to find/learn 
what I need, there are two additional problems: at each point, there's a 
good chance I'm missing relevant information/explanation about that 
thing, which is in the other manual (but I don't want to keep checking 
at every step); and, as I'm navigating around, I might miss something 
entirely because the navigation got me into the Guide, and it just 
didn't cover that thing.


Now that Racket has a number of tutorial manuals (and even more 
tutorials can be created independently), there's less need for a Guide 
to be the train read for people new to it, at the cost of the 
Guide+Reference separation burdening those same people while they're 
actually using it, for every day after.


--
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Ben Kovitz
On Friday, August 24, 2018 at 9:33:12 PM UTC-4, Robby Findler wrote:
> The racket documentation is organized into two documents.
> …
> Guide: http://docs.racket-lang.org/guide/define-struct.html 
> 
> Reference:  http://docs.racket-lang.org/reference/define-struct.html 

I noticed the separate User's Guide and Reference, and indeed that's one
reason I'm considering Racket for practical use right now. This two-document
structure used to be commonplace in software. I think it's a really good,
effective approach and I'm glad to see it in use again.

I'm asking for something much smaller than a User's Guide, though: a little
collection of the down-and-dirty stuff that you need to know to be 
productive,
beyond knowing the syntax and semantics of the language. Often this kind of
information goes undocumented and is learned only by word of mouth. 
Sometimes
it's documented in tutorials, but I haven't found a tutorial for this yet.
The DrRacket documentation may well already have it; I haven't read much of
that yet.

A really narrow "Welcome to Racket" tutorial specifically for people coming
over from Clojure would be the most efficient thing for me to read, but I
realize that this may be asking more than is feasible. However, I am willing
to help write one in collaboration with someone who already knows their way
around Racket. The best time to write such a thing is while beginning—when 
the
stuff that goes without saying because everyone knows it is still getting 
said.

Ben

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Robby Findler
The racket documentation is organized into two documents. One that is
intended to be the useful, commonly-used bits (called the guide) and
one is intended to be comprehensive, showing every possibly knob and
button (called the reference). If you don't know about that, it can be
easy to flip into the wrong one. In this case, it sounds like you
wanted to be reading the Guide's chapter on structs, not the
reference's (although both mention 'transparent).

Guide: http://docs.racket-lang.org/guide/define-struct.html

Reference:  http://docs.racket-lang.org/reference/define-struct.html

hth,
Robby
On Fri, Aug 24, 2018 at 7:15 PM Ben Kovitz  wrote:
>
> On Thursday, August 23, 2018 at 2:49:32 PM UTC-4, David K. Storrs wrote:
>
>> For me, the first resorts in Racket are list and hash.  If I'm going to do 
>> any heavy lifting with it then I move to struct:
>>
>> (hash 'username 'bob 'age 18)  ; quick and easy, works well with database, 
>> useful print representation.  Weak against typos, not easy to identify what 
>> a hash represents
>>
>> (struct user (username age) #:transparent) ; transparent means "show field 
>> values when printing"
>> (user 'bob 18) ; well-defined accessors and setters so not vulnerable to 
>> typos, has an inbuilt predicate to identify 'user' structs.
>
>
> Ah, thanks! I spent about an hour trying to figure out inspectors and didn't 
> get anywhere, and I never would have guessed that :transparent means to make 
> the struct printable. This is the kind of thing I'm looking for: very simple 
> stuff that's crucial to know to be productive and usually takes only a couple 
> minutes to explain in person but is omitted in documentation.
>
> I take it, then, that no collection of these little things exists yet?
>
> Ben
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] racket meetup: november 8, 2018 in frankfurt, germany

2018-08-24 Thread jesse
I'll be hosting a Racket meetup in a couple of months. It'll be held on 
Thursday, November 8, from 18:30 to 20:30 in Frankfurt, Germany. More 
information (agenda, location, etc.) can be found at

  https://afterworkracket.com/1

Racketeers in Germany, or any of you who'll by chance be around Frankfurt 
in early November: you're welcome to attend/present!

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Miodrag
:transparent is definitely mentioned in the guide chapter on structures,
maybe ch 5
On Fri, Aug 24, 2018 at 8:15 PM Ben Kovitz  wrote:

> On Thursday, August 23, 2018 at 2:49:32 PM UTC-4, David K. Storrs wrote:
>
> For me, the first resorts in Racket are list and hash.  If I'm going to do
>> any heavy lifting with it then I move to struct:
>>
>> (hash 'username 'bob 'age 18)  ; quick and easy, works well with
>> database, useful print representation.  Weak against typos, not easy to
>> identify what a hash represents
>>
>> (struct user (username age) #:transparent) ; transparent means "show
>> field values when printing"
>> (user 'bob 18) ; well-defined accessors and setters so not vulnerable to
>> typos, has an inbuilt predicate to identify 'user' structs.
>>
>
> Ah, thanks! I spent about an hour trying to figure out inspectors and
> didn't get anywhere, and I never would have guessed that :transparent means
> to make the struct printable. This is the kind of thing I'm looking for:
> very simple stuff that's crucial to know to be productive and usually takes
> only a couple minutes to explain in person but is omitted in documentation.
>
> I take it, then, that no collection of these little things exists yet?
>
> Ben
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Ben Greenman
The Racket Cheat Sheet might help:
http://docs.racket-lang.org/racket-cheat/index.html

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Ben Kovitz
On Friday, August 24, 2018 at 8:39:43 PM UTC-4, Miodrag Milenkovic replied 
to me:
>> Ah, thanks! I spent about an hour trying to figure out inspectors and 
didn't get anywhere, and I never would have guessed that :transparent means 
to make the struct printable. This is the kind of thing I'm looking for: 
very simple stuff that's crucial to know to be productive and usually takes 
only a couple minutes to explain in person but is omitted in documentation.
>
> :transparent is definitely mentioned in the guide chapter on structures, 
maybe ch 5

Yep, section 5.4: 
https://docs.racket-lang.org/guide/define-struct.html#%28part._trans-struct%29
When I first read it, I misunderstood the main point as preventing 
reflection
in order to prevent clients of a library from depending on implementation
details—and promptly put it out of my head as something I could ignore for
now. It didn't occur to me that in everyday programming, you should normally
specify #:transparent when defining a struct. That's the kind of information
I'm looking for--the elementary, practical things that you typically learn 
in
the first few days of pair-programming with someone experienced, or in six
months of beating your head against a new language completely on your own.
(I'd prefer not to go the latter route.)

Ben

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Thank you Racket!

2018-08-24 Thread Hendrik Boom
On Fri, Aug 24, 2018 at 07:50:26AM -0700, Sanjeev Sharma wrote:
> "Turing is useless" ... 
> 
> While I worked as a programmer I used to complain quite bitterly about 
> university comp sci departments that had NIH (not invented here) syndrome 
> and  a captive audience. 
> 
> I learned Turing as my 2nd programming language.  I'm sure the only reason 
> it could have been taught is the profs & grad students that "invented" 
> (added a few trivial things to Pascal) Turing had great political pull at 
> University of Toronto in that decade. 

If I recall correctly, Turing was a systems language and was use to 
implement Tunis, an early Unix work-alike.  It was a pity it didn't get 
distributed more freely, or we would have had a free OS long before 
Linux.

-- hendrik

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Get contract from function

2018-08-24 Thread Joao Pedro Abreu De Souza
The library is with a problem that is when manage the * operator(greedy
repeat), if the term that is repeat would be a string, then he returns a
empty string, that is the equivalent of a rule that always match but
without consume anything. If the term that is repeat would be other thing,
the * returns a empty list.

The problem is : when there's no match of the operand, the * is not
returning "" but (). Some cases this is good, in other force us to handle
more cases that theorically will be the same. Worse than that, force our
users, that may use the link to create a parser, to handle this special
case too. The repository is racket-peg on GitHub, from user rain-1. There's
a issue about empty string in the second place I think if this helps.

Thank you for the attention. :)

2018-08-24 11:02 GMT-03:00 Alex Knauth :

>
>
> On Aug 24, 2018, at 8:50 AM, Joao Pedro Abreu De Souza 
> wrote:
>
> Hi. I am contributing in a library that create functions to parse
> PEG(parsing expression grammar). To implement a feature, I need to know the
> return's type of a function. We are using racket, not typed-racket, so I
> think that I need to get the contract or something like that. I dont see in
> the reference and guide how to do that. Can anyone give me a direction?
>
>
> There's the `value-contract` function [1].
>
> > (define/contract (f x)
> (-> integer? integer?)
> x)
> > (value-contract f)
> (-> integer? integer?)
>
> However, it doesn't work on everything (only values that had to be
> *wrapped* in chaperones because of higher-order properties), so might be
> less useful than you think. Also, it only works on functions that were
> explicitly wrapped with contracts, while most "base" functions do error
> checking themselves without a contract wrapper. So `value-contract` doesn't
> work on functions like that:
>
> > (value-contract string-length)
> #f
> > (value-contract sqrt)
> #f
>
> Also, contracts are *extensible* in a way that types are not, which makes
> them more flexible but harder to analyze in general. Users can define new
> contracts and contract combinators that can "do" anything. With types it's
> about what the type "is" and its relationships to other types and language
> forms. But with contracts it's about what they "do" when a value comes
> along that it can check. So someone could create a new contract that checks
> their function, and `value-contract` would return it, but it wouldn't be an
> `->` contract, and your library wouldn't be able to analyze it.
>
> So can you give more details about what you would need to use it for?
>
>   [1]: https://docs.racket-lang.org/reference/contract-utiliti
> es.html#(def._((lib._racket%2Fcontract%2Fprivate%2Fguts..
> rkt)._value-contract))
> 
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] From Clojure to Racket

2018-08-24 Thread Ben Kovitz
On Thursday, August 23, 2018 at 2:49:32 PM UTC-4, David K. Storrs wrote:

For me, the first resorts in Racket are list and hash.  If I'm going to do 
> any heavy lifting with it then I move to struct:
>
> (hash 'username 'bob 'age 18)  ; quick and easy, works well with database, 
> useful print representation.  Weak against typos, not easy to identify what 
> a hash represents
>
> (struct user (username age) #:transparent) ; transparent means "show field 
> values when printing"
> (user 'bob 18) ; well-defined accessors and setters so not vulnerable to 
> typos, has an inbuilt predicate to identify 'user' structs.
>

Ah, thanks! I spent about an hour trying to figure out inspectors and 
didn't get anywhere, and I never would have guessed that :transparent means 
to make the struct printable. This is the kind of thing I'm looking for: 
very simple stuff that's crucial to know to be productive and usually takes 
only a couple minutes to explain in person but is omitted in documentation.

I take it, then, that no collection of these little things exists yet?

Ben


-- 
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.
For more options, visit https://groups.google.com/d/optout.