[racket-users] Language oriented racket

2021-03-22 Thread Jos Koot
Racket has nice features to implement languages.
This is very useful, for a programmer should allow his/her users to speak
or write in their own languages. I was aware of this already some 50 years
ago when writing systems for quantum mechanical calculations (NB using
fortran, not an easy tool to implement a new language).

However, I see packages that implement languages for Racket programmers.
For example  fluent: ~> syntax and infix notation
(I must admit that I did the same some times, what in my humble opinion is
a mistake).

I think Racket programmers should talk or write Racket.
I think for a student learning Racket or any language alike,
it takes little effort to get acquainted with prefix notation and
parentheses.
For myself this notation is very helpful for it avoids mistakes with regard
to precedence rules.
Furthermore, the DrRacket GUI provides very nice tools to check parentheses.
(and much more)

JMHO, Jos

-- 
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/CAL6KNi1s0oataXQkq4LVx1dWXdBaDJdWfg_wLNxnE-Q3%2BLTPog%40mail.gmail.com.


Re: [racket-users] Retrieve name of defined variable in a syntax form in the expr of define form

2021-02-27 Thread Jos Koot
At second thought I'll use syntax-local-name to infer names to structs
(in an immutable field and using prop:custom-write)
Does not give me the variable in which an instance originally was defined,
but that is less important .
Not being able to spot the original definition of an instance in case of an
error
while using the instance later on, well that I can live with.
Thanks again, Jos

On Sat, 27 Feb 2021 at 20:56, Matthew Flatt  wrote:
>
>> If you're just interested in the symbolic name "x", as opposed to the
>> binding identifier, then see `syntax-local-name` or
>> `syntax-local-infer-name`.
>>
>> If you want the binding identifier, though, that's not available.
>>
>> Matthew
>>
>

-- 
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/CAL6KNi3dTaSXcWvwA1UDWtq5mEbEP1-sp3-73sAG%2BOxx%3D0%3Djsg%40mail.gmail.com.


Re: [racket-users] Retrieve name of defined variable in a syntax form in the expr of define form

2021-02-27 Thread Jos Koot
Thanks for your quick reply.
Yes I want the binding identifier. Alas.
Nevertheless I am happy with the separation between expansion time and run
time.
I have decided not to redefine define.
Jos

On Sat, 27 Feb 2021 at 20:56, Matthew Flatt  wrote:

> If you're just interested in the symbolic name "x", as opposed to the
> binding identifier, then see `syntax-local-name` or
> `syntax-local-infer-name`.
>
> If you want the binding identifier, though, that's not available.
>
> Matthew
>
> At Sat, 27 Feb 2021 20:52:23 +0100, Jos Koot wrote:
> > Hi
> >
> > Consider:
> > (define-syntax (my-syntax stx)  blah ...)
> > (define x (my-syntax blah ...)
> >
> > Is it possible for syntax my-syntax such as to know (at expansion time)
> > that is used as the expr of variable x in the expression of the
> definition?
> > Probably this is possible by redefining syntax define, but can I do it
> > without touching syntax define?
> > Thanks, Jos
>

-- 
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/CAL6KNi05xNFAYXExOx9kX3%3D5QWoy_CQVoBfWENxBvFPzoonj%2Bw%40mail.gmail.com.


[racket-users] Retrieve name of defined variable in a syntax form in the expr of define form

2021-02-27 Thread Jos Koot
Hi

Consider:
(define-syntax (my-syntax stx)  blah ...)
(define x (my-syntax blah ...)

Is it possible for syntax my-syntax such as to know (at expansion time)
that is used as the expr of variable x in the expression of the definition?
Probably this is possible by redefining syntax define, but can I do it
without touching syntax define?
Thanks, Jos

-- 
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/CAL6KNi36QCX%3D6x4hZk6wnfN7-n57a3MHq2jweVgWwvQ757pYEw%40mail.gmail.com.


[racket-users] circuits

2021-01-15 Thread Jos Koot
Thanks to all who have responded to my email about my hobby circuit
simulator, all in a kind manner and instructive. Stephand de Gabrielle (to
whom many thanks too, of course) pointed me to section 3.3.4 of SICP, where
I learned how to deal with time by means of an agenda. After reading this
section of SICP I totally revised my simulator tools such as to use an
agenda, but in quite a different way than exposed in SICP. My agenda first
changes all signals to be changed and subsequently triggers the gates whose
inputs have changed, but every gate only once at a given time. For this
reason I don't need a queue. I use a hash that maps times to lists of
events. Because every gate is triggered only once at a time, the order in
which they are triggered is irrelevant. Furthermore my gates do not
schedule signal changes for their outputs if the new inputs do not change
the output. In my simulators all gates and all wires are distinct Racket
objects, like in a physical circuit all parts are distinct components. This
means that every subcircuit, and even every gate, has it's own internal
wires and gates. The documentation contains examples of flip-flops and
shows how to deal with vibration (such as when powering up a twin-flip-flop
(usually called a master-slave-flip-flop, but that's not a happy name) I am
aware of the fact that my simulators are very limited. For instance, they
change signals instantaneously and at the same time, which in a physical
circuit cannot be true, I think. Nevertheless, if you are interested, take
a look at joskoot /
circuit-simulation-after-SICP-3.3.4
*. *I hold
all files in the same directory. To make the documentation I open
file circuit-manual-scrbl with DrRacket and press button Scribble HTML. I
have tried to make it a package, but the documentation does not come out
well. Maybe I need more info in file info.rkt. I don't know. Help is very
welcome. Because I have Windows 10, I use the package manager in the file
menu of DrRacket. In Windows command line commands are almost impossible.
Well, a long story, sorry about that. Thanks very much.
Jos

-- 
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/CAL6KNi0K8Z5xzdGhKEdF2kdML5xYhbHVk350PdW87a_B25W8mA%40mail.gmail.com.


[racket-users] #:kind (list ... ) in defthing and defproc

2020-09-26 Thread Jos Koot
The following works well in DrRacket, version 7.8 [3m]

#lang scribble/manual
@deftogether[
(@defthing[#:kind "constant false/on/high" F trit? #:value '0]
 @defthing[#:kind (list "constant true/off/low" (hspace 1)) T trit? #:value
'1]
 @defthing[#:kind "constant indeterminate" ? trit? #:value '?]
 @defthing[#:kind (list "constant" (hspace 13)) trits (list/c trit? trit?
trit?) #:value (list F T ?)]
 @defthing[#:kind (list "constant" (hspace 13)) in-trits sequence? #:value
(in-list trits)]
 @defproc[#:kind (list "predicate" (hspace 12)) (trit? (obj any/c))
boolean?]
 @defproc[#:kind (list "predicate" (hspace 12)) (F? (obj any/c)) boolean?]
 @defproc[#:kind (list "predicate" (hspace 12)) (T? (obj any/c)) boolean?]
 @defproc[#:kind (list "predicate" (hspace 12)) (?? (obj any/c))
boolean?])]{}

I use hspace for alignment of the kinds.

But in version 7.8.0.10--2020-09-25(515012525c/a) [3m] I get:

. . C:\Program Files\Racket-7.8.0.10\collects\syntax\contract.rkt:101:21:
defthing: contract violation
  expected: (or/c string? #f)
  given: ("constant true/off/low" #(struct:element hspace (" ")))
  in: (or/c string? #f)
  macro argument contract on #:kind argument
  contract from:
  (lib scribble/private/manual-proc.rkt)
  blaming: E:\circuits\circuit-manual.scrbl
   (assuming the contract is correct)
  at: E:\circuits\circuit-manual.scrbl:416.18

Because I don't know whether or not this is a known issue, I post it on
this list.
If this is a known issue or an intentional change, then ignore this email,
please.
If not I can post it as a racket issue.
Let me know, please.
Thanks, Jos

-- 
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/CAL6KNi3P251G%2BBMQqDbo2qt6K22Gw_OOgjjnHDboLLuC3qKrGg%40mail.gmail.com.


[racket-users] strange error message with debugging enabled

2020-09-25 Thread Jos Koot
file b.rkt
#lang racket
(require "a.rkt")
(err 5)

file a.rkt
#lang racket
(require "a.rkt")
(err 5)

Run file b.rkt from DrRacket.
Normal error message when debugging on file b.rkt is not enabled.
With debugging enabled:
-- #(struct:exn:fail:contract "vector-ref: contract violation\n  expected:
vector?\n  given: ((error 'err \"blah blah ~s\" x)
# 3 16 44 29)\n  argument position:
1st\n  other arguments...:\n   0" #)
exception raised by error display handler: vector-ref: contract violation
  expected: vector?
  given: ((error 'err "blah blah ~s" x) # 3
16 44 29)
  argument position: 1st
  other arguments...:
   0; original exception raised: err: blah blah 5

Maybe this has already been posted as a racket issue.
Therefore I post this here.
If not yet an issue, I'll post a racket issue.
Thanks, Jos

-- 
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/CAL6KNi0-QB%2BZYkq3U%2B-z%3D_Fip9CpP7rZaq%2B2kiT1L5EfNbpgyg%40mail.gmail.com.


[racket-users] racket-dev problem?

2020-06-26 Thread Jos Koot
Sending mail to racket -dev seems not to arrive correctly.Sending to other addresses does work.Therefore I try to report via racket-users.Jos 



-- 
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/94D32D8C-D5A0-4B85-A326-CC3BCABED799%40hxcore.ol.


[racket-users] make-set!-transformer

2020-06-24 Thread Jos Koot
The docs on make-set!-transformer do not mention that it also applies to 
set!-values.
That is does apply to both is a good case, I think. I have tried to find the 
documentation  on the GitHub of racket but could not find it. Please give me a 
hint where to look, so I can do a pull request for submitting a suggestion of 
improvement. That is, if such an improvement is wanted, of course. I often have 
trouble to find docs  code on Racket’s GitHub.
If my suggestion is welcome I am willing to do the job by myself! Just as to be 
a tiny contributor by myself.
Jos

-- 
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/5ef3eb1e.1c69fb81.c3c6e.5819%40mx.google.com.


[racket-users] RE: [racket-money] Fwd: [racket-dev] Racket Survey 2020

2020-06-24 Thread Jos Koot
Hi,
Your email is not an assault I think, but nevertheless I would like to add some 
positive remarks on the community.

It is true that us...@racket-lang.org has changed in the last year or two 
years, I think.
There are much less posts of users nowadays.
It is obvious that what you call the ‘cabal’ has much influence, more than 
users.
Of course they have.
But my experience is that the ‘cabal’ take questions and suggestions of users 
seriously.
Questions and problem reports of users always are responded to very promptly.
Well, that’s my experience.
And with respect to the future of Racket:
I think users have enough opportunity to contribute their opinions.
That’s how I feel about it, just my few cents.
Best wishes, Jos



From: Neil Van Dyke
Sent: 24 June 2020 07:59
To: racket-mo...@googlegroups.com
Subject: Re: [racket-money] Fwd: [racket-dev] Racket Survey 2020

There's a Racket community, but Racket isn't a community project, and I 
think that's not the fault of the community members.

Racket is directed by the interests of a cabal (or clique, or monarchy) 
of professors.  I think most of their intentions are admirable (and, 
really, most of them still chose to become professors when it was clear 
they could make a lot more money going to Google, when Google was cooler).

When it was mostly just Matthias and his students, Matthias seemed to 
include and respect non-professor community members more, and I recall 
collaborations in the early community that were not only among the 
professors.  But a cabal kinda solidified around the time Matthias's 
students were becoming professors.  The effect was kinda a bait and 
switch, though I don't think that was intended.  Then various other 
things happened.

Today, one perspective is that it's more like there's a cabal, the cabal 
controls a platform, and there is user base to 
support/engage/retain/grow/leverage.

There are practical reasons for controlling it (e.g., some development 
needs money to fund it, justified as research, and they also still want 
to push it in directions to suit their research and careers), but then 
it's not a community project.

I suspect they wonder why they're making additional effort, beyond their 
research papers and education projects, to have a community (e.g., spend 
time on community email lists, ask how Rust keeps its users happy, 
entertain a survey), and to do some things that they think their users 
want, when the users aren't giving back much work, and it's still not 
popular.  So the monarchy is maybe frustrated and resentful about all 
the peasants freeloading on their benevolence, and the monarchy doesn't 
know how to community those worthless ingrates harder.

The community actually used to have prolific contributors, and those 
contributors did much to bootstrap and build the community and relative 
popularity of PLT, at a time when Matthias's students might've been 
pretty distracted with their dissertations and interviewing, but most of 
those people eventually left, and were forgotten.

Looks like there are currently some prolific contributors, but looks 
like even they aren't treated as peers by the cabal, in things 
professors think are important.

I think there's a Racket community, but that it exists despite the fact 
that Racket isn't a community project.

(It's funny to distinguish community from user base, in a forum about 
making money in contemporary dotcom world. :)

-- 
racket-money is private. Please don't quote/forward/etc. elsewhere.
https://linki.tools/racket-money/
--- 
You received this message because you are subscribed to the Google Groups 
"racket-money" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-money+unsubscr...@googlegroups.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/5ef3d049.1c69fb81.3fe0e.26b4%40mx.google.com.


RE: [racket-users] Re: trying to use futures for some calculations

2020-06-17 Thread Jos Koot
In addition, some time ago I did use futures which did parallelization very 
well when using distinct parts of  the same vector. I did not need unsafe for 
that.
Jos

-- 
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/5eea45fb.1c69fb81.a8487.089d%40mx.google.com.


RE: [racket-users] Re: trying to use futures for some calculations

2020-06-17 Thread Jos Koot
It’s long ago, but I worked nicely with parallelization on a CDC 205 both in 
assembler and Fortran (CDC has expired shortly after). IIRC it did not protect 
against simultaneous updating the same memory location. But what I do recall is 
that it is very important that parallel processes use distinct parts of memory. 
So I wonder: give each future or place its own copies of the data they need and 
produce data in locations local within the place or future before returning 
them. Of course it may happen that a procedure is called for which Racket 
cannot know which parts of memory it will access. But for (very) primitive 
arithmetic functions this should be an avoidable problem, I think.
Just my single one cent.
Jos
 

From: Robby Findler
Sent: 17 June 2020 17:23
To: Brian Adkins
Cc: Racket Users
Subject: Re: [racket-users] Re: trying to use futures for some calculations

On Wed, Jun 17, 2020 at 8:56 AM Brian Adkins  wrote:
On Wednesday, June 17, 2020 at 4:50:44 AM UTC-4, Alex Harsanyi wrote:

I am trying to speed up an algorithm using futures, but I am getting some 
unexpected results (and no real speed improvements), and I was wondering if 
someone more experienced could have a look a the code and tell me what am I 
doing wrong.
[...]

I would *love* to be proven wrong on this, but I think it's rare to be able to 
get decent parallelization in practice using futures. You may have better 
results using places, but it will depend on how the amount of processing for a 
unit compares to the overhead of communicating with the places i.e. you may get 
better results with 2 places than with 8 due to place communication overhead. 
In your case, if it's easy for the places to input their own sets of 
parameters, then the place overhead may be small since I think each place would 
simply need to communicate its best value.


While this may be true, it is also the case that the design of futures is such 
that incremental work on the primitives turns into incremental ability to 
parallelize programs. So while it is likely to be more work today, it may also 
be the case that people putting effort in to help their own programs will help 
us turn the corner here. Perhaps this is a place where an interested 
contributor can help us out a lot!

Robby

-- 
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/CAL3TdOPnzjMdTEOU%2BdO34B8VAfXzORSVHfXYx6tV-8DVGZ7oXw%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/5eea438f.1c69fb81.872f7.149c%40mx.google.com.


[racket-users] scribble: how to put a bar above text?

2020-06-17 Thread Jos Koot

Thanks to all of you for your help.
I have tried some of your suggestions.
They are promising.
Meanwhile I have found out that I can do the following:
- Create an equation in Word
- Save it as a picture
- Convert it to gif
- Insert it with @image
Nevertheless I’ll look further into your suggestions.
Thanks, Jos

-- 
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/5ee9fe05.1c69fb81.f0c4e.da9a%40mx.google.com.


RE: [racket-users] scribble: how to put a bar above text?

2020-06-16 Thread Jos Koot
Hi,
Thanks for your prompt reply.
I’ll first look into Mathjax. It’s on github, so I suppose I can download it 
without charges.
Using head-extra seems straight forward, but I never used it before. I’ll see 
what happens.
I hope it works with the scribble HTML button in DrRacket, for it seems I do 
not have the required software to use the scribble PDF button. (I tried to 
download the required software, but it did not work. May be windows 10 poses a 
problem (well, it always does). It would be nice to have Unix as a subsystem 
within windows, but I don’t know whether or not that is possible.)
Thanks again, Jos


From: Stephen De Gabrielle
Sent: 16 June 2020 19:02
To: Jos Koot
Cc: us...@racket-lang.org
Subject: Re: [racket-users] scribble: how to put a bar above text?

Hi Jos

MathML support via the  tag is not good. 

I suspect the best option is to use Mathjax 
https://www.mathjax.org/#gettingstarted
 
I think you use `head-extra`[1] to add the required script tags[2] to your 
file. (not done this myself though so I'm not sure how)
 
[1] 
https://docs.racket-lang.org/scribble/core.html#%28def._%28%28lib._scribble%2Fhtml-properties..rkt%29._head-extra%29%29

[2]
https://polyfill.io/v3/polyfill.min.js?features=es6&quot</a>;>
https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js&quot</a>;>

-- 
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/5ee903dd.1c69fb81.14578.f52a%40mx.google.com.


[racket-users] scribble: how to put a bar above text?

2020-06-16 Thread Jos Koot

Hi,
Using scribble when writing a text containing Boolean expressions it would be 
nice to write ‘not(A+B)’ as ‘A+B’ with a bar above it. An expression like 
not(not(A)+not(B)) would need bars above the A and the B as well above the 
whole. Is this possible? I have found no solution in the scribble docs. I have 
looked into some HTML tutorials too, but did not find what I want. I am an 
ignorant with respect to HTML. And even when I would know how to do it in HTML, 
I also would need to know how to transfer the tool to scribble.
Thanks, Jos

-- 
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/5ee8bddd.1c69fb81.0a99.bd38%40mx.google.com.


RE: [racket-users] Re: local variables arehyperlinkedinscribble/manual

2020-06-14 Thread Jos Koot
Well, thanks to both Ryan C and Ryan K.
Sorry for my confusion.
Best wishes, Jos Koot

From: Ryan Kramer
Sent: 14 June 2020 02:20
To: Racket Users
Subject: Re: [racket-users] Re: local variables arehyperlinkedinscribble/manual

That was actually Ryan Culpepper. Sorry for the noise, but I can't implicitly 
take credit for something that I didn't do.

By the way, thank you Ryan C for both of those techniques. I've already happily 
used `make-element-id-transformer`

On Saturday, June 13, 2020 at 4:07:06 PM UTC-5, jos.koot wrote:
defaul...@gmail.com gave me a clear and usable answer.
His email follows below.
Best wishes, Jos
 
 
 
>From Ryan Kramer
You can also use make-element-id-transformer, like this:
 
    (define-syntax SET
      (make-element-id-transformer
       (lambda _ #'(racketvarfont "set"
 
Then Scribble will automatically replace SET within rendered code with the 
element expression above.
 
Another trick is to break the for-label binding by introducing a local binding 
that shadows it. For example, if you write

    (let ([set #f])
      (racket set))
 
then the occurrence of `set` within the `racket` form isn't linked to `set` 
from racket/set. This trick relies on being able to put a let around the 
occurrences you don't want linked but not the ones that you do want linked, so 
it might not work in all cases.
 
Ryan
 
 
 
-- 
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/f7162464-1d7b-4113-8883-03f022f0cf5fo%40googlegroups.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/5ee6a08b.1c69fb81.acbb0.1753%40mx.google.com.


RE: [racket-users] Re: local variables are hyperlinkedinscribble/manual

2020-06-13 Thread Jos Koot
default.kra...@gmail.com gave me a clear and usable answer.
His email follows below.
Best wishes, Jos



>From Ryan Kramer
You can also use make-element-id-transformer, like this:

    (define-syntax SET
      (make-element-id-transformer
       (lambda _ #'(racketvarfont "set"

Then Scribble will automatically replace SET within rendered code with the 
element expression above.

Another trick is to break the for-label binding by introducing a local binding 
that shadows it. For example, if you write

    (let ([set #f])
      (racket set))

then the occurrence of `set` within the `racket` form isn't linked to `set` 
from racket/set. This trick relies on being able to put a let around the 
occurrences you don't want linked but not the ones that you do want linked, so 
it might not work in all cases.

Ryan



-- 
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/5ee53ff5.1c69fb81.6e0e8.3f90%40mx.google.com.


RE: [racket-users] Re: local variables are hyperlinked inscribble/manual

2020-05-25 Thread Jos Koot
Thank you Ryan and Ryan.

I think make-element-id-transformer is the easiest solution.
(let ([set #f])   (racket set)) is nice too because it can be used just where 
needed.
I’ll try if that works around an interaction too.

An expression containing ‘set’ both as local and as imported variable remains a 
problem, I think,
but never mind, that can and probably must be avoided.

Thanks again, Jos


From: Ryan Culpepper
Sent: 25 May 2020 17:28
To: Ryan Kramer
Cc: Racket Users
Subject: Re: [racket-users] Re: local variables are hyperlinked 
inscribble/manual

You can also use make-element-id-transformer, like this:

    (define-syntax SET
      (make-element-id-transformer
       (lambda _ #'(racketvarfont "set"

Then Scribble will automatically replace SET within rendered code with the 
element expression above.

Another trick is to break the for-label binding by introducing a local binding 
that shadows it. For example, if you write

    (let ([set #f])
      (racket set))

then the occurrence of `set` within the `racket` form isn't linked to `set` 
from racket/set. This trick relies on being able to put a let around the 
occurrences you don't want linked but not the ones that you do want linked, so 
it might not work in all cases.

Ryan


On Mon, May 25, 2020 at 4:55 PM Ryan Kramer  wrote:
My favorite way to avoid this problem is simply to choose another name, or use 
`except-in` to avoid importing `set` for-label. But if you must use the name 
`set` and you want it linking to racket/set most of the time (but not this 
time), here is a technique I've used in the past:

#lang scribble/manual

@(require (for-label racket) scribble/eval
  (for-syntax racket
  syntax/parse))

@(define-for-syntax (replace-helper stx orig-sym new-sym)
   (let ([content (syntax-e stx)])
 (cond
   [(list? content)
    (datum->syntax stx
   (map (λ (child) (replace-helper child orig-sym new-sym))
    content)
   stx stx)]
   [(equal? orig-sym content)
    (datum->syntax #f new-sym stx #f)]
   [else
    stx])))

@(define-syntax (replace stx)
   (syntax-parse stx
 [(_ [orig:id new:id] body:expr)
  (replace-helper #'body (syntax-e #'orig) (syntax-e #'new))]))

@(replace
  [SET set]
  @interaction[
 (let ((SET 1)) (add1 SET))])

On Sunday, May 24, 2020 at 11:26:54 AM UTC-5, jos.koot wrote:
Hi,
I have:
 
#lang scribble/manual
@(require (for-label racket) scribble/eval)
@interaction[
(let ((set 1)) (add1 set))]
 
I prepare a HTML document with DrRacket (in Windows 10).
Works, but local variable set is hyperlinked to procedure set in the documents 
(racket/set). I would like this variable to be typeset as any other local 
variable. How can I do that without loosing the hyperlink where I do mean the 
procedure from racket/set ?
 
Thanks, Jos
-- 
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/ffd4f155-ee18-409d-b92f-9450d976220f%40googlegroups.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/CANy33qk3Q3F6uLx9_Y%2BRNUb4j-z4DEuH3_%2BEgSc4evnNHpoXgg%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/5ecbeed6.1c69fb81.358b9.eec7%40mx.google.com.


[racket-users] local variables are hyperlinked in scribble/manual

2020-05-24 Thread Jos Koot
Hi,
I have:

#lang scribble/manual
@(require (for-label racket) scribble/eval)
@interaction[
(let ((set 1)) (add1 set))]

I prepare a HTML document with DrRacket (in Windows 10).
Works, but local variable set is hyperlinked to procedure set in the documents 
(racket/set). I would like this variable to be typeset as any other local 
variable. How can I do that without loosing the hyperlink where I do mean the 
procedure from racket/set ?

Thanks, Jos

-- 
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/5ecaa047.1c69fb81.1dbb1.cd9f%40mx.google.com.


[racket-users] Circuits

2020-05-19 Thread Jos Koot
Hi
Just for a hobby I made a syntax producing procedures that emulate simple 
electronic circuits.
But certainly there already are many more sophisticated systems that perform 
this task.
I did not find them with google.
I would appreciate very much some pointers to such procedures
(preferably in Racket or in a Scheme like or Lisp like language).
Best wishes for all, Jos Koot

-- 
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/5ec4112a.1c69fb81.80de.207d%40mx.google.com.


RE: [racket-users] multiple-value version of in-value

2020-05-04 Thread Jos Koot
To Philip McGrath, Hi again

I modified the clause
 ((id ...) (in-value* expr ...))
to the following in-values clause:
 ((id ...) (in-values expr))

where the expr is supposed to return as many values as ids.
I simplified the code such as to avoid syntax-parse,
because I do not (yet) understand all its powerful features.
I prefer writing code I can understand in all details.
 I should study on syntax-parse in due future 

(define-sequence-syntax in-values
 (λ (stx)
  (raise-syntax-error 'in-values
   "can only be used in for forms" stx))
 (λ (stx)
  (syntax-case stx ()
   (((id ...) (_ expr))
  #'((id ...)
 (:do-in
  (((id ...) expr))
  #t () #t () #t #f ()))

For example:

(for/first (((a b c) (in-values (values 2 + 3 (b a c)) ; -> 5

Thanks again, Jos

From: Philip McGrath
Sent: 04 May 2020 17:21
To: Jos Koot
Cc: us...@racket-lang.org
Subject: Re: [racket-users] multiple-value version of in-value

My package `adjutor` has a few variants of this, like `in-value*`: 
https://docs.racket-lang.org/adjutor/Stable.html#(part._.Sequence_.Constructors)

They can all be used as first-class procedures, but that does involve a little 
runtime overhead, so they use `define-sequence-syntax` to cooperate directly 
with `for`-like forms when possible.

-Philip



-- 
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/5eb0cb72.1c69fb81.3dc70.19a4%40mx.google.com.


RE: [racket-users] multiple-value version of in-value

2020-05-04 Thread Jos Koot
Very nice. I have installed the package. Thanks very much,
Jos

From: Philip McGrath
Sent: 04 May 2020 17:21
To: Jos Koot
Cc: us...@racket-lang.org
Subject: Re: [racket-users] multiple-value version of in-value

My package `adjutor` has a few variants of this, like `in-value*`: 
https://docs.racket-lang.org/adjutor/Stable.html#(part._.Sequence_.Constructors)

They can all be used as first-class procedures, but that does involve a little 
runtime overhead, so they use `define-sequence-syntax` to cooperate directly 
with `for`-like forms when possible.

-Philip


On Mon, May 4, 2020 at 6:28 AM Jos Koot  wrote:
 
Recently I needed a multiple value version of in-value.
Does something like that exist already?
I could not find it, so I made one:
 
(define-syntax (in-values stx)
(syntax-case stx ()
  ((_ expr)
#'(make-do-sequence
    (λ ()
 (values
  (λ (p) expr)
  (λ (p) #f)
  #t
  (λ (p) p)
  #f
  #f))
 
A pity that it is a syntax. It is possible to code it as a procedure, but I do 
not see an elegant way to do that without confusing a list with a multiple 
value.
 
I had:
 
File drac-plus-sant-is-jordi.rkt
 
(define digits '(0 1 2 3 4 5 6 7 8 9))
 
  (for*/list
   ((A (in-list digits)) (digits (in-value (remove A digits)))
    (C (in-list digits)) (digits (in-value (remove C digits)))
    (D (in-list digits)) (digits (in-value (remove D digits)))
    (N (in-list digits)) (digits (in-value (remove N digits)))
    (R (in-list digits)) (digits (in-value (remove R digits)))
    (S (in-list digits)) (digits (in-value (remove S digits)))
    (T (in-list digits))
    (DRAC  (in-value (+ (* 1000 D) (* 100 R) (* 10 A) C)))
    (SANT  (in-value (+ (* 1000 S) (* 100 A) (* 10 N) T)))
    (JØRDI (in-value (+ DRAC SANT))) ...
 
With syntax in-values I could simplify it to:
 
File drac-plus-sant-is-jordi-with-combi.rkt
 
  (for*/list
   ((combination (in-combinations '(0 1 2 3 4 5 6 7 8 9) 7))
    (permutation (in-permutations combination))
    ((A C D N R S T) (in-values (apply values permutation)))
    (DRAC  (in-value (+ (* 1000 D) (* 100 R) (* 10 A) C)))
    (SANT  (in-value (+ (* 1000 S) (* 100 A) (* 10 N) T)))
    (JØRDI (in-value (+ DRAC SANT)))
    (J (in-value (find-decimal-digit JØRDI 4)))
    (Ø (in-value (find-decimal-digit JØRDI 3)))
    (I (in-value (find-decimal-digit JØRDI 0))) ...
 
See https://github.com/joskoot/drac-sant-jordi for the complete programs.
 
Best wishes, Jos
-- 
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/5eafee34.1c69fb81.33cf0.0ce5%40mx.google.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/5eb040ec.1c69fb81.f0906.df35%40mx.google.com.


[racket-users] scribble defproc looses parenthesis

2019-09-14 Thread Jos Koot
Hi



File bug.rkt



#lang racket

(define (make-proc) (λ (x (y #f)) (void)))

(provide make-proc)



File bug.scrbl



#lang scribble/manual



@(require

  scribble/core

  scribble/eval

  racket

  "bug.rkt"

  (for-label racket "bug.rkt")

  (for-syntax racket))

@(defmodule "bug.rkt" #:packages ())

@defproc[((make-proc ) (x any/c) (y any/c #f)) any/c]{blah blah}



Renders:



 (require "bug.rkt")



((make-proc *x* [*y*]) → any/c ççç  here a parenthesis is missing.

  *x* : any/c

  *y* : any/c = #f

blah blah



I suppose this is a bug.

Best wishes, Jos

-- 
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/CAL6KNi3KZtRRBjp9%3D8NpvOqtQz-FBU4cw-_f9OkhsQW4K0owDQ%40mail.gmail.com.


RE: [racket-users] problem with current-error-port in scribbleinteraction

2019-06-27 Thread Jos Koot
Perfect. (with-handlers ((exn:fail? exception-handler)) ...) works nice.
Thanks very much for your rapid response,
Jos

From: Ryan Culpepper
Sent: 27 June 2019 13:36
To: Jos Koot; Racket Users
Subject: Re: [racket-users] problem with current-error-port in 
scribbleinteraction

The `uncaught-exception-handler` parameter controls the *bottom* of the 
exception handler stack, so it won't override the exception handler 
installed by Scribble's `interaction` form. If you use `with-handlers` 
(or `call-with-exception-handler`) instead, it should work.

The `uncaught-exception-handler` value is inherited by new threads, so 
it shouldn't refer to a specific escape continuation. That continuation 
(maybe the whole parent thread) may be gone by the time a child thread 
raises an exception.

Ryan


On 6/27/19 12:42 PM, Jos Koot wrote:
>
>
> Hi,
>
> The attachments are assumed to reside in the same directory and
> are reduced forms of more elaborated code.
> In module try-rkt I have code that captures errors such as
> to avoid an error-message being written on the current-error-port,
> to retrieve the error-message and to return normally.
> This works well as shown in module test-try-rkt.
> However, in a scribble interaction as shown in module try-scrbl,
> I get page try.html in which the interaction shows the error message
> and does not show the value returned by the test-proc.
>
> How can I make the interaction behave like in module test-try.rkt?
>
> In module try.rkt the use of eval is necessary.
>
> It is a strongly reduced version of a testing system
>
> that accepts sexprs and checks the returned values, the standard output and
>
> the error-message when an error is expected.
>
> Best wishes, Jos

-- 
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/5d14b620.1c69fb81.1ae35.7a64%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] problem with current-error-port in scribble interaction

2019-06-27 Thread Jos Koot

Hi,

The attachments are assumed to reside in the same directory and
are reduced forms of more elaborated code.
In module try-rkt I have code that captures errors such as
to avoid an error-message being written on the current-error-port,
to retrieve the error-message and to return normally.
This works well as shown in module test-try-rkt.
However, in a scribble interaction as shown in module try-scrbl,
I get page try.html in which the interaction shows the error message
and does not show the value returned by the test-proc.

How can I make the interaction behave like in module test-try.rkt?

In module try.rkt the use of eval is necessary.
It is a strongly reduced version of a testing system
that accepts sexprs and checks the returned values, the standard output and
the error-message when an error is expected.

Best wishes, Jos

-- 
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/5d149d7c.1c69fb81.9bc88.bf49%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


test-try.rkt
Description: Binary data
Title: Try-test

•Try-testTry-testtest-procTry-testJacob J. A. Koot (require "try.rkt")procedure(test-proc) → void?blah blah
> (require "try.rkt")> (test-proc)monkey 

try.rkt
Description: Binary data


try.scrbl
Description: Binary data


[racket-users] RE: ojo

2019-06-20 Thread Jos Koot
Dag Alice,

Fijn dat er vooruitgang is geboekt met je ojos en
dat je dit als een aanzienlijke verbetering ervaart.
Geduld is voor velen moeilijk.
Dat geldt ook voor mij, vooral hier in Spanje, waar alles traag en inefficient 
gaat.
Ik hoop dat de volgende behandelingen eveneens verbetering zullen geven.
Cros my fingers for you.

Het is de afgelopen en vorige week inderdaad vaak warmer geweest
in Nederland dan in Catalonie.
Zelf vind ik een temperatuur van 30 graden heel behaaglijk
(maar dan blijf ik uiteraard wel in de schaduw.)

De afgelopen week niet veel kleinkinderen te logeren gehad,
maar de weken daarvoor wel.
Aankomend weekend komen ze weer.
Maar ze zijn al wat rustiger en daardoor veel gemakkelijker.
Wel elk ontbijt ben ik verplicht pannekoeken voor ze bakken
(geen pannenkoeken alsjeblieft)
Uiteraard houden we altijd in de gaten waar ze uithangen,
maar het is niet meer nodig om ze de hele dag op de lippen te zitten.
Ze kijken veelteveel TV en zijn tegelijkertijd bijna voortdurend bezig met hun 
mobieltjes.
Niet mijn favoriete tijdverblijf, maar ja, elke generatie heeft zijn eigen 
levensstijl;
dit moet je, zolang het niet teveel uit de hand loopt,
als oudere generatie weten te accepteren, denk ik.
De twee meisjes lezen wel voldoende, denk ik.
Jammer dat ze weinig andere culturele bezigheden hebben.
Wel veel sport.
Maar musea vinden ze over het algemeen wel interessant.
De twee oudere kleinkinderen, allebei al bijna señoritas, zijn dicht bij de 
pubertijd.
Ze gaan 1 of 2 maal per jaar zonder ouders naar
een georganiseerde vakantie in Ierland, Engeland of Canada.
Goed voor blikverruiming, denk ik,
en voor het leggen van interessante contacten.

Zelf speel ik de laatste tijd weinig blokfluit,
maar wel enkele keren per week een uurtje gitaar, altijd improviserend.
Ik heb zelfs een keer improviserend met gitaar opgetreden (solo)
Ga binnenkort toch weer op zoek naar een muziekgezelschap,
bijvoorbeeld een koor.
Probleem is dat mijn stem noch bas noch tenor is, maar iets daartussenin.
Ik lees nog steeds erg graag, en uiteraard blijft de wiskunde me boeien.
Mijn laatste bijdragen op de netwerken
https://racket-lang.org/ en https://github.com/joskoot/
zijn met verscheidene sterren bekroond.

Onlangs mail gekregen van Norbert Kunst.
Hij wil een ontmoeting organiseren.
Ik heb hem meteen teruggemailed dat ik dit erg leuk zou vinden.
Ik wacht nu op zijn antwoord.

De gezondheid van mij en Teresa laat niets te wensen over.
Hoewel ik geen klachten heb
weet mijn vrouwelijke huisarts toch altijd wel weer een smoes te verzinnen
voor een extra echo, bloed- of urine-test.
Na de inspectie van mij lever (in augustus geloof ik)
ga ik het testen wel wat afremmen, denk ik.
Ik test liever mijn computerprogrammas.
Ook de programmas die de testen uitvoeren moeten worden getest.
Daar krijg ik niet gauw genoeg van.

Veel liefs, Jos

From: meer.ba...@kpnmail.nl
Sent: 20 June 2019 20:43
To: Jos Koot
Subject: ojo

Dag Jos,

Zoals beloofd laat ik weten hoe het met mijn oog is gegaan maandag j.l. De 
nastaar op de implantaatlens is weggelaserd en ik heb nu iets meer helderheid 
in mijn rechteroog. Een paar procentjes scheelt al heel wat voor mij zoals je 
zult begrijpen. De volgende afspraak is op 1 augustus en dan hoop ik ook de 
verwijzing naar het Radboud UMC in Nijmegen te krijgen. Ik moet veel geduld 
hebben en dat is niet altijd makkelijk. 

Wij hebben een paar erg warme dagen achter de rug en er komen nog meer volgende 
week. Even doorbijten dus en de ventilator in de slaapkamer op volle toeren 
laten draaien. ’s Ochtends studeren dan is het nog lekker.

Hoe is met jullie? Veel logees en afspraken?
Geniet van jullie heerlijke Spaanse land.
Groet en liefs voor allebi,
Alice

Verzonden vanuit Mail voor Windows 10


-- 
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/5d0c0d2a.1c69fb81.4d779.792f%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] exact rationals in interactions window

2019-06-14 Thread Jos Koot
Yes, the intermediate output-string does the job. Thanks.
Stupid me, not thinking of that by myself.
Jos

From: Robby Findler
Sent: 13 June 2019 21:32
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] exact rationals in interactions window

Does this help?

(let ([cp (current-print)])
  (current-print
   (λ (x)
 (define sp (open-output-string))
 (parameterize ([current-output-port sp])
   (cp x))
 (display (get-output-string sp)

On Thu, Jun 13, 2019 at 12:20 PM Jos Koot  wrote:
>
>
>
> Hi
>
>
>
> Is it possible to instruct DrRacket to display non-integer exact rationals 
> with a slash in stead of a horizontal line?
>
> If so, how? I tried current-print and the like, but without success.
>
>
>
> Jos
>
> --
> 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/5d0285e1.1c69fb81.4a5ab.43b8%40mx.google.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5d034f53.1c69fb81.e0de4.b3dd%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] exact rationals in interactions window

2019-06-13 Thread Jos Koot

Hi

Is it possible to instruct DrRacket to display non-integer exact rationals with 
a slash in stead of a horizontal line?
If so, how? I tried current-print and the like, but without success.

Jos

-- 
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/5d0285e1.1c69fb81.4a5ab.43b8%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] nj-symbols

2019-06-13 Thread Jos Koot
To whom may be interested,
Repository https://github.com/joskoot/nj-symbols
Provides procedures for the exact computation of the squares of 3j-, 6j- and 
9j-symbols.
For documentation a scribble module is included.
Jos

-- 
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/5d026282.1c69fb81.9eed6.0c2b%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] exact 3j-symbols

2019-05-18 Thread Jos Koot
To whom is interested,

I have initiated a new repository:
https://github.com/joskoot/3j-symbol.
It contains a procedure for the exact computation of the signs
and the squares of 3j-symbols using the Racah formula.
Documentation is included as a scribble/manual module.
To do: add more tests.
Comments are welcome, of course.
May be a candidate for math/number-theory?

Jos

-- 
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/5ce01819.1c69fb81.99909.8a86%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Struct properties and recursion

2019-02-23 Thread Jos Koot
I think the definition of write-point must come before the definition of
the struct type.
Jos

On Fri, 22 Feb 2019 at 23:35, Jack Firth  wrote:

> Does it seem weird to anybody else that there's no way to set struct
> properties without mutual recursion?
>
> Say I'm defining a 2d point struct and want to set the prop:custom-write
> property to control how points print. I might start with this:
>
> (struct point (x y)
>   #:property prop:custom-write
>   (lambda (this out _)
> (write-string "(point " out)
> (write (point-x this) out)
> (write-string " " out)
> (write (point-y this) out)
> (write-string ")" out)))
>
> This works fine. But if I try to extract that lambda into a named function:
>
> (struct point (x y) #:property prop:custom-write write-point)
> (define (write-point pt out _) ...)
>
> That doesn't work, and the error complains that I'm using write-point
> before it's defined. This error makes sense to me. The property value is
> associated with the type, not with instances, and the struct form is
> essentially a macro that expands to a call to `make-struct-type` with a
> list of property values. So I understand that I need to define those
> properties before using them in the struct definition:
>
> (define (write-point pt out _) ...)
> (struct point (x y) #:property prop:custom-write write-point)
>
> All well and good. But then I decide that defining write-foo for every one
> of my struct types is tedious, so I define a make-list-type-writer helper
> function and try to use it:
>
> (define ((make-list-type-writer name . accessors) this out _)
>   (write-string "(" out)
>   (write-string name out)
>   (for ([accessor (in-list accessors)])
> (write-string " " out)
> (write (accessor this) out))
>   (write-string ")" out))
>
> (define write-point (make-list-type-writer "point" point-x point-y))
> (struct point (x y) #:property prop:custom-write write-point)
>
> And now we've got a problem. This doesn't work because I can't pass the
> point-x and point-y accessors as arguments to make-list-type-writer. They
> don't exist yet! So in order to make my property value, I need the struct
> defined. But in order to define the struct, I need the property value. A
> workable fix is to delay evaluation somewhere with lambdas:
>
> (define write-point
>   (make-list-type-writer
> "point"
> (lambda (this) (point-x this))
> (lambda (this) (point-y this
>
> This feels tedious and unnecessary. Looking at the underlying API of
> make-struct-type, I can't see any way to avoid this mutual recursion. Which
> is *weird* to me, because when else are you forced to use mutual
> recursion? Mutually recursive functions can be transformed into functions
> that accept the other function as an argument. Mutually recursive modules
> can (usually) be broken down into smaller modules that don't have any
> cyclic dependencies. But I can't seem to do the same for structs, which
> makes it difficult to write nice helper functions for building struct types
> in a first-class way.
>
> --
> 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] Guide and reference

2019-02-08 Thread Jos Koot
+1

On Thu, 7 Feb 2019 at 18:48, David Storrs  wrote:

> For what it's worth, I like having the Guide and the Reference be
> separate things.  They have different purposes and trying to mash them
> together is likely to make them worse at both.
>
> The Guide is designed to introduce new concepts, give the reader basic
> familiarity, and clarify edge cases.
>
> The Reference is intended to be, well, a *reference*.  It is concise
> and exhaustive.  It requires a certain degree of familiarity to
> provide full value but once you have that familiarity it becomes
> invaluable.  Perhaps there are places where a few more examples
> wouldn't hurt, but folding pages of soft-walk introduction into each
> section would be a waste.  Either it's at the top and gets ignored
> when you're trying to look something up or it's inline and gets in the
> way.
>
>

-- 
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] Racket v7.2

2019-01-30 Thread Jos Koot
Very nice.
Runs fast for my programs.
Thanks, to all who contributed, Jos

On Wed, 30 Jan 2019 at 19:59, Vincent St-Amour <
stamo...@eecs.northwestern.edu> wrote:

> Racket version 7.2 is now available from
>
> http://racket-lang.org/
>
> Racket-on-Chez is done in a useful sense, but we'll wait until it gets
> better before making it the default Racket implementation. For more
> information, see
>
> http://blog.racket-lang.org/2019/01/racket-on-chez-status.html
>
> In addition, the Racket 7.2 release includes the following improvements,
> which apply to both implementations:
>
> - The contract system supports collapsible contracts, which avoid
>   repeated wrappers in certain pathological situations. Thanks to Daniel
>   Feltey.
>
> - Quickscript, a scripting tool for DrRacket, has become part of the
>   standard distribution. Thanks to Laurent Orseau.
>
> - The web server's built-in configuration for serving static files
>   recognizes the ".mjs" extension for JavaScript modules.
>
> - The `data/enumerate` library supports an additional form of
>   subtraction via `but-not/e`, following Yorgey and Foner's ICFP'18
>   paper. Thanks to Max New.
>
> - The `letrec.rkt` example model in Redex has been changed to more
>   closely match Racket, which led to some bug fixes in Racket's
>   implementation of `letrec` and `set!`.
>
> - The racklog library has seen a number of improvements, including fixes
>   to logic variable binding, logic variables containing predicates being
>   applicable, and the introduction of an `%andmap` higher-order predicate.
>
> The following people contributed to this release:
> Akihide Nano, Alex Feldman-Crough, Alexander McLin, Alexander Shopov,
> Alexis King, Alex Knauth, Andrew Kent, Asumu Takikawa, Ben Greenman,
> Bogdan Popa, Caner Derici, Chongkai Zhu, Dan Feltey, Darren Newton, Gan
> Shen, Greg Hendershott, Gustavo Massaccesi, Jay McCarthy, Jens Axel
> Søgaard, John Clements, Jordan Johnson, Kevin Robert Stravers, Leif
> Andersen, Leo Uino, Matt Kraai, Matthew Butterick, Matthew Flatt,
> Matthias Felleisen, Max New, Michael Burge, Mike Sperber, Paul
> C. Anagnostopoulos, Paulo Matos, Philip McGrath, Robby Findler, Ronald
> Garcia, Ryan Culpepper, Ryan Kramer, Sam Tobin-Hochstadt, Shu-Hung You,
> Sorawee Porncharoenwase, Spencer Florence, Stephen Chang, and Vincent
> St-Amour
>
> Feedback Welcome
>
> --
> 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] Are the terms "function" and "procedure" synonymous in Racket?

2019-01-22 Thread Jos Koot
You write:

> "It is often the case that
> arbitrary procedures don't compose meaningfully, whereas procedures that
> represent functions always compose meaningfully. "
>
> functions f and g can be composed meaningfully only if the domain of f is
> compatible with the co-domain of g.


Jos

-- 
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.


FW: [racket-users] colon keywords

2018-09-23 Thread Jos Koot
 Forgot to include the users group.

-Original Message-
From: Jos Koot [mailto:jos.k...@gmail.com] 
Sent: 23 September 2018 21:37
To: 'Tomasz Rola'
Subject: RE: [racket-users] colon keywords

MHO, adhere to #:foo,
because :foo is a permitted identifier.
I prefer a clear distinction between keywords and identifiers.
Just like the sharp sign is used in many other output.
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Tomasz Rola
Sent: 23 September 2018 18:50
To: Racket-Users List
Cc: Neil Van Dyke; Tomasz Rola
Subject: Re: [racket-users] colon keywords

On Wed, Sep 19, 2018 at 04:56:05AM -0400, Neil Van Dyke wrote:
> Currently, in main Racket reader, `#:` starts a keyword, as in `#:foo`.
> 
> Who on this email list would also like (or not like) `:` to start a
> keyword, as in `:foo`?


-- 
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.


FW: [racket-users] Semaphore-count

2018-09-06 Thread Jos Koot
Ignore my email on this subject, please.
It is wrong.
Jos

-- 
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] Semaphore-count

2018-09-05 Thread Jos Koot
Hi Craig Allen
Would something like the following work?
Jos
 
(define (make-sema n)
 (define-syntax-rule (with-counter-sema expr ...)
  (begin
   (semaphore-wait counter-sema)
   (define result (begin expr ...))
   (semaphore-post counter-sema)
   result))
 (define counter-sema (make-semaphore 1))
 (define counter n)
 (define sema (make-semaphore n))
 (define (wait) (with-counter-sema (semaphore-wait sema) (set! n (sub1 n
 (define (post) (with-counter-sema (semaphore-post sema) (set! n (add1 n
 (define (count) (with-counter-sema n))
 (values wait post count))
 
(define-values (wait post count) (make-sema 3))
(count)
(wait)
(count)
(post)
(count)


  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of George Neuner
Sent: 04 September 2018 17:47
To: Craig Allen
Cc: racket users
Subject: Re: [racket-users] Semaphore-count



On 9/4/2018 8:31 AM, Craig Allen wrote:


I saw that function, but was scared off by its documentation:

Like semaphore-wait, but semaphore-try-wait? never blocks execution. If sema's 
internal counter is zero, semaphore-try-wait? returns
#f immediately without decrementing the counter. If sema's counter is positive, 
it is decremented and #t is returned.


I'm not sure why I'd want it to decrement the count, I really just want to see 
if my critical section is running. I will try it
though, thanks.




'wait' takes the semaphore when it is available.  'try-wait' takes the 
semaphore if possible, or fails immediately if it can't.  

AFAIK there is no way to simply 'check' if the semaphore is available.  In a 
multithread environment, such checking doesn't do much
good anyway ... a positive counter value doesn't mean you actually can take a 
semaphore - some other thread(s) may beat you to it.

The canon [language independent] methods of "optimistic" locking are either to 
spin until 'try' returns true, or to combine one or a
few initial probes using 'try' with a fall back to a normal wait if the probes 
fail.

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.
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] How is define-values defined?

2018-08-01 Thread Jos Koot
Matthias,
Thanks, for the pointer.
I am studying the article, which at first look seems very well readable.
I did not mean to 'propose' my odd idea.
Jos

-Original Message-
From: Matthias Felleisen [mailto:matth...@felleisen.org] 
Sent: 01 August 2018 16:26
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] How is define-values defined?


> On Jul 31, 2018, at 2:17 PM, Jos Koot  wrote:
> 
> It even is possible to implement a multiple value as a single value such as 
> to allow:
>  
> (define x (values 1 2 3))
> (define-values (a b c) x)
> (call-with-values (lambda () x) list)
>  
> Somewhere I must have an interpreter that allows this,
> but for the moment I can't find it without long searching.
> IIRC it is/was a very odd (and probably bad) interpreter.

I don't think this proposal denotes. The 'values' idea is to deal with several 
values in parallel. The 'define x' idea is that x is
bound to a single value. 

;; - - - 

I don't know too many publications about the implementation of 'values'. The 
one I'd always start with is Ashley and Dybvig's: 

   https://www.cs.indiana.edu/~dyb/pubs/mrvs.pdf

For CL, I'd look in CL2. - 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] sharing an awesome plot - warms the cockles of my heart

2018-03-24 Thread Jos Koot
Very nice,
Jos Koot

  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Sanjeev Sharma
Sent: 23 March 2018 22:17
To: Racket Users
Subject: [racket-users] sharing an awesome plot - warms the cockles of my heart


I've done no math in 20 years - used to do tons (with the not so great graphics 
of the time) saw this intriguing plot & banged my
head against a wall for a couple of hours.

Then I just settled down & read the manual systematically, pretending it may 
have some info,  followed the examples and voila

(require plot)(plot-new-window? #t)
(define(xu u)(*(sin(* 33 u))(cos(* 9 u
(define(yu u)(*(sin(* 49 u))(sin(* 7 u
(plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));




-- 
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] Using match to decompose a nested hash

2018-03-19 Thread Jos Koot
You forgot some parentheses:
 
(match user
  [(hash-table ('name name) ('job (hash-table ('type type) ('id id ; <---
   (displayln name)
   (displayln type)
   (displayln id)])
 
Jos

  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of David Storrs
Sent: 19 March 2018 16:38
To: Racket Users
Subject: [racket-users] Using match to decompose a nested hash


-- 
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] Understanding 'curry'

2018-02-28 Thread Jos Koot
You are right, I think.
Thanks.

  _  

From: David Storrs [mailto:david.sto...@gmail.com] 
Sent: martes, 27 de febrero de 2018 22:29
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] Understanding 'curry'




On Tue, Feb 27, 2018 at 2:46 PM, Jos Koot <jos.k...@gmail.com> wrote:



It breaks my brain, certainly.
Glad to read you think you are getting to it.
When you got it, explain to me, please, for I don't understand nothing of it.
I just applied some trial and error to get to a point where I can use curry.
(In fact I prefer to use my own curry (that is not curried, but neither workd 
with keyword arguments)
My private curry gives ((curry list)) -> (), not a procedure.
For me it remains a queston why curry has been made such as to give a procedure 
that in behaviour differs from a procedure produced
by an application of a curried frunction.
Jos


Oh, it's simple!  When you curry curry your curried curry can have curried any 
sort of arguments but it can't curry keyword
arguments, only positionals, so you need to curry curry in order to curry a 
keyword that you want to curry onto a non-curry function
to produce a curried function.


Stated in a less smart-alecky way:  You cannot curry keyword arguments onto a 
function, unless that function is the curry function
itself.  I have no idea why it does that.


Here's a series of items that clarified it for me.  I suspect you get it at 
least as well as I do, but hopefully it will help
someone else at some point:


Welcome to Racket v6.11.


> (define (pos-only a b) b)

> (pos-only 7 8)
8

> (curry pos-only 7)
# ; actual value is roughly (lambda (b) (pos-only 7 b))

> ((curry pos-only 7) 8)
8
> ((lambda (b) (pos-only 7 b)) 8)
8


> (curry curry pos-only 7) ; you can curry the 'curry' function.
#  ; roughly equivalent to (lambda args (apply (curry 
pos-only 7) args))
 

> (define (has-1-kw a #:foo b) b)
> (has-1-kw 7 #:foo 8)
8
 

> (curry has-1-kw 7)  ; you cannot curry a function with keyword arguments...
; application: required keyword argument not supplied
;   procedure: has-1-kw
;   required keyword: #:foo
; [,bt for context]

> (curry curry has-1-kw)  ; ...but you can curry the function 'curry', giving 
> it a single argument that is a function.  The function
in question requires keyword arguments, but that's not relevant here.
#  

> (curry curry #:foo 7)   ; the 'curry' function can accept arbitrary keyword 
> arguments
# ; conceptually equivalent to (lambda (func . args) (apply 
curry func _ #:foo 7)) where _ will be replaced with
more arguments later.  That is NOT legal syntax, however.


Recall that the 'curry' function takes a function (call it ) and returns a 
new function (call it ).  In general,  is not
allowed to accept keyword arguments.  The only exception to this is if  is 
the curry function itself, in which case you're free
to pass keywords. Why it's like this, I don't get any more than Jos does.






  _  

From: David Storrs [mailto:david.sto...@gmail.com] 
Sent: martes, 27 de febrero de 2018 20:13
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] Understanding 'curry'




On Tue, Feb 27, 2018 at 12:12 PM, Jos Koot <jos.k...@gmail.com> wrote:


curry itself is curried (which sometimes is puzzling)

(define (foo a #:bar x) x)
((curry   foo #:bar 9) 8) ; -> #
((curry curry foo #:bar 9) 8) ; -> 9

I hope others can explain this in detail.
I can't.

Jos



Madness!  Madness, I say!


Okay, it looks like I misunderstood what it meant by "The curry function 
provides limited support for keyworded functions: only the
curry call itself can receive keyworded arguments to be propagated eventually 
to proc."  It's currying the keyword argument *onto
the curry function*, not onto the foo function.  The result is a form of curry, 
not a form of foo.


(define (bar a b) b)

(curry bar 7)

...produces a version of bar that takes one argument and the other one is 
already set.


(curry curry bar)

...produces a function  that, when evaluated, will return a function  
that is the result of currying no arguments onto the
function bar.  (Which is equivalent to bar)


Similarly:

(define (foo a #:bar x) x)

(curry curry foo #:bar 9)

...is creating a function  that, when evaluated, will generate a function 
 that is the result of currying the keyword
argument+value '#:bar 9' onto foo.   expects N arguments where N is the 
number of positional arguments expected by foo.  It is
not possible to generate  directly, it needs to be done by creating and 
evaluating .  Also,  will not accept keyword
arguments.

(define (foo a #:bar x #:baz y) x)
> (foo 7 #:bar 8 #:baz 9)
8

> (curry curry foo #:bar 8 #:baz 9)
#

> ((curry curry foo #:bar 8 #:baz 9) 7)
8

> ((curry curry foo #:bar 8) 7)
; application: required keyword argument not supplied
;   procedure: foo
;   required keyword: #:baz
; [,bt for context]

> ((curry curry foo #:bar 8) 7 #:baz 9)
; a

RE: [racket-users] Understanding 'curry'

2018-02-27 Thread Jos Koot
It breaks my brain, certainly.
Glad to read you think you are getting to it.
When you got it, explain to me, please, for I don't understand nothing of it.
I just applied some trial and error to get to a point where I can use curry.
(In fact I prefer to use my own curry (that is not curried, but neither workd 
with keyword arguments)
My private curry gives ((curry list)) -> (), not a procedure.
For me it remains a queston why curry has been made such as to give a procedure 
that in behaviour differs from a procedure produced
by an application of a curried frunction.
Jos

  _  

From: David Storrs [mailto:david.sto...@gmail.com] 
Sent: martes, 27 de febrero de 2018 20:13
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] Understanding 'curry'




On Tue, Feb 27, 2018 at 12:12 PM, Jos Koot <jos.k...@gmail.com> wrote:


curry itself is curried (which sometimes is puzzling)

(define (foo a #:bar x) x)
((curry   foo #:bar 9) 8) ; -> #
((curry curry foo #:bar 9) 8) ; -> 9

I hope others can explain this in detail.
I can't.

Jos



Madness!  Madness, I say!


Okay, it looks like I misunderstood what it meant by "The curry function 
provides limited support for keyworded functions: only the
curry call itself can receive keyworded arguments to be propagated eventually 
to proc."  It's currying the keyword argument *onto
the curry function*, not onto the foo function.  The result is a form of curry, 
not a form of foo.


(define (bar a b) b)

(curry bar 7)

...produces a version of bar that takes one argument and the other one is 
already set.


(curry curry bar)

...produces a function  that, when evaluated, will return a function  
that is the result of currying no arguments onto the
function bar.  (Which is equivalent to bar)


Similarly:

(define (foo a #:bar x) x)

(curry curry foo #:bar 9)

...is creating a function  that, when evaluated, will generate a function 
 that is the result of currying the keyword
argument+value '#:bar 9' onto foo.   expects N arguments where N is the 
number of positional arguments expected by foo.  It is
not possible to generate  directly, it needs to be done by creating and 
evaluating .  Also,  will not accept keyword
arguments.

(define (foo a #:bar x #:baz y) x)
> (foo 7 #:bar 8 #:baz 9)
8

> (curry curry foo #:bar 8 #:baz 9)
#

> ((curry curry foo #:bar 8 #:baz 9) 7)
8

> ((curry curry foo #:bar 8) 7)
; application: required keyword argument not supplied
;   procedure: foo
;   required keyword: #:baz
; [,bt for context]

> ((curry curry foo #:bar 8) 7 #:baz 9)
; application: procedure does not accept keyword arguments
;   procedure: curried
; [,bt for context]


That makes my brain hurt, but I think I get it.


Thanks, Jos


 



-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@ 
<mailto:racket-users@googlegroups.com> googlegroups.com] On Behalf Of
David Storrs
Sent: martes, 27 de febrero de 2018 17:36
To: Racket Users
Subject: [racket-users] Understanding 'curry'

Despite using it for a long time, I discovered today that I do not
understand 'curry', at least insofar as it applies to keyword
arguments.

> (define (baz a b) b)
> (baz 8 9)
9

> (curry baz 8)
#

> ((curry baz 8) 9)
9

> (define (foo a #:bar x) x)
> (foo 8 #:bar 9)
9

> (curry foo #:bar 9)
#

Up to this point I'm fine, but now my understanding derails and all is
confusion.

> ((curry foo #:bar 9) 8)
#

I expected it to yield 9 as it did in the original direct call.  The
curry records the keyword argument and returns a function that takes
one positional argument; when that argument is supplied the original
foo function has all the arguments it needs so it should execute.

Maybe if I apply the final curried proc as a thunk?

> (((curry foo #:bar 8) 9))
#

Nope.

What am I not understanding?


--
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+unsubscribe@
<mailto:racket-users%2bunsubscr...@googlegroups.com> googlegroups.com.
For more options, visit https://groups.google.com/d/ 
<https://groups.google.com/d/optout> 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] Understanding 'curry'

2018-02-27 Thread Jos Koot
curry itself is curried (which sometimes is puzzling)

(define (foo a #:bar x) x)
((curry   foo #:bar 9) 8) ; -> #
((curry curry foo #:bar 9) 8) ; -> 9

I hope others can explain this in detail.
I can't.

Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of David Storrs
Sent: martes, 27 de febrero de 2018 17:36
To: Racket Users
Subject: [racket-users] Understanding 'curry'

Despite using it for a long time, I discovered today that I do not
understand 'curry', at least insofar as it applies to keyword
arguments.

> (define (baz a b) b)
> (baz 8 9)
9

> (curry baz 8)
#

> ((curry baz 8) 9)
9

> (define (foo a #:bar x) x)
> (foo 8 #:bar 9)
9

> (curry foo #:bar 9)
#

Up to this point I'm fine, but now my understanding derails and all is
confusion.

> ((curry foo #:bar 9) 8)
#

I expected it to yield 9 as it did in the original direct call.  The
curry records the keyword argument and returns a function that takes
one positional argument; when that argument is supplied the original
foo function has all the arguments it needs so it should execute.

Maybe if I apply the final curried proc as a thunk?

> (((curry foo #:bar 8) 9))
#

Nope.

What am I not understanding?

-- 
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] make-custom-set-types and make-custom-hash-types

2018-02-27 Thread Jos Koot
Hi

The order in which procedure make-custom-set-types returns its values
differs from the order given in the docs.

The same holds for procedure make-custom-hash-types.

Can this be synchronized?
(preferably in the docs for backward compatibilty, I assume)

DrRacket, version 6.12 [3m].

Jos Koot

-- 
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] (number->string -nan.0) == "+nan.0" ?

2018-02-06 Thread Jos Koot
(eq? +nan.0 -nan.0) -> #t
This is documented:
The datum -nan.0 refers to the same constant as +nan.0, and -nan.f is the same 
as +nan.f.
Jos

  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of David Storrs
Sent: martes, 06 de febrero de 2018 00:42
To: Racket Users
Subject: [racket-users] (number->string -nan.0) == "+nan.0" ?


I noticed that (number->string -nan.0) yields "+nan.0" instead of "-nan.0" as I 
would have expected.  It's not an issue for me, but
I was wondering why this is?


-- 
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] some issues about in-permutations

2018-01-19 Thread Jos Koot
Hi,

1:

In module racket/collects/list.rkt
the definition of procedure in-permutations
contains the line:

(define cur (reverse l))

Why the reversal?
Why not:

(define cur l)?

With (define cur l) in-permutations returns the permutations
in the same order as procedure permutations,
starting with list l,
which to me seems more logical.

In procedure permutations the reversal in line

(let loop ([i 0] [acc (list (reverse l))])

seems logical to me.

2:

The documentation does not mention that the list to be handled
must not be longer than 256 elements.
This restriction is acceptable, of course,
for never can we produce all 256! permutations.

3:

I would prefer the names 'rearrangements' and 'in-rearrangements',
such as to reserve the word 'permutation'
for bijections of a set onto the same set.

You may want to have a look into https://github.com/joskoot/rearrangements.
It can handle rearrangements of long lists
and takes care of an equivalence relation between the elements.

Best wishes, Jos

-- 
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] Re: Alternatives to DrRacket

2018-01-12 Thread Jos Koot
+1
On windows it is the same.
It would be nice to have the option to revert defaults for the current tab only.
Jos

  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of JCG
Sent: viernes, 12 de enero de 2018 01:38
To: Racket Users
Subject: [racket-users] Re: Alternatives to DrRacket


 snip  

6) In the preferences dialog (on a Mac at least), the "Revert All Preferences 
to Defaults" is unclear about whether the defaults are
for the displayed tab or for all preferences.  At least twice in the past, I've 
incorrectly assumed that the defaults were for the
topic displayed and not all preferences.  I fiddled with the background 
expansion and finally decided "Oh, I'll just put it back to
whatever is suggested - bam, all my other settings were gone."

 snip 

-- 
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] misterious empty line

2017-11-27 Thread Jos Koot
Hi Ben,
Your guess seems reasonable.
The empty line does not appear when I put the comment in one long line,
but this is ugly.
Defining the comment outside the definition works well,
so I'll use this hack as follows:
 
@elemtag["rearrangement" "Not important."]

@(define my-comment
 (list
  "Procedure "
  (racket in-permutations)
  " produces a sequence of "
  @elemref["rearrangement" "rearrangements"]
  "."))

 
@interaction[
(require racket)
(define (a)
 (code:comment #,my-comment)
 (in-permutations '(1 2 3)))
(a)]

 
Thanks, Jos 

 
  _  

From: Ben Greenman [mailto:benjaminlgreen...@gmail.com] 
Sent: lunes, 27 de noviembre de 2017 6:44
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] misterious empty line


My guess is that "(define" does something special to figure out where to insert 
newlines in the rendered document.

On Thu, Nov 23, 2017 at 9:13 AM, Jos Koot <jos.k...@gmail.com> wrote:


My code:

#lang scribble/manual

@(require
  scribble/core
  scribble/eval
  racket
  (for-label racket)
  (for-syntax racket))

@elemtag["rearrangement" "Not important."]
@interaction[
(require racket)
(code:comment #,(list "Procedure " (racket in-permutations)
 " produces a sequence of " @elemref["rearrangement" "rearrangements"] "."))
(define (a)
 (code:comment #,(list "Procedure " (racket in-permutations)
 " produces a sequence of " @elemref["rearrangement" "rearrangements"] "."))
 (in-permutations '(1 2 3)))
(a)]

Produces the attached HTML.

Why is there a blank line following the comment within the definition?
The blank line does not appear after the comment preceding the definition.

Windows 7 Home Premium,
DrRacket, version 6.11.0.2--2017-11-12(b54ea8c5b1/a) [3m].
Language: scribble/manual [custom]; memory limit: 4000 MB.

Thanks, Jos


--
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+unsubscribe@
<mailto:racket-users%2bunsubscr...@googlegroups.com> googlegroups.com.
For more options, visit https://groups.google.com/d/ 
<https://groups.google.com/d/optout> 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] misterious empty line

2017-11-23 Thread Jos Koot
My code:

#lang scribble/manual

@(require
  scribble/core
  scribble/eval
  racket
  (for-label racket)
  (for-syntax racket))

@elemtag["rearrangement" "Not important."]
@interaction[
(require racket)
(code:comment #,(list "Procedure " (racket in-permutations)
 " produces a sequence of " @elemref["rearrangement" "rearrangements"] "."))
(define (a)
 (code:comment #,(list "Procedure " (racket in-permutations)
 " produces a sequence of " @elemref["rearrangement" "rearrangements"] "."))
 (in-permutations '(1 2 3)))
(a)]

Produces the attached HTML.

Why is there a blank line following the comment within the definition?
The blank line does not appear after the comment preceding the definition.

Windows 7 Home Premium,
DrRacket, version 6.11.0.2--2017-11-12(b54ea8c5b1/a) [3m].
Language: scribble/manual [custom]; memory limit: 4000 MB.

Thanks, Jos 


-- 
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.

•??6.11.0.2Not important.
> (require racket); Procedure in-permutations produces a sequence of rearrangements.> (define (a)   ; Procedure in-permutations produces a sequence of rearrangements. (in-permutations '(1 2 3)))> (a)# 

RE: [racket-users] strange behaviour of procedure partitions

2017-11-12 Thread Jos Koot
I have downloaded and installed "Welcome to DrRacket, version 
6.11.0.2--2017-11-12(b54ea8c5b1/a) [3m].",
but the problem still remains.
I have Windows 7 premium home.
Thanks, Jos

  _  

From: Jens Axel Søgaard [mailto:jensa...@soegaard.net] 
Sent: zondag 12 november 2017 21:21
To: Jos Koot; Racket Users
Subject: Re: [racket-users] strange behaviour of procedure partitions



søn. 12. nov. 2017 kl. 19.54 skrev Jos Koot <jos.k...@gmail.com>:




Hi 

In the definitions window of DrRacket: 

#lang racket 
(require (only-in math/number-theory partitions)) 
(partitions 0) 
(partitions 0) 

Runs ok, 
but after running, 
typing (partitions 0) in the interactions window 
gives the following error: 

define-values: assignment disallowed; 
 cannot re-define a constant 
  constant: lifted.0 




Have you tried it in a version of Racket using the new expander?

Just a hunch based on: https://github.com/racket/datalog/issues/6



The error does not show up when I comment out 
the two lines (partitions 0) in the definitions window 
and rerun before typing (partitions 0) in the interactions window. 
I suppose this is a bug. 

The error does not occur when replacing 
#lang racket 
by 
#lang typed/racket 

It is very well possible that I don't correctly require 
from a typed module into an untyped one. 
Should be possible, no? 

Thanks, Jos 



-- 
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.


-- 

-- 
Jens Axel Søgaard


-- 
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] strange behaviour of procedure partitions

2017-11-12 Thread Jos Koot
Hi

In the definitions window of DrRacket:

#lang racket
(require (only-in math/number-theory partitions))
(partitions 0)
(partitions 0)

Runs ok,
but after running,
typing (partitions 0) in the interactions window
gives the following error:

define-values: assignment disallowed;
 cannot re-define a constant
  constant: lifted.0

The error does not show up when I comment out
the two lines (partitions 0) in the definitions window
and rerun before typing (partitions 0) in the interactions window.
I suppose this is a bug.

The error does not occur when replacing
#lang racket
by
#lang typed/racket

It is very well possible that I don't correctly require
from a typed module into an untyped one.
Should be possible, no?

Thanks, Jos

-- 
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] numerical partitions

2017-11-09 Thread Jos Koot
I have put my code at: https://github.com/joskoot/partitions 
Best wishes, Jos

-Original Message-
From: Iain Gray [mailto:iaing...@ednet.co.uk] 
Sent: jueves, 09 de noviembre de 2017 17:30
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] numerical partitions

my use will be a rhythmic pattern generator macro within the Common Music 
package. Sorry I lost the original implementation when my
computer crashed last year, Iain

> On 9 Nov 2017, at 13:28, Jos Koot <jos.k...@gmail.com> wrote:
> 
> How did you implement procedure part many years ago?
> Things may depend on what you want to do with the partitions.
> Do you want the whole list at once,
> or would a stream or generator be more appropriate?
> If you want I can send you a stream-version,
> but it is in a bad style.
> It has docs made with scribble.
> Jos
> 
> -Original Message-
> From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
> Behalf Of Iain Gray
> Sent: jueves, 09 de noviembre de 2017 11:17
> To: Racket Users
> Subject: [racket-users] numerical partitions
> 
> Many years ago (r5rs days) I asked for help in partitioning numbers i.e.
> 
> (part 4) returns ((4) (3 1)  (2 2) (2 1 1) (1 1 1 1))
> 
> where the order of solutions is not important. Is it more efficient to 
> implement using Racket's iteration macros? Any help would
be
> appreciated.
> 
> Iain
> 
> -- 
> 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] numerical partitions

2017-11-09 Thread Jos Koot
How did you implement procedure part many years ago?
Things may depend on what you want to do with the partitions.
Do you want the whole list at once,
or would a stream or generator be more appropriate?
If you want I can send you a stream-version,
but it is in a bad style.
It has docs made with scribble.
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Iain Gray
Sent: jueves, 09 de noviembre de 2017 11:17
To: Racket Users
Subject: [racket-users] numerical partitions

Many years ago (r5rs days) I asked for help in partitioning numbers i.e.

(part 4) returns ((4) (3 1)  (2 2) (2 1 1) (1 1 1 1))

where the order of solutions is not important. Is it more efficient to 
implement using Racket's iteration macros? Any help would be
appreciated.

Iain

-- 
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] repeated code in interactions of scribble

2017-10-03 Thread Jos Koot
Hi Ben Greenman
 
Unsyntaxed elemtag and elemref work well in code:comment.
I did this as follows:
 
#lang scribble/manual
@require[scribble/example]

@(define my-eval (make-base-eval)) 

Beginning.

@examples[#:eval my-eval
  (code:comment #,(elemtag "plus2" ""))
  (define (plus2 n)
(+ 2 n))
  (plus2 0)
  (plus2 1)
]

 
Intermission.

@examples[#:eval my-eval
  (code:comment #,(list "See " (elemref "plus2" "previous example")
" for the definition of plus2."))
  (define (plus4 n)
(plus2 (plus2 n)))
  (plus4 0)
]
 

Conclusion.
 
Thanks again for your help.
 
Jos Koot
 

  _  

From: Jos Koot [mailto:jos.k...@gmail.com] 
Sent: domingo, 24 de septiembre de 2017 13:01
To: 'Ben Greenman'
Cc: 'Racket Users'; 'Jos Koot'
Subject: RE: [racket-users] repeated code in interactions of scribble


Thanks very much.
A nice and clear answer.
May be I can insert tagged elements and elemrefs in code:comment escaping with 
#,
in order to provide links to definitions in previous examples.
I'll try that later.
Thanks again, Jos

  _  

From: Ben Greenman [mailto:benjaminlgreen...@gmail.com] 
Sent: domingo, 24 de septiembre de 2017 6:45
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] repeated code in interactions of scribble


You can re-use helper functions by running the different example blocks with 
the same evaluator (example below). 

I don't know how to hyperlink one interaction to another.

- - -

#lang scribble/manual
@require[scribble/example]


@(define my-eval (make-base-eval))


Beginning.


@examples[#:eval my-eval
  (define (plus2 n)
(+ 2 n))
  (plus2 0)
  (plus2 1)
]


Intermission.


@examples[#:eval my-eval
  (define (plus4 n)
(plus2 (plus2 n)))
  (plus4 0)
]


Conclusion.

-- 
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] repeated code in interactions of scribble

2017-09-24 Thread Jos Koot
Thanks very much.
A nice and clear answer.
May be I can insert tagged elements and elemrefs in code:comment escaping with 
#,
in order to provide links to definitions in previous examples.
I'll try that later.
Thanks again, Jos

  _  

From: Ben Greenman [mailto:benjaminlgreen...@gmail.com] 
Sent: domingo, 24 de septiembre de 2017 6:45
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] repeated code in interactions of scribble


You can re-use helper functions by running the different example blocks with 
the same evaluator (example below). 

I don't know how to hyperlink one interaction to another.

- - -

#lang scribble/manual
@require[scribble/example]


@(define my-eval (make-base-eval))


Beginning.


@examples[#:eval my-eval
  (define (plus2 n)
(+ 2 n))
  (plus2 0)
  (plus2 1)
]


Intermission.


@examples[#:eval my-eval
  (define (plus4 n)
(plus2 (plus2 n)))
  (plus4 0)
]


Conclusion.

-- 
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] repeated code in interactions of scribble

2017-09-22 Thread Jos Koot
Hi,
What would be the easiest way to avoid duplication of code in interactions 
within a scribble/manual document?
I often place examples in such a document.
In some of them I need the same auxiliary procedures.
How to avoid duplicating them?
The most nice solution would be the appearance of a hyperlink within an 
interaction to a procedure in a previous interaction.
In the docs of Racket I see examples that do refer to procedures defined in 
previous examples.
Hence it must be possible.
I have looked around how it is done in the Racket docs, but it has not become 
clear to me how to acheive my goal.
Thanks, Jos.

-- 
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] Mapping over pattern variables

2017-09-01 Thread Jos Koot
How about:

(define-syntax (macro stx)
  (syntax-case stx ()
[(_ (var1 ...) (var2 ...))
 #`(begin
#,@(for*/list ((v1 (in-list (syntax->list #'(var1 ...
   (v2 (in-list (syntax->list #'(var2 ...)
 #`(do-something #,v1 #,v2)))])) 

Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Sam Waxman
Sent: viernes, 01 de septiembre de 2017 11:37
To: Racket Users
Subject: [racket-users] Mapping over pattern variables

Lets say I have a macro

(define-syntax (macro stx)
  (syntax-parse stx
[(_ (var1 ...) (var 2 ...))
 #'(begin
 (begin
   (do-something (#freeze var1) var2)
   ...)
 ...)]))

and I want to iterate first over var2, and then over var1. So if I type

(macro (1 2 3) (1 2))

I should get

(begin
  (begin
(do-something 1 1)
(do-something 1 2))
  (begin
(do-something 2 1)
(do-something 2 2))
  (begin
(do-something 3 1)
(do-something 3 2)))

What do I put where I currently have "#freeze" to tell the expander that I 
don't want the ... to affect var1? Or do I have to do
this manually with syntax->list and mapping functions?
 

-- 
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: FW: [racket-users] Can't seem to find the blue box(es) in DrRacket anymore

2017-08-28 Thread Jos Koot
Thanks!
Jos 

-Original Message-
From: Robby Findler [mailto:ro...@eecs.northwestern.edu] 
Sent: lunes, 28 de agosto de 2017 1:21
To: Jos Koot
Cc: hashim muqtadir; Racket Users
Subject: Re: FW: [racket-users] Can't seem to find the blue box(es) in DrRacket 
anymore

I've pushed a fix. Sorry for the delay in looking into this.

 https://github.com/racket/drracket/issues/118

Robby


snip

-- 
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.


FW: [racket-users] Can't seem to find the blue box(es) in DrRacket anymore

2017-08-27 Thread Jos Koot
 Sorry, ignore my post.
Jos Koot

-Original Message-
From: Jos Koot [mailto:jos.k...@gmail.com] 
Sent: domingo, 27 de agosto de 2017 19:00
To: 'hashim muqtadir'; 'Racket Users'
Subject: RE: [racket-users] Can't seem to find the blue box(es) in DrRacket 
anymore

I think you can toggle a switch in tab 'background expansion' of the 
preferences menu.
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of hashim muqtadir
Sent: domingo, 27 de agosto de 2017 8:12
To: Racket Users
Subject: [racket-users] Can't seem to find the blue box(es) in DrRacket anymore

Hello,
I recently updated to Racket 6.10 and I cannot seem to find the blue boxes in 
the top right of the definitions and interactions
windows anymore. They don't show up by pressing the hotkey (f2) either. There's 
no error or anything, just nothing happens. External
help works, i.e. pressing f1 opens up the docs search in my browser.

snip

-- 
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] Can't seem to find the blue box(es) in DrRacket anymore

2017-08-27 Thread Jos Koot
I think you can toggle a switch in tab 'background expansion' of the 
preferences menu.
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of hashim muqtadir
Sent: domingo, 27 de agosto de 2017 8:12
To: Racket Users
Subject: [racket-users] Can't seem to find the blue box(es) in DrRacket anymore

Hello,
I recently updated to Racket 6.10 and I cannot seem to find the blue boxes in 
the top right of the definitions and interactions
windows anymore. They don't show up by pressing the hotkey (f2) either. There's 
no error or anything, just nothing happens. External
help works, i.e. pressing f1 opens up the docs search in my browser.

Other things I did around the same time the blue boxes disappeared were 
tinkering with the preferences a bit and 'raco pkg migrate
6.9'. But I didn't find any relevant preference that turns them off (there was 
something about blue boxes and background expansion
but turning that on/off doesn't help) and it did not seem to me that the 
migrate command would have messed anything up.

Anyone has any idea what might have happened? I'd like those back. Maybe I'm 
just missing some preference or something. I'm using a
64-bit Windows 10, in case that is relevant.

Regards,
Hashim.

-- 
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] Re: European Racketeers and conferences

2017-08-24 Thread Jos Koot
There was a little group
(variable, but about 10 persons in average)
meeting each month in Barcelona,
but it did not survive very long.
Died several years ago after a summer month of hollidays.
May be we can give it a new life?
I live a mere 1.5 hours drive from Barcelona.
Mail me pleaae, if you remember or/and want to start again.
I think I can contribute with short talks and conversations.
Jos Koot

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of luis.osa.gdc
Sent: jueves, 24 de agosto de 2017 14:19
To: Racket Users
Cc: mebass...@gegn.net
Subject: [racket-users] Re: European Racketeers and conferences

Hi all,

I live in Stockholm. Using Racket for pet projects. I would also love to see a 
meetup or get-together happen on this side of the
Atlantic.

Best,
  Luis

-- 
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] I can translate a word but how can I translate a setence with drrakket

2017-06-25 Thread Jos Koot
Surely this is homework.
I am not giving you all detauils, just some hints.
First of all: Look in HtDP.

Your translator works for single words.
Let translate-sentence be the procedure for translating a list of words.
Following HtDP it can look like:

(define (translate-sentence sentence lexicon sprache)
 (cond 
  ((null? sentence) ...)
  ((else
(cons 
 (translate (car sentence) ...)
 (translate-sentence (cdr sentence) ...)

There are many more ways to do the same.
If you are acquanted with procedure map, you could write something like:

(define (translate-sentence sentence lexicon sprache)
 (define (translate-word word) (translate word lexicon spache))
 (map ...))

Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of philipp.thiess1...@gmail.com
Sent: domingo, 25 de junio de 2017 14:24
To: Racket Users
Subject: [racket-users] I can translate a word but how can I translate a 
setence with drrakket

Hello today I made a translator for drRakket cause its a task of my teacher.



I did it for one word but now I have to make it with a whole setence. I know I 
have to work with cons somehow but I just dont get
how to make it. My teacher doesnt understand it himself (he uses a pdf which 
gives all the tasks and wont give us solutuions) so you
guys are my only hope.


Here is my current code (Sorry for the german ( wort means word, lexikon is the 
list with all the words in 3 langauges) and sprache
means language)



#lang racket

(define *lex*
'((catgato   katze)
  (dog   perro  hund)
  (eats   come  frisst)
  (jumps   salte   springt)
  (the   el   die)))


(define (translator wort lexikon sprache)

  (cond ((null? lexikon) '(Wort wurde nicht gefunden)) 

((or (equal? wort (first (first lexikon))) 

 (equal? wort (first (rest (first lexikon 

 (equal? wort (first (rest (rest (first lexikon))


   (cond
 ((equal? sprache 'english) (first (first lexikon))) 

 ((equal? sprache 'spanisch) (first (rest (first lexikon 

 ((equal? sprache 'deutsch) (first (rest (rest (first lexikon)) 

)  




(else (translator wort (rest lexikon) sprache)) 

))


So (translator 'cat *lex* 'deutsch) will give the german word for cat which is 
Katze.


But now I have to change the code that (translator '(the dog jumps) *lex* 
'deutsch) will give me "die hund springt".

Can anyone help me? You are my last hope!



-- 
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] Turing machines

2017-06-12 Thread Jos Koot
Hi Damien

Right, interesting only for the theory.
But also a lot of fun to play with.

Did you see my example of a TM for binary addition of two arbitrary large 
numbers?
It has 13 states (of which only 9 are essential)
and 51 rules (of which only 27 are essential)
The test includes 50 tests with binary encodings of numbers (random 3000).
All tests together take about 5 seconds on my simple PC,
(conversion between exact-nonnegative-integers and their binary encodings 
included)

https://github.com/joskoot/turing.

It took me two days to find out why the UTM
presented by Hopcroft and Ullman does not work
(in their 1969 edition of "Formal Languages and their Relation to Automata")
May be these errata have been corrected in more recent editions,
but I have no free access to them to check this.
May be someone can tell me?
 
Thanks for your reply, Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Damien MATTEI
Sent: lunes, 12 de junio de 2017 14:36
To: racket-users@googlegroups.com
Subject: Re: [racket-users] Turing machines

snip

Interesting but from a theoretical point of view, when i was student i 
programmed a Turing machine emulator in PASCAL (still
somewhere on the net) ,
and as example i started to code in Turing states a 8bit addition number, i 
stopped near the 4th bits, there was so many states...
it is interesting for students but for the theory only.

Damien

-- 
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] Turing machines

2017-06-10 Thread Jos Koot
To whom is interested.

Jay McCarthy has a nice page about how to program Turing machines:
http://jeapostrophe.github.io/2013-10-29-tmadd-post.html.

Because I did not immediately see his implementation of producing a Turing 
machine as a Racket procedure,
I made one myself : https://github.com/joskoot/turing such as to play with his 
ideas.

My version contains much material inspired by Jay McCarthy, but goes further,
as far as including a universal Turing machine in the document
https://github.com/joskoot/turing/blob/master/make-TM.scrbl.

The documentation is long because it contains many elaborated examples.
Although the Turing machines produced by my procedure make-TM are very fast,
producing the documentation from make-TM.scrbl may take up to 30 seconds on my 
simple computer.
You may need 1 Mbyte or more to run my modules. I use 4 Mbytes.

Hope you enjoy it.
Criticisme welcome, of course,
Jos



-- 
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] RE: student project idea: semi-WYSIWYG Scribble editor (Was: Racket 6.9)

2017-04-29 Thread Jos Koot
Hi Matthias,
Put it your way it seems managable for a simple user like me.
I don't immediately see how to follow all details of your advice,
but I'll look into it in due time. I'll need time for that
and probably from time to time some more advice.
For instance, I would like to avoid repeated execution of interactions
that are not mutated, for they may slow down.
The rendering of a scribble can easily take 10 or more seconds.
A memoizing interaction (and companions) seems possible, though.
May be much more memoizing is possible for speed up.
May be, for once, I can be useful for Racket
as a thanks to PLT to be so useful for me for many years.
This is a promise to try, not one to succeed.
Jos  

-Original Message-
From: Matthias Felleisen [mailto:matth...@ccs.neu.edu] 
Sent: domingo, 30 de abril de 2017 0:39
To: Jos Koot
Cc: Neil Van Dyke; Racket Users
Subject: Re: [racket-users] RE: student project idea: semi-WYSIWYG Scribble 
editor (Was: Racket 6.9)


What you need to know is — at a high level — how to write a thread that, 
in DrRacket, conceptually clicks the ‘render as HTML’ button every time 
you hit a key. It’s kind of like background syntax checking. except that 
the result shows up in your browser not in DrRacket. So your GUI skills
aren’t really in demand. Just concurrent programming and managing 
threads (you don’t want to run it as a thread but as a place and you 
want to kill threads that don’t finish shipping their stuff to the browser
in time for the next keystroke to be processed.) 





> On Apr 29, 2017, at 6:13 PM, Jos Koot <jos.k...@gmail.com> wrote:
> 
> Hi Neil,
> Your idea crossed my mind when I started to use scribble,
> but I don't think I know enough of Scribble,
> (let alone HTML etc) for such a task.
> I hardly have experience in making Guis.
> I am a simple, but very content user of Racket.
> Thanks to you and all others of PLT,
> Jos
> 
> -Original Message-
> From: Neil Van Dyke [mailto:n...@neilvandyke.org] 
> Sent: sábado, 29 de abril de 2017 23:25
> To: Jos Koot; 'Racket Users'
> Subject: student project idea: semi-WYSIWYG Scribble editor (Was: Racket 6.9)
> 
> If some undergrad wanted a summer programming project... make a 
> semi-WYSIWYG editor for Scribble documents.
> 
> You might have a long scrolling text window, in which things like 
> boldface/italics/color/textsize that Scribble would render are editable 
> text, and Scribble markup itself doesn't appear on-screen. Things like 
> print pagination probably would not appear here, though, but you'll want 
> to special-case what normally ends up as rendered Table of Contents, for 
> navigation purposes.  This can be tricky, especially if you're not 
> closed-world to a particular set of Scribble primitives, but let the 
> user extend it with arbitrary constructs layered atop those (but you 
> could avoid intractability situations by always preserving the structure 
> the user specifies, and only going to WYSIWYG-ish display when 
> you can determine (programmatically) how the text in the renderer 
> relates to the text of the construct arguments.
> 
> Alternatively, and simpler: you might have two window panes, one in 
> which the user writes Scribble source, and another that gives an 
> almost-live semi-WYSIWYG view of how the source would render. Ideally 
> have the semi-WYSIWYG one approximate UI cues like text cursor point and 
> selection highlighting in the semi-WYSIWG view.
> 
> You could start with the latter, and then later implement the former as 
> an alternative mode that user could switch to/from dynamically. This 
> development path would certainly make your GUI-based selection of 
> regions for arbitrary extensible Scribble constructs, and traceability 
> of text between constructs and semi-WYSIWYG, easier to debug. :)
> 
> You might decide to implement this within the DrRacket framework, which 
> includes a bunch of GUI and support stuff that you'll need anyway, 
> beyond what the Racket `gui` packages provide.
> 
> 
> Jos Koot wrote on 04/29/2017 05:00 PM:
> [...]
>> Indeed I like WYSIWYG,
>> but nowadays I use scribble too (most scribble/manual)
>> (frequently rendering in order to see what I get and
>> looking into the docs in order to see how to get what I want)
>> A very nice thing of scribble is that you can make
>> elaborate procedures and syntax transformers,
>> much easier to write and more flexible and reliable
>> than Java macros in MS-word, I think.
>> And, of course, the @interaction[] and companions,
>> which I don't have in MS-word.
> [...]
> 
> -- 
> 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

[racket-users] RE: student project idea: semi-WYSIWYG Scribble editor (Was: Racket 6.9)

2017-04-29 Thread Jos Koot
Hi Neil,
Your idea crossed my mind when I started to use scribble,
but I don't think I know enough of Scribble,
(let alone HTML etc) for such a task.
I hardly have experience in making Guis.
I am a simple, but very content user of Racket.
Thanks to you and all others of PLT,
Jos

-Original Message-
From: Neil Van Dyke [mailto:n...@neilvandyke.org] 
Sent: sábado, 29 de abril de 2017 23:25
To: Jos Koot; 'Racket Users'
Subject: student project idea: semi-WYSIWYG Scribble editor (Was: Racket 6.9)

If some undergrad wanted a summer programming project... make a 
semi-WYSIWYG editor for Scribble documents.

You might have a long scrolling text window, in which things like 
boldface/italics/color/textsize that Scribble would render are editable 
text, and Scribble markup itself doesn't appear on-screen. Things like 
print pagination probably would not appear here, though, but you'll want 
to special-case what normally ends up as rendered Table of Contents, for 
navigation purposes.  This can be tricky, especially if you're not 
closed-world to a particular set of Scribble primitives, but let the 
user extend it with arbitrary constructs layered atop those (but you 
could avoid intractability situations by always preserving the structure 
the user specifies, and only going to WYSIWYG-ish display when 
you can determine (programmatically) how the text in the renderer 
relates to the text of the construct arguments.

Alternatively, and simpler: you might have two window panes, one in 
which the user writes Scribble source, and another that gives an 
almost-live semi-WYSIWYG view of how the source would render. Ideally 
have the semi-WYSIWYG one approximate UI cues like text cursor point and 
selection highlighting in the semi-WYSIWG view.

You could start with the latter, and then later implement the former as 
an alternative mode that user could switch to/from dynamically. This 
development path would certainly make your GUI-based selection of 
regions for arbitrary extensible Scribble constructs, and traceability 
of text between constructs and semi-WYSIWYG, easier to debug. :)

You might decide to implement this within the DrRacket framework, which 
includes a bunch of GUI and support stuff that you'll need anyway, 
beyond what the Racket `gui` packages provide.


Jos Koot wrote on 04/29/2017 05:00 PM:
[...]
> Indeed I like WYSIWYG,
> but nowadays I use scribble too (most scribble/manual)
> (frequently rendering in order to see what I get and
> looking into the docs in order to see how to get what I want)
> A very nice thing of scribble is that you can make
> elaborate procedures and syntax transformers,
> much easier to write and more flexible and reliable
> than Java macros in MS-word, I think.
> And, of course, the @interaction[] and companions,
> which I don't have in MS-word.
[...]

-- 
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] Re: Racket 6.9

2017-04-29 Thread Jos Koot
Thanks,
I tried again and it works now (6.9 64 bit release)
I had to disable part of Bullguard to completely uninstall the 6.8 release.
(It didn't recognize me as administrator. Formerly it did.)
Have run some tests among which a heavy one. Goes well.
Also thanks for your advices concerning buying a new computer
and choosing an operating system
that will suit me well for Racket.
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of George Neuner
Sent: sábado, 29 de abril de 2017 22:45
To: racket-users@googlegroups.com
Subject: [racket-users] Re: Racket 6.9

On Sat, 29 Apr 2017 21:05:10 +0200, "Jos Koot"
<jos.k...@gmail.com> wrote:

>I have downloaded 6.9, but was warned that the file does not end
>in correct way. Running the exe anyway gave a DrRacket that aborts
>after opening it.  I have Windows 7 with Bullguard protection.

I would say try again with a new download.  I don't use Bullguard so I
can't say if that was a factor, but both 32-bit and 64-bit versions
install and start for me on Windows 7.  I haven't checked them out
much beyond verifying that they run, but I don't expect any trouble.

 
>Soon I'll switch to a more modern system
>(preferably not with windows; what would be a cheap and yet good
>choice? I also need a good replacement for Microsoft Office 2003.
>I ask these questions here, because Racket (besides email and a
>replacement for Microsoft Word) is my most important tool.)

Just about any modern Linux distro will give you what you need.  Mint
(based on Ubuntu) probably is the easiest to just start working with
if you are switching from Windows.  If you are willing to invest a bit
in learning, I expect that any modern distro will satisfy your need.

Linux has a number of different GUI shells to choose from - it's not a
single ecosystem like Windows.  You may have to experiment to find
something you like.
https://www.howtogeek.com/163154/linux-users-have-a-choice-8-linux-desktop-environments/


LibreOffice probably is the most comprehansive replacement for MS
Office currently ... it has excellent compatibility up to Office 2013,
and some features of the newer version(s).

The word processor "Write" is ~99% compatible with Word.  The
developers concentrate on Write, so the other modules (spreadsheet,
presentation, database, etc.) tend to be a bit behind - but unless you
depend on really advanced features of Office, it's likely LibreOffice
will do everything you want.

However, be aware that there can be issues exchanging files with
Office users.  If you stick to the old DOC or new OpenDocument formats
- i.e. Office 2003 or prior, or Office 2012 or later - you should have
little or no trouble.  The DOCX formats, introduced in 2003 and used
natively by 2007 and 2010 cause problems even between the different
versions of Office.

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.
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] Racket 6.9

2017-04-29 Thread Jos Koot
Thanks for all reponses of Gabrielle and van Dyke.
Very useful info.
Indeed I like WYSIWYG,
but nowadays I use scribble too (most scribble/manual)
(frequently rendering in order to see what I get and
looking into the docs in order to see how to get what I want)
A very nice thing of scribble is that you can make
elaborate procedures and syntax transformers,
much easier to write and more flexible and reliable
than Java macros in MS-word, I think.
And, of course, the @interaction[] and companions,
which I don't have in MS-word.
Thanks again, Jos 

-Original Message-
From: Neil Van Dyke [mailto:n...@neilvandyke.org] 
Sent: sábado, 29 de abril de 2017 22:29
To: Jos Koot; Racket Users
Subject: Re: [racket-users] Racket 6.9

Stephen De Gabrielle wrote on 04/29/2017 03:18 PM:
> Ubuntu Linux is cheap, includes an alternative to ms word, gets 
> regular updates and (most importantly) runs racket fine.

Debian, RHEL/CentOS, Fedora, ArchLinux, and (maybe) Ubuntu are all good 
choices for people who don't *have* to run Windows stuff. These are more 
secure, and grew out of open source traditions of respecting users' 
various technical and societal freedoms.  Debian is the most 
freedom-principles-oriented, Red Hat is the most professional, Arch has 
the most technically-savvy median user (I usually end up on the Arch 
wiki, for a more technical take on some unusual stuff I do with Debian), 
Ubuntu is the most ordinary-user popular.  There are other big ones that 
I wouldn't consider or recommend.  There are also some non-US 
region-oriented distros with emphasis on a particular language/culture, 
in features and in support forums, but you'd have to ask people from the 
region about those.

For much academic publishing, and for many non-academic book 
manuscripts, LaTeX is often a good way to go.  (Even if your book 
publisher doesn't use LaTeX for ultimate layout, you can write minimal 
LaTeX as almost plain ASCII text for drafts, if you can resist the 
traditional TeX thesis-avoidance behavior of fine-tuning your layout for 
camera-ready copy.  Same with Scribble.)  Or, since you're a Racket 
person, perhaps Scribble for papers, books, and slides.  If you want a 
WYSIWYG word processor veneer over LaTeX source, try LyX.  If you're an 
Emacs user, you might like AUCTeX, but even the older Emacs LaTeX/TeX 
support might be enough for you.

LibreOffice/OpenOffice is there on GNU/Linux for those users who really 
must have something MS Office-like, but it has many of the same security 
problems (design-fundamental, as well as code quality), and also doesn't 
work as well as MS Office under normal conditions, and MS doesn't want 
it to interoperate too well.

-- 
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] scale of image of scribble with .jpg

2017-04-29 Thread Jos Koot
Thanks for clarifying.
Jos

  _  

From: Stephen De Gabrielle [mailto:spdegabrie...@gmail.com] 
Sent: sábado, 29 de abril de 2017 21:57
To: Jos Koot; Racket Users
Subject: Re: [racket-users] scale of image of scribble with .jpg


Scaling will always make the image less sharp, but you are right - scale works 
with GIF images but not jpg. 


 I have not checked the documentation. 

S.



On Sat, 29 Apr 2017 at 19:06, Jos Koot <jos.k...@gmail.com> wrote:




Hi, 

I have the following: 

#lang scribble/manual 
... 
@(image #:scale 2 "Turing-machine.jpg") 
... 

Works well, except that the image is not enlarged. 
What should I do to force the scale? 
Scaling does work with .gif, 
but .gif gives less sharp images. 

Thanks, Jos 



-- 
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.


-- 

Kind regards,
Stephen
--

-- 
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] Racket 6.9

2017-04-29 Thread Jos Koot
Thanks for both replies.
I'll remember them when shopping for a new computer.
 
I have 64 bit windows and downloaded 64 bit Racket 6.9.
Later I'll try 32 bit Racket, which should be accepted too
by 64 bit Windows.
 
Thanks again, Jos
 

  _  

From: Stephen De Gabrielle [mailto:spdegabrie...@gmail.com] 
Sent: sábado, 29 de abril de 2017 21:33
To: Jos Koot; Racket Users
Subject: Re: [racket-users] Racket 6.9


I just realised I have a Windows 7 (32bit) toshiba nb 200. 
DrRacket (32bit) launched with no problems. 

Check the operating system type(32-bit/x86 or 64-bit x64) is the same as the 
DrR download type.

Kind regards

Stephen

On Sat, 29 Apr 2017 at 20:18, Stephen De Gabrielle <spdegabrie...@gmail.com> 
wrote:


Ubuntu Linux is cheap, includes an alternative to ms word, gets regular updates 
and (most importantly) runs racket fine.

https://launchpad.net/~plt/+archive/ubuntu/racket

Kind regards
Stephen


On Sat, 29 Apr 2017 at 20:05, Jos Koot <jos.k...@gmail.com> wrote:



Hi
I have downloaded 6.9, but was warned that the file does not end in correct way.
Running the exe anyway gave a DrRacket that aborts after opening it.

I have Windows 7 with Bullguard protection.
 
In the past I saw the warning often for dayly night builds,
but ignoring the warning (almost) never gave problems.
 
Soon I'll switch to a more modern system
(preferably not with windows; what would be a cheap and yet good choice?
I also need a good replacement for Microsoft Office 2003.
I ask these questions here, because Racket (besides email and a replacement for 
Microsoft Word) is my most important tool.)
 
Thanks, Jos




-- 
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.


-- 

Kind regards,
Stephen
--

-- 

Kind regards,
Stephen
--

-- 
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] scale of image of scribble with .jpg

2017-04-29 Thread Jos Koot
Hi,

I have the following:

#lang scribble/manual
...
@(image #:scale 2 "Turing-machine.jpg")
...

Works well, except that the image is not enlarged.
What should I do to force the scale?
Scaling does work with .gif,
but .gif gives less sharp images.

Thanks, Jos

-- 
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] #:grammar and #:contracts of scribble

2017-04-14 Thread Jos Koot
Hi,
In a defform of scribble, the grammar (#:grammar) is nicely alligned
such as to put every = and every | in the same column of the text.
However the contracts (#:contracts) are not alligned such as
to put the colons in the same column.
MHO is that placing the colons in the same column
in a way similar to the grammar can improve
the layout of the rendering of a defform.
Just a thought,
Jos Koot


 

-- 
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] RE: empty lines in a grammer of defform of scribble

2017-03-28 Thread Jos Koot
Option 3 works very fine.
I have incorporated it in https://github.com/joskoot/turing.
Looks very good.
Thanks again, Jos

-Original Message-
From: Dupéron Georges [mailto:jahvascriptman...@gmail.com] 
Sent: martes, 28 de marzo de 2017 15:13
To: Racket Users
Cc: jos.k...@gmail.com
Subject: Re: empty lines in a grammer of defform of scribble

Le lundi 27 mars 2017 22:36:43 UTC+2, jos.koot a écrit :
> When I use #:grammar in a defform,
> the rules of the grammer are separated by empty lines.
> 
> I would like to avoid these empty lines.
> Is it possible?

I haven't seen a built-in mechanism to control this. Generally speaking, the 
tools for documenting bindings are somewhat inflexible,
if your use case falls out of the existing options. This leaves you with three 
possibilities:

1) Copy the source code of the @defform macro, and patch it to your needs
2) Add an option to control this in the mainstream scribble, and hope/wait for 
your Pull Request to be accepted
3) Call the current, official @defform macro, and patch the result.

Solution 1 is future-proof, but your implementation and the official one may 
drift apart, yielding slight inconsistencies in the
rendered output.

Solution 2 sounds better, although I wonder how many quick-fixes like this one 
@defform and similar macros can bear, given that they
are already a maze of particularly complex code, with lots of special-casing.

Solution 3 is the simplest, but is also more brittle, as you depend on the 
output of @defform staying roughly the same.

Here's a quick and dirty implementation of solution 3, note that if you intend 
to use this in production, you should try to make the
match pattern a bit more robust (i.e. a bit more general, in several cases I 
assume single-element lists, and any change in the
implementation of @defform is likely to break this code).

#lang scribble/manual
@(require scribble/manual
  scribble/core
  racket/match
  racket/list)
@(define (defform-remove-empty-lines the-defform)
   (match the-defform
 [(box-splice
   (list
before ...
(nested-flow nf-style
 (list
  (table t-style
 (list other ...
   (list
(table (style "specgrammar" tspec-style)
   (list lines ...)))
   more ...
after ...))
  (define without-empty-lines
;; an empty lines is a sequence of five empty columns:
(remove* (list
  (list
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)))
 lines))
  (box-splice
   (append
before
(list (nested-flow nf-style
   (list
(table t-style
   (append other
   (list (list
  (table (style "specgrammar" 
tspec-style)
 without-empty-lines)))
   more)
after))]))

@defform-remove-empty-lines[
 @defform[(foo bar baz quux)
  #:grammar ([bar (code:line xxx)
  (code:line yyy)]
 [baz (code:line zzz)
  (code:line ttt)]
 [quux (code:line aaa)
  (code:line bbb)])]{
  Blah blah lots of text.}]

-- 
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] RE: empty lines in a grammer of defform of scribble

2017-03-28 Thread Jos Koot
Thanks very much indeed for your comprehensive answer.
I tried your code given for option 3.
Works well, but your warning makes me hesitate.
Well, I'll see.
I already have a lot of old code no longer accepted by Racket.
Not a big problem, but requires work to adapt.
Thanks a lot again,
Jos Koot

-Original Message-
From: Dupéron Georges [mailto:jahvascriptman...@gmail.com] 
Sent: martes, 28 de marzo de 2017 15:13
To: Racket Users
Cc: jos.k...@gmail.com
Subject: Re: empty lines in a grammer of defform of scribble

Le lundi 27 mars 2017 22:36:43 UTC+2, jos.koot a écrit :
> When I use #:grammar in a defform,
> the rules of the grammer are separated by empty lines.
> 
> I would like to avoid these empty lines.
> Is it possible?

I haven't seen a built-in mechanism to control this. Generally speaking, the 
tools for documenting bindings are somewhat inflexible,
if your use case falls out of the existing options. This leaves you with three 
possibilities:

1) Copy the source code of the @defform macro, and patch it to your needs
2) Add an option to control this in the mainstream scribble, and hope/wait for 
your Pull Request to be accepted
3) Call the current, official @defform macro, and patch the result.

Solution 1 is future-proof, but your implementation and the official one may 
drift apart, yielding slight inconsistencies in the
rendered output.

Solution 2 sounds better, although I wonder how many quick-fixes like this one 
@defform and similar macros can bear, given that they
are already a maze of particularly complex code, with lots of special-casing.

Solution 3 is the simplest, but is also more brittle, as you depend on the 
output of @defform staying roughly the same.

Here's a quick and dirty implementation of solution 3, note that if you intend 
to use this in production, you should try to make the
match pattern a bit more robust (i.e. a bit more general, in several cases I 
assume single-element lists, and any change in the
implementation of @defform is likely to break this code).

#lang scribble/manual
@(require scribble/manual
  scribble/core
  racket/match
  racket/list)
@(define (defform-remove-empty-lines the-defform)
   (match the-defform
 [(box-splice
   (list
before ...
(nested-flow nf-style
 (list
  (table t-style
 (list other ...
   (list
(table (style "specgrammar" tspec-style)
   (list lines ...)))
   more ...
after ...))
  (define without-empty-lines
;; an empty lines is a sequence of five empty columns:
(remove* (list
  (list
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)
   (paragraph (style #f '(omitable)) (element #f (list (element 
'tt '(nbsp)))
 lines))
  (box-splice
   (append
before
(list (nested-flow nf-style
   (list
(table t-style
   (append other
   (list (list
  (table (style "specgrammar" 
tspec-style)
 without-empty-lines)))
   more)
after))]))

@defform-remove-empty-lines[
 @defform[(foo bar baz quux)
  #:grammar ([bar (code:line xxx)
  (code:line yyy)]
 [baz (code:line zzz)
  (code:line ttt)]
 [quux (code:line aaa)
  (code:line bbb)])]{
  Blah blah lots of text.}]

-- 
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] empty lines in a grammer of defform of scribble

2017-03-27 Thread Jos Koot
When I use #:grammar in a defform,
the rules of the grammer are separated by empty lines.
I would like to avoid these empty lines.
Is it possible?
The contracts of #:contracts do not have empty lines between them.
I ask this question because I have a rather long grammar that
would fit in one page without the empty lines; easier to read, IMHO.
Thanks, Jos




-- 
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] question about unexpected newlines in code:line

2017-01-25 Thread Jos Koot
Hi,
First: thanks for version 6.8.

I have the following:

#lang scribble/manual

@(require
  scribble/core
  scribble/eval
  racket
  scribble/html-properties
  (for-label racket)
  (for-syntax racket))

@interaction[
 (let ()
  (code:comment #,(list "a" "b"))
  (code:comment #,(list "a" "b"))
  'who-cares?)]

@interaction[
 (let ()
  (code:comment #,(list
   "a"
   "b"))
  (code:comment #,(list
   "a"
   "b"))
  'who-cares?)]

It renders:

6.8 


> (let ()   
   ; ab 
   ; ab 
   'who-cares?) 
'who-cares? 

> (let ()   
   ; ab 


   ; ab 


   'who-cares?) 
'who-cares? 

Why the additional linebreaks when the list elements are put on separate lines?
How can I avoid these linebreaks (other than by putting all elements on the 
same line)?
I have made several attempts, but without luck.
If it is a bug, I'll submit a bug-report, but I am not sure it is a bug.

Thanks, Jos











-- 
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] newlines in scribble interaction output

2017-01-12 Thread Jos Koot
Hi,

Consider:

#lang scribble/manual

@(require
  scribble/core
  scribble/eval)

@interaction[
 (printf "a~n~nb")]

Shows one newline only.
It produces:

| > (printf "a~n~nb")
| a
| b

It is not a big problem.
I can write:

@interaction[
 (printf "a~n ~nb")]

which produces:

| > (printf "a~n~nb")
| a
|
| b

Nevertheless:
why looses (printf "a~n~nb")
the second newline?

Jos

PS: This is with DrRacket, version 6.7 [3m]

-- 
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] Racket-ese for Scheme `define-record-type' protocol?

2016-12-29 Thread Jos Koot
Doesn't (struct ... #:guard guard-proc ...) not do what you want?
See the doc on struct.
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Eric Eide
Sent: jueves, 29 de diciembre de 2016 2:55
To: Racket Users
Subject: [racket-users] Racket-ese for Scheme `define-record-type' protocol?

Hi!  I'm translating a R6RS Scheme program to Racket, and I have a question
about the best "Racket-ese" translation for Scheme's `define-record-type'.

Consider the following R6RS definition:

-
 (define-record-type racr-specification
   (fields (mutable specification-phase) rules-table (mutable start-symbol))
   (opaque #t)(sealed #t)
   (protocol
(lambda (new)
  (lambda ()
(new 1 (make-eq-hashtable 50) racr-nil)
-

What is the Racket translation of the protocol specification?  Reading the
online Racket docs, I don't see how to specify a different (and fresh per
instance) value for every field within Racket's `struct` form.  (#:auto and
#:auto-value are not what I want; I need different values, and fresh values,
for every created instance.)

I guess I could "cheat" by defining the "expected" constructor myself:

-
(define (make-racr-specification)
  (racr-specification 1 (make-eq-hashtable 50) racr-nil))
-

But this seems common enough that it would be built into `struct` in some way?
Or maybe `struct` isn't what I want at all?

Thanks ---

Eric.
(a Racket newbie)

-- 
---
Eric Eide   . University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX

-- 
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] Narrow radix of string->number.

2016-12-22 Thread Jos Koot
You have a valid argument here,
Jos 

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Dmitry Pavlov
Sent: jueves, 22 de diciembre de 2016 11:30
To: racket-users@googlegroups.com
Subject: Re: [racket-users] Narrow radix of string->number.



On 12/21/2016 11:33 PM, Jos Koot wrote:
>
> Or up to 60, 60 even nowadays being a commonly used radix in time notation.

FWIW, the radix of the time notation does not seem that simple to me.
I would rather say it is a combined notation.

base-10 (days), base-60 (up to 24 hours+minutes+seconds), base-10 (fractions of 
a second)

or

base-60 (up to 360 degrees+minutes+seconds), base-10 (fractions of a second)



> Why restricting it to 36?

I guess that the original poster implied 10 digits + 26 Latin letters for 
notation.



Best regards,

Dmitry

-- 
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] Narrow radix of string->number.

2016-12-21 Thread Jos Koot
 
Or up to 60, 60 even nowadays being a commonly used radix in time notation.
Why restricting it to 36?
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Dmitry Igrishin
Sent: miércoles, 21 de diciembre de 2016 20:41
To: Racket Users
Subject: [racket-users] Narrow radix of string->number.

Hello,

Why the radix of string->number is narrowed to (2 16)? Shouldn't it be
(2 36)? There is a real need for it.

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.
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] Newbie seeking advice

2016-12-20 Thread Jos Koot
Yes agreed, HtDP is a very good start too.
Nevertheless I like the approach in TLS/TLL
for its mathematical approach and giving
deep insight in recursion.
Jos 

-Original Message-
From: Matthias Felleisen [mailto:matth...@ccs.neu.edu] 
Sent: martes, 20 de diciembre de 2016 20:00
To: Jos Koot
Cc: steve.lett777; Racket Users
Subject: Re: [racket-users] Newbie seeking advice


> On Dec 20, 2016, at 1:53 PM, Jos Koot <jos.k...@gmail.com> wrote:
> 
> Hi,
> 
> You already had some very good replies.
> If you are very new to programming, I second the advice
> to start with Racket and to look into The Little Schemer
> (in older days The Little Lisper)
> In addition, this mailing list is very friendly
> and can help you with problems you will encounter on your road.
> 
> With many thanks to The Little Lisper and Racket,
> Jos
> 
> PS
> The Little Schemer may seem a simple tail in the beginning,

tale 

;; - - - 

How to Design Programs is the very very very long version of TLS/TLL. 

http://www.ccs.neu.edu/home/matthias/HtDP2e/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] Newbie seeking advice

2016-12-20 Thread Jos Koot
Hi,

You already had some very good replies.
If you are very new to programming, I second the advice
to start with Racket and to look into The Little Schemer
(in older days The Little Lisper)
In addition, this mailing list is very friendly
and can help you with problems you will encounter on your road.

With many thanks to The Little Lisper and Racket,
Jos

PS
The Little Schemer may seem a simple tail in the beginning,
but at the end it goes deep into the maths of recursion.
I learned a lot of it.
While studying a programming language,
don't forget to study maths too.
Maths are important in every field of programming (MHO)


-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of steve.lett777
Sent: martes, 20 de diciembre de 2016 10:48
To: Racket Users
Subject: [racket-users] Newbie seeking advice

I really want to learn programming but I am a slow learner. How do I know if I 
can achieve learning programming or not? Am I wasting
my time trying?

And after that one is answered, Which language should I learn programming in, 
Racket, Scheme, or Python?

-- 
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] logo of DrRacket

2016-12-11 Thread Jos Koot
Hi
After downloading DrRacket, version 6.7.0.3--2016-12-11(db8d8f8/a) [3m]
starting DrRacket shows a rotating lambda.
IMHO the previous logo has more style and better shows the remaining time 
needed to load DrRacket.
Not an important issue, of course. A matter of taste probably.
Please let's not make taste an important issue.
MHO, Jos

-- 
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] hyperlink in code:comment

2016-12-01 Thread Jos Koot
Thank you very much.
I don't understand why I missed that part of the docs.
Jos 

-Original Message-
From: stchang...@gmail.com [mailto:stchang...@gmail.com] On Behalf Of Stephen 
Chang
Sent: miércoles, 30 de noviembre de 2016 19:56
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] hyperlink in code:comment

Each code formatting form, like `racketblock`, allows specifying an
escape identifier for use within that form, though all forms default
to `unsyntax` if unspecified, I believe. Some forms, like `codeblock`
do not support escapes.

The docs here [1] has more details, and specifically the docs for
racketblock [2] has more examples.


[1]: http://docs.racket-lang.org/scribble/scribble_manual_code.html
[2]:
http://docs.racket-lang.org/scribble/scribble_manual_code.html?#%28form._%28%28lib._scribble%2Fmanual..rkt%29._racketblock%29%29

On Tue, Nov 29, 2016 at 3:42 PM, Jos Koot <jos.k...@gmail.com> wrote:
> Thanks, I'll try that.
> It is not clear to me where I can use @#,
> But certainly your response will be a great help for me.
> Thanks again, Jos
>
> -Original Message-
> From: stchang...@gmail.com [mailto:stchang...@gmail.com] On Behalf Of Stephen 
> Chang
> Sent: martes, 29 de noviembre de 2016 21:31
> To: Jos Koot
> Cc: Racket Users
> Subject: Re: [racket-users] hyperlink in code:comment
>
> You can use the escape identifier:
>
> #lang scribble/manual
>
> @(require scribble/eval
>   (for-label racket))
>
> @interaction[
>  (define a (list 1))
>  (define b (list 1))
>  (code:comment @#,para{a and b are not @racket[eq?], but they are
> @racket[equal?]:})
>  (eq? a b)
>  (equal? a b)]
>
> On Tue, Nov 29, 2016 at 2:56 PM, Jos Koot <jos.k...@gmail.com> wrote:
>> A simplified fragment of scribble code:
>>
>> #lang scribble/manual
>>
>> @(require scribble/eval)
>>
>> @interaction[
>>  (define a (list 1))
>>  (define b (list 1))
>>  (code:comment "a and b are not eq, but they are equal:")
>>  (eq? a b)
>>  (equal? a b)]
>>
>> Within the comment I would like to hyperlink 'eq' to the doc of [eq?]
>> and 'equal' to the doc of [equal?]
>>
>> Is this possible?
>> If so how?
>> I have tried it without success.
>>
>> Thanks, Jos
>>
>> --
>> 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.

-- 
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] hyperlink in code:comment

2016-11-29 Thread Jos Koot
Thanks, I'll try that.
It is not clear to me where I can use @#,
But certainly your response will be a great help for me.
Thanks again, Jos

-Original Message-
From: stchang...@gmail.com [mailto:stchang...@gmail.com] On Behalf Of Stephen 
Chang
Sent: martes, 29 de noviembre de 2016 21:31
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] hyperlink in code:comment

You can use the escape identifier:

#lang scribble/manual

@(require scribble/eval
  (for-label racket))

@interaction[
 (define a (list 1))
 (define b (list 1))
 (code:comment @#,para{a and b are not @racket[eq?], but they are
@racket[equal?]:})
 (eq? a b)
 (equal? a b)]

On Tue, Nov 29, 2016 at 2:56 PM, Jos Koot <jos.k...@gmail.com> wrote:
> A simplified fragment of scribble code:
>
> #lang scribble/manual
>
> @(require scribble/eval)
>
> @interaction[
>  (define a (list 1))
>  (define b (list 1))
>  (code:comment "a and b are not eq, but they are equal:")
>  (eq? a b)
>  (equal? a b)]
>
> Within the comment I would like to hyperlink 'eq' to the doc of [eq?]
> and 'equal' to the doc of [equal?]
>
> Is this possible?
> If so how?
> I have tried it without success.
>
> Thanks, Jos
>
> --
> 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] Re: Best alternate editor/IDE for someone who gets overwhelmed by complexity

2016-11-26 Thread Jos Koot
Go to menu item: edit, preferences, background-expansion
and enable it.
Sometimes it is necessary to close and reopen DrRacket to get the choices 
active.
Jos 

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of SR
Sent: sábado, 26 de noviembre de 2016 21:41
To: Racket Users
Subject: [racket-users] Re: Best alternate editor/IDE for someone who gets 
overwhelmed by complexity

Jos,  What is "background expansion" and how do I turn it on to see if it helps 
me?  I just did a search of help and didn't find the
term.  I did look around in view but don't see that as a choice.

-- 
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] css and js files when using scribble

2016-11-26 Thread Jos Koot
Thanks for the clear answer.
I'll try raco pkg install ...,
but command line stuff is troublesome on windows.
But I'll try.
Jos

  _  

From: Matthew Butterick [mailto:m...@mbtype.com] 
Sent: viernes, 25 de noviembre de 2016 23:03
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] css and js files when using scribble



On Nov 25, 2016, at 12:54 PM, Jos Koot <jos.k...@gmail.com> wrote:


Every time I click Scribble HTML in DrRacket 

for a scribble/manual module in a separate directory 
I find that a number of css files and two js files are produced in the same 
directory (Windows 7) 

Are these files always the same? 
If so can't we put them in Appdata.Roaming, in order to avoid multiple copies? 
Or may be they can be pre-included in the Racket tree? 

I expect there is a good reason for generating a new set of css and js files 
for every (HTML) file produced by scribble,

but I have not the slightest idea why. 


IIUC, when you click "Scribble HTML", Scribble makes a self-contained render, 
which necessarily includes the CSS and JavaScript
files that the HTML files depend on. (Corollary: this render has no 
dependencies on local resources, so it can be moved anywhere,
e.g., a remote web server.)

But when you install a package normally (e.g., via `raco pkg install ...`), 
Racket can rely on the shared copy of those files used
by all documentation, so they are not duplicated.


-- 
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] css and js files when using scribble

2016-11-25 Thread Jos Koot
Hi,

Every time I click Scribble HTML in DrRacket
for a scribble/manual module in a separate directory
I find that a number of css files and two js files are produced in the same 
directory (Windows 7)

Are these files always the same?
If so can't we put them in Appdata.Roaming, in order to avoid multiple copies?
Or may be they can be pre-included in the Racket tree?

I expect there is a good reason for generating a new set of css and js files 
for every (HTML) file produced by scribble,
but I have not the slightest idea why.

Thanks, Jos



-- 
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] If a thunk is a proc of zero arguments, what is a proc of one argument?

2016-11-12 Thread Jos Koot
Your quastion is not clear to me but may be you want --thunk*--?
Jos

  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of David Storrs
Sent: sábado, 12 de noviembre de 2016 22:23
To: Racket Users
Subject: [racket-users] If a thunk is a proc of zero arguments, what is a proc 
of one argument?


The 'thunk' procedure is really useful and is sprinkled liberally through my 
code because it saves keystrokes / is clearer than
(lambda () ...).  I often find myself writing (lambda (x) ...) for something 
and wishing that there was an equivalent of 'thunk' for
that.  

Is there?  If not, what would be a good name for it that I could use to create 
a macro for it?  My current suggestion is 'thwonk',
but I figured I'd bounce it off other people first.



-- 
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] Structs vs Lists

2016-10-27 Thread Jos Koot
Hi

Lisp (and Racket) programmers know the value, Fortran (and assembler) 
programmers the cost.
Nowadays the PLTeam is working on effeciency too, I think.
But: the most important factor for efficient programming is to select efficient 
algorithms.
Two very simple, but notorious examples where you can go wrong in efficiency 
with the algorithm
are Fibonacci numbers and binomial coefficients.

Nowadays we have lots of primary memory, but long ago, with machines with 
limited primary memory,
there was a time that for some computations it was faster to recompute than to 
store to and retrieve from disk.
Much depends on the architecture of the computer, which in the old days was 
documented very well,
so well that you could predict how data were flowing through the processors 
(even with virtual memory).
Nowaday manufactures of computers give less information.
For a good estimation of the efficiency of a program
you have to know which busses are used, their numbers of bits and their 
frequencies
and how well these busses connect to each other.
Well, a little bit of nostalgia.

MHO, Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Ken MacKenzie
Sent: jueves, 27 de octubre de 2016 19:28
To: Racket Users
Cc: deviloc...@gmail.com
Subject: Re: [racket-users] Structs vs Lists

Thank you for the information.  Good to know.  Performance isn't the first 
thing I am thinking about, but as I am tinkering and
getting running with Racket I like to kind of dig into the underlying structure 
to know the cost of certain operations.

Ken

> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
> array: it's a contiguous chunk of memory, and you can
get at any member of it in constant time.
> 
> 
> For other purposes? Depends on the purpose. A struct is superior to a list 
> for struct-like operations. A list is superior to a
struct for list-like operations.
>  

-- 
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] scribble/eval interaction hyperlinks locally bound variables

2016-10-27 Thread Jos Koot
Hi Matthias,
Thanks. I'll look into your suggestion.
For the moment, when I see an unwanted link,
I change the name of the local variable
to one not found in the help desk for any module I import. 
Thanks again, Jos

-Original Message-
From: Matthias Felleisen [mailto:matth...@ccs.neu.edu] 
Sent: jueves, 27 de octubre de 2016 16:46
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] scribble/eval interaction hyperlinks locally bound 
variables


> On Oct 27, 2016, at 5:34 AM, Jos Koot <jos.k...@gmail.com> wrote:
> 
> Consider:
> #lang scribble/manual 
> @(require (for-label racket) scribble/eval)) 
> @interaction[(let ((add1 sub1)) (add1 1))]
> In the produced HTML file the locally bound variable 'add1' 
> is linked (in blue) to the docs of Racket's procedure 'add1'. 
> The same problem with @racket[...]
> I can avoid this by using (for-label (except-in racket add1)) 
> but then the link also disappears in 
> @interaction[(add1 3)].
> This is a silly simplified example, of course, 
> but the problem is the probable chance that one uses a local variable 
> or otherwise shaddows a variable with the same name 
> as an imported variable whose existence one is not aware of.
> Is there a way to avoid hyperlinking of 
> locally bound or otherwise shaddowed variables 
> with the same names as imported variables?
> Thanks, Jos



You could define local things so that they also introduce an anchor and then 
references to the local name get linked. (I failed to
think about this when I wrote HtDP/2e but some of us thought ahead and some of 
our papers use such setups.) 

- 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] scribble/eval interaction hyperlinks locally bound variables

2016-10-27 Thread Jos Koot
Consider:

#lang scribble/manual
@(require (for-label racket) scribble/eval))
@interaction[(let ((add1 sub1)) (add1 1))]

In the produced HTML file the locally bound variable 'add1'
is linked (in blue) to the docs of Racket's procedure 'add1'.
The same problem with @racket[...]

I can avoid this by using (for-label (except-in racket add1))
but then the link also disappears in
@interaction[(add1 3)].

This is a silly simplified example, of course,
but the problem is the probable chance that one uses a local variable
or otherwise shaddows a variable with the same name
as an imported variable whose existence one is not aware of.

Is there a way to avoid hyperlinking of
locally bound or otherwise shaddowed variables
with the same names as imported variables?

Thanks, Jos

-- 
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] optional hyphen in scibble

2016-10-02 Thread Jos Koot
Thanks for your quick reply.
It is not the same as I have seen before, but I'll look into it.
IIRC the optional hyphen I am looking for, was documented in a scribble doc.
Nevertheless your suggestion may very well solve my problem.
Thanks again, Jos

  _  

From: Ben Greenman [mailto:benjaminlgreen...@gmail.com] 
Sent: domingo, 02 de octubre de 2016 21:34
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] optional hyphen in scibble


Maybe: 
https://pkgn.racket-lang.org/package/hyphenate

On Sun, Oct 2, 2016 at 3:30 PM, Jos Koot <jos.k...@gmail.com> wrote:




Hi to all of this nice list, 

IIRC I have seen a tool to put optional hyphens in running text in order to 
allow scribble to break words at the end of a line.

However, I no longer can't find it (I know, I am a bad browser) 
A pointer to the related docs will be appreciated very much. 

Thanks, 
Jos 




-- 
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+unsubscribe@
<mailto:racket-users+unsubscr...@googlegroups.com> googlegroups.com.
For more options, visit https://groups.google.com/d/ 
<https://groups.google.com/d/optout> 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] optional hyphen in scibble

2016-10-02 Thread Jos Koot
Hi to all of this nice list,

IIRC I have seen a tool to put optional hyphens in running text in order to 
allow scribble to break words at the end of a line.
However, I no longer can't find it (I know, I am a bad browser)
A pointer to the related docs will be appreciated very much.

Thanks,
Jos

-- 
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] Trouble with recursive lambda macros, using Y combinator

2016-09-11 Thread Jos Koot
After you have figured how to make recursive-lambda,
you may want to figure out how to produce two mutually recursive functions.
If, or rather I think 'when', you have more questions, don't hesitate to 
consult this list,
for I am sure the PLT team and many others agree with this advice.
Jos

  _  

From: Jos Koot [mailto:jos.k...@gmail.com] 
Sent: lunes, 12 de septiembre de 2016 4:07
To: 'Vasily Rybakov'; 'Racket Users'
Cc: 'Jos Koot'
Subject: RE: [racket-users] Trouble with recursive lambda macros, using Y 
combinator



When using a macro, always think: "can I do the same without a macro?" 
You use the simple auto-applicator (lambda (x) (x x)). 
I suggest to use an applicative-order Y-combinator, such as: 
(define Y (λ (m) ((λ (f) (f f)) (λ (g) (m (λ (n) ((g g) n))) 
Now: ((Y (lambda (!) (lambda (n) (if (zero? n) 1 (* n (! (sub1 n))) 4) -> 
24 
There are many more ways to write an applicative-order Y-combinator. 
Now is the moment to think about a sugaring macro: 

#lang racket 
; Let Y work for functions of more than one argument: 
(define Y (λ (m) ((λ (f) (f f)) (λ (g) (m (λ args (apply (g g) args))) 
((Y (lambda (!) (lambda (n) (if (zero? n) 1 (* n (! (sub1 n))) 4) 
; The sugar: 
(define-syntax-rule 
 (recursive-lambda (name arg ...) body ...) 
 (Y (lambda (name) (lambda (arg ...) body ... 
((recursive-lambda (! n) (if (zero? n) 1 (* n (! (sub1 n) 4) 
; Or in tail recursive style 
; (I am not sure it is realy tail recursive under Y, 
;  but using debug I don't see a growing stack) 
((recursive-lambda (! n m) (if (zero? n) m (! (sub1 n) (* n m 4 1) 

Jos 

-Original Message- 
From: racket-users@googlegroups.com [ <mailto:racket-users@googlegroups.com> 
mailto:racket-users@googlegroups.com] On Behalf Of
Vasily Rybakov 
Sent: domingo, 11 de septiembre de 2016 5:54 
To: Racket Users 
Subject: [racket-users] Trouble with recursive lambda macros, using Y 
combinator 

Hi! 

I'm learning Racket and I stumpbled into a couple of problems with macros. 

I tried to make macros that implements recursive lambda, but not the classic 
one (that uses letre), but the one that uses Y
combinator.

So it should work like this: 

(recursion fact (n) 
(if (zero? n) 
1 
(* n (fact (sub1 n) 

transforms into 

((lambda (x) (x x)) 
(lambda (fact) 
  (lambda (n) 
 (if (zero? n) 1 (* n ((fact fact) (sub1 n))) 

which produces recursive anonymous function to compute factorial. 

So I wrote this macros: 

(define-syntax recursion 
  (syntax-rules () 
[(_ label (args ...) body ...) 
 ((lambda (x) (x x)) 
  (lambda (label) 
(lambda (args ...) 
  (substitute-term label (label label) body) ...)))])) 

(substitute-term) macros is helper macros to substitute one piece of code with 
another, here its fist version: 

(define-syntax (substitute-term stx) 
  (syntax-case stx () 
[(_ term-from term-to body) 
   (cond 
 [(null? (syntax-e #'body)) #'(void)] 
 [(list? (syntax-e #'body)) #`#,(map (lambda (x) (append (syntax-e 
#'(substitute-term term-from term-to)) (if (list? x) x
(list x (syntax-e #'body))]

 [else (if (equal? (syntax-e #'body) (syntax-e #'term-from)) #'term-to 
#'body)])])) 

>(substitute-term - + (- 1 2)) 
3 

This works. But 

>(substitute-term and or (and #t #f)) 
or: bad syntax in: or 

Macro stepper shows that it expands into 

(or (substitute-term and or #t) (substitute-term and or #f)) 

And after this step is "bad syntax" error. I couldn't figure why is this and 
how to fix it. It raises "bad syntax" errors with all
special forms for some reason. Can somebody explain to me -- why? And how to 
fix it?

Then I tried rewrite (substitute-term) macro: 

(define-syntax (substitute-term-2 stx) 
  (syntax-case stx () 
[(substitute-term term-from term-to body) 
 (datum->syntax stx (for-substitute-term (syntax->datum #'term-from) 
(syntax->datum #'term-to) (syntax->datum #'body)))]))

It uses helper function (define-for-syntax) which do all the work: 

(define-for-syntax (for-substitute-term term-from term-to expr) 
  (cond 
[(null? expr) (void)] 
[(list? expr) (map (lambda (x) (apply for-substitute-term (list term-from 
term-to x))) expr)] 
[else (if (equal? expr term-from) term-to expr)])) 

>(substitute-term-2 and or (and #t #f)) 
#t 

Hurray! But if I use it in my (recursion) macro: 

(define-syntax recursion-2 
  (syntax-rules () 
[(_ label (args ...) body ...) 
 ((lambda (x) (x x)) 
  (lambda (label) 
(lambda (args ...) 
  (substitute-term-2 label (label label) body) ...)))])) 

>((recursion-2 fact (n) 
(if (zero? n) 
1 
(* n (fact (sub1 n) 5) 
n: unbound identifier in module 
  context...: 
  other binding...: in: n 

Although macro stepper shows that it expands into 

((lambda (x) (x x)) 
   

RE: [racket-users] Trouble with recursive lambda macros, using Y combinator

2016-09-11 Thread Jos Koot
When using a macro, always think: "can I do the same without a macro?"
You use the simple auto-applicator (lambda (x) (x x)).
I suggest to use an applicative-order Y-combinator, such as:
(define Y (λ (m) ((λ (f) (f f)) (λ (g) (m (λ (n) ((g g) n)))
Now: ((Y (lambda (!) (lambda (n) (if (zero? n) 1 (* n (! (sub1 n))) 4) -> 24
There are many more ways to write an applicative-order Y-combinator.
Now is the moment to think about a sugaring macro:

#lang racket
; Let Y work for functions of more than one argument:
(define Y (λ (m) ((λ (f) (f f)) (λ (g) (m (λ args (apply (g g) args)))
((Y (lambda (!) (lambda (n) (if (zero? n) 1 (* n (! (sub1 n))) 4)
; The sugar:
(define-syntax-rule
 (recursive-lambda (name arg ...) body ...)
 (Y (lambda (name) (lambda (arg ...) body ...
((recursive-lambda (! n) (if (zero? n) 1 (* n (! (sub1 n) 4)
; Or in tail recursive style
; (I am not sure it is realy tail recursive under Y,
;  but using debug I don't see a growing stack)
((recursive-lambda (! n m) (if (zero? n) m (! (sub1 n) (* n m 4 1)

Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Vasily Rybakov
Sent: domingo, 11 de septiembre de 2016 5:54
To: Racket Users
Subject: [racket-users] Trouble with recursive lambda macros, using Y combinator

Hi!

I'm learning Racket and I stumpbled into a couple of problems with macros.

I tried to make macros that implements recursive lambda, but not the classic 
one (that uses letre), but the one that uses Y
combinator.

So it should work like this:

(recursion fact (n)
(if (zero? n)
1
(* n (fact (sub1 n)

transforms into

((lambda (x) (x x))
(lambda (fact)
  (lambda (n)
 (if (zero? n) 1 (* n ((fact fact) (sub1 n)))

which produces recursive anonymous function to compute factorial.

So I wrote this macros:

(define-syntax recursion
  (syntax-rules ()
[(_ label (args ...) body ...)
 ((lambda (x) (x x))
  (lambda (label)
(lambda (args ...)
  (substitute-term label (label label) body) ...)))]))

(substitute-term) macros is helper macros to substitute one piece of code with 
another, here its fist version:

(define-syntax (substitute-term stx)
  (syntax-case stx ()
[(_ term-from term-to body)
   (cond
 [(null? (syntax-e #'body)) #'(void)]
 [(list? (syntax-e #'body)) #`#,(map (lambda (x) (append (syntax-e 
#'(substitute-term term-from term-to)) (if (list? x) x
(list x (syntax-e #'body))]
 [else (if (equal? (syntax-e #'body) (syntax-e #'term-from)) #'term-to 
#'body)])]))

>(substitute-term - + (- 1 2))
3

This works. But

>(substitute-term and or (and #t #f))
or: bad syntax in: or

Macro stepper shows that it expands into

(or (substitute-term and or #t) (substitute-term and or #f))

And after this step is "bad syntax" error. I couldn't figure why is this and 
how to fix it. It raises "bad syntax" errors with all
special forms for some reason. Can somebody explain to me -- why? And how to 
fix it?

Then I tried rewrite (substitute-term) macro:

(define-syntax (substitute-term-2 stx)
  (syntax-case stx ()
[(substitute-term term-from term-to body)
 (datum->syntax stx (for-substitute-term (syntax->datum #'term-from) 
(syntax->datum #'term-to) (syntax->datum #'body)))]))

It uses helper function (define-for-syntax) which do all the work:

(define-for-syntax (for-substitute-term term-from term-to expr)
  (cond
[(null? expr) (void)]
[(list? expr) (map (lambda (x) (apply for-substitute-term (list term-from 
term-to x))) expr)]
[else (if (equal? expr term-from) term-to expr)]))

>(substitute-term-2 and or (and #t #f))
#t

Hurray! But if I use it in my (recursion) macro:

(define-syntax recursion-2
  (syntax-rules ()
[(_ label (args ...) body ...)
 ((lambda (x) (x x))
  (lambda (label)
(lambda (args ...)
  (substitute-term-2 label (label label) body) ...)))]))

>((recursion-2 fact (n)
(if (zero? n)
1
(* n (fact (sub1 n) 5)
n: unbound identifier in module
  context...:
  other binding...: in: n

Although macro stepper shows that it expands into

((lambda (x) (x x))
 (lambda (fact)
   (lambda (n)
 (substitute-term-2
  fact
  (fact fact)
  (if (zero? n) 1 (* n (fact (sub1 n

Which if entered in interaction area works as intended. I understand that 
binding for n is lost when I invoke (substitute-term-2)
macro on body. But I couldn't find in documentation -- why? And how to fix it?

I would be grateful, if somebody explained to me what's wrong with my first and 
my second attempts and how to fix them. 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.
For 

RE: [racket-users] typed racket confusion

2016-09-09 Thread Jos Koot
Thanks,
I already had a hunch in the direction of your answer.
In function b the problem seems to be that subexpression
(if (even? n) add1 sub1)
seems to be reduced without info to which the argument it will be applied.
Nevertheless I wonder whether or not it would be possible
to have the typechecker look one level higher.
After all, after evaluating (if (even? n) add1 sub1)
with zero n, it is clear that sub1 will not be applied to zero
if the argument n is inspected as well.
Probably I am asking too much.
Thanks again, Jos

  _  

From: WarGrey Gyoudmon Ju [mailto:juzhenli...@gmail.com] 
Sent: viernes, 09 de septiembre de 2016 22:21
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] typed racket confusion


Because in function `b`, the type of the `lambda` that `n` actually be passed 
to is the union of `add1` and `sub1` in the context, 
hence, the info on parity of `n` are lost before this `lambda` is evaluated.

On Sat, Sep 10, 2016 at 3:42 AM, Jos Koot <jos.k...@gmail.com> wrote:




#lang typed/racket 

(define (a (n : Exact-Nonnegative-Integer)) : Exact-Nonnegative-Integer 
 (if (even? n) (add1 n) (sub1 n))) 

(define (b (n : Exact-Nonnegative-Integer)) : Exact-Nonnegative-Integer 
 ((if (even? n) add1 sub1) n)) 

Function a goes well, 
but function b gives an error during expansion: 

Type Checker: type mismatch 
  expected: Nonnegative-Integer 
  given: Integer in: ((if (even? n) add1 sub1) n) 

Apparently the type checker deduces that in function a, 
sub1 will not be applied to zero. 
Why it can't also detect this for function b? 

Thanks, Jos 




-- 
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+unsubscribe@
<mailto:racket-users+unsubscr...@googlegroups.com> googlegroups.com.
For more options, visit https://groups.google.com/d/ 
<https://groups.google.com/d/optout> 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] typed racket confusion

2016-09-09 Thread Jos Koot
#lang typed/racket

(define (a (n : Exact-Nonnegative-Integer)) : Exact-Nonnegative-Integer
 (if (even? n) (add1 n) (sub1 n)))

(define (b (n : Exact-Nonnegative-Integer)) : Exact-Nonnegative-Integer
 ((if (even? n) add1 sub1) n))

Function a goes well,
but function b gives an error during expansion:

Type Checker: type mismatch
  expected: Nonnegative-Integer
  given: Integer in: ((if (even? n) add1 sub1) n)

Apparently the type checker deduces that in function a,
sub1 will not be applied to zero.
Why it can't also detect this for function b?

Thanks, Jos

-- 
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] Scribble: unnumbered and unindexed sections

2016-09-04 Thread Jos Koot
Would this do what you want?

#lang scribble/base

@section{a}
@subsubsub*section{a}
@subsubsub*section{a}
@subsubsub*section{a}

@section{b}
@seclink["a" "section a"]
@subsubsub*section{b}
@subsubsub*section{b}
@subsubsub*section{b}

@section{b}
@subsubsub*section{b}
@subsubsub*section{b}
@subsubsub*section{b}

Jos



-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Shriram Krishnamurthi
Sent: domingo, 04 de septiembre de 2016 20:50
To: Racket Users
Subject: [racket-users] Scribble: unnumbered and unindexed sections

Is there a way to have unnumbered and unindexed section? (Yes, these are 
different issues.)

It would be helpful to have unnumbered sections, à la \[sub]section* in LaTeX.

It would be especially helpful to have unindexed sections. The real nuisance 
I'm trying to avoid is, say I have N sections that each
have a subsection named "Handin Instructions". Then I get a bunch of Scribble 
warnings due to the duplicate section name. Since I
have no desire to link to these sections, I don't need them indexed at all. And 
this way I don't have to cons up new names for each
of them (though I do of course have that option…).

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.
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] Re: HtDP 2e

2016-08-28 Thread Jos Koot
 
I love it too, but I think he author(s) want much more than teach a language. 
They want to teach designing programs (in arbitrary
language I think). They have chosen student languages (subsets of racket) to 
talk about design.

To Matthias: I love the book very much as said above. Nevertheless I have some 
problems how the N-queens problem is presented. I
already wrote you abuot this a long time ago. In my opinion: first think about 
the essentials of the problem (in natural language,
possibly applying some mathematics) Then you come up with a very much simpler 
representation of data and consequently simpler ways
for a solution (or all solutions). If only one solution is desired, the student 
should be directed to:
https://en.wikipedia.org/wiki/Eight_queens_puzzle. Using the algorithm 
presented in this web-page, a 100 x 100 solution is
found within seconds and within reasonably limited memory. MHO.

Nevertheless, proficiat with the new edition!
Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of ???
Sent: domingo, 28 de agosto de 2016 16:24
To: Racket Users
Cc: matth...@ccs.neu.edu
Subject: [racket-users] Re: HtDP 2e

I love this book.I learned racket from it.

-- 
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.


  1   2   >