endformationage has quit [Ping timeout: 240 seconds]
efm has joined #racket
sword865 has joined #racket
orivej has quit [Ping timeout: 265 seconds]
orivej has joined #racket
orivej has quit [Ping timeout: 268 seconds]
orivej has joined #racket
libertyprime has quit [Ping timeout: 268 seconds]
libertyprime has joined #racket
Codaraxis_ has quit [Read error: Connection reset by peer]
notzmv has joined #racket
orivej has quit [Ping timeout: 276 seconds]
orivej_ has joined #racket
dddddd has quit [Remote host closed the connection]
aidalgol has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 265 seconds]
Codaraxis_ has joined #racket
megeve has joined #racket
Codaraxis__ has joined #racket
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #racket
Codaraxis_ has quit [Ping timeout: 240 seconds]
FreeFull has quit []
libertyprime has quit [Quit: leaving]
lockywolf_ has joined #racket
lockywolf has quit [Ping timeout: 240 seconds]
sauvin has joined #racket
orivej_ has quit [Ping timeout: 240 seconds]
aidalgol has joined #racket
nullman has quit [Ping timeout: 250 seconds]
nullman has joined #racket
lockywolf_ has quit [Ping timeout: 265 seconds]
zipper has joined #racket
<zipper>
Hey, has anyone dealt with lazily reading a text file into memory?
<zipper>
Say in chunks
<zipper>
Brb please don't answer while I'm away
zipper has quit [Quit: WeeChat 2.6]
mzan has joined #racket
manualcrank has quit [Ping timeout: 265 seconds]
manualcrank has joined #racket
ZombieChicken has quit [Quit: WeeChat 2.6]
lockywolf has joined #racket
keep_learning has joined #racket
Codaraxis_ has joined #racket
Codaraxis__ has quit [Ping timeout: 240 seconds]
aidalgol has quit [Ping timeout: 268 seconds]
<bkhl>
Hah, this is IRC, we can answer while he's away and he'll never know. :-)
dddddd has joined #racket
manualcrank has quit [Quit: WeeChat 1.9.1]
lockywolf has quit [Ping timeout: 250 seconds]
sagax has quit [Ping timeout: 245 seconds]
Codaraxis_ has quit [Ping timeout: 240 seconds]
jmiven has quit [Quit: bye]
jmiven has joined #racket
ubLIX has joined #racket
iyzsong has joined #racket
ubLIX has quit [Client Quit]
ubLIX has joined #racket
ng0 has joined #racket
sagax has joined #racket
ng0 has quit [Ping timeout: 260 seconds]
cartwright has quit [Ping timeout: 260 seconds]
_whitelogger has joined #racket
dddddd has quit [Remote host closed the connection]
ng0 has joined #racket
orivej has joined #racket
lockywolf has joined #racket
lockywolf has quit [Remote host closed the connection]
lockywolf has joined #racket
sarna has joined #racket
<sarna>
hi! I just began learning and there's one thing that bothers me - a `string-length` function. why doesn't racket have a generic `length` function or something similar?
<sarna>
is there something interface-like or protocol-like in Racket?
<erkin>
Mostly for performance, I believe. You can of course write a generalised version of it.
<sarna>
erkin: I don't know how that'd look like though. check if the type has `typename-length` function, if yes, call it?
<erkin>
You're overthinking it. :-)
<sarna>
I think so too :)
<erkin>
One way to do it: (define (my-length x) (match x ((? string?) (string-length x)) ((? number?) (abs x)) ((? list?) (length x)) ...))
<sarna>
yes, but notice how I have to add a line for every possible type in existence
<erkin>
Yes, how else could you do it?
<erkin>
Protocols/interfaces work the same way.
<erkin>
If you want something more powerful for generic programming, I recommend looking at multimethods.
<sarna>
do they? with protocols you'd have the functions defined with every type (string's length definition would be in another place than list's length definition), here I have everything crumbled into one function
<sarna>
oh nice, that would work :) thanks
<erkin>
But you already have the functions defined with every type! Hence length for lists, string-length for strings!
<erkin>
You just need to implement dynamic dispatch for them.
<sarna>
yeah, and this part would be solved by protocols, wouldn't it?
<sarna>
I'm sorry, I'm new to lisps
<erkin>
Typechecking each time can be performance intensive at large scale, but okay, I concede. Racket does have interfaces. :-)
<sarna>
if I wanted top performance I'd be writing on #rust now :D
<erkin>
Hah
<erkin>
Note that you need to implement classes for your interface, and primitives aren't objects.
<sarna>
oh, that's a bummer
<erkin>
Racket's object system is heavily influenced by Smalltalk (where everything *is* an object), but most of Racket is cleanly separated from the object system.
<erkin>
You're most likely looking for multimethods, the Lisp way of doing things.
<erkin>
You can also check out Swindle, a Racket language, that deeply embeds multimethods into the language.
<erkin>
s/doing things/doing generics/
efm has quit [Read error: Connection reset by peer]
<erkin>
If you want to work with simple generics on structs without touching the object system, you can use racket/generic.
<sarna>
hm, is the OO variant of Racket popular?
<erkin>
Frankly speaking, I don't think it sees much use outside racket/gui (Racket's high-level library for graphical programs, entirely built upon the object system)
<erkin>
But it's pretty comprehensive and well-documented.
<erkin>
Functional programming without OO seems to be the most popular style amongst Racketeers.
<sarna>
glad to hear that - I'm trying to pick a lisp to learn and write some projects in, and I began to worry the Racket ecosystem might be too fragmented
<sarna>
there are so many implementations of Scheme already..
<erkin>
Yeah. :-(
<erkin>
Racket's core libraries are fortunately very tightly built.
<sarna>
Clojure seems to be popular and opinionated, but well, Java bleeds through :^)
<sarna>
cool!
sarna has quit [Remote host closed the connection]
vraid has joined #racket
lockywolf has quit [Ping timeout: 268 seconds]
efm has joined #racket
sword865 has quit [Quit: Connection closed for inactivity]
efm has quit [Ping timeout: 276 seconds]
iyzsong has quit [Ping timeout: 246 seconds]
lockywolf has joined #racket
endformationage has joined #racket
<jcowan>
I'm working on getting both multimethods (the best part of OO) and typeclasses (the best part of Haskell) into R7RS-large. Fortunately, multimethods don't require classes: they can be based on predicates alone.
<jcowan>
(plus a mechanism for declaring that one predicate subsumes another)
lockywolf has quit [Remote host closed the connection]
lockywolf has joined #racket
lockywolf has quit [Max SendQ exceeded]
lockywolf has joined #racket
efm has joined #racket
<erkin>
Bless
DGASAU has quit [Read error: Connection reset by peer]
mzan has quit [Ping timeout: 264 seconds]
DGASAU has joined #racket
casaca has quit [Ping timeout: 276 seconds]
lockywolf_ has joined #racket
casaca has joined #racket
lockywolf_ has quit [Remote host closed the connection]
lockywolf_ has joined #racket
lockywolf has quit [Ping timeout: 240 seconds]
ziyourenxiang_ has quit [Ping timeout: 276 seconds]
manualcrank has joined #racket
casaca has quit [Ping timeout: 268 seconds]
casaca has joined #racket
Codaraxis has joined #racket
vraid has quit [Quit: Leaving]
Codaraxis has quit [Ping timeout: 246 seconds]
<bremner>
jcowan: interesting, I never thought about dynamically typed typeclasses
pera has joined #racket
dddddd has joined #racket
mzan has joined #racket
orivej has quit [Ping timeout: 240 seconds]
FreeFull has joined #racket
orivej has joined #racket
<jcowan>
bremner: They are basically records of procedures that you pass explicitly, as opposed to Haskell's records of procedures that the compiler passes under the table.
<bremner>
how do I tell the difference between objects and typeclasses? lack of explicit state?
<jcowan>
We already have Comparator, which is Eq + Ord + Hashable, and I am planning Dictionary and Context (Functor + ApplicableFunctor + Monad) and possibly Monoid
<jcowan>
Yes. I think in Scheme there is no real point in a Typeclass class; all of them are completely sui generis.
Lowl3v3l has joined #racket
vraid has joined #racket
ng0 has quit [Ping timeout: 260 seconds]
ng0 has joined #racket
ubLIX has quit [Quit: ubLIX]
tumdum has joined #racket
tumdum has quit [Client Quit]
Codaraxis has joined #racket
ubLIX has joined #racket
Codaraxis has quit [Ping timeout: 240 seconds]
Codaraxis has joined #racket
aidalgol has joined #racket
teardown has quit [Read error: Connection reset by peer]
teardown has joined #racket
teardown has quit [Read error: Connection reset by peer]
teardown has joined #racket
teardown has quit [Read error: Connection reset by peer]
teardown has joined #racket
teardown has quit [Read error: Connection reset by peer]
teardown has joined #racket
jao has joined #racket
efm has quit [Ping timeout: 240 seconds]
efm has joined #racket
ng0 has quit [Quit: Alexa, when is the end of world?]