Can you elaborate a little on this , what exactly you mean by “check reverse of the inputs” ?
Actually I think I manged to solve the “bug” by removing all “reverse commands”
Is foo/bar
considered a different collection from foo
or is it considered a subcollection?
it depends :slightly_smiling_face:
I take it that by “subcollection” you mean some modules that can’t really be used on their own, and only make sense with the rest of the foo
collection.
In that case, racket/string
can be used independently of racket/list
, say, so they are two different collections.
metapict/crop
on the other hand doesn’t make sense on its own, and is really meant to be used as part of metapict
Ah, ok. That clears things up.
So the list (0)
represents the polynomial 0
, which has degree -infinity
? Or does the list ()
represent 0
?
From 1 to 10 , how bad is if I use the “else” inside of a “cond” ? (like I used in the code from above ) ?
Why would it be bad?
i read the Racket documentation and I could not fully understand the “else” syntax exmplanation
and I googled so I found “by adding an else clause, you are telling Racket that it is okay to turn off error-checking.You are assuming the burden of error-checking yourself! Therefore, we strongly recommend against using an else case in your cond expressions” https://cs.brown.edu/courses/cs017/content/docs/racket-style.pdf
Actually I thought Scheme has an “else” statement, and Racket does not, this was my first confusion
Ah, if you’re a student and/or are beginning in programming, then yes, it’s probably better to write all the conditions and not use else. But to be honest, once the programmer understands clearly what they’re doing, they always use an else.
okay, thank you so much for your reply!
My next question is related to the poly-add code I shared above. I want to do ( run "+ var 5" ) ; expected “1x +5”
but I get :; +: contract violation
; expected: number?
; given: '(0 1)
; argument position: 1st
; [,bt for context]
Could anybody please give me a hint? I feel that is a “mismatch” between the number and the “given ’(0 1”) ", but I am not sure where to trace the issue
I mean, since my function “poly-add” has 2 lists as arguments, and is working fine when i add two polynomial as lists, how do I have to handle this case when i have to do ( run "+ var 5") , where “var” is like an “x”
What does the function run
do?
this information was not provided
What is the best way to define an alias for a macro?
Does something like (define-syntax-alias alias macro)
exist?
(define-syntax alias (make-rename-transformer #'macro))
@quincbj5 has joined the channel
@attilasedon1 has joined the channel
woot! :parrot:
Thank you
Does a formatter for Racket code exist? DrRacket lets you indent the whole file with “Reindent all”, which is very nice. It would be nice to expose that as a command line utility.
#lang racket
(require framework)
(define t (new racket:text%))
(send t set-filename "/tmp/foo.rkt")
(send t load-file)
(send t tabify-all)
(send t save-file)
The above seems to work, but I’m not sure if it’s the right approach.
Nice. The dependency on framework is overkill. Maybe look at how tabify all is implemented.
I agree. Will look into it.
Is there a standard macro/option to make lazy struct fields, or should I just manually wrap field values in promises?
@mwblakley has left the channel