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

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

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

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—

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2017-07-28 Thread Matthias Felleisen
> On Jul 28, 2017, at 11:23 AM, James Geddes wrote: > > This is likely a typed-untyped interface newbie question. > > Briefly, how can I write a contract that asserts that some value has a type > that is defined in an imported typed/racket library? > > In more detail, I am using the math/dist

Re: [racket-users] Help needed to fix type error

2017-06-06 Thread Jens Axel Søgaard
2017-06-06 7:30 GMT+02:00 Ben Greenman : > Maybe the issue is line 52 of math/private/distributions/utils (it seems > like a typo to me) > > (define-type type-name (struct-name Real Flonum)) > > > I think this means that the type Discrete-Uniform-Dist is really > (discrete-uniform-dist-struct Real

Re: [racket-users] Help needed to fix type error

2017-06-05 Thread Ben Greenman
Maybe the issue is line 52 of math/private/distributions/utils (it seems like a typo to me) (define-type type-name (struct-name Real Flonum)) I think this means that the type Discrete-Uniform-Dist is really (discrete-uniform-dist-struct Real Flonum). Anyway, if I change the return typed of disc

Re: [racket-users] help

2017-05-20 Thread Jens Axel Søgaard
Hi See https://m.youtube.com/watch?list=PLD0EB7BC8D7CF739A&v=T4Myub8sJH0 > Den 20. maj 2017 kl. 17.12 skrev Masto Fine : > > hello , can you explain me how save a definition in dr arcket > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" grou

Re: [racket-users] help with splicing syntax class error report

2017-03-15 Thread Dan Liebgold
On Tuesday, March 14, 2017 at 11:05:08 AM UTC-7, Stephen Chang wrote: > > 1) Use a commit pattern, which tells syntax-parse not to backtrack > past the commit point. You have to change the order of patterns for > this to work. > [...] > 2) Use the ~post pattern, which essentially tells syntax-par

Re: [racket-users] help with splicing syntax class error report

2017-03-14 Thread Stephen Chang
You get the dreaded "bad syntax" because syntax-parse doesnt know which pattern failed. There a couple of things you can do: 1) Use a commit pattern, which tells syntax-parse not to backtrack past the commit point. You have to change the order of patterns for this to work. (define-splicing-synt

Re: [racket-users] help

2016-10-24 Thread David Storrs
Hi Masto, You have at least one obvious syntax error in that code, which you should probably fix before asking for help. Also, it sounds like you're asking for help with homework, which generally defeats the point. May I suggest that you take a real swing at it, then ask for more specific help?

Re: [racket-users] Help needed in file processing idioms

2016-08-20 Thread WarGrey Gyoudmon Ju
see docs for (read-line) On Sat, Aug 20, 2016 at 5:16 PM, Pekka Niiranen wrote: > Thank you guys, > > > both functions work. Looks like single function (for/or) could be used > if the calling side handles #f, #t and a list. > > Another issue: > > I am planning to support both Unix and Windows, b

Re: [racket-users] Help needed in file processing idioms

2016-08-20 Thread Pekka Niiranen
Thank you guys, both functions work. Looks like single function (for/or) could be used if the calling side handles #f, #t and a list. Another issue: I am planning to support both Unix and Windows, but have not found a way to define 'return-linefeed as system-wide default (aside using global va

Re: [racket-users] Help needed in file processing idioms

2016-08-19 Thread Gustavo Massaccesi
Minor fix: In the first function "read-on-row" you must replace for/first with for/last. Gustavo PS for Pekka: In this case it's better to use for/last and for/or, but in more complicated cases you can try with for/fold. On Fri, Aug 19, 2016 at 10:34 AM, WarGrey Gyoudmon Ju wrote: > (define (r

Re: [racket-users] Help needed in file processing idioms

2016-08-19 Thread WarGrey Gyoudmon Ju
(define (read-on-row *params*) ;; Returns the last line in "myfile" which contains ;; substring "ON", otherwise #f (call-with-input-file (hash-ref *params* "myfile") (lambda (inp) (for/first ([row (in-lines inp 'return-linefeed)] #:when (string-contains? row "ON"))

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Jon Zeppieri
On Mon, Feb 22, 2016 at 7:26 PM, Neil Van Dyke wrote: > For someone who really wants to learn this well, rather than just make a > lexer and move on... > > I started learning the pertinent theory (such as automata NFA/DFA, and > classes of formal languages) from the original red dragon book: > ht

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Neil Van Dyke
For someone who really wants to learn this well, rather than just make a lexer and move on... I started learning the pertinent theory (such as automata NFA/DFA, and classes of formal languages) from the original red dragon book: https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Justin Zamora
You can also try using a state machine using the approach described in https://cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf On Feb 22, 2016 4:46 PM, "Federico Ramírez" wrote: > Hello everyone! I'm new to Scheme, and I need some help wrapping my head > around it. > >

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Federico Ramírez
On Monday, 22 February 2016 19:25:50 UTC-3, Jon Zeppieri wrote: > Have you looked at the parser-tools/lex library? > https://docs.racket-lang.org/parser-tools/Lexers.html > > > On Feb 22, 2016, at 4:46 PM, Federico Ramírez wrote: > > > > Hello everyone! I'm new to Scheme, and I need some help

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Federico Ramírez
On Monday, 22 February 2016 19:34:40 UTC-3, Jens Axel Søgaard wrote: > 2016-02-22 22:46 GMT+01:00 Federico Ramírez : > > >     (define (tokenize input) > >       (cond > >         ((match-identifier input) (consume-identifier input)) > >         ((match-equals     input) (consume-equals     i

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Jens Axel Søgaard
2016-02-22 22:46 GMT+01:00 Federico Ramírez : (define (tokenize input) > (cond > ((match-identifier input) (consume-identifier input)) > ((match-equals input) (consume-equals input)) > ((match-number input) (consume-number input)) > (else '

Re: [racket-users] Help writing a simple lexer/tokenizer

2016-02-22 Thread Jon Zeppieri
Have you looked at the parser-tools/lex library? https://docs.racket-lang.org/parser-tools/Lexers.html > On Feb 22, 2016, at 4:46 PM, Federico Ramírez wrote: > > Hello everyone! I'm new to Scheme, and I need some help wrapping my head > around it. > > I want to write a simple tokenizer, which

Re: [racket-users] Help trying to create a script to launch a program from command line.

2016-02-06 Thread Daniel Brunner
Hi Alvarao, Am 05.02.2016 um 15:59 schrieb Alvaro Antolinez: > Hi all, > [...] > > this works so far, but when I try to use > > (command my-path) > > to launch the executable dr. Racket says this: > command: unbound identifier in module > you might want to consider using something like (s

  1   2   >