Re: [racket-users] unicode (or just plain byte) regular expression positions?

2021-01-18 Thread Jon Zeppieri
On Mon, Jan 18, 2021 at 10:53 PM Tim Meehan wrote: > > Say that I have a strange character group that I want to find in a binary > file. > I wanted to use something like this: > > (define needle (list->string (map integer->char (list #xab #xcd #xef > (define needle-offset >

Re: [racket-users] Match: non-greedy, and also repeated elements?

2020-12-31 Thread Jon Zeppieri
Right... except that I completely misread your first example, which is not at all the same as my example with `cons` patterns. Sorry about that. On Thu, Dec 31, 2020 at 2:06 PM Jon Zeppieri wrote: > > On Wed, Dec 30, 2020 at 2:24 PM David Storrs wrote: > > > > First off, is t

Re: [racket-users] Match: non-greedy, and also repeated elements?

2020-12-31 Thread Jon Zeppieri
On Wed, Dec 30, 2020 at 2:24 PM David Storrs wrote: > > First off, is there a way to make ... in a pattern match non-greedily? i.e., > match as *few* elements as possible instead of as many? As far as I know, no. However, if your first example is really illustrative of what you're trying to

Re: [racket-users] Trouble with `set-copy`

2020-12-08 Thread Jon Zeppieri
I think that's this bug [https://github.com/racket/racket/commit/543dab59640fa5e911443baaadaae471406dbf40], which should be fixed in 7.9. - Jon On Tue, Dec 8, 2020 at 7:19 PM Nathaniel W Griswold wrote: > > I don’t know if i’m missing something or what, but the following is confusing > me: > >

Re: [racket-users] Why is get-impure-port* slower than a system call to curl?

2020-09-14 Thread Jon Zeppieri
with: 1) > I can confirm that sending HTTP requests from Racket has always been fast for > me, or 2) I too have noticed Racket HTTP requests are slow. > > (Note that by "slow", I mean: takes noticeably longer than curl.) > > > > On Tue, Jul 7, 2020 at 12:21

Re: [racket-users] Why is get-impure-port* slower than a system call to curl?

2020-07-07 Thread Jon Zeppieri
Hi Stephen, Your video shows you running this code in DrRacket with debugging enabled. That usually affects performance. Have you made measurements when running this code outside of DrRacket? - Jon On Tue, Jul 7, 2020 at 2:13 PM Stephen Foster wrote: > > I'm considering using Racket to remake

Re: [racket-users] Re: [racket] Web Framework Benchmarks

2020-06-09 Thread Jon Zeppieri
On Tue, Jun 9, 2020 at 7:59 AM Bogdan Popa wrote: > > I think we'd need to also set `SO_REUSEPORT', which is not available on > all platforms, to support multiple processes listening on the same port > without reusing file descriptors. And even where it is available, it doesn't work the same

Re: [racket-users] br-parser-tools question

2020-06-08 Thread Jon Zeppieri
On Mon, Jun 8, 2020 at 8:36 PM jon stenerson wrote: > > Hi all, > > I don't understand the error message here. The parser seems to be > looking for a position-token but the lexer is sending srcloc-tokens? Is > there a simple fix? Using Racket 7.7 on WIn 10. Hi Jon, Yes, you're right, and there

Re: [racket-users] Some stuff about "case".

2020-06-01 Thread Jon Zeppieri
On Mon, Jun 1, 2020 at 3:52 PM Jens Axel Søgaard wrote: > > Den man. 1. jun. 2020 kl. 20.53 skrev Christopher Lemmer Webber > : > > > I think `case` were more important before `match` arrived. > If you want to see how `case` can be implemented without hash-tables, look at > William D Clinger's

Re: [racket-users] Trouble shooting net/http-client

2020-05-15 Thread Jon Zeppieri
I can't reproduce this with a simple example. ``` #lang racket/base (require net/http-client) (define data "hello world!") (http-sendrecv "postman-echo.com" "/post" #:ssl? #f #:method #"POST" #:data data) ``` Maybe you could post

Re: [racket-users] trickiness about the order of definitions in GUI code

2020-05-06 Thread Jon Zeppieri
On Wed, May 6, 2020 at 7:50 PM James Platt wrote: > > I'm working on organizing and documenting some things and I have some code, > below, which works but I don't understand why. Specifically, why don't I get > an error about table3 not being defined? The reason you don't get an error for the

Re: [racket-users] a question or two regarding Gregor

2020-04-30 Thread Jon Zeppieri
Only a small number of zone formats are supported in parsing mode. This is discussed a bit in https://github.com/97jaz/gregor/issues/25. The situation could definitely be improved. - Jon On Thu, Apr 30, 2020 at 11:33 AM Tim Hanson wrote: > > p.s. I'm stuck on parsing one pattern that comes up

Re: [racket-users] Question on test failures sorting a BTS

2020-04-27 Thread Jon Zeppieri
In addition to what Jens said, you should probably give a definition of a BST at the top, and give some thought to the question of why a BST is not simply the same thing as a node. - Jon On Sun, Apr 26, 2020 at 10:36 PM Kristina Marie wrote: > > Hello, > I am trying to use HtDF to create a

Re: [racket-users] a question or two regarding Gregor

2020-04-27 Thread Jon Zeppieri
On Mon, Apr 27, 2020 at 2:38 AM Tim Hanson wrote: > > hi, I've installed and am trying out > > Gregor: a date and time library for Racket > > and find it to be very powerful and useful. Thanks! > > In my current application (digging through mail headers) I'm wondering > whether there is a

Re: [racket-users] [racket users] struct #:methods question

2020-04-20 Thread Jon Zeppieri
There's no trick to it: #lang racket/base (require racket/generic) (define-generics foo (foo-do foo x)) (struct thing (x) #:methods gen:foo [(define (foo-do f x) (thing x))]) On Mon, Apr 20, 2020 at 6:32 PM Kevin Forchione wrote: > > Hi guys, > How do you return an instance of

Re: [racket-users] New to racket, help with coursework question

2020-04-19 Thread Jon Zeppieri
Well, this all looks very familiar. Can I ask where this course is offered? Okay, let's start with part of the problem definition: > Create a function that calculates the number of days in a month given a year > and a month > > Call the function number-of-days-in-month, and it's signature is

Re: [racket-users] typing variable length argument lists

2020-04-10 Thread Jon Zeppieri
(define (unique [list : (Listof Any)] [message : String] . [messageargs : Any *]) ; return the only element of the list, or '() if there is none. ; Produce message if not just one. (if (equal? 1 (length list)) (car list) (begin (apply fprintf anomaly message messageargs)

Re: [racket-users] Best way to say "terminate unless received by X time"

2020-03-24 Thread Jon Zeppieri
On Tue, Mar 24, 2020 at 4:03 PM David Storrs wrote: > > I've got this code: > > (thread > (thunk > (let loop () > (define-values (len shost sport) (udp-receive! socket buffer)) > ...do stuff with the received message... > (loop > > I'd like to be able to say "If you

Re: [racket-users] [racket users] Generics question

2020-03-03 Thread Jon Zeppieri
On Tue, Mar 3, 2020 at 12:37 PM Kevin Forchione wrote: > > Thanks! That brings me a little closer in appreciating the comments I’ve > read about replacing object-oriented code with structs and methods. > > Is this part of the racket/generic or the Multimethods library? The example > you

Re: [racket-users] [racket users] Generics question

2020-03-03 Thread Jon Zeppieri
Kevin, This is what `define/generic` is for. In your example: On Tue, Mar 3, 2020 at 11:08 AM Kevin Forchione wrote: > > (struct A (this other) #:transparent > #:methods gen:foo > [(define (do-foo foo) > (printf "other=~a ~a" > (A-this foo) > (do-foo (A-other

Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2020-02-20 Thread Jon Zeppieri
Okay, in that case, you really shouldn't add a content-length header. -Jon On Thu, Feb 20, 2020 at 1:13 PM Bogdan Popa wrote: > > > Jon Zeppieri writes: > > > When you stream the response, it doesn't use a chunked transfer encoding? > > -Jon > > The web server ch

Re: [racket-users] Implications of stateless servlets & how/whether to avoid them

2020-02-20 Thread Jon Zeppieri
When you stream the response, it doesn't use a chunked transfer encoding? -Jon On Thu, Feb 20, 2020 at 12:40 PM Jay McCarthy wrote: > > I assume it is not necessary to be totally accurate, but it is good to when > you can, because of the Web principle of accepting broad input and producing >

[racket-users] join-based tree operations and racket-cs futures

2019-12-11 Thread Jon Zeppieri
I've been playing around with a simple AVL tree that uses the split/join operations that Adams originally applied to weight-balanced binary trees[1] and then Blelloch, Ferizovic, and Sun later applied to other kinds of balanced binary trees.[2] The latter paper concentrates on how certain

Re: [racket-users] How to use dates (especially gregor) with Typed Racket?

2019-12-04 Thread Jon Zeppieri
On Tue, Dec 3, 2019 at 8:55 PM Ben Greenman wrote: > > The error is because gregor/time doesn't export a struct. But > nevermind that, because you're probably best off with an opaque type: > > ``` > #lang typed/racket > > (require/typed gregor/time > [#:opaque Time time?] > [time (->*

Re: [racket-users] Re: raco distribute and runtime paths, conditioned on whether a package was installed at compile time

2019-11-12 Thread Jon Zeppieri
On Tue, Nov 12, 2019 at 10:13 PM Matthew Flatt wrote: > > At Tue, 12 Nov 2019 19:46:01 -0700, Matthew Flatt wrote: > > Although you can find the files using `find-share-dir` and/or > > `find-user-share-dir`, adding a 'share mode to `define-runtime-path` > > would make it possible for `raco

Re: [racket-users] Re: raco distribute and runtime paths, conditioned on whether a package was installed at compile time

2019-11-12 Thread Jon Zeppieri
On Tue, Nov 12, 2019 at 2:09 PM Matthew Flatt wrote: > > I'd say the problem is that "info.rkt" and `find-relevant-directories` > are set up as Racket-installation concepts. They're not made to play > well with standalone applications. > > The most similar concept that plays well with standard

[racket-users] Re: raco distribute and runtime paths, conditioned on whether a package was installed at compile time

2019-11-10 Thread Jon Zeppieri
On Sun, Nov 10, 2019 at 7:38 PM Jon Zeppieri wrote: > > On Sun, Nov 10, 2019 at 4:45 PM Jon Zeppieri wrote: > > > > On Sun, Nov 10, 2019 at 3:26 PM Jon Zeppieri wrote: > > > = > > > ;; If the tzdata package is installed, put its zoneinfo directory at

[racket-users] Re: raco distribute and runtime paths, conditioned on whether a package was installed at compile time

2019-11-10 Thread Jon Zeppieri
On Sun, Nov 10, 2019 at 4:45 PM Jon Zeppieri wrote: > > On Sun, Nov 10, 2019 at 3:26 PM Jon Zeppieri wrote: > > = > > ;; If the tzdata package is installed, put its zoneinfo directory at > > ;; the head of the search path. > > (define-runtime-path-list t

[racket-users] Re: raco distribute and runtime paths, conditioned on whether a package was installed at compile time

2019-11-10 Thread Jon Zeppieri
On Sun, Nov 10, 2019 at 3:26 PM Jon Zeppieri wrote: > = > ;; If the tzdata package is installed, put its zoneinfo directory at > ;; the head of the search path. > (define-runtime-path-list tzdata-paths > (match (find-relevant-directories '(tzdata-zoneinfo-module-path)) >

Re: [racket-users] Efficient idiom for converting key-set of a hash-map into a hash-set

2019-10-25 Thread Jon Zeppieri
Oh -- forgot to mention: if you're using an immutable hash, then `in-immutable-hash-keys` is significantly faster than `in-hash-keys`. I mean: (for/set ([k (in-immutable-hash-keys h)]) k) On Fri, Oct 25, 2019 at 4:37 PM Jon Zeppieri wrote: > > From a little test I just ran, building

Re: [racket-users] Efficient idiom for converting key-set of a hash-map into a hash-set

2019-10-25 Thread Jon Zeppieri
>From a little test I just ran, building a set of hash keys, using a hash with 100,000 k/v pairs and generating the key set 100 times each: "list->set" cpu time: 3147 real time: 3148 gc time: 1137 "apply" cpu time: 3205 real time: 3206 gc time: 1146 "in-hash" cpu time: 2791 real time: 2791 gc

Re: [racket-users] Would it help to call racket2 something else?

2019-08-28 Thread Jon Zeppieri
On Wed, Aug 28, 2019 at 11:43 PM Sage Gerard wrote: > > Why is the name Racket2 so important, anyway? It isn't. It's been mentioned several times that "Racket2" is currently just a placeholder for whatever it ends up being called.

Re: [racket-users] (curry map string->number) in Typed Racket

2019-08-28 Thread Jon Zeppieri
On Wed, Aug 28, 2019 at 9:58 AM Štěpán Němec wrote: > > On Wed, 28 Aug 2019 09:23:03 -0400 > Jon Zeppieri wrote: > > [...] > > >> Does that mean that for higher-order function parameters, inst expects > >> only the return type signature, not that of the fun

Re: [racket-users] (curry map string->number) in Typed Racket

2019-08-28 Thread Jon Zeppieri
On Wed, Aug 28, 2019 at 5:59 AM Štěpán Němec wrote: > > On Thu, 22 Aug 2019 16:40:03 -0400 > Jon Zeppieri wrote: > > > (curry (inst map (U Complex False) String) > > string->number) > > > > ... typechecks, but in your expression, you're goin

Re: [racket-users] (curry map string->number) in Typed Racket

2019-08-22 Thread Jon Zeppieri
(curry (inst map (U Complex False) String) string->number) ... typechecks, but in your expression, you're going to need to handle the possibility that the pattern variables in `list-rest` pattern are #f. - Jon On Thu, Aug 22, 2019 at 4:15 PM Štěpán Němec wrote: > > > I have a hard

Re: [racket-users] Seeking good benchmark code for immutable hash and hash set usage

2019-08-22 Thread Jon Zeppieri
; does too. > > [1] https://github.com/bennn/gtp-benchmarks > > On 8/14/19, Jon Zeppieri wrote: > > Hello Racketeers, > > > > I'm looking for examples of code that would make good benchmarks for > > evaluating the performance of immutable hashes. > > >

Re: [racket-users] Re: The case, and a proposal, for elegant syntax in #lang racket2

2019-08-21 Thread Jon Zeppieri
On Wed, Aug 21, 2019 at 2:43 PM George Neuner wrote: > > > On 8/21/2019 1:13 PM, Gustavo Massaccesi wrote: > > The expander in racket adds something equivalent to > > [else (void)] > > if there is no else clause. (Try an example with the Macro Stepper.) > > So an explicit else clause would

[racket-users] Seeking good benchmark code for immutable hash and hash set usage

2019-08-14 Thread Jon Zeppieri
Hello Racketeers, I'm looking for examples of code that would make good benchmarks for evaluating the performance of immutable hashes. Some background: Immutable hashes used to be implemented in Racket as red-black trees. That was changed to hash array mapped tries (HAMTs) a number of years

Re: [racket-users] finding the expander at run-time

2019-08-04 Thread Jon Zeppieri
On Sun, Aug 4, 2019 at 2:40 PM Jesse Alama wrote: > [...] > > In secret.rkt I've essentially got this: > > (define program (parse path)) > (parameterize ([current-namespace (make-base-empty-namespace)]) > (namespace-require '(file "expander.rkt")) > (eval program)) > I thought I

Re: [racket-users] How to implement a hash function for different types?

2019-08-03 Thread Jon Zeppieri
On Sat, Aug 3, 2019 at 1:35 AM Jon Zeppieri wrote: > > On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang wrote: > > > > If I want to turn the hash code into array index in a hash table, do I need > > to > > apply another uniform hash function such as md5 on the

Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jon Zeppieri
On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang wrote: > > If I want to turn the hash code into array index in a hash table, do I need to > apply another uniform hash function such as md5 on the result of > equal-hash-code? > That wouldn't accomplish anything. The defining feature of a function is

Re: [racket-users] How to implement a hash function for different types?

2019-08-02 Thread Jon Zeppieri
On Fri, Aug 2, 2019 at 9:37 PM Justin Zamora wrote: > > Racket doesn't implement hash tables using a hash function. If I > recall correctly, it uses b-trees as the representation for a hash > table. The Racket reference states that "Immutable hash tables > actually provide O(log N) access and

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread Jon Zeppieri
On Mon, Jun 24, 2019 at 4:51 PM Jon Zeppieri wrote: > > `lseek` docs say: > > > The lseek() function shall allow the file offset to be set beyond the end > > of the existing data in the file. If data is later written at this point, > > subsequent reads of data in

Re: [racket-users] file-position does not extend file as expected

2019-06-24 Thread Jon Zeppieri
I *think* that the docs are wrong here. `file-position` maps onto `lseek` on posix systems (pretty sure about this after a quick perusal of the code) and `lseek` docs say: > The lseek() function shall allow the file offset to be set beyond the end of > the existing data in the file. If data is

Re: [racket-users] Are function parameters copy on write?

2019-06-06 Thread Jon Zeppieri
On Thu, Jun 6, 2019 at 12:00 PM David Storrs wrote: > My understanding is that Racket is call by value, not call by reference. > My application will often be passing around large-ish byte strings; will > they be copied every time I pass them, or will the interpreter use > copy-on-write? >

Re: [racket-users] db module + SQLite driver + 'ON CONFLICT' = syntax error

2019-04-18 Thread Jon Zeppieri
It might well be the SQLlite version. This is a pretty new feature. It's possible that the db library is using an older version than your CLI client. - Jon On Thu, Apr 18, 2019 at 4:03 PM David Storrs wrote: > I'm having trouble with using the the 'ON CONFLICT' clause with a SQLite >

Re: [racket-users] printing decimals

2019-03-15 Thread Jon Zeppieri
https://docs.racket-lang.org/reference/strings.html?q=~r#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%29%29 On Fri, Mar 15, 2019 at 1:57 PM wrote: > Hi all, > > I've been looking through the docs for a way to print decimals to a > defined precision. > > I can get close to what I want using

Re: [racket-users] json, performance, racket cs, puzzlement, etc.

2019-03-03 Thread Jon Zeppieri
On Sat, Mar 2, 2019 at 3:38 PM Matthew Flatt wrote: > > That's a big difference between Racket and Racket CS. My initial > thought was that the program must have a lot of indirect function > calls, and Racket CS is faster at those... but not by such a big > factor. You don't use `call/cc`,

[racket-users] json, performance, racket cs, puzzlement, etc.

2019-03-02 Thread Jon Zeppieri
After the recent discussion on json parsing performance, I spent some time doing a quick port of enough of attoparsec and aeson (haskell libraries providing, respectively, byte-oriented parser combinators and json parsing) to do some testing. The result: really slow. (This is where the puzzlement

Re: [racket-users] How do I get the username from a database handle?

2019-02-26 Thread Jon Zeppieri
On Tue, Feb 26, 2019 at 4:58 PM David Storrs wrote: > Given a database handle, I'd like to be able to ask it what user it's > connected as. Is there a way to do this? > > I don't see anything in the `db` library's API to get this, but your database probably allows you to do it in SQL (at the

Re: [racket-users] Cannot use case+else inside match+else

2019-02-25 Thread Jon Zeppieri
Previously on this program... https://lists.racket-lang.org/dev/archive/2013-May/thread.html [racket-dev] else clauses: possible change to match? On Mon, Feb 25, 2019 at 10:59 PM Greg Hendershott wrote: > Yep, I also spent a non-zero number of years not even realizing "else" > wasn't a magic

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-25 Thread Jon Zeppieri
On Mon, Feb 25, 2019 at 9:42 PM Brian Adkins wrote: > On Friday, February 22, 2019 at 4:00:11 PM UTC-5, Jon Zeppieri wrote: > > Thanks for the fix Jon. I'm still a relative Racket newbie - I'd like to > be able to install your package from the new branch, but I'd also like to >

Re: [racket-users] performance, json

2019-02-22 Thread Jon Zeppieri
On a related (but not too related) note: is there an efficient way to skip multiple bytes in an input stream? It looks like there are two choices: - You can read the bytes you want to skip, but that implies either allocating a useless byte array or keeping one around for this very purpose. -

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-22 Thread Jon Zeppieri
On Fri, Feb 22, 2019 at 11:36 AM Brian Adkins wrote: > > It seems that not short circuiting would be a good idea regardless of > other changes. It's not urgent for me, because the code in question won't > run late in the evening where the problem occurs. > > I have a proposed fix, if you care

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-22 Thread Jon Zeppieri
On Fri, Feb 22, 2019 at 11:22 AM Jon Zeppieri wrote: > > - I could also abandon the symlink check altogether and always use the > slow path, which checks for file _content_ identity between /etc/timezone > and any file that names an IANA time zone in the zoneinfo tree. > Or. b

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-22 Thread Jon Zeppieri
On Fri, Feb 22, 2019 at 10:44 AM Brian Adkins wrote: > > Yes, I think we found the problem: > > $ ls -l /etc/localtime > lrwxrwxrwx 1 root root 36 Feb 21 21:45 /etc/localtime -> > /usr/share/zoneinfo/America/New_York > deploy@ip-172-31-10-34:~$ ls -l /usr/share/zoneinfo/America/New_York >

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-21 Thread Jon Zeppieri
I just realized that some of my instructions rely on DrRacket, and you mentioned that this is on AWS, so you probably you're likely not running that. The reason I suggested running the code in DrRacket is that it allows you to work within a module, so that you're not restricted to calling only

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-21 Thread Jon Zeppieri
On Thu, Feb 21, 2019 at 10:12 PM Brian Adkins wrote: > On Thursday, February 21, 2019 at 9:54:23 PM UTC-5, Jon Zeppieri wrote: >> >> >> >> On Thu, Feb 21, 2019 at 9:48 PM Brian Adkins wrote: >> >>> On Thursday, February 21, 2019 at 9:35:58 PM UTC-5,

Re: [racket-users] Re: How do I get (system-tzid) to return the correct value?

2019-02-21 Thread Jon Zeppieri
On Thu, Feb 21, 2019 at 9:48 PM Brian Adkins wrote: > On Thursday, February 21, 2019 at 9:35:58 PM UTC-5, Brian Adkins wrote: >> >> On Thursday, February 21, 2019 at 9:26:07 PM UTC-5, Brian Adkins wrote: >>> >>> I'm using the (today) function from the gregor library. It was returning >>>

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

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 answe

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

Re: [racket-users] [macro help] How can I render a parenthesized set of elements optional?

2019-02-15 Thread Jon Zeppieri
On Fri, Feb 15, 2019 at 11:50 PM David Storrs wrote: > > #lang racket > (require (for-syntax racket/syntax syntax/parse)) > > (define-syntax (struct++ stx) > (syntax-parse stx > [(_ name:id (field:id ...) (~optional (rule:expr ...)) opt ...) > #'(begin (struct name (field ...) opt

Re: [racket-users] Multipart HTTP requests

2019-01-30 Thread Jon Zeppieri
On Wed, Jan 30, 2019 at 6:46 AM Christopher Lemmer Webber < cweb...@dustycloud.org> wrote: > Jon Zeppieri writes: > > > On Tue, Jan 29, 2019 at 4:17 AM Christopher Lemmer Webber < > > cweb...@dustycloud.org> wrote: > > > >> > >> Any thou

Re: [racket-users] Multipart HTTP requests

2019-01-29 Thread Jon Zeppieri
On Tue, Jan 29, 2019 at 4:17 AM Christopher Lemmer Webber < cweb...@dustycloud.org> wrote: > > Any thoughts on how I should move forward? I think that using a `data-procedure/c` of a particular sort should allow you to implement this without needing access to the struct internals or needing to

Re: [racket-users] Are the terms "function" and "procedure" synonymous in Racket?

2019-01-22 Thread Jon Zeppieri
> > [25 messages] > I think Wadler's Law needs an update. -- 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

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

Re: [racket-users] with-input-from-file question

2018-12-16 Thread Jon Zeppieri
On Sun, Dec 16, 2018 at 2:59 PM Jonathan Simpson wrote: > What is the difference between this code, which reads and returns "#lang" > from the file: > (define in-file (open-input-file "adventure.rkt")) > (parameterize ([current-input-port in-file]) (read-string 5)) > > and this code which

Re: [racket-users] JSON vs. normal Racket for simple serialization to database

2018-12-12 Thread Jon Zeppieri
Postgres can index jsonb column data. Also, other languages will have an easier time reading it. If neither of those matter for your case, then no. - Jon On Wed, Dec 12, 2018 at 10:26 AM Brian Adkins wrote: > I have some simple serialization needs. In Ruby, I would always serialize > an

Re: [racket-users] Struct initialization?

2018-03-09 Thread Jon Zeppieri
On Fri, Mar 9, 2018 at 9:35 PM, Kevin Forchione wrote: > Is it possible to initialize a struct field based on values from > previously defined fields? Something equivalent to let* where > > >(struct foo (A B C)) > >(foo 1 2) would produce (foo 1 2 3) for

Re: [racket-users] struct question

2018-03-07 Thread Jon Zeppieri
On Wed, Mar 7, 2018 at 9:27 PM, Kevin Forchione wrote: > Hi guys, > Can we associate more than 1 generic with a struct? Something like: > > (struct foo (..) #:methods gen:bar [] gen:baz [] …) > > > Yes, except it's: (struct foo (..) #:methods gen:bar [] #:methods gen:baz []

Re: [racket-users] The Birth and Death of Units

2018-01-22 Thread Jon Zeppieri
There's also Backpack, which adds something similar to ML's module system* to Haskell, except at the package level: https://plv.mpi-sws.org/backpack/backpack-paper.pdf * It's more similar to Rossberg & Dreyer's MixML than it is to Standard ML or OCaml's module systems. On Mon, Jan 22, 2018 at

Re: [racket-users] Racket Echo Server/Client hanging

2017-12-05 Thread Jon Zeppieri
On Wed, Dec 6, 2017 at 12:13 AM, Vishal Prasad wrote: > And this is the client: > > > (define (hello_socket port) > (define-values (in out) (tcp-connect "localhost" port)) > (write "hello socket world\n" out) > (display (read in))) > > > The client does not

Re: [racket-users] Plumbum for racket

2017-10-24 Thread Jon Zeppieri
Featured at the recent RacketCon: http://docs.racket-lang.org/rash@rash/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

Re: [racket-users] Science graphics with Racket?

2017-10-23 Thread Jon Zeppieri
On Mon, Oct 23, 2017 at 3:04 PM, Lawrence Bottorff wrote: > I'd like to use Racket to generate scalable (svg?) graphics like gnuplot or > GeoGebra does. For example, I'd like to create a cartesian coordinate graph > system, then draw functions on it. One thing in particular

Re: [racket-users] How to identify the target of a symlink?

2017-09-28 Thread Jon Zeppieri
https://docs.racket-lang.org/reference/Manipulating_Paths.html?q=resolve-path#%28def._%28%28quote._~23~25kernel%29._resolve-path%29%29 On Thu, Sep 28, 2017 at 5:50 PM, David Storrs wrote: > The link-exists? function will tell me that something is a symlink. > How do I

Re: [racket-users] "<>&" in script xexprs

2017-09-19 Thread Jon Zeppieri
I haven't tried this, but I think that script source should be in a cdata structure [http://docs.racket-lang.org/xml/index.html?q=xexpr#%28def._%28%28lib._xml%2Fmain..rkt%29._cdata%29%29] to prevent the behavior you're seeing. -J On Tue, Sep 19, 2017 at 4:36 PM, Byron Davies

Re: [racket-users] Re: Do futures actually work? What are they useful for?

2017-09-11 Thread Jon Zeppieri
> On Sep 11, 2017, at 6:39 PM, mrmyers.random.suf...@gmail.com wrote: > > As far as I'm aware, futures usually shouldn't improve performance outside of > networking or hardware-latency type situations. The main goal of futures is > just time-sharing, not improving performance. It doesn't

Re: [racket-users] Racket Web servlet performance benchmarked and compared

2017-09-10 Thread Jon Zeppieri
On Sat, Sep 9, 2017 at 6:25 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > It looks like after roughly 2^14 requests are > `accept`-ed, there's a *long* delay before the next one succeeds. Okay, the above happens when the host runs out of ephemeral ports. So, not a big deal. --- My t

Re: [racket-users] Racket Web servlet performance benchmarked and compared

2017-09-09 Thread Jon Zeppieri
On Sat, Sep 9, 2017 at 8:05 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > On Sat, Sep 9, 2017 at 7:52 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: >> >> It does seem odd, though, that the server seems to *favor* sending >> ACKs to clients it can't service o

Re: [racket-users] Racket Web servlet performance benchmarked and compared

2017-09-09 Thread Jon Zeppieri
On Sat, Sep 9, 2017 at 7:52 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > > It does seem odd, though, that the server seems to *favor* sending > ACKs to clients it can't service over responding to the ones it can. No, there has to be something else wrong. The tcpdump output sh

Re: [racket-users] Racket Web servlet performance benchmarked and compared

2017-09-09 Thread Jon Zeppieri
On Sat, Sep 9, 2017 at 6:25 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > When I ran experiments similar to yours on OS X I saw some odd > scheduling behavior. It looks like after roughly 2^14 requests are > `accept`-ed, there's a *long* delay before the next one succeed

Re: [racket-users] Racket Web servlet performance benchmarked and compared

2017-09-09 Thread Jon Zeppieri
When I ran experiments similar to yours on OS X I saw some odd scheduling behavior. It looks like after roughly 2^14 requests are `accept`-ed, there's a *long* delay before the next one succeeds. It appears that the program is `poll`-ing, waiting for activity, but, for whatever reason, it doesn't

Re: [racket-users] Re: Racket Web servlet performance benchmarked and compared

2017-09-07 Thread Jon Zeppieri
On Thu, Sep 7, 2017 at 4:52 PM, dbohdan wrote: > > In both cases the ordering is still "single" > "many" > "places" > > "many-places". Though "many" and "places" are pretty close in the first case, > "many" consistently comes out ahead if you retest. This is really

Re: [racket-users] Re: Racket Web servlet performance benchmarked and compared

2017-09-04 Thread Jon Zeppieri
On Tue, Sep 5, 2017 at 1:38 AM, dbohdan wrote: > > I've run the default benchmark with the new application, which I've dubbed > "racket-custom". (Actually, I had to make a tweak to the benchmark to > accommodate the number of requests it was fulfilling. It made

Re: [racket-users] Requiring module beneath top level?

2017-08-18 Thread Jon Zeppieri
On Fri, Aug 18, 2017 at 7:08 PM, wrote: > > Here is an idea of what a plugin registration function could look like: > > (define (load-plugins paths) > ;; Process one plugin at a time > (define (load-plugin path) > ;; Add the path (or its stem) to the

Re: [racket-users] Need help with parallelizing a procedure

2017-08-12 Thread Jon Zeppieri
On Sat, Aug 12, 2017 at 6:21 AM, Zelphir Kaltstahl wrote: > > ~~~ > (define (gini-index subsets label-column-index) > (for*/list ([subset (in-list subsets)] > [label (in-list (list 0 1))]) > (place pch >(place-channel-put pch (list

Re: [racket-users] Get number of CPUs / Cores

2017-08-08 Thread Jon Zeppieri
On Tue, Aug 8, 2017 at 4:56 PM, Zelphir Kaltstahl wrote: > I want to parallelize some program using places, so actually using multiple > cores. > > To parallelize as much as possible on any given machine, I'd like to know how > many cores + effect of hyperthreading

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Jon Zeppieri
You can get better performance out of the recursive function by using car/cdr instead of first/rest; first/rest require their arguments to be lists, whereas car/cdr require theirs to be pairs, which is a lot cheaper to check. Also, using an optional argument (in a loop, especially) makes a

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-27 Thread Jon Zeppieri
On Thu, Jul 27, 2017 at 4:01 PM, Zelphir Kaltstahl wrote: > Wow, are those timings for the "big" data set?! > Unless I'm mistaken, Daniel's times are for 274 rows of the big data set, not the whole thing. -- You received this message because you are subscribed to

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Jon Zeppieri
On Mon, Jul 24, 2017 at 4:40 PM, Jay McCarthy wrote: > On Mon, Jul 24, 2017 at 3:18 PM, Alejandro Sanchez > wrote: >>> - I'm curious of the performance. In particular, I would expect that a >>> computed jump in unpack could do you good. Did you

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Jon Zeppieri
Just want to emphasize that the main source of inefficiency in your code is what I mentioned in my last message (iterating over the class labels of each row instead of the unique class labels of the entire data set). The second biggest factor is your structural recursion over a non-recursive

Re: [racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 10:09 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > > Even after implementing my own suggestions, it's still much slower > than the python example it was based. Maybe there's an algorithmic > problem somewhere (aside from the vector iteration I mentioned

Re: [racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl wrote: > Hi Racket Users, > > The last few days I've been working on implementing decision trees in Racket > and I've been following the following guide: >

Re: [racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 9:07 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: > Struct update does, however, involve a full copy[...] Err, immutable struct update, that is (in case it wasn't obvious). -- You received this message because you are subscribed to the Google Groups &quo

Re: [racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl wrote: > > How can I make my code more efficient, without changing the basic logic of it? > In addition to what I wrote before, there are a couple of places where you're constructing new lists when you don't need to.

Re: [racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 8:43 PM, David Storrs <david.sto...@gmail.com> wrote: > > > On Sun, Jul 23, 2017 at 8:05 PM, Jon Zeppieri <zeppi...@gmail.com> wrote: >> - Use a struct instead of a hash to represent a split. > > > Oh, are structs faster than has

Re: [racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl wrote: > Hi Racket Users, > > The last few days I've been working on implementing decision trees in Racket > and I've been following the following guide: >

Re: [racket-users] IO in racket is painful

2017-07-22 Thread Jon Zeppieri
On Sat, Jul 22, 2017 at 3:30 PM, David Storrs wrote: > > Alternatively, if 'match' made the results of a successful regexp test > available to the bodies on the RHS then you could do the same thing by > accessing the result list. Perhaps if match would allow the RHS to be

Re: [racket-users] for/list with in-parallel lists

2017-07-10 Thread Jon Zeppieri
On Tue, Jul 11, 2017 at 12:56 AM, Alex Knauth wrote: > > You can do this with the Generic Bind package [1]. Oh, this is very nice. Thank you. -J -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this

  1   2   3   >