[racket-users] Finite state machine

2020-05-27 Thread Med Ra
Dear All, i'm a new member in the group and also a debutante in racket 
programming and i will be happy if you read and understand what i'm asking .

I want create a finite state machine to represent an hotel room booking 
system.

first , i have created the FSM Scheme as the following :

about Rooms ---> (state (available) (unavailble))
two inputs ---> Time: T = 1 if some room will be available in the required 
entering date in future.
  Full Of F = 1if all the rooms are full at the moment.

I just want some help about how create this on drracket coding, And please 
forgive my ignorance !

Thanks for attention.

-- 
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/ee6807b0-8b02-40c1-8eeb-f41a01fa31d6%40googlegroups.com.


Re: [racket-users] Function that potentially can return more than one value

2020-05-27 Thread George Neuner



On 5/27/2020 1:50 PM, Jens Axel Søgaard wrote:
Den ons. 27. maj 2020 kl. 19.27 skrev George Neuner 
mailto:gneun...@comcast.net>>:



On 5/27/2020 6:34 AM, Jens Axel Søgaard wrote:
>
> In standard Racket an application doesn't communicate how many
values
> a function is expected to produce.

You can ask:  see procedure-result-arity
https://docs.racket-lang.org/reference/procedures.html


I think  procedure-result-arity  answers the question "how many
values could this procedure return?" and not "how many values
is the procedure expected to return in this context?".


Oh, I get it ... it's not that you "don't know" what's expected, it's 
that you've got something that returns N values on some path and M 
values on some other path, etc.  and you can't predict which path will 
be followed.


Yeah, that is a problem:  e.g., I don't think procedure-result-arity  
works for  case-lambda  where different invocations can return different 
numbers of results.


In that case, better to return a container: a list, vector, hash, etc. 
rather than a bunch of individual values.  Or, if the function is canned 
[e..g, in a library] to put them into a container for your code to work 
with.



> I have written a small proof-of-concept of an assignment operator :=
> that communicates to a function how many extra values it is expected
> to produce (and still works with standard functions).
>
> Are there alternative solutions that are better than the "use a
> keyword" approach?

You can use  call-with-values  which connects the function that
produces
with the one that consumes, but they have to agree on the number of
values being passed or it won't work.


My problem is that the producer still needs to be told how many values 
to produce.



Sorry, I missed that - I thought you needed to know how many were 
produced by something.


The only way to call attention - particularly compiler attention - to a 
particular argument is to make it a keyword with no default value.


If your function has default behavior that the keyword(s) would only 
modify, then you can make keyword(s) optional using default values or by 
defining the function with  make-keyword-procedure.



George

--
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/5bea165b-3357-7236-173c-934ca3a0ab58%40comcast.net.


Re: [racket-users] coding style query

2020-05-27 Thread Laurent
I use markdown syntax for that:
The function `function` functions like `functions` but for a single
function `proc`.

I've seen others use `function' instead.

On Wed, May 27, 2020 at 7:04 PM Jens Axel Søgaard 
wrote:

> Den ons. 27. maj 2020 kl. 19.56 skrev Hendrik Boom  >:
>
>> Is there an accepted convention about how to use a symbol used in a
>> program within a comment so it's clear the comment is using it as a
>> program symbol and not as an ordinary English word?
>>
>
> Not sure. Sometimes I surround the symbol with two spaces to each side
> instead of just one.
> Can't remember where I picked that habit up.
>
> /Jens Axel
> https://racket-stories.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/CABefVgyY%3DGY%2BOTNxfEZLkaZaqpZi%3DGF6%3DVgrPThRJoY7_g%40mail.gmail.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/CABNTSaGpc%2B12732wkQjV10XfT%3DCjHB6Fea7sV-JkhT%2BJsMV%2BDQ%40mail.gmail.com.


Re: [racket-users] coding style query

2020-05-27 Thread Jens Axel Søgaard
Den ons. 27. maj 2020 kl. 19.56 skrev Hendrik Boom :

> Is there an accepted convention about how to use a symbol used in a
> program within a comment so it's clear the comment is using it as a
> program symbol and not as an ordinary English word?
>

Not sure. Sometimes I surround the symbol with two spaces to each side
instead of just one.
Can't remember where I picked that habit up.

/Jens Axel
https://racket-stories.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/CABefVgyY%3DGY%2BOTNxfEZLkaZaqpZi%3DGF6%3DVgrPThRJoY7_g%40mail.gmail.com.


[racket-users] How to make DrRacket interactions window use the same reader as the definitions window?

2020-05-27 Thread Thomas Dickerson
I'm working on #lang with a custom reader (via read-table extension), that 
among other things, defines custom syntax for duodecimal numbers. 

My reader is working great in the definitions window / when I hut "Run" in 
DrRacket, and the top of the interaction window shows the name of my #lang, 
but my custom literal syntax is being read as an (undefined) identifier.

Any thoughts on what I'm missing?

Thanks!

-- 
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/483bb175-67c7-45c4-9a77-49a0347e10aa%40googlegroups.com.


[racket-users] coding style query

2020-05-27 Thread Hendrik Boom
Is there an accepted convention about how to use a symbol used in a 
program within a comment so it's clear the comment is using it as a 
program symbol and not as an ordinary English word?

-- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200527175636.6f23slgqphlo3sfk%40topoi.pooq.com.


Re: [racket-users] Function that potentially can return more than one value

2020-05-27 Thread Jens Axel Søgaard
Den ons. 27. maj 2020 kl. 19.27 skrev George Neuner :

>
> On 5/27/2020 6:34 AM, Jens Axel Søgaard wrote:
> >
> > In standard Racket an application doesn't communicate how many values
> > a function is expected to produce.
>
> You can ask:  see procedure-result-arity
>  https://docs.racket-lang.org/reference/procedures.html


I think  procedure-result-arity  answers the question "how many
values could this procedure return?" and not "how many values
is the procedure expected to return in this context?".


> > I have written a small proof-of-concept of an assignment operator :=
> > that communicates to a function how many extra values it is expected
> > to produce (and still works with standard functions).
> >
> > Are there alternative solutions that are better than the "use a
> > keyword" approach?
>
> You can use  call-with-values  which connects the function that produces
> with the one that consumes, but they have to agree on the number of
> values being passed or it won't work.
>

My problem is that the producer still needs to be told how many values to
produce.

/Jens Axel

-- 
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/CABefVgwy4YEPcswLjLEf-FN2sZMa2xbPqOWxOJ%3DdOEnEUF6_Hg%40mail.gmail.com.


Re: [racket-users] Function that potentially can return more than one value

2020-05-27 Thread George Neuner



On 5/27/2020 6:34 AM, Jens Axel Søgaard wrote:


In standard Racket an application doesn't communicate how many values
a function is expected to produce.


You can ask:  see procedure-result-arity
    https://docs.racket-lang.org/reference/procedures.html



I have written a small proof-of-concept of an assignment operator :=
that communicates to a function how many extra values it is expected
to produce (and still works with standard functions).

Are there alternative solutions that are better than the "use a 
keyword" approach?


You can use  call-with-values  which connects the function that produces 
with the one that consumes, but they have to agree on the number of 
values being passed or it won't work.


You can use a Rest argument in the consumer if the values from the 
producer are put into a list.



Unfortunately, Scheme did not embrace the idea of using tuples for 
return values, nor did it allow to catch only the first N values as was 
permitted by Lisp.


George

--
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/fefd28d4-bab8-11bc-0a29-0983758cd454%40comcast.net.


Re: [racket-users] Testing for Packages

2020-05-27 Thread George Neuner


On 5/26/2020 10:36 PM, Robert Postill wrote:


Inspired by the reply to 
https://stackoverflow.com/questions/62014612/how-to-test-a-racket-package-self-sufficiently, I 
decided to ask the question here.  So a little background to the 
discussion.  I've been looking at a racket package, and the package 
has a couple of collections.  It's been dormant for a few years, and 
so when I ran the tests they didn't work (it's a driver, and the 
database it works with had moved on in the intervening time).  So I 
started thinking about the tests.  One thing that troubled me was that 
the tests seemed to be dependant on the package already being 
installed. Ryan Culpepper's comment on the stack overflow question 
(https://stackoverflow.com/a/62027185/11219) suggests that the tests 
should be run once the package is under raco pkg's management.


The problem is that any particular package may require a specific 
runtime environment:  e.g., many packages provide Racket interfaces to 
3rd party libraries.  And those libraries have their own sets of 
dependencies.  And many libraries have compatibility problems with 
others, so having many libraries available in a "generic" test 
environment is not possible.


But even if the package host did maintain custom test environments (VM 
or container or ...) for every contributed package - that STILL does not 
guarantee that any given package will work on YOUR system, with YOUR 
particular set of libraries.


You say the package that inspired this question used a database. Which 
database?  What version?  There are dozens of DBMS available - many are 
NOT $$$ free to own, and all of them have multiple versions having 
various compatibility problems (i.e. what works with v8.2 may not work 
with v10.4 - or the reverse).  Many server class DBMS will not 
peacefully co-exist with another on the same system, so then you're 
talking about many virtual machines or containers (if the DBMS in 
question even works in a container - some don't).



In the generally excellent docs for racket, I haven't found advice 
relating to the right way to structure the tests for a package.


Right.  Because many packages interface to 3rd party software, and so a 
lot of - so called - advice would, of necessity, be generic to the point 
of being useless.



Now I think I should explain why I'm thinking that way.  FYI I've been 
a part of the ruby community, and so my thinking has a ruby-ish 
colour.  Which makes me think I'm maybe off in my community norms for 
racket. I've always considered the point at which a package gets 
transferred into the domain of raco pkg's management to be a pivotal 
moment. It has this implied social contract that if I'm mixing with 
code into a system area managed by the language, the package needs to 
be trustworthy.


If the Ruby maintainers told me that they were able to test every 
contributed package in that package's expected runtime environment, I 
simply would not believe them.


I wouldn't believe it if Google, or Apple, or Oracle, or Microsoft, or 
Redhat, or Ubuntu said it either.  Nobody can do it - the expense is 
prohibitive.



Testing *after* installing seems a bit like I'm putting the cart 
before the horse? It feels like saying here's my code, put it in a 
system-wide place, I hope it works.


I understand both the motivation and the frustration.  For a long time I 
developed embedded software under situations where I controlled 
everything: the hardware, the OS (if there was one), my application, the 
libraries it depended on, etc.  I knew exactly the conditions my 
software was expected to operate under, and and the complete set of 
input it could possibly receive.


But 99+% of all software has to run under an uncertain environment that, 
at best, is only partly know to its developer, depending (at least 
transitively) on a lot of 3rd party software that the developer often is 
completely unaware of.



YMMV,
George

--
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/03945aa3-d83a-73c9-d206-ce25a423fd39%40comcast.net.


[racket-users] How can source-omit-files exclude a directory?

2020-05-27 Thread Ryan Kramer
I have a multi-collection package and I wanted to exclude a certain 
directory (plisqin-test) from being a package. I found the relevant 
documentation here: https://docs.racket-lang.org/pkg/strip.html.

The first thing I tried was simply adding a `~` to the end of the 
directory. This worked. Then I kept reading and found `source-omit-files` 
which sounds like a better way, but I couldn't get it to work. I tried 
adding the following to the info.rkt of the multi-collection package (and 
maybe a few more), but none of them worked:

(define source-omit-files
  '("plisqin-test"
"plisqin-test/"
"plisqin/plisqin-test"
"plisqin/plisqin-test/"))

Is it possible to exclude an entire collection using the info.rkt of a 
multi-collection package? (For reference, this is the package in question: 
https://github.com/default-kramer/plisqin/tree/d44effd731b1c6d8c924ec311da43d8755f07049)

-- 
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/fe6eac50-19c9-4501-803b-9335e4bee682%40googlegroups.com.