samth changed the topic of #racket to: Racket v7.9 has been released: https://blog.racket-lang.org/2020/11/racket-v7-9.html -- Racket -- https://racket-lang.org -- https://pkgs.racket-lang.org -- Paste at http://pasterack.org
rgherdt has quit [Ping timeout: 272 seconds]
richbridger has quit [Remote host closed the connection]
richbridger has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
mirrorbird has quit [Ping timeout: 272 seconds]
badkins has quit [Ping timeout: 246 seconds]
phillbush has joined #racket
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 240 seconds]
acarrico has quit [Ping timeout: 240 seconds]
phillbush has quit [Quit: Leaving]
orivej_ has quit [Ping timeout: 240 seconds]
aquijoule_ has joined #racket
richbridger has quit [Ping timeout: 265 seconds]
orivej has joined #racket
catt has joined #racket
orivej has quit [Ping timeout: 240 seconds]
mzan has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
mzan has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 240 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 265 seconds]
juanfra has quit [Ping timeout: 256 seconds]
juanfra has joined #racket
cubik has joined #racket
catt has quit [Ping timeout: 240 seconds]
badkins has joined #racket
cubik has quit [Quit: Leaving.]
badkins has quit [Ping timeout: 256 seconds]
aeth has quit [Ping timeout: 264 seconds]
aeth has joined #racket
orivej has joined #racket
mirrorbird has joined #racket
cubik has joined #racket
rgherdt has joined #racket
badkins has joined #racket
juanfra has quit [Ping timeout: 256 seconds]
juanfra has joined #racket
badkins has quit [Ping timeout: 264 seconds]
cubik has quit [Quit: Leaving.]
rgherdt has quit [Remote host closed the connection]
cubik has joined #racket
gpanders_ has quit [Quit: ZNC - https://znc.in]
gpanders has joined #racket
mirrorbird has quit [Quit: Leaving]
orivej has quit [Ping timeout: 256 seconds]
Major_Biscuit has joined #racket
Major_Biscuit has quit [Ping timeout: 240 seconds]
Sgeo has quit [Read error: Connection reset by peer]
landakram has joined #racket
Major_Biscuit has joined #racket
landakram has quit [Ping timeout: 240 seconds]
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
badkins has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
Major_Biscuit has quit [Ping timeout: 264 seconds]
Lowl3v3l has quit [Remote host closed the connection]
Lowl3v3l has joined #racket
Major_Biscuit has joined #racket
FreeFull has joined #racket
Major_Biscuit has quit [Ping timeout: 240 seconds]
mirrorbird has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 240 seconds]
phillbush has joined #racket
badkins has joined #racket
rgherdt has joined #racket
badkins has quit [Ping timeout: 265 seconds]
orivej has joined #racket
acarrico has joined #racket
nperez has quit [Ping timeout: 272 seconds]
badkins has joined #racket
mirrorbird has quit [Remote host closed the connection]
gpanders has quit [Quit: ZNC - https://znc.in]
orivej has quit [Ping timeout: 240 seconds]
gpanders has joined #racket
gpanders has quit [Client Quit]
gpanders has joined #racket
aeth has quit [Ping timeout: 240 seconds]
aeth has joined #racket
orivej has joined #racket
nperez has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 246 seconds]
sschwarzer has joined #racket
<sschwarzer> Hi, I'm quite new to Racket. I have a struct with eight fields, but at the start of development I don't need to populate all of them. As I understand the documentation, however, I have to supply all arguments. Is there a way to create a struct value without specifying all fields?
<sschwarzer> It would be ok if the non-specified field would be populated with a default value.
<sschwarzer> I found https://www.greghendershott.com/2015/07/keyword-structs-revisited.html , which would help. But I wonder if there's meanwhile something like this in the standard library (or installable with `raco pkg`).
juanfra has quit [Remote host closed the connection]
juanfra has joined #racket
<dzoe> sschwarzer: https://docs.racket-lang.org/reference/define-struct.html?q=struct#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct%29%29
<dzoe> sschwarzer: look at #:auto-value and #:auto
<dzoe> (first one is struct option, second one is field option)
<dzoe> Or, of course, you can make your own constructor which provides reasonable defaults which suit your needs.
<dzoe> jcowan: I doubt it - OTOH, I would LOVE to see unboxed single-flonums atomic type, but I do not think it's feasible
<dzoe> (On 64bit platforms it is probably possible to hack it relatively easily)
<sschwarzer> dzoe: My understanding is that #:auto means that I can't optionally specify a value. ...
badkins has joined #racket
<sschwarzer> I'm still trying to figure out how to use #:auto-value
<sschwarzer> #:auto-value specifies a value for all #:auto fields, doesn't it?
<jcowan> dzoe: I am seeing more and more Schemes that are strictly 64-bit
<dzoe> Oh, I completely forgot. Yeah, you are right.
<dzoe> sschwarzer: So a custom constructor should do the trick.
<sschwarzer> dzoe: I'll probably go with the custom constructor function.
<sschwarzer> dzoe: yes, thank you! :-)
<sschwarzer> I'll give it a try.
FreeFull has quit []
<dzoe> jcowan: It makes certain things easier - that's true, but still I have to think about my 16-bit days and wonder where it all went wrong :)
<sschwarzer> dzoe: :-D
<jcowan> You know the wisecrack about Windows 95?
<dzoe> jcowan: nope, what's that?
<dzoe> (Truth is, I was mostly using DOS back then and used Win98 as nice DPMI extender)
<jcowan> "A 32-bit extension to a 16-bit patch for an 8-bit OS designed originally for a 4-bit machine by a 2-bit company that doesn't care 1 bit about its users."
<dzoe> Ah this thing ;-)
<dzoe> Well... 4004 -> 8008 -> 8080 -> 8088 -> 8086 -> 80286 (forget about XT) -> 80386 -> 80486 (CMPXCHG)
<dzoe> That's roughly the history, isn't it?
<jcowan> anyway, I do not have Racket CS installed yet, which is why I am asking about whether there are single-floats and if so how they are integrated.
<jcowan> Correct.
<dzoe> I really think they are deprecated for good.
<jcowan> The 8086 was just a version of the 8088 with an 8-bit external bus
<jcowan> no, vice versa
<dzoe> I had a 80286 with 80287 and hardware EMS!
<dzoe> I think it still lurks somewhere in my attic.
<jcowan> I used one at work, but never owned one. It ran Xenix System III.
<jcowan> And a 10 MB hard drive! (it was an IBM PC-AT)
<jcowan> I knew if I programmed for a lifetime I'd never fill that up.
<dzoe> Btw, why do you need single flonums? The requirements are SSE2+ anyway.
<jcowan> I don't personally, but as the chair of the current R7RS-large standards process, I keep track of a lot of Schemes, and of course Racket is very important.
<jcowan> Once I had an idea for using IEEE-style 8-bit floats in bytevectors, scaled so that all the values are integral. You get from 0 to 122880 (positive or negative) plus the usual +inf.0, -inf.0, and +nan.0.
<jcowan> But it didn't come to anything
<dzoe> Well, 8 bits feel really too little.
<dzoe> Yet, the ability to divide by zero is useful for many applications.
<jcowan> The idea was to use it to store instrument observations very compactly (an observation is inherently inexact).
<sschwarzer> What is an idiomatic way in Racket to specify an unset/unknown value in a struct? For example, should I use #f , #<void> or an "empty"/"zero" value for the data type that a field would have if normally populated?
<sschwarzer> I guess #<void> would express best that the field value isn't specified. #f would "only" work that way for non-bool fields.
<dzoe> sschwarzer: #f is pretty common for non-boolean fields as you can easily test for it.
<sschwarzer> dzoe: Ok, that's why I was thinking of #f :)
<jcowan> I would stay away from #<void> altogether
<jcowan> If you really might have any Scheme object in your data structure, you could use the Maybe/Either SRFI or do a poor man's Maybe (data is in the car of a cons, non-data is #f)
<sschwarzer> dzoe: What about boolean fields? (Doesn't apply for me right now, because I have only one boolean field and #f should work well as a default)
<sschwarzer> jcowan: I guess I'll use #f at the moment. I'm trying to find a balance to do everything "right" vs. overwhelm me with too many details and never finish my first program. XD
<dzoe> sschwarzer: in those (rare) cases when you really need it, jcowan's suggestion would be probably the best choice
<dzoe> Honestly - I can't think of an occassion when I couldn't use #f.
<jcowan> In the cases where you can't because the field is (implicitly) boolean, you can use #t, #f, 'unknown or whatever. It's the problem of NULL, over which relational database heads have been fighting for 30 years.
<jcowan> And Maybe Bool is the very worst case, because it tosses you from nice easy 2-value logic to messy, horrible 3-value logic
<sschwarzer> dzoe: You mean any of the "Maybe/Either" or the cons approaches?
<sschwarzer> jcowan: right about the 3-value logic
<sschwarzer> jcowan: using a symbol is also interesting
nperez has quit [Ping timeout: 264 seconds]
<jcowan> Unfortunately IMAO, Scheme says everything is truthy except #f, whereas I take the Java viewpoint: #t is truthy, #f is falsy, and anything else is a type exception.
<sschwarzer> jcowan: I think if I needed a proper API for such a query (and not just internally or for a test), I imagine it would be best to not expose the special value but instead provide a predicate function.
<sschwarzer> Is there a way to run test suites with `raco test`? I. e. not calling `(run-tests)` explicitly?
<jcowan> Absolutely. You can also make a guaranteed unique value with (string-copy "unknown") at the top level
<sschwarzer> jcowan: regarding truthy and falsy, the Scheme behavior is probably still better than Python's rules for truthy/falsy values. :-D
<jcowan> Ghu yes. Not to mention JavaScript's infamous ==, which is (I can hardly bear to type this) NOT EVEN TRANSITIVE
<sschwarzer> But right, raising a type exception would have been reasonable, too.
<jcowan> Fortunately JS hs ===, which is eqv? and works fine.
<sschwarzer> jcowan: Same for Python's `==` if one of the objects is of a custom class and you have defined `__eq__`. (Or actually more complicated; it would be too cumbersome to describe the rules. :) )
<sschwarzer> I'm most experienced with Python (20 years), but also programmed in a dozen other languages over time.
<jcowan> Yes, which means it can be asymmetric. But at least sufficient caution will eliminate that problem.
nperez has joined #racket
<sschwarzer> I looked into Haskell a few years ago, as my first functional language. Somehow I stopped using it after half a year or so (after working throughh about half of "Learn you a Haskell for great good"). Now, since a month or so ago, I started looking into Scheme, or rather mostly/specifically Racket.
<jcowan> The first rule of Functional Language Club is that you don't *have* to wear the hair shirt, but it may be helpful.
<sschwarzer> I'm still not sure if I prefer statically or dynamically typed languages. :-)
<jcowan> Good, that's the right place to be IMAO
<sschwarzer> jcowan: What's a/the "hair shirt"?
<jcowan> Of immutability and laziness.
<jcowan> Haskell is actually divided into a pure language and an impure language (pure languages can't actually do anything), but in what I consider a messy way. If they just said "We are going to have two sublanguages, and here they are", things would be far less confusing.
<jcowan> (There is an article which claims that C is as pure as Haskell, for nobody programs in C. They program in C + preprocessor, where C is the impure part and the preprocessor is the pure part. It's just that you can't do very much in the preprocessor.){
mirrorbird has joined #racket
<sschwarzer> Re Haskell: I liked it initially, but after some time I had the impression that the complexity of the language (for me) wasn't a good enough tradeoff for the gains from this complexity. So I was looking for a simpler functional language. And I was "always" curious to look into Lisp.
<sschwarzer> Still, Haskell introduced me to FP and I liked it. :)
<sschwarzer> (FP)
<jcowan> Racket certainly has all the tools for FP; you just have to avoid stuff ending in ! (to a first approximation).
<sschwarzer> jocowan: Yes, that's my impression.
<sschwarzer> I try to work as "functional" as possible. Let's see how successful I'll be. ;-)
cubik has quit [Quit: Leaving.]
<sschwarzer> jcowan: I looked through the slides and still don't know what the hair shirt is. Update: I found it out ... https://idioms.thefreedictionary.com/a+hair+shirt . I didn't know the expression before.
<jcowan> Oh, okay, I didn't know that you didn't know the general idiom, I thought you wanted to know how it applied to Haskell programming.
<sschwarzer> I guess both in hindsight :)
<sschwarzer> No problem
<sschwarzer> For how long have you all been using Racket?
endformationage has joined #racket
Sgeo has joined #racket
<sschwarzer> Thanks for all your feedback. Bye for now! :-)
sschwarzer has quit [Quit: leaving]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 264 seconds]
badkins has joined #racket
Lowl3v3l has quit [Ping timeout: 264 seconds]
mirrorbird has quit [Ping timeout: 272 seconds]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
notzmv has quit [Remote host closed the connection]
notzmv has joined #racket
notzmv has quit [Remote host closed the connection]
badkins has quit [Ping timeout: 265 seconds]
notzmv has joined #racket
aeth has quit [Ping timeout: 256 seconds]
notzmv has quit [Remote host closed the connection]
aeth has joined #racket
notzmv has joined #racket
phillbush has quit [Quit: Leaving]
phillbush has joined #racket
rgherdt has quit [Ping timeout: 258 seconds]
aeth has quit [Ping timeout: 265 seconds]
aeth has joined #racket
phillbush has quit [Quit: Leaving]
badkins has joined #racket