dddddd has quit [Remote host closed the connection]
endformationage has quit [Quit: WeeChat 2.3]
mzan has joined #racket
orivej has joined #racket
<ZombieChicken>
If I'm using a module that requires a certain package, do I need to (require ...) is in the program itself?
<ZombieChicken>
specifically, I'm using the irc lib and want to know if I have to explicitly require async-channel, which irc already requires
_whitelogger has joined #racket
ZombieChicken has quit [Remote host closed the connection]
ZombieChicken has joined #racket
Shambles_ has joined #racket
<Shambles_>
This isn't Racket specific, but I cannot locate a chat room specifically for this kind of question. I know there is a recognized term for adapting a function to be a function from a different type to that same type, but I cannot remember the term. Can anyone help?
<Shambles_>
An example would be if you had a function that capitalized strings and you wanted to convert it to a function from type Foo to to type Foo such that it would capitalize the "name" field of Foos.
zmt00 has quit [Read error: Connection reset by peer]
zmt00 has joined #racket
ayerhart has joined #racket
refpga has quit [Ping timeout: 246 seconds]
refpga has joined #racket
YuGiOhJCJ has joined #racket
refpga has quit [Remote host closed the connection]
<`micro>
all other variations - 'cd, "cd", :cd, cd: - all produce: Command not found
<`micro>
What's the proper way to call ,help to get extended info for another command?
<`micro>
(Racket version: 7.1)
<`micro>
Error for ,help cd - expected: number? given: "; " argument position: 2nd
orivej has quit [Ping timeout: 246 seconds]
<Shambles_>
`micro: I can't seem to get it to work either, but most people would be using DrRacket and looking things up in the help that using the pulldown menu leads to or the website at https://docs.racket-lang.org/index.html.
<`micro>
From Step 1: "See xrepl for more information"
libertyprime has joined #racket
<Shambles_>
xrepl might only work in text mode.
<Shambles_>
Yep, I just tested it there.
<`micro>
text mode - where?
<Shambles_>
You have to run the text version of Racket (gracket-text on my system) from the command line, then (require xrepl), then stuff like ,help will start working.
<`micro>
... or I should ask - How do I set text mode?
<`micro>
Ahh - OK
<Shambles_>
You don't set text mode, you run this stuff from a DOS or Unix command line prompt.
<`micro>
I was just running racket from command line.
<Shambles_>
Which only supports text. I'm not sure how much of Racket will work this way. I know DrRacket supports showing images or whatnot in the REPL and I'm guessing people have written code that depends on that.
<Shambles_>
If it works that's great though. If not, maybe give Scsh a try. It's made for this sort of thing.
<`micro>
I get the same behaviour with gracket-text
<Shambles_>
You have to run gracket-text, then enter:
<Shambles_>
(require xrepl)
<Shambles_>
Then at least for me when I enter:
<Shambles_>
,help
<Shambles_>
it works.
<`micro>
I did the require
<`micro>
,help <cmd> is what's failing
<Shambles_>
Sorry, make that ,?
<Shambles_>
Try ,?
<`micro>
,help alone works in racket
<`micro>
,help cd - as in examples above - is what's failing.
<`micro>
,help ,h ,? all work
<`micro>
it's getting extended help for any of the listed commands
<Shambles_>
Yeah, that's not working here either.
<Shambles_>
If you just want to write code that works with files and processes, you can probably do that from in DrRacket without needing xrepl. It won't make it easy to pretend Lisp is a shell though. You probably need to use Emacs and/or Scsh for that. At least I've never heard of anyone doing something else successfully.
<`micro>
Since 6.2, xrepl is automatically required when running racket
<`micro>
I've played with scsh years ago. Just wanted to use something that's actively being maintained.
<Shambles_>
I just did the rest of the tutorial you mentioned in Racket and the rest of it works. You don't need xrepl and you won't have the shell-like commands, but the rest will work.
<`micro>
No probs. Thanks.
<Shambles_>
I think Scsh still works fine. There's just not much being added to it and it's very stable. There's updates to it within the last 2 years: https://github.com/scheme/scsh
<`micro>
Aye - but there have been 3 issues (since 20 Aug 2016) that have not been responded to.
<Shambles_>
Whatever you decide it will hurt less than Bash. :p
<`micro>
Most definitely!
ayerhart has quit [Quit: ayerhart]
ayerhart has joined #racket
ayerhart has quit [Client Quit]
ayerhart has joined #racket
ayerhart has quit [Client Quit]
<`micro>
On a related note - if I wanted to debug this, how can I access the commands hash that is defined in pkgs/xrepl-lib/xrepl/xrepl.rkt ?
ayerhart has joined #racket
<`micro>
... from command line racket?
<Shambles_>
I'm not sure. Try it I guess?
<Shambles_>
I had actually forgotten there was a text mode version.
ayerhart has quit [Client Quit]
ayerhart has joined #racket
ayerhart has quit [Client Quit]
ayerhart has joined #racket
ayerhart has quit [Client Quit]
ayerhart has joined #racket
ayerhart has quit [Client Quit]
ayerhart has joined #racket
dustyweb has joined #racket
dustyweb has quit [Ping timeout: 246 seconds]
<`micro>
To answer my own question (re debugging xrepl):
<`micro>
1. (require xrepl/xrepl)
<`micro>
2. ,en xrepl/xrepl
<Shambles_>
After that things work as documented?
<`micro>
That allows debugging.
<`micro>
I've found the bug - introduced 2 years ago
<Shambles_>
I see.
<`micro>
line 396 xrepl/xrepl.rkt - show-cmd called with "; " instead of a number (replresenting the indentation level)
libertyprime has quit [Quit: leaving]
<`micro>
s/replresenting/representing/
<`micro>
:-)
dustyweb has joined #racket
<`micro>
> ,help sh
<`micro>
; shell (sh ls cp mv rm md rd git svn): run a shell command
<`micro>
; `sh' runs a shell command (via `system'), the aliases run a few useful
<`micro>
; usage: ,sh <shell-command>
<`micro>
; unix commands. (Note: `ls' has some default arguments set.)
<`micro>
; If the REPL is inside some module's namespace, the command can use $F
<`micro>
; which is set to the full path to this module's source file.
mzan has quit [Ping timeout: 268 seconds]
dddddd has joined #racket
<Shambles_>
If you make a patch of some kind I'm sure the Racket folks would be happy to fix it. I remember, years ago, reporting some problems with the documentation and it was fixed in a day or two.
dustyweb has quit [Ping timeout: 250 seconds]
dustyweb has joined #racket
<`micro>
An issue has been raised. No PR (yet) as still trying to understand the surrounding additions that were made when 'command sections' were added.
<Shambles_>
Does anyone know what the term is for adapting a function to work on another type? I remember there was one, but not the term. For example, I have a function that uppercases a string. I want to adapt it to work on the name field of objects of type "foo". So I write a function that wraps functions to take the name field out, pass it through the function, and put it back in (functionally)?
<`micro>
dispatch ?
<Shambles_>
I don't don't believe that's it. I believe dispatching is recognizing the type and branching to the right code to handle that type, or using polymorphism to jump to code to handle that type.
<Shambles_>
This is where you have a function of type a to type a and you pass it through a function that turns it into a function of type b to type b by performing the necessary accesses or conversions.
<Shambles_>
Although that's the case I'm trying to think of the term for, I'd also like the term for just adapting the input, if that's not the same thing.
<Shambles_>
I'm wanting to say the term is something like "lift" but that doesn't sound right.
<Shambles_>
Maybe. I admit to not being a category theorist. The things I'm trying to document are just some functions that adapt existing predicates to work on a new type, and some functions that adapt existing functions to work on certain fields of a new type. I thought there was a standard term for the idea but I can't think of it.
<Shambles_>
I'm not sure if this counts as a "monad" (I don't think of a simple record as being a monad).
<Shambles_>
Maybe I'm just mistaken.
<bremner>
Shambles_: combinator would apply, although it seems more general than what you mean
<Shambles_>
Yes, this is a specific kind of combinator. The situation is pretty close to this (without getting into the whys). I have a record with two fields. I have a bunch of unary predicates and other functions. I'd like to be able to use those unary predicates and functions with this record type. I wrote functions that adapt those unary predicates and functions, and now I'm trying to document what I did.
<Shambles_>
I just need to know what to call it, if there's a term.
<Shambles_>
I thought there was but I can't seem to find it.
<bremner>
If I was making stuff up, I'd go with "adapter"
<Shambles_>
I'd been using the language "adapts" already. I thought the term for this was something like "lift" but that's pulling up compiler optimizations ("lambda lifting") and plain "lift" seems to only refer to operations on aggregate data structures (like arrays), not scalar or composite data structures (like records). I might just be misremembering.
<`micro>
The article I posted has a `lift` function
<Shambles_>
Yes, but all these terms have certain requirements. I do not believe I meet the "fmap" part of the "lift" requirement. At least "take the value out this field, run it through the function we wrap, then stuff the result in the same field and copy the other fields over" does not sound like what I think of as "mapping" (applying a function to each element of an aggregate like an array or list).
<`micro>
Ahh - OK.
<jcowan>
No, that is exactly what fmapping is.
<jcowan>
so yes, you want to lift your functions from the string domain to the Foo domain
<jcowan>
Shambles_: ^^
badkins has joined #racket
<jcowan>
mapping is a particular case of fmapping: you take all the elements of an aggregate out of it, apply the function to them individually, and put them back in a new aggregate of the same type.
<jcowan>
but there is no requirement that a particular type treat its elements uniformly; indeed, there may be more than one functor corresponding to a particular type. For pairs, for example, there is the car functor and the cdr functor.
<jcowan>
(a functor is any view of a type that provides an fmap function)
badkins has quit [Ping timeout: 268 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
charh has quit [Quit: bye :)]
<`micro>
jcowan: So, is monad transform the correct term or is there another/alternate one?
<Shambles_>
jcowan: So I am using the term "lift" correctly?
<Shambles_>
The process of changing the input and output type to a different type is lifting?
<jcowan>
Yes.
<Shambles_>
Even though it is not "more general" (unlike the, mostly Haskell related, pages seem to be indicating)?
<Shambles_>
And is there a term for the Foo to Bool adapting to Bar to Bool? Is that also lifting?
<Shambles_>
I am also urprised to hear that car and cdr count as functors.
dustyweb has quit [Ping timeout: 268 seconds]
<Shambles_>
I thought, from the description of Functor, that the list (in the car and cdr situation) would be the functor, since it's the list, not the car or cdr functions or their results, that are map-over-able.
badkins has joined #racket
<jcowan>
Yes, List is a functor, but so is Pair. Or rather, functors can be defined on them. *The* List functor is the one that fmaps using map, but there are any number of other possible functors with their own fmaps. This is something that Haskell blurs, though even it finds it necessary to have both Sum and Product functors rather than a single Number functor.
<jcowan>
s/possible functors/possible functors on List/
badkins_ has joined #racket
badkins has quit [Ping timeout: 268 seconds]
endformationage has joined #racket
badkins_ is now known as badkins
ng0 has quit [Ping timeout: 256 seconds]
ng0 has joined #racket
ng0 has quit [Client Quit]
dustyweb has joined #racket
orivej has quit [Ping timeout: 246 seconds]
juanfra has quit [Remote host closed the connection]
juanfra has joined #racket
<Shambles_>
jcowan: How about the adapting predicates situation? What would that be called?
<jcowan>
not sure I know any name for that
<Shambles_>
Do you have a suggestion for how to describe it? Just "adapts the predicate to accept the X type"?
<jcowan>
safe enough
YuGiOhJCJ has joined #racket
<erkin>
I want to insert a line of stylised (eg bold, coloured) text into a read-only editor. Do I need to implement a brand new snip% for that or can I somehow use string-snip% for that?
<erkin>
-for that
<erkin>
I was trying to insert the string into a new string-snip% before inserting to the editor-canvas%, hoping to stylise it later, but (send string-snip insert string (string-length string)) (send editor-canvas insert string-snip) doesn't work, even though (send editor-canvas insert string) does, which, to my understanding, creates a string-snip% with that string and inserts that.
<erkin>
(by doesn't work, I mean it doesn't appear on the canvas — no errors though)
ayerhart has quit [Read error: Connection reset by peer]
badkins has quit [Ping timeout: 250 seconds]
Falacer has quit [Quit: Lost terminal]
Falacer has joined #racket
ZombieChicken has quit [Remote host closed the connection]
ZombieChicken has joined #racket
<Shambles_>
jcowan: Thanks for all the help. :)
<jcowan>
Sure
dan_f has joined #racket
<erkin>
It turns out text% converts the snip's style upon insertion, so my plan wasn't going to work either way.
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
orivej has joined #racket
pera has joined #racket
badkins has joined #racket
dustyweb has quit [Ping timeout: 268 seconds]
pera has quit [Ping timeout: 245 seconds]
Shambles_ has left #racket [#racket]
pera has joined #racket
FreeFull has joined #racket
ng0 has joined #racket
mizu_no_oto has joined #racket
mizu_no_oto has quit [Quit: Computer has gone to sleep.]
pierpal has quit [Quit: Poof]
pierpal has joined #racket
dustyweb has joined #racket
acarrico has joined #racket
dustyweb has quit [Remote host closed the connection]
dustyweb has joined #racket
dustyweb has quit [Remote host closed the connection]
badkins has quit [Ping timeout: 272 seconds]
Falacer has quit [Ping timeout: 250 seconds]
Arcaelyx has joined #racket
badkins has joined #racket
davidl has joined #racket
dataangel has joined #racket
dataangel has quit [Client Quit]
dataangel has joined #racket
dataangel has quit [Read error: Connection reset by peer]