Re: [racket-users] Help not working after fresh installation of Racket 8.3

2021-11-25 Thread Erich Rast
It's fixed. The problem was the configuration of Firefox's default applications. It was set to use Caja for opening files. I changed it to use Firefox itself and it works now, although it opens every link in a new tab. On Thursday, November 25, 2021 at 1:14:55 PM UTC laurent...@gmail.com wrote

Re: [racket-users] Help not working after fresh installation of Racket 8.3

2021-11-25 Thread Laurent
Maybe: raco setup --doc-index On Thu, Nov 25, 2021 at 11:28 AM Stephen De Gabrielle < spdegabrie...@gmail.com> wrote: > My first guess would be to use raco to rebuild the docs - but I can’t > remember the exact command. It’s probably in raco pkg > > > On Thu, 25 Nov 2021 at 10:08, Erich Rast wro

Re: [racket-users] Help not working after fresh installation of Racket 8.3

2021-11-25 Thread Stephen De Gabrielle
My first guess would be to use raco to rebuild the docs - but I can’t remember the exact command. It’s probably in raco pkg On Thu, 25 Nov 2021 at 10:08, Erich Rast wrote: > On Linux Mint I installed Racket 8.3 as usual in local folder > /home/nemo/racket. Now when I try to access the help in t

[racket-users] Help not working after fresh installation of Racket 8.3

2021-11-25 Thread Erich Rast
On Linux Mint I installed Racket 8.3 as usual in local folder /home/nemo/racket. Now when I try to access the help in the browser (recent version of Firefox), any link I click results in an error message, for example: *Could not display "/home/nemo/racket/doc/quick/-index.html" The location is

Re: [racket-users] Help debugging handin client connection problem

2021-09-19 Thread 'William J. Bowman' via Racket Users
I think I've debugged the issue, but it's only present in our locally modified version of the client, although the root cause could affects others. In case others have minor modifications to the client, or anyone modifies the client in the future: It was a race condition between some error chec

Re: [racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
I've confirmed it's definitely client side, by redirecting the handin server's address to 127.0.0.1 in /etc/hosts, and listening with `nc -l`. The handin client hangs on "Making secure connection ..." and nc display nothing at all. A few restarts and `nc -l` displays a bunch of gibberish that I'

Re: [racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
Since I'm currently experiencing the issue, I've been able to get some better data. I've managed to reproduce it in 8.2.0.2 CS, which suggests it's not https://github.com/racket/racket/issues/3804. Restarting twice DrRacket hasn't helped, nor has resetting my wifi connection. After connecting v

Re: [racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
I just tried this, but I can't seem to connect. http://cs110.students.cs.ubc.ca:7979/ gives "connection reset", and https://cs110.students.cs.ubc.ca:7979/ gives "secure connection failed". There's no prompt to accept the certificate (which I wouldn't expect, because we're using a CA signed c

[racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
I need some help debugging an issue with the handin package. The handin plugin (client) displays “Making secure connection to …”, and simply hangs. Closing the dialog and trying again never resolves the issue. The only method that seems to resolve the issue, although inconsistently, is restart

Re: [racket-users] Help in understanding 'letrec' example

2021-05-14 Thread Utkarsh Singh
Hi David, On 2021-05-13, 13:12 -0400, David Storrs wrote: > Incidentally, a more concise way of doing this would be: > > (define target (build-path "tarzan")) ; convert to path only once > (for/or ([item (in-directory "/tmp/test")]) ; or whatever directory > you want to start in > (equal? targ

Re: [racket-users] Help in understanding 'letrec' example

2021-05-13 Thread David Storrs
Incidentally, a more concise way of doing this would be: (define target (build-path "tarzan")) ; convert to path only once (for/or ([item (in-directory "/tmp/test")]) ; or whatever directory you want to start in (equal? target (file-name-from-path item))) On Sat, May 8, 2021 at 3:50 AM Utkarsh

[racket-users] Help in understanding 'letrec' example

2021-05-08 Thread Utkarsh Singh
Hi, First of all I would like to thank Racket community for creating and maintaining top quality documentation at https://docs.racket-lang.org/ and even providing a local copy for it. Currently I am having some difficulties in understanding this letrec example from Racket Guide docs (https://docs

Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread David Storrs
I'm not sure if this is exactly what you want, but the handy module (which I still need to split up into less of a Fibber McGee) includes handy/try. This would let you do the following: #lang racket (require handy/try) (define x (random 100)) ; these are obviously silly functions that are only

Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Hendrik Boom
On Wed, Oct 28, 2020 at 03:54:29AM -0700, Jack Firth wrote: > So I'm a little tired of writing code like this: > > (define x ...) > (cond > [(take-shortcut? x) (shortcut x)] > [else >(define y (compute-y x)) >(cond > [(take-other-shortcut? x y) (other-shortcut x y)] > [else >

Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Sam Caldwell
Ryan's solution is almost certain to be nicer, but if you do find yourself needing internal definition contexts now or in the future, this is similar to a case I ran into while adding `define` to a language implemented with Turnstile. I wrote a blog post outlining the solution [1], which I believe

Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Ryan Culpepper
This is a nice example of a macro design pattern that I think of as "partial expansion with trampolining". You don't need to deal with the internal definition context API, because you can return definitions to the macro expander, let it handle their interpretation, and then resume your work. Here's

Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Philip McGrath
The most similar example that comes to mind is the way `for`-like forms handle the `body-or-break` nonterminal to support `#:break` and `#:final`. In particular, I think you would end up needing something analogous to these semantics for definitions

Re: [racket-users] Help implementing an early return macro

2020-10-28 Thread Laurent
I've also had the same issues for a long time, and condd was almost good enough, but the #:do is too specific. But recently I'm using something much simpler (no continuation) and straightforward: cond/else https://github.com/Metaxal/bazaar/blob/master/cond-else.rkt By contrast to other approaches—

[racket-users] Help implementing an early return macro

2020-10-28 Thread Jack Firth
So I'm a little tired of writing code like this: (define x ...) (cond [(take-shortcut? x) (shortcut x)] [else (define y (compute-y x)) (cond [(take-other-shortcut? x y) (other-shortcut x y)] [else (define z ...) (cond ...)])]) That is, I have some logic and that logic

[racket-users] Help creating a distributable version of my app

2020-08-17 Thread Andre Garzia
Good afternoon friends, I'm trying to build a distributable version of my little Gemini browser: https://git.sr.ht/~soapdog/fafi-browser The source folder contains a `main.rkt` which has `(module+ main ...)` in it. I thought that selecting that file and using the menu to create a distribution

[racket-users] Help with simple macro transformation

2020-02-17 Thread Ryan Kramer
I'm 95% sure I've done this before, but for some reason I am really stuck right now. Given (rearrange ([(a b c) 1] [(d e) 2])) I would like any kind of shape containing [a 1] [b 1] [c 1] [d 2] [e 2]. Any kind of nesting should be fine as long as the ids are matched up 1:1 with the

Re: [racket-users] Help with vector-sort

2020-02-16 Thread greadey
On Saturday, 15 February 2020 13:03:44 UTC, Jens Axel Søgaard wrote: > > Den lør. 15. feb. 2020 kl. 13.44 skrev greadey >: > >> I have written a programme to compute a bootstrapped mean etc. I >> successfully wrote it using lists both untyped and in typed/racket. >> I am interested in optimisi

Re: [racket-users] Help with vector-sort

2020-02-15 Thread Jens Axel Søgaard
Den lør. 15. feb. 2020 kl. 13.44 skrev greadey : > I have written a programme to compute a bootstrapped mean etc. I > successfully wrote it using lists both untyped and in typed/racket. > I am interested in optimising the code and having seen that typed racket > performs faster (for lists) I am i

[racket-users] Help with vector-sort

2020-02-15 Thread greadey
Hi there, I have written a programme to compute a bootstrapped mean etc. I successfully wrote it using lists both untyped and in typed/racket. I am interested in optimising the code and having seen that typed racket performs faster (for lists) I am interested in seeing if I get a performance i

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-31 Thread Hendrik Boom
On Thu, Oct 31, 2019 at 07:00:23AM -0700, Thomas Dickerson wrote: > Hi Sage - > > Does your SIGSEGV MAPERR show up only while attached to a debugger? > If so I noticed similar behavior while debugging my own project this week, > and opened #2882 . >

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-31 Thread Thomas Dickerson
Hi Sage - Does your SIGSEGV MAPERR show up only while attached to a debugger? If so I noticed similar behavior while debugging my own project this week, and opened #2882 . It took me quite a bit of head scratching before I realized that (a) it only

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-30 Thread Sage Gerard
Hi Matthew, I reproduced "SIGSEGV MAPERR si_code 1 fault on addr (nil)" after specifying '#:atomic? #t', so not out of the woods yet. If you wish I can help you set up Vulkan off-list. > Will the callback definitely be invoked in the same OS-level thread as calls > to Vulkan functions? Yes. [

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-29 Thread Matthew Flatt
I haven't been able to get Vulkan going on my machines, so I can't run your code enough to offer reliable advice. Still, I wonder whether making the callback atomic has any effect. To make the callback atomic: * Change the definition of `_PFN_vkDebugReportCallbackEXT` to add `#:atomic? #t` aft

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-27 Thread Sage Gerard
I was still stumped on this one due to the opaque error message and repeated comparisons to the original source appearing correct. I stepped away for a while to think about it, and the only option I see to help me along is to write a shared library in C that behaves similarly, and have it log no

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-24 Thread Sage Gerard
Hi Ryan, and thank you for the detailed and informative reply! I gathered that I should trust Racket's handling of values across the foreign boundary more, and used what I learned from your email to get past one error. Sadly, I landed on "SIGSEGV MAPERR si_code 1 fault on addr (nil)" right after

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-24 Thread Ryan Culpepper
On 10/25/19 12:45 AM, Sage Gerard wrote: I am porting some C++ code to Racket that uses a function pointer. C++ origin: See 294 through 306: https://github.com/Erkaman/vulkan_minimal_compute/blob/master/src/main.cpp#L294 Racket destination: https://github.com/zyrolasting/racket-vulkan/blob/m

[racket-users] Help me understand FFI callouts in this context?

2019-10-24 Thread Sage Gerard
I am porting some C++ code to Racket that uses a function pointer. C++ origin: See 294 through 306: https://github.com/Erkaman/vulkan_minimal_compute/blob/master/src/main.cpp#L294 Racket destination: https://github.com/zyrolasting/racket-vulkan/blob/master/examples/mandelbrot.rkt#L240 How do I

Re: [racket-users] Help designing a library like 2htdp/image

2019-07-02 Thread Dwayne Crooks
Oh nice, thanks! On Tuesday, July 2, 2019 at 2:01:21 PM UTC-4, Sam Tobin-Hochstadt wrote: > > There's a quite comprehensive paper about the library here: > http://users.cs.northwestern.edu/~robby/pubs/papers/sfp2010-bff.pdf > > The library builds on the underlying Racket drawing toolkit, which i

Re: [racket-users] Help designing a library like 2htdp/image

2019-07-02 Thread Sam Tobin-Hochstadt
There's a quite comprehensive paper about the library here: http://users.cs.northwestern.edu/~robby/pubs/papers/sfp2010-bff.pdf The library builds on the underlying Racket drawing toolkit, which is similar to many other retained-mode graphics libraries such as Cairo. Sam On Tue, Jul 2, 2019 at 1

[racket-users] Help designing a library like 2htdp/image

2019-07-02 Thread Dwayne Crooks
I'd like to implement a library like the image teachpack . - What domain knowledge would help me to think through the implementation details? - Are there any papers or tutorials that explain the implementation of 2htdp/image or

Re: [racket-users] Help: assimp ffi trouble with pointers

2019-05-21 Thread Akash Shakdwipeea
Makes sense. I modified the code and got it working. Thanks a lot On Wednesday, 22 May 2019 00:44:54 UTC+5:30, Matthew Flatt wrote: > > Since `aiImportFile` can return NULL to indicate failure, you should use > `_ai-scene-pointer/null`: > > (define-assimp ai-import-file (_fun _string _int ->

Re: [racket-users] Help: assimp ffi trouble with pointers

2019-05-21 Thread Matthew Flatt
Since `aiImportFile` can return NULL to indicate failure, you should use `_ai-scene-pointer/null`: (define-assimp ai-import-file (_fun _string _int -> _ai-scene-pointer/null) #:c-id aiImportFile) Probably you don't want `_array`. In a structure, that inlines an array instead of representing

[racket-users] Help: assimp ffi trouble with pointers

2019-05-21 Thread Akash Shakdwipeea
Hi guys, I am trying to use assimp to load some 3d objects. I have run into a problem with the ffi. So I have written bindings to a function which helps me load the model into a scene object

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2019-05-17 Thread Ben Greenman
What happens if you provide the data structure from Typed Racket and require it in an untyped module? On 5/17/19, bruno cuconato wrote: > hi, > > I'm trying to use a data structure defined in a typed racket module in my > untyped code. > > I'm want it to be accessible from a generic interface, so

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2019-05-17 Thread bruno cuconato
hi, I'm trying to use a data structure defined in a typed racket module in my untyped code. I'm want it to be accessible from a generic interface, so I'm using `define-generics`'s #:fast-defaults for dispatching to the proper methods (this might not be the best practice though, and if so I wel

Re: [racket-users] Help with pretty printing

2019-04-04 Thread 'John Clements' via Racket Users
I’m glad to hear it! I think that it may not fail in nice ways for deeply nested s-expressions, but that not be an issue for you. I do think that there should be a nicer way than using a text%. John > On Apr 4, 2019, at 11:14 AM, Stephen Foster wrote: > > Thanks, John. Actually, when you di

Re: [racket-users] Help with pretty printing

2019-04-04 Thread Stephen Foster
Thanks, John. Actually, when you distinguished between the line breaks and the indentation, that helped me come up with the following algorithm. It basically, 1) lets pretty-print do its thing (inserting more line breaks than I need), 2) uses a regex to scrub out all line breaks after a keywords,

Re: [racket-users] Help with pretty printing

2019-04-02 Thread 'John Clements' via Racket Users
One note about this: it’s not really a question about indentation, which isn’t ludicrously hard, it’s a question about inserting linebreaks, which IMHO is much harder. Specifically, you’re asking for a pretty-printer that treats keywords differently from other items. Have you looked through all

[racket-users] Help with pretty printing

2019-04-02 Thread Stephen Foster
Hi all, Suppose, I have a datum that represents valid racket code, like '(test #:a a #:b b #: c). I'd love to render (arbitrarily deeply nested) datums like this to a string that displays like this: (test #:a a #:b b #:c c) Pretty printing almost works: (displayln (pretty-format

Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-11 Thread Ryan Culpepper
On 3/10/19 4:16 PM, Matt Jadud wrote: Oh! Thank you, Matthew. I see. So, I'm running into the sandbox... as in, the sandbox is doing what it should, and as a result, it is preventing the networked accesses that I've added to my documentation. That's awfully obvious (now that it is put that wa

Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Matt Jadud
Oh! Thank you, Matthew. I see. So, I'm running into the sandbox... as in, the sandbox is doing what it should, and as a result, it is preventing the networked accesses that I've added to my documentation. That's awfully obvious (now that it is put that way), but it wasn't obvious from the error me

Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Robby Findler
For the purposes of documentation building however, does it perhaps make sense to fake then actual network connection? Robby On Sun, Mar 10, 2019 at 9:48 AM Matthew Flatt wrote: > Use `call-with-trusted-sandbox-configuration` around the creation of > the evaluator. It's painful and unlikely to

Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Matthew Flatt
Use `call-with-trusted-sandbox-configuration` around the creation of the evaluator. It's painful and unlikely to be worthwhile to give a documentation sandbox limited (but workable) access to the filesystem. At Sun, 10 Mar 2019 10:29:15 -0400, Matt Jadud wrote: > Hi all, > > I am trying to get sa

[racket-users] Help with evaluation of examples in Scribble

2019-03-10 Thread Matt Jadud
Hi all, I am trying to get sandboxed evaluation of code working in my scribble docs, and am having trouble. At the top of a scribble file, I have --- PASTE --- #lang scribble/manual @(require scribble/example racket/sandbox ) --- ENDPASTE --- This file is a section that is b

Re: [racket-users] Help with generators from python land!

2019-02-22 Thread Matthias Felleisen
> On Feb 21, 2019, at 10:32 PM, Konrad Hinsen > wrote: > > The main difference, as has been pointed out before, is that Python > generators are more common as an idiom for solving problems that in Racket > would typically be approached differently. [[ This is of course ironic in a way,

Re: [racket-users] Help with generators from python land!

2019-02-21 Thread Konrad Hinsen
On 21/02/2019 20:40, Zelphir Kaltstahl wrote: Python, I believe, has some kind of `Iterable` interface, which a generator satisfies and which specifies the method to call to get the next value. In Racket maybe one would have to do with a convention of how to get a next value from a lazy list.

Re: [racket-users] Help with generators from python land!

2019-02-21 Thread Dave McDaniel
Yes, that is a key difference to the extent of the laziness I think. The python generator is different than `for` in racket as what is returned from calling a generator function in python is not a list at all, its a generator that must be externally driven in order to produce values. Whereas

Re: [racket-users] Help with generators from python land!

2019-02-21 Thread Zelphir Kaltstahl
Ah, you are of course right. Somehow I thought about `for/list` and returning lists and then doing something on the returned list, instead of simply doing it _inside_ the `for`. Apologies! On 2/21/19 8:46 PM, Robby Findler wrote: > For the record, `for` iterators go element-by-element. For example

Re: [racket-users] Help with generators from python land!

2019-02-21 Thread Robby Findler
For the record, `for` iterators go element-by-element. For example, this program does not construct anything that has all of the natural numbers in it: #lang racket (define my-stuffs-value (hash 'telephone 3 'bluejeans 24 'house 10 'computer 3000)) (define my-estate

Re: [racket-users] Help with generators from python land!

2019-02-21 Thread Zelphir Kaltstahl
I don't think one can see `for` in Racket as equivalent to generators in Python. Generators in Python are used when you want to save memory by not producing all values at once, but want to go value by value (which to my knowledge Racket's `for` variants do not do, but I'd like to be corrected,

Re: [racket-users] Help with generators from python land!

2019-02-21 Thread Dave McDaniel
Hi Jon, Thanks for the very detailed explanation. It does make good sense and is helpful in getting up to speed on racket in general. Regarding the docs, it does not say "slight", but rather "can provide better", I read this as slight since it wasn't definitive--but I understand better now ba

Re: [racket-users] Help with generators from python land!

2019-02-20 Thread Jon Zeppieri
On Wed, Feb 20, 2019 at 9:14 PM Dave McDaniel wrote: > Thanks Jon and Jen, This is a great! I figured there must be a > straightforward way to do this with a `for/hash` implementation. I have > not seen these 2 methods `in-hash` and `in-list` vs just using the hash or > list without that sequen

Re: [racket-users] Help with generators from python land!

2019-02-20 Thread Dave McDaniel
Thanks Jon and Jen, This is a great! I figured there must be a straightforward way to do this with a `for/hash` implementation. I have not seen these 2 methods `in-hash` and `in-list` vs just using the hash or list without that sequence modifier. Can you comment on what is going on with this

Re: [racket-users] Help with generators from python land!

2019-02-20 Thread Jon Zeppieri
On Wed, Feb 20, 2019 at 5:08 PM Jon Zeppieri wrote: > > (define (reverse-hash h) > (for*/fold ([result (hash)]) > ([(score letters) (in-hash h)] > [letter (in-list letters)]) > (hash-set result letter score))) > > As with Jens's answer, we can use `for*/hash` here

Re: [racket-users] Help with generators from python land!

2019-02-20 Thread Jens Axel Søgaard
Den ons. 20. feb. 2019 kl. 22.25 skrev Dave McDaniel : > Hello, > > I have interest in picking up racket and have done some koans and also > have been doing the racket track on exercism. > > There is a fairly simple exercise called `etl` on exercism related to > taking a hash for scoring scrabble

Re: [racket-users] Help with generators from python land!

2019-02-20 Thread Jon Zeppieri
On Wed, Feb 20, 2019 at 4:25 PM Dave McDaniel wrote: > Hello, > > I have interest in picking up racket and have done some koans and also > have been doing the racket track on exercism. > > There is a fairly simple exercise called `etl` on exercism related to > taking a hash for scoring scrabble l

[racket-users] Help with generators from python land!

2019-02-20 Thread Dave McDaniel
Hello, I have interest in picking up racket and have done some koans and also have been doing the racket track on exercism. There is a fairly simple exercise called `etl` on exercism related to taking a hash for scoring scrabble letters and unpacking it into a flatter, more efficient structure

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-22 Thread netraken
On 21/01/2019 21:01, Neil Van Dyke wrote: Hi, > > That's an improper end to a list.  It means a structure of pairs in > which the CDR (right element) of the last pair is not the null list. > Thanks again for your detailed and pedagogic answer. I have replaced 'cons' by 'list' and it is ok.

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-21 Thread Neil Van Dyke
netraken wrote on 1/21/19 2:51 PM: (define (enum-var-dim n v) (if ( = n 2) (cons (fst (cantor-enum v)) (snd (cantor-enum v))) (cons (fst (cantor-enum v))(enum-var-dim (sub1 n) (snd (cantor-enum v)) This is looking nicely Rackety. :) Running (enum-var-dim n value) outputs

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-21 Thread netraken
On 20/01/2019 15:33, Neil Van Dyke wrote: [lot of helpful information] OK, it works now. I could finally strip it down to (define (enum-var-dim n v) (if ( = n 2) (cons (fst (cantor-enum v)) (snd (cantor-enum v))) (cons (fst (cantor-enum v))(enum-var-dim (sub1 n) (snd (cantor-enum v))

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread netraken
Hi, Thanks you very much for these very detailed explanations. It helped me a lot. Thank you again, Alain On 20/01/2019 15:33, Neil Van Dyke wrote: > > netraken wrote on 1/20/19 8:31 AM: >> (define (EnumVarDim n value result) >>    (if ( >= n 2) >>    ( (define pairValue Enum(result)) > > That

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread Neil Van Dyke
netraken wrote on 1/20/19 8:31 AM: (define (EnumVarDim n value result) (if ( >= n 2) ( (define pairValue Enum(result)) That first Racket parentheses in `( (define` is not like grouping parentheses or braces in some other languages.  Each Racket parentheses is significant.  When you wa

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread netraken
Hello Neil, Thanks for your help. On 20/01/2019 13:54, Neil Van Dyke wrote: > Hello, Alain.  You might wish to write out htdp.org design recipes for > EnumVarDim and Enum. Yes it seems that this is an useful reference for learning. Thanks for pointing it. I don't know what they're supposed to

Re: [racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread Neil Van Dyke
Hello, Alain.  You might wish to write out htdp.org design recipes for EnumVarDim and Enum.  I don't know what they're supposed to do, but is the below code closer to what you want? #lang racket/base (define (Enum x)   (fprintf (current-error-port) "TODO: implement Enum\n")   x) (define (Enu

[racket-users] Help on a fuction syntax (beginner)

2019-01-20 Thread netraken
Hello all, I am a beginner in Racket. I need to define a variable pairValue as the result of Enum(result) The following function ;; Fonction inverse en dimension variable (define (EnumVarDim dim value result) (if ( >= dim 2) ( (define pairValue Enum(result))) (result))) fails with "defi

Re: [racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread David Storrs
On Thu, Jan 17, 2019 at 5:54 PM Matthew Butterick wrote: > > > On Jan 17, 2019, at 2:39 PM, David Storrs wrote: > > it would be nice to be able to do some slicing and dicing in the > parsing pattern as opposed to doing it manually afterwards. Is there > a way to do it? > > > > > #lang racket > (

Re: [racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread Matthew Butterick
> On Jan 17, 2019, at 2:39 PM, David Storrs wrote: > > it would be nice to be able to do some slicing and dicing in the > parsing pattern as opposed to doing it manually afterwards. Is there > a way to do it? #lang racket (struct spec (type mode) #:transparent) ; cf 'cipher-spec' in crypto

Re: [racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread David Storrs
On Thu, Jan 17, 2019 at 3:32 PM Neil Van Dyke wrote: > > Just one off-the-cuff alternative representation, with some properties > that might be useful to you... > [...much good stuff about string encoding...] Thanks, those are all good thoughts. We get to control how much data is sent so yes, I

Re: [racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread Neil Van Dyke
Just one off-the-cuff alternative representation, with some properties that might be useful to you... If this representation is internal to your system, the encrypted data is small enough that you'll fit it in RAM, and you only have a small number of different encryption methods, and your cryp

[racket-users] [help?] Using match-define to generate lists of fields from a struct

2019-01-17 Thread David Storrs
I'm shipping encrypted data between RAM, DB, and network and wondering if there's an efficient way to the parsing. (struct spec (type mode) #:transparent) ; cf 'cipher-spec' in crypto module (define s (spec "aes" "cbc")) (match-define (struct* spec ([type (app string->symbol type)]

Re: [racket-users] Help understanding cond expression

2019-01-15 Thread Michael Murdock MacLeod
On Saturday, January 12, 2019 8:34:35 PM PST Hassan Shahin wrote: > I have this definition for a procedure: > > (define type-of (lambda (item) > (cond >[(pair? item) 'pair] >[(null? item) 'empty-list] >

Re: [racket-users] Help narrow down problem using plt-web-server:

2019-01-13 Thread Neil Van Dyke
Regarding the immediate problem, and then a couple things you might see after... * Unless you have a really weird OS, I think the first problem is that another process currently has/had port 443 open on the same network address.  (This might even be from the last run of your same program, as

Re: [racket-users] Help understanding cond expression

2019-01-12 Thread Hassan Shahin
Thanks Jon. yes. I did, and you are right. I posted the same question a Google+ forum (https://plus.google.com/108613325307702875646/posts/1BaDJFoat4D), and I also got a reply that: "John is being parsed as a variable, and thus, its binding is looked up in the local environment. Of course, ther

Re: [racket-users] Help understanding cond expression

2019-01-12 Thread Jon Zeppieri
On Sun, Jan 13, 2019 at 12:37 AM Hassan Shahin wrote: > Thanks Jack and Mike! > > You are right. Arguments to procedures will be evaluated before the > invocation of the procedure. > This is true, but it's not really the issue in your case. Even in #lang lazy, which does not eagerly evaluate pro

Re: [racket-users] Help understanding cond expression

2019-01-12 Thread Hassan Shahin
Thanks Jack and Mike! You are right. Arguments to procedures will be evaluated before the invocation of the procedure. I thought that because (if) is not an ordinary procedure, and because one can express if in terms of cond (or vice versa) that my procedure is also a non ordinary procedure, wh

Re: [racket-users] Help understanding cond expression

2019-01-12 Thread Jack Rosenthal
On Sat, 12 Jan 2019 at 21:12 -0800, Hassan Shahin wrote: > When I apply the procedure to 'John it will evaluate to 'symbol. The idea > of the procedure is to check the "type" of the given item, which is not > decided aprior. If I give it 'John I know it is a symbol. > May be my question should be

Re: [racket-users] Help understanding cond expression

2019-01-12 Thread Hassan Shahin
Thanks Mike. When I apply the procedure to 'John it will evaluate to 'symbol. The idea of the procedure is to check the "type" of the given item, which is not decided aprior. If I give it 'John I know it is a symbol. May be my question should be formulated as this: Since John is not a pair, an

Re: [racket-users] Help understanding cond expression

2019-01-12 Thread Mike MacHenry
You need to apply the function to 'John, with a single quote in front of it. The word John without that quote is just a variable reference to something that you have not actually defined. On Sat, Jan 12, 2019 at 11:34 PM Hassan Shahin wrote: > I have this definition for a procedure: > > (define

[racket-users] Help understanding cond expression

2019-01-12 Thread Hassan Shahin
I have this definition for a procedure: (define type-of (lambda (item) (cond [(pair? item) 'pair] [(null? item) 'empty-list] [(number? item) 'number] [(symbol? item)

Re: [racket-users] Help narrow down problem using plt-web-server:

2019-01-11 Thread George Neuner
On 1/10/2019 3:50 PM, Don Green wrote: I suspect that I: (a) may be misusing plt-web-server; or (b) have not actually installed my server-cert.pem properly even though the verification operation indicates a successful installation: openssl verify -CApath /etc/ssl/certs server-cert.pem returns: s

Re: [racket-users] Help narrow down problem using plt-web-server:

2019-01-10 Thread 'John Clements' via users-redirect
Apologies if this is obvious, but have you checked to see whether some other process is already listening on port 443? On a Linux server, it looks to me like you should be able to see what processes are listening on what ports by running sudo netstat -tulpn Also, you don’t mention what the res

[racket-users] Help narrow down problem using plt-web-server:

2019-01-10 Thread Don Green
I could use some help narrowing down this problem using plt-web-server: Context: I can successfully run all code described in: Continue: Web Applications in Racket, Chapters 1 through 17. However, 'Chapter 18: Using HTTPS' where I run plt-web-server is giving me a problem. (I am using OS:Linux/Ubun

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Matthew Butterick
> On Dec 30, 2018, at 8:41 PM, Jonathan Simpson wrote: > > I'm doing #1, so I think #2 is the explanation. 'type' is a function > available in expander.rkt so the literal will only match that binding. The > same is true for 'offset'. Both need to be provided. 'test' is not bound to > anythin

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
On Sunday, December 30, 2018 at 8:51:25 PM UTC-5, Matthew Butterick wrote: > > Without seeing "reader.rkt" or "expander.rkt" — I'd guess that: > > 1) `read-syntax` isn't stripping all bindings from its parse tree before > returning it. Though this isn't mandatory, it's a wise practice to avoid

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Matthew Butterick
> On Dec 30, 2018, at 3:13 PM, Jonathan Simpson wrote: > > Adding a '(provide type)' in expander.rkt (where 'line' is defined) gets me > past this error. Strangely, providing 'compare' or 'offset' doesn't seem to > be necessary. I'm interested in any theories as to why this might be the case.

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
Adding a '(provide type)' in expander.rkt (where 'line' is defined) gets me past this error. Strangely, providing 'compare' or 'offset' doesn't seem to be necessary. I'm interested in any theories as to why this might be the case. Thanks for your help. -- Jonathan On Sunday, December 30, 2018

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jens Axel Søgaard
Den søn. 30. dec. 2018 kl. 22.33 skrev Jonathan Simpson : > On Sunday, December 30, 2018 at 3:58:50 PM UTC-5, Jens Axel Søgaard wrote: > >> The error >> >> line: bad syntax >> (line (offset 0) (type (string8 "string")) (test (strtest "MZ"))) >> >> means that the macro `line` doesn't have a

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
On Sunday, December 30, 2018 at 3:58:50 PM UTC-5, Jens Axel Søgaard wrote: > The error > > line: bad syntax > (line (offset 0) (type (string8 "string")) (test (strtest "MZ"))) > > means that the macro `line` doesn't have a clause that matches the input. > > How is line defined? > > /Jens A

Re: [racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jens Axel Søgaard
The error line: bad syntax (line (offset 0) (type (string8 "string")) (test (strtest "MZ"))) means that the macro `line` doesn't have a clause that matches the input. How is line defined? /Jens Axel Den søn. 30. dec. 2018 kl. 21.27 skrev Jonathan Simpson : > I'm bumbling through my f

[racket-users] Help debugging a custom language read/expansion error

2018-12-30 Thread Jonathan Simpson
I'm bumbling through my first attempts at creating a language in Racket and am currently stuck debugging an error in expansion. I have a macro in my expander that works fine until I try to run the language. Here's what the macro stepper in DrRacket gives me: [Error] line: bad syntax (line (o

[racket-users] help me make this lexer compile on racket !

2018-12-26 Thread 撒闿要
hi: https://gist.github.com/zhu-fei/14392eb5eae29607db72b1b7a09194d4 I want to compile this piece of code on racket , these code can compile with chez scheme , but not racket , anyone can help me out? thank you! -- You received this message because you are subscribed to the Google Grou

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-08-08 Thread Sam Tobin-Hochstadt
One other suggestion: you can use `define-predicate` in a Typed Racket module to create a predicate for any type that can be checked immediately. So ``` (define-predicate dist? (Discrete-Dist Your-Type-Here)) ``` should define the predicate you want. Sam On Fri, Jul 28, 2017 at 10:23 AM, James

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-31 Thread Matthias Felleisen
> On Jul 31, 2017, at 5:27 AM, James Geddes wrote: > > > Matthias, > > Thank you, that's really helpful, both for letting me know I'm not being an > idiot (always welcome!) and for the example code, which makes me realise I > should learn about exceptions next. > > Many thanks again, > >

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-31 Thread James Geddes
Matthias, Thank you, that's really helpful, both for letting me know I'm not being an idiot (always welcome!) and for the example code, which makes me realise I should learn about exceptions next. Many thanks again, James --- James Geddes -- You received this m

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-28 Thread Matthias Felleisen
After some poking around, here is what I can offer: #lang racket (module predicates racket (provide discrete-dist-thing?) ;; - ;; dependencies (require math/distributions) ;; - ;; implementation (define (discrete

  1   2   3   >