samth changed the topic of #racket to: Racket v7.6 has been released: https://blog.racket-lang.org/2020/02/racket-v7-6.html -- Racket -- https://racket-lang.org -- https://pkgs.racket-lang.org -- Paste at http://pasterack.org
rmnull has quit [Quit: WeeChat 2.7.1]
wingsorc has quit [Quit: Leaving]
aeth has quit [Ping timeout: 265 seconds]
aeth has joined #racket
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
Sgeo__ has quit [Read error: Connection reset by peer]
Sgeo has joined #racket
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
aidalgol has joined #racket
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
ArthurStrong has quit [Quit: leaving]
orivej_ has joined #racket
orivej has quit [Read error: Connection reset by peer]
pilne has quit [Quit: Hello, 911? Yeah, it's caught in the window this time.]
orivej_ has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
Sgeo_ has joined #racket
Sgeo has quit [Ping timeout: 250 seconds]
Sgeo__ has joined #racket
Sgeo_ has quit [Ping timeout: 264 seconds]
narimiran has joined #racket
dddddd has quit [Ping timeout: 265 seconds]
sauvin has joined #racket
<lavaflow> I have a list of fixnums, and want to serialize it to a byte string as fast as possible. how might I go about doing that?
<lavaflow> I could use s-exp->fasl, but I feel like that's not the fastest for this specialized case
<lavaflow> ideally I think I'd like a length prefixed bytes. first octlet being the length and subsequent octlets for each fixnum
<lavaflow> I see there's fxvector, but I don't see any way to serialize these
Naptra has joined #racket
teardown has joined #racket
nullcone has quit [Quit: Connection closed for inactivity]
meimeix has quit [Ping timeout: 258 seconds]
pounce has quit [Ping timeout: 260 seconds]
BitPuffin has quit [Quit: killed]
setthemfree[m] has quit [Quit: killed]
olavx200 has quit [Quit: killed]
juanfra_ has quit [Quit: killed]
laduke has quit [Ping timeout: 252 seconds]
laduke has joined #racket
olavx200 has joined #racket
Codaraxis has quit [Read error: Connection reset by peer]
Codaraxis has joined #racket
notzmv has quit [Ping timeout: 258 seconds]
ski has quit [Read error: Connection reset by peer]
notzmv has joined #racket
mingy has joined #racket
setthemfree[m] has joined #racket
BitPuffin has joined #racket
juanfra_ has joined #racket
vraid has joined #racket
jellie has joined #racket
sagax has quit [Read error: Connection reset by peer]
jellie has quit [Read error: Connection reset by peer]
jellie has joined #racket
jellie has quit [Ping timeout: 265 seconds]
urbanslug has joined #racket
selimcan has joined #racket
urbanslug has quit [Ping timeout: 240 seconds]
urbanslug has joined #racket
Ven`` has joined #racket
urbanslug has quit [Ping timeout: 240 seconds]
urbanslug has joined #racket
adamgolding has joined #racket
<mingy> what is "Program Contour"?
<mingy> in DrRacket
ArthurStrong has joined #racket
<mingy> I know,thanks
urbanslug has quit [Ping timeout: 264 seconds]
KDr24 has joined #racket
adamgolding has quit [Remote host closed the connection]
KDr23 has quit [Ping timeout: 265 seconds]
mingy has quit [Ping timeout: 250 seconds]
laduke has quit [Ping timeout: 240 seconds]
urbanslug has joined #racket
laduke has joined #racket
urbanslug has quit [Ping timeout: 264 seconds]
YuGiOhJCJ has joined #racket
dddddd has joined #racket
iyzsong has joined #racket
sagax has joined #racket
MustardCheese has joined #racket
urbanslug has joined #racket
FreeFull has quit [Quit: rebooting]
k_sze has quit [Quit: ZNC 1.7.5 - https://znc.in]
k_sze has joined #racket
urbanslug has quit [Ping timeout: 240 seconds]
urbanslug has joined #racket
FreeFull has joined #racket
ArthurStrong has quit [Quit: leaving]
urbanslug has quit [Ping timeout: 258 seconds]
urbanslug has joined #racket
urbanslug has quit [Ping timeout: 256 seconds]
urbanslug has joined #racket
urbanslug has quit [Ping timeout: 260 seconds]
true-grue has joined #racket
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
efm has joined #racket
Ven`` has joined #racket
lockywolf has joined #racket
iyzsong has quit [Ping timeout: 240 seconds]
<wild_buffalo> Is there a shorthand define for case-lambda?
<jcowan> A case-define would be easy to write.
<wild_buffalo> jcowan: what do you mean? I'm new with Racket. Is that a pre-built form or are you suggesting I write one that has that functionality?
real-grue has joined #racket
true-grue has quit [Read error: Connection reset by peer]
<jcowan> The latter (with help, of course; writing macros is a serious endeavor)
<wild_buffalo> Ah OK. Well I don't particularly need that functionality, using case-lambda is fine, it was more of a curiosity.
<jcowan> Until you feel comfortable with run-time-level programming, I wouldn't advise adding new syntax.
YuGiOhJCJ has quit [Ping timeout: 240 seconds]
<wild_buffalo> jcowan: agreed. I was mostly just curious if there was a shorthand for it.
<jcowan> It's just that in the Lisp languages we *can* add new syntax easily compared to cracking open a C compiler, say, and adding new syntax there.
cartwright has quit [Ping timeout: 240 seconds]
efm has quit [Quit: Konversation terminated!]
<MustardCheese> Isn't there define/match ?
YuGiOhJCJ has joined #racket
cartwright has joined #racket
<bremner> yes. but I believe case-lambda is more general
<bremner> define/match has a fixed set of arguments that match clauses are tried against, right?
<MustardCheese> This is true. I've just been experimenting with it
<MustardCheese> Match asks you to define the arguments before you can use them, while case-lambda happily lets you declare the arguments in the pattern
Sgeo__ has quit [Ping timeout: 264 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
sarna has joined #racket
vraid has quit [Quit: Leaving]
pilne has joined #racket
orivej has quit [Ping timeout: 256 seconds]
Sgeo has joined #racket
efm has joined #racket
efm has quit [Ping timeout: 240 seconds]
orivej has joined #racket
acarrico has quit [Quit: Leaving.]
orivej_ has joined #racket
orivej has quit [Read error: Connection reset by peer]
real-grue has quit [Quit: Leaving]
<samth> lavaflow: I think the code for fixnums in sexp->fasl is probably the right thing to use
<samth> I doubt the dispatch overhead there will be that significant, but you could measure
<samth> wild_buffalo: most of the time, just using optional and keyword arguments is enough
Ven`` has quit [Quit: Textual IRC Client: www.textualapp.com]
MustardCheese|2 has joined #racket
MustardCheese has quit [Ping timeout: 256 seconds]
pilne has quit [Ping timeout: 240 seconds]
hagenek has joined #racket
<hagenek> Hi. I have found something strange. When I define a function like this, I cannot retrieve it's value in the REPL:
<hagenek> (define vec2 (make-vector 3))(define (vec3 v) (vector-set! vec2 1 v))
<hagenek> Nvm I saw my fault now
<hagenek> I am updating the vec2 by doing this. Now I felt stupid
endformationage has joined #racket
* jcowan wishes we had put case-define into R7RS instead of case-lambda
<jcowan> with case-define, a self-call to another case can be implemented as a tail call; with case-lambda, not.
<jcowan> s/tail call directly to the branch/
<samth> jcowan: I don't see why it can't be done with case-lambda
<jcowan> Because an anonymous case-lambda has no name by which such tail calls can be made.
<samth> but (define f (case-lambda [(a) (f a #f)] [(a b) ... stuff ...])) can be compiled the same way
sauvin has quit [Read error: Connection reset by peer]
MustardCheese|2 has quit [Ping timeout: 264 seconds]
<hagenek> Will this function have performance issues on long vectors?
<hagenek> (define (vector-assoc v vec) (letrec ([f (lambda (n) (if (equal? n (+ (vector-length vec) 1)) #f (if (pair? (vector-ref vec n)) (if (equal? (car (vector-ref vec n)) v) (vector-ref vec n) (f (+ n 1))) (f (+ n 1)))))]) (f 0)))
<hagenek> Is there a better way to paste code?
<hagenek> Yeah I found it, cool site actually :)
<hagenek> I love Racket, really neat language
<samth> hagenek: that function will take time proportional to the lentgth of the vector
<hagenek> yeah I smelled trouble when I saw that I called twice..
<samth> probably better to use a hash in most cases
<hagenek> Is it possible to fix with an accumulator? To make it tail-recursive
<hagenek> How would I do it with using a hash?
<bremner> immutable hashes work fine as accumulators
<bremner> (or mutable ones, but not needed usually)
<bremner> think of it like using a list as an accumulator, and replacing cons with hash-set
<jcowan> samth: No, not safely, because if f is global, there is no guarantee that f will have the same value at the time it is applied as at the point of definition.
<samth> jcowan: fortunately in racket this is easy to check
<jcowan> Providing define-immutable would also work.
<jcowan> (How do you check?)
aidalgol has quit [Read error: Connection reset by peer]
<samth> jcowan: all `set!` to a module-top-level variable must be within that module
<jcowan> True. So it's the REPL that creates the problem, as is often the case.
<samth> in this case, "optimizing" the top-level is a non-problem
* jcowan nods
orivej_ has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #racket
aidalgol has joined #racket
MustardCheese|2 has joined #racket
sagax has quit [Read error: Connection reset by peer]
efm has joined #racket
sagax has joined #racket
wingsorc has joined #racket
narimiran has quit [Ping timeout: 256 seconds]
nullcone has joined #racket
catonano has joined #racket
true-grue has joined #racket
catonano has quit [Quit: catonano]
<setthemfree[m]> Hi everyone. I'm a bit divided between using let* and define inside a function definition; define somehow make the code look procedural while let* more functional; but are there any recommendations on when to use each form within functions?
<aeth> I just always use internal lets/etc. because it makes the scope explicit.
<samth> setthemfree[m]: the usual racket style is to use internal `define`
<setthemfree[m]> samth: I remember reading it in somewhere in the manual; however it seems to me that there's some implicit difference in how define vs let communicate their purposes to the person reading the code later
<samth> setthemfree[m]: that isn't how I read them
<samth> but of course everyone has their own style preferences
<setthemfree[m]> samth: I'm curious what you think about the following example
<setthemfree[m]> let's say there is a function that does a HTTP request for some API
<setthemfree[m]> inside the function there are things in the beginning that are `define`d, for instance the query string is constructed from the function arguments
<setthemfree[m]> then it proceeds with the HTTP request and starts to exctract some information from the response, perhaps by looking into the JSON structure
<setthemfree[m]> would you use defines down the road when you are processing the response data? like `(define response ...) (define relevant1 (hash-ref ...)) (define relevant2 (hash-ref ...))`?
<jcowan> setthemfree[m]: internal define is not quite let*, it is letrec*.
<samth> setthemfree[m]: yes, usually, if I was binding them
<setthemfree[m]> samth: okay, thanks!
<setthemfree[m]> jcowan: thanks for clarifying.
<setthemfree[m]> I guess maybe my problem is not the `defines` themselves but that I'm writing procedural code:)
<setthemfree[m]> And I have the terminology mixed up
<setthemfree[m]> Sorry
Naptra has quit [Remote host closed the connection]
rmnull has joined #racket
rmnull has quit [Client Quit]
efm has quit [Ping timeout: 256 seconds]
efm has joined #racket
Sgeo_ has joined #racket
lavaflow has quit [Ping timeout: 240 seconds]
lavaflow has joined #racket
jboy has quit [Quit: bye]
Sgeo has quit [Ping timeout: 256 seconds]
hagenek has quit [Remote host closed the connection]
jboy has joined #racket
pilne has joined #racket
urbanslug has joined #racket
wingsorc has quit [Quit: Leaving]
urbanslug has quit [Ping timeout: 265 seconds]
urbanslug has joined #racket
MustardCheese|2 has quit [Quit: Quit]
urbanslug has quit [Read error: Connection reset by peer]
true-grue has quit [Read error: Connection reset by peer]
Sgeo__ has joined #racket
Sgeo_ has quit [Ping timeout: 260 seconds]
lockywolf has quit [Ping timeout: 265 seconds]
jhei has joined #racket
epony has quit [Quit: reconf]
epony has joined #racket