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

@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.)

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

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

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”.

Or did I somehow mess up my system settings?

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

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



Notepad++ works differently As does ms word

What does Emacs do? Or visual studio code ?

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.

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

From the official macOS User Guide: https://support.apple.com/en-gb/guide/mac-help/cpmh0152/mac


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

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

@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.

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

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

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

> 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).

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:

Lol

@mdconn_uk has joined the channel

@laurent.orseau copy and paste

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

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

You have Home and End in Mac?

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

And they move the the beginning/end of line

Not the exact model though.


remainder : quotient :: modulo : ???

(compose floor /)
?

No, remainder, quotient and modulo.

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.

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

By :: do you mean divide?

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

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

I think he meant something like
red : yellow :: apple : banana or something like that

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

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

Yes.

Good call.

analogies

Don’t know of a name btw.

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

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

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.

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

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


It has names for some of the possibilities.

@soegaard2

Thanks!

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

“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.

Almost forgot this one!

when is it not equal to quotient
?

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

When the result is negative.

yes

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

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

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


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

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

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

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

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

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

Might div
or div0
from r6rs be what you want?

I suspect so…

In which case they are already close to hand

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 has joined the channel

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

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

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

hello colleagues, can someone help me with a workshop?

Hello @juanesgonzalez746 welcome! Can you provide more details?

dejame te muestro

let me show you

Ok?

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.

that’s what i need to do

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.

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\|
.

ah ok thanks

@ahnaaf20 has joined the channel

So you need all sublists that contains the character a?

Yea

Look at filter
.

I tried but couldn’t

Can you please show me the code

Actually I am a beginner

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

(Sorry not much time tonight)

I am sure others have more time tonight.

Yep.

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

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

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

Will it work if the values change ?

then you simply need to change the code accordingly.

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

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

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

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

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.

I get the following error

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

@capfredf

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

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

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

@capfredf

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

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

It’s not my homework

I was making a game where I need these

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

@capfredf

Sorry, I am afraid not

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

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

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

Relevant: https://smlfamily.github.io/Basis/integer.html#SIG:INTEGER.div:VAL\|https://smlfamily.github.io/Basis/integer.html#SIG:INTEGER.div:VAL note diff between div and quot

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

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

It ought to be relatively easy to simulate with if

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).

@chansey97 what dictionary argument?

@panduwana a type class instance.