rokitna
2021-3-17 07:03:37

Ordinal numbers are another (maybe related) example where the usual notions of + and * aren’t commutative.


jesse697
2021-3-17 07:30:23

@mflatt are there any health checks set up on the infrastructure as such? One could automatically check, for example, whether the disk is, say, more than 90% full and send mail if so. (More advanced would be to automatically rotate out a server that meets such a condition and replace it with a fresh one, but that’s more involved.)


jesse697
2021-3-17 07:33:54

Just a reminder that the next edition of Racketfest is just 9 days away! A ton of great speakers are lined up spanning a diverse range of Racket-y topics. Come join us next week! https://racketfest.com


laurent.orseau
2021-3-17 08:41:30

I was wondering what this #<procedure:>> was about :smile:


soegaard2
2021-3-17 08:57:44

Did “Home” and “End” keys always mean “start and end of line” respectively in DrRacket? I was expecting them to be bound to “start and end of buffer”.


soegaard2
2021-3-17 09:00:24

Or did I somehow mess up my system settings?


laurent.orseau
2021-3-17 09:04:03

That’s usually Ctrl-Home and Ctrl-End for start/end of buffer


soegaard2
2021-3-17 09:48:47

In both Pages and Emacs, Home and End behaves like this:


soegaard2
2021-3-17 09:48:59


spdegabrielle
2021-3-17 09:51:27

Notepad++ works differently As does ms word


spdegabrielle
2021-3-17 09:51:56

What does Emacs do? Or visual studio code ?


soegaard2
2021-3-17 10:02:34

https://code.visualstudio.com/docs/getstarted/keybindings But since this is probably a macOS vs Windows difference, Visual Studio might not be the best comparison :slightly_smiling_face:

Sublime Text: https://coderwall.com/p/upolqw/fix-sublime-text-home-and-end-key-usage-on-mac-osx

I guess, this is one of those things, where expectations differ.


spdegabrielle
2021-3-17 10:26:50

I think it is one of those things that vary by ide


soegaard2
2021-3-17 11:35:49

soegaard2
2021-3-17 11:36:02

mflatt
2021-3-17 11:58:24

Currently, for the pkg-build service, there’s just a heartbeat registered after finishing each run.


jesse697
2021-3-17 13:14:20

Perhaps that step could incorporate the check that I have in mind (suspiciously low disk capacity)


greg
2021-3-17 13:41:36

@badkins Yes I’d say that team/project size and modularization is a more basic thing to figure out, first. Then within each team/piece, static vs. dynamic can be an interesting and worthwhile discussion.


greg
2021-3-17 13:46:50

Ideally you want changing the code to be safe, and easy, both.


greg
2021-3-17 13:48:00

Or I guess “more ideally” there’s the view that you never change existing code — just add more code.


greg
2021-3-17 13:48:50

Insert “You can’t break code if you never change it” <img src=tap-forehead-meme.jpg>.


greg
2021-3-17 13:57:06

> What does Emacs do? Whatever you want it to do. :smile:

Seriously for me Home is bound to move-beginning-of-line, which I think is a default binding, at least in programming mode buffers.

Having said that my muscle memory is now C-a for beginning of line and M-< for beginning of buffer (also default bindings).


greg
2021-3-17 13:58:58

Oh, hah, but C-a is bound for me to a little function I cribbed from someone, gh/smarter-move-beginning-of-line, which either moves to the start of indentation on a line, or if already there, then to the first column. So “whatever you want it to do” is I guess the correct as well as the jokey answer. :slightly_smiling_face:


spdegabrielle
2021-3-17 13:59:31

Lol


mdconn_uk
2021-3-17 14:14:21

@mdconn_uk has joined the channel


samth
2021-3-17 15:52:55

@laurent.orseau copy and paste


laurent.orseau
2021-3-17 15:53:35

yeah I figured :slightly_smiling_face: Funny the repl is ‘resilient’ to this :slightly_smiling_face:


samdphillips
2021-3-17 17:31:08

All I know is that MacOS does it wrong (different than Linux and Windows) by default.


sorawee
2021-3-17 18:11:51

You have Home and End in Mac?


sorawee
2021-3-17 18:12:13

My Mac doesn’t have those keys, but it does have fn + left and fn + right which function as home and end


sorawee
2021-3-17 18:12:29

And they move the the beginning/end of line



soegaard2
2021-3-17 18:14:50

Not the exact model though.


soegaard2
2021-3-17 18:19:59

An old UNIX thing apparently. https://en.wikipedia.org/wiki/Home_key


tov
2021-3-17 18:51:57

remainder : quotient :: modulo : ???


tov
2021-3-17 18:52:11

(compose floor /) ?


soegaard2
2021-3-17 18:54:54

No, remainder, quotient and modulo.


tov
2021-3-17 18:58:53

What do you mean? I expect that for all integers n, m, (= m (+ (* n (quotient m n)) (remainder m n))) (= m (+ (* n (divide m n)) (modulo m n))) But so far as I can tell, there is no divide. And (= m (+ (* n (quotient m n)) (modulo m n))) has counterexamples.


soegaard2
2021-3-17 19:01:48

My guess at what you were asking were wrong. What was the original question?


soegaard2
2021-3-17 19:02:30

By :: do you mean divide?


tov
2021-3-17 19:02:54

No, by “A : B :: C : D” I mean “A is to B as C is to D”


soegaard2
2021-3-17 19:02:58

(I am used to :: meaning cons :-) )


sorawee
2021-3-17 19:03:11

I think he meant something like

red : yellow :: apple : banana or something like that


sorawee
2021-3-17 19:03:26

Yeah, that’s a better way to put it lol


soegaard2
2021-3-17 19:04:01

Haven’t seen that before. Is it a SAT thing?


tov
2021-3-17 19:04:06

Yes.


tov
2021-3-17 19:04:11

Good call.


tov
2021-3-17 19:04:23

analogies


soegaard2
2021-3-17 19:09:36

Don’t know of a name btw.


greg
2021-3-17 19:09:38

SAT scores are 400 : 1600 :: 0 : 100 so …


greg
2021-3-17 19:10:16

Students must be given an obfuscated rating similar to a US consumer credit score. Because reasons.


greg
2021-3-17 19:13:09

Oh maybe I screwed that up. 400 .. 1600 :: 0 .. 100. But does that mean 400 : 0 :: 1600 : 100? idk I guess a get a zero on the math portion. Sorry I mean a 200.


tov
2021-3-17 19:14:32

I think “integer division” is a fine name, but it seems to be missing from racket/base.


soegaard2
2021-3-17 19:17:39

I am reminded of Abbott and Costello: https://www.youtube.com/watch?v=lzxVyO6cpos


soegaard2
2021-3-17 19:18:53

soegaard2
2021-3-17 19:19:48

It has names for some of the possibilities.


tov
2021-3-17 19:27:32

@soegaard2


tov
2021-3-17 19:27:37

Thanks!


jesse697
2021-3-17 19:30:23

+1 for @laurent.orseau’s explanation. It’s just a whimsical twist on “sweet!”


tov
2021-3-17 19:30:27

“Floored division” is better than “integer division.” What I was looking for was standard Racket function, not a name. I think omitting this operation while including modulo is a minor bug.


soegaard2
2021-3-17 19:32:41

Almost forgot this one!


samth
2021-3-17 19:36:46

when is it not equal to quotient?


jaz
2021-3-17 19:43:08

quotient does truncating division, right? So, (quotient 5 -3) is -1, whereas (floor (/ 5 -3)) is -2.


tov
2021-3-17 19:43:11

When the result is negative.


tov
2021-3-17 19:43:19

yes


samth
2021-3-17 19:45:12

so that’s floor . / and quotient is truncate . /. Are there uses for round . / and ceiling . /?


tov
2021-3-17 19:46:32

ceiling . / is useful when you have m things and need to fit them into n boxes.


samth
2021-3-17 19:46:57

I recall there being a very long discussion about all of this in some Scheme standards venue



tov
2021-3-17 19:47:20

I usually define: (define (ceil-div m n) (floor-div (+ m n -1) n))


tov
2021-3-17 19:47:49

Yeah, it’s controversial. Historically C didn’t specify whether / was truncating or flooring, but as of C99 (iirc) it’s truncating.


tov
2021-3-17 19:47:57

In Ruby and Python (//) it’s flooring.


tov
2021-3-17 19:48:28

I don’t know any uses for round . / .


tov
2021-3-17 19:49:05

I don’t have an opinion on flooring versus truncating division, but I do have an opinion on the relationship between div and mod.


tov
2021-3-17 19:50:05

In particular, as the R7RS link says, “everyone agrees that 1. n = dq + r,”


samth
2021-3-17 19:50:26

Might div or div0 from r6rs be what you want?


tov
2021-3-17 19:50:35

I suspect so…


samth
2021-3-17 19:51:45

In which case they are already close to hand


tov
2021-3-17 19:51:59

Well, I’m fine doing floor and / myself (and probably prefer that to depending on r6rs), but it seems like a funny omission to be able to compute r via modulo but not the corresponding q.


juanesgonzalez746
2021-3-17 19:52:59

@juanesgonzalez746 has joined the channel


tov
2021-3-17 19:53:25

not “be able to compute” but “have a built-in way to compute”


capfredf
2021-3-17 19:58:13

seems like you have to bind those two keys to the functions yourself. Alternatively, you can press cmd+up/down and move the cursor to the beginning/end of the buffer


tov
2021-3-17 19:58:16

Huh, neither R6RS div nor div0 is flooring. (r6rs:div 123 -10) is –12, not –13. and same for div0


juanesgonzalez746
2021-3-17 19:58:39

hello colleagues, can someone help me with a workshop?


spdegabrielle
2021-3-17 20:12:35

Hello @juanesgonzalez746 welcome! Can you provide more details?


juanesgonzalez746
2021-3-17 20:13:18

dejame te muestro


juanesgonzalez746
2021-3-17 20:13:41

let me show you


spdegabrielle
2021-3-17 20:14:27

Ok?


juanesgonzalez746
2021-3-17 20:17:09

The Chamber of Commerce of the city of Tuluá has registered an amount N of micro-businesses dedicated to the sale of minutes, for which you need a program to control these businesses, and produce the following data as a result: 1. (1.5 points) Number of sales made by all companies in one or more given weeks. 2. (1.5 point) Profit obtained by all companies detailing the company that sold the most (name and quantity), the least sold (name and quantity) and the average sales of all of them.


juanesgonzalez746
2021-3-17 20:17:43

that’s what i need to do


spdegabrielle
2021-3-17 20:27:39

the best place to ask is in #beginners channel You should also include an example of what you have written so far and where you are stuck.


jaz
2021-3-17 20:27:40

The R7RS document that Sam linked, above, says that R6RS div is Euclidean division, and div0 is what it calls “balanced” division, where -\|d/2\| <= r < \|d/2\|.


juanesgonzalez746
2021-3-17 20:33:51

ah ok thanks


ahnaaf20
2021-3-17 20:35:50

@ahnaaf20 has joined the channel


soegaard2
2021-3-17 20:46:32

So you need all sublists that contains the character a?


ahnaaf20
2021-3-17 20:46:48

Yea


soegaard2
2021-3-17 20:47:03

Look at filter.


ahnaaf20
2021-3-17 20:47:57

I tried but couldn’t


ahnaaf20
2021-3-17 20:48:07

Can you please show me the code


ahnaaf20
2021-3-17 20:48:19

Actually I am a beginner


soegaard2
2021-3-17 20:48:38

Use member to check that a value is a member of the list.


soegaard2
2021-3-17 20:48:51

(Sorry not much time tonight)


soegaard2
2021-3-17 20:49:40

I am sure others have more time tonight.


tov
2021-3-17 20:50:27

Yep.


tov
2021-3-17 20:51:25

In any case, I don’t mind using (compose floor /), but I just think it’s oddly asymmetric.


capfredf
2021-3-17 20:58:29

(filter (curry memv 'a) '((a b c) (a c d) (d e f))


ahnaaf20
2021-3-17 21:02:05

The values can change and a not a set character it can be anything


ahnaaf20
2021-3-17 21:02:21

Will it work if the values change ?


capfredf
2021-3-17 21:04:08

then you simply need to change the code accordingly.


ahnaaf20
2021-3-17 21:05:00

As a beginner I am struggling to do that, I tried using lamda x y


capfredf
2021-3-17 21:07:48

you could parametrize the function call above. e.g. change 'a to a parameter you used in your function


ahnaaf20
2021-3-17 21:08:46

Can you please write it down ? If you don’t mind. I am a beginner so having trouble with these


capfredf
2021-3-17 21:10:44

(lambda (li arg) (filter (curry memv arg) li)))


tgbugs
2021-3-17 21:19:34

Does anyone know off hand if there is an implementation of case-lambda that takes keyword arguments? dispatch on optional arguments would be difficult to dispatch on, but it seems like keyword arguments might be possible.


ahnaaf20
2021-3-17 21:26:39

I get the following error


ahnaaf20
2021-3-17 21:30:37

And If I just use lambda ( li arg ). I get the following error


ahnaaf20
2021-3-17 21:31:01

@capfredf


tgbugs
2021-3-17 21:33:22

I can kind of fake it by using ((case-lambda [key-value key-value]) '#:a 1 '#:b 2) and then quoting the keywords.


capfredf
2021-3-17 21:43:12

put (require racket/function) somewhere before extract or change curry to a lambda


ahnaaf20
2021-3-17 21:53:54

It still doesn’t work. Give out all the list. Filter is not working


ahnaaf20
2021-3-17 21:54:08

@capfredf


capfredf
2021-3-17 21:55:42

(lambda memv arg) => (lambda (v) (memv arg v))


capfredf
2021-3-17 21:57:06

if you are working on your homework/problem sets, I’d recommend you go back learn the fundamentals


ahnaaf20
2021-3-17 21:57:48

It’s not my homework


ahnaaf20
2021-3-17 21:58:03

I was making a game where I need these


ahnaaf20
2021-3-17 21:58:20

There is another last function I need help with. Will you do ?


ahnaaf20
2021-3-17 21:58:28

@capfredf


capfredf
2021-3-17 21:58:49

Sorry, I am afraid not


ahnaaf20
2021-3-17 22:02:29

It is very similar just that it should match more than one character


ahnaaf20
2021-3-17 22:08:44

INPUT - ( function ‘((#\a #\b #\c) (#\a #\c #\d) (#\d #\e #\f)) ‘(#\a #\b)

OUTPUT - (#\a #\b #\c)


ahnaaf20
2021-3-17 22:09:25

@capfredf This would be the last help. Please brother. I am very thankful for your effort



tov
2021-3-17 23:01:23

Yes, Haskell has this as well. div, mod, quot, and rem


samth
2021-3-18 01:11:08

No, no one has written an extension of the keyword support to case-lambda


samth
2021-3-18 01:11:47

It ought to be relatively easy to simulate with if


chansey97
2021-3-18 01:30:17

This article missed an important advantages of static typed languages i.e. Generating terms by type inference. For example, in Haskell we have type classes, by type inference, compiler can implicitly pass a dictionary argument for us. This feature cannot be achieved by SML (which is also a static typed language though) module and cannot be achieved by dynamic typed languages (because dynamic typed languages’ compiler have no type inference in general).


panduwana
2021-3-18 02:07:23

@chansey97 what dictionary argument?


chansey97
2021-3-18 02:28:01

@panduwana a type class instance.