simon_paul58
2021-1-13 09:46:22

@simon_paul58 has joined the channel


jestarray
2021-1-13 19:44:22

so i presume the snapshot builds (the x64 unspecified ) is cs?


jestarray
2021-1-13 19:44:25

samth
2021-1-13 20:05:33

Yes, unlabeled is CS


yilin.wei10
2021-1-13 22:19:56

In general are explicit exceptions or #f preferred? In the latter case, is there any good way to express multiple return values which can fail?


yilin.wei10
2021-1-13 22:20:25

i.e. I have a function which returns values or #f


soegaard2
2021-1-13 22:22:33

I think, it depends.

Regarding the last question, you can solve it by returning an extra value: (values success? value1 value2 ...) and then let the receiver check success? to see whether the values are valid.


soegaard2
2021-1-13 22:23:41

Or, if the returned values are related, introduce a struct to hold the answer.


soegaard2
2021-1-13 22:24:01

(and then skip using multiple values)


yilin.wei10
2021-1-13 22:24:02

Yeah - I guess it feels weird to return redundant values though.


soegaard2
2021-1-13 22:24:20

Yeah, not ideal.


yilin.wei10
2021-1-13 22:25:07

I think I prefer the struct/list approach. I think it conveys intent better (or exceptions).


laurent.orseau
2021-1-13 22:34:59

IMO: Choose exceptions if they are not meant to be handled, that is, the user should check themselves beforehand if the use case is valid. Otherwise return a specific value so the user can act depending on it.


laurent.orseau
2021-1-13 22:35:21

Exceptions signal abnormal behaviours


yilin.wei10
2021-1-13 22:44:18

It’s tricky - I think for functional code that makes perfect sense and the boundaries are clear. But I’m quite used to encoding failure states as data coming from other functional languages (say a file handle is missing, or some permissions issues).


yilin.wei10
2021-1-13 22:45:29

Typically it’s because I want to force the user to actually check the return value/handle the error. In Racket this feels less clear, because it’s not enforced at compile time anyway.


notjack
2021-1-13 22:59:02

Definitely use a struct to bundle the values together if you can (which is when the number of values is fixed and you can pick sensible names for the struct fields that would contain them)


jestarray
2021-1-13 23:05:02

is libracketcs_bq4bwg.dll in the lib folder when distributing an exe, supposed to be 38MB? i notice chezscheme executables are double that of bc(well, its adding +38MB)


yilin.wei10
2021-1-13 23:07:56

@notjack Is that with returning #f or throwing?


notjack
2021-1-13 23:08:09

Either way, honestly


notjack
2021-1-13 23:08:19

but especially when returning #f


yilin.wei10
2021-1-13 23:09:24

I guess the last part of it is that I lose the stack with #f , esp. if users aren’t careful.


jestarray
2021-1-14 00:46:35

is raco distribute working for those on cs snapshot?


jestarray
2021-1-14 00:50:02

nevermind, its working now


jestarray
2021-1-14 03:36:00

image=? seems to not be available in htdp2/image … is there another way to check if 2 images are the same?(cant import both htdp and htdp2) i presume i need to run them through a hash?


samth
2021-1-14 03:46:59

What do you want the comparison to do?


samth
2021-1-14 03:47:09

You can just use equal?


samth
2021-1-14 03:47:27

But that won’t often give the answer you want, probably


jestarray
2021-1-14 03:49:18

i want the comparison to check if two images are equal, has to be exactly equal


jestarray
2021-1-14 03:49:32

equal? is accurate enough?


jestarray
2021-1-14 03:53:29

seems like it works, thanks


d.zivertas
2021-1-14 07:47:35

@d.zivertas has joined the channel