Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 02:50 philix_: how can I call a function right after the user hits Ctrl+C?
- 02:50 mithos28: Ctrl+c raises a break exception, you need to catch that
- 02:51 http://docs.racket-lang.org/reference/breakhandler.html?q=break#%28tech._break%29
- 02:51 rudybot_: http://tinyurl.com/clglh8x
- 03:00 philix_: Thank you! (with-handlers ([exn:break? (lambda (x) (quit-server))]) (do-not-return)) WORKED really well!
- 14:27 eg0: packages seem way more complicated than they need to be, and the guide is almost completely unhelpful in explaining it
- 14:30 s/packages/modules
- 14:33 bremner: ah, modules. Well, you don't need to use all of the features.
- 14:34 eg0: even if i wanted to, i couldnt because the guide explains them so poorly
- 14:35 i spent a few hours yesterday and a few more this morning wasting time on guide's ch 6 and 7, and now i've elected to just skip them entirey
- 14:41 soegaard: eg0: That'd difficult :-) A file that begins with #lang racket defines a module.
- 14:42 eg0: why does racket not use namespaces like CL?
- 14:42 just out of curiosity
- 14:45 soegaard: I am not familar with CL namespaces. However the module and macro system in Racket solves a problem: The languages macros are written in and the file using the macros are different. The Racket module system use phases to solve this.
- 14:47 See for example Eli's answer on stackoverflow: http://stackoverflow.com/a/7073230/23567
- 14:47 eg0: cl namespaces are packagename:functionname
- 14:47 its that simple
- 14:47 no ambiguity, no problems
- 14:49 eli: CL packages are a half-assed hack.
- 14:49 soegaard: If you like the naming scheme, then you can use (require (prefix-in math: math)) to import the functions in math. Then use e.g. math:divides?
- 14:49 eli: They provide some convenience, but not enough to get actual guarantees from it.
- 14:49 eg0: cl packages take 30 seconds to explain and learn forever
- 14:49 eli: And they're simple name management tools, rather than Racket modules that also serve as tools for encapsulation, compilation, and linking.
- 14:50 eg0: none of which is explainer in the guide of course
- 14:50 explained*
- 14:51 eli: If you're looking for a comparison between CL namespaces and Racket modules, then obviously it doesn't belong in the guide.
- 14:51 eg0: im not
- 14:51 you've only been participating for half the exchange here, so i can understand your sentiment
- 14:52 but ive wasted a fair bit of time trying to comprehend something that was not explained well, and im asking why it is that way
- 14:52 eli: I'm not talking about any exchange, I'm just responding to the point of romanticizing CL packages because "they're simple".
- 14:52 eg0: cl's namespaces do what I expect them to, which is leaps and bounds ahead of racket's modules, as the guide is horridly vague
- 14:52 what do you care? thats my opinion
- 14:52 eli: It's something that often goes hand-in-hand with `defmacro' which is also touted as a good option because "it's simple".
- 14:53 eg0: racket isnt better or worse by my preference of namespaces to modules
- 14:53 and i could reiterate all of my points again
- 14:53 eli: To be clear, namespaces are not comparable to modules.
- 14:53 eg0: although hygienic macros are great
- 14:53 eli: ThereYouGo™.
- 14:53 eg0: thats apples to oranges though, and offtopic as well
- 14:54 you havent been listening
- 14:54 im not asking for comparisons
- 14:54 i do not understand modules
- 14:54 the guide poorly explains them
- 14:54 wat do
- 14:55 soegaard: Here is the minimal to know:
- 14:55 eli: If you have a technical question about modules, then ask it, but don't go raving about CL namespaces since it's not the same tool at all.
- 14:55 soegaard: 1. A file that begins with #lang racket defines a module
- 14:55 2. You can import functions into your module with (require modulename)
- 14:56 3. If two modules export two different values with the same name, you must use (require (except-in modulename name)) in order not to import name (but import everything else)
- 14:56 4. Use (provide name) to export name from your module.
- 14:57 That's it.
- 14:57 eg0: alright
- 14:57 thanks soegaard i appreciate it
- 14:58 soegaard: 5. If you have a macro that uses an imported name use (require (for-syntax modulename)) to import it.
- 14:58 eli: An alternative for #3 is (require (prefix-in foo: some-module))
- 14:58 (One that has a more namespace-ish feel to it.)
- 14:58 eg0: right up my alley
- 14:58 apparently
- 15:00 heres a question, whats the consensus on the chapter about modules in the guide? i think it could be improved a great deal, and id like to know what others feel
- 15:01 eli: If you're just learning the language, then it's probably better to focus on just doing that, rather than trying to improve the guide.
- 15:01 (And that's not saying that the guide is perfect in any way.)
- 15:02 eg0: im trying to learn the language
- 15:02 i spend 4-5 hours every single day working through the guide, and working on a few hobby projects in racket
- 15:02 im a slow learner, admittedly, but im not exactly stupid
- 15:03 eli: So just ask questions (here or on the list) about things that are unclear.
- 15:04 soegaard: We are talking about this one? http://docs.racket-lang.org/guide/module-basics.html?q=module
- 15:04 eg0: yes
- 15:06 soegaard: I see that the discussion jumps from modules to collections without explicitly motivate when to use (non-library) collections.
- 15:13 asumu: eg0: can you pinpoint anything in particular that is not explaiend well?
- 15:14 eg0: 6.2.1, that example doesnt work for me
- 15:14 asumu: Does it need more examples? Different prose?
- 15:14 eg0: working through the chapter
- 15:14 im going to make a list of all the stuff i dont understand, and then im gonna do something about it
- 15:16 when i have that example in my editor pane, and i try (require 'cake) in my repl pane, i get an unknown module error
- 15:17 asumu: Are you using DrRacket or some other editor?
- 15:18 eg0: drracket
- 15:18 i can do (require (submod "." cake)) and have access to that print-cake function
- 15:18 but not (require 'cake) like the guide says
- 15:19 soegaard: (Have to ask) Did you click run first?
- 15:19 Before you tried (require 'cake) in the repl.
- 15:19 eg0: yes
- 15:20 heres a question, is it working for you when you try it?
- 15:20 soegaard: Hmm. Doesn't work for me either.
- 15:20 eg0: ok
- 15:20 thats comforting
- 15:20 i am sane
- 15:20 soegaard: I expected it to do so.
- 15:20 If you pase (module cake …) into the repl it works.
- 15:21 pase -> paste
- 15:21 eg0: paste that whole example?
- 15:21 soegaard: yes
- 15:21 eg0: yeah, same here
- 15:21 it worked
- 15:22 but is it actually getting it from the module?
- 15:22 asumu: Oh, that's a submodule and enter!-related bug. I don't remember if it's been fixed. Submodules are a relatively new feature.
- 15:22 soegaard: Oh!
- 15:23 I got it wrong.
- 15:23 If you write (module cake racket …) without the #lang racket file it works fine.
- 15:23 And in the guide there is no #lang racket line.
- 15:23 eg0: negative
- 15:24 asumu: Oh, the 6.2.1 example. Yes, that is not supposed to have a #lang.
- 15:24 eg0: i just tried it without a #lang file, and its giving me the same unknown module error
- 15:24 soegaard: That works for me on 5.3.4.3
- 15:25 eg0: im on 5.3.3
- 15:26 soegaard: works in 5.3.2 as well
- 15:26 (I haven't got a 5.3.3 installed)
- 15:27 eg0: i mean, i dont know what to say
- 15:27 i have that exact example, with no #lang racket
- 15:27 and its the same error
- 15:28 soegaard: Try updating. http://pre.racket-lang.org/installers/
- 15:29 asumu: I'm pretty sure that should work in 5.3.3. I have a 5.3.3 installed and tried a similar example. So you have a module (module cake ...) at the top of the file?
- 15:29 And in the interaction pane doing (require 'cake)?
- 15:29 eg0: yes
- 15:30 asumu: Did you run the file before doing the `require` in the REPL?
- 15:30 eg0: yes
- 15:30 several different tries
- 15:31 upgrading...
- 15:35 mithos28: If I have an optional keyword in a macro what is the easiest way to match it, and then splice it/the empty sequence into another macro call
- 15:36 eg0: when its talking about new system links, where should I install them?
- 15:37 mithos28: I'm using syntax-parse, but cannot figure out how to go from (~optional #:kw) to something useful
- 15:37 asumu: mithos28: (~optional (~and #:kw kw-attr)) and then use the kw-attr attribute.
- 15:38 mithos28: asumu: but that is #f sometimes
- 15:38 soegaard: eg0: don't know, is there a suggestion?
- 15:38 mithos28: how to do I easily splice in the empty sequence in that case
- 15:38 asumu: mithos28: you can put a (if (attribute foo.kw-attr) #'(foo.kw-attr) #'()) and splice that
- 15:39 mithos28: Which is what I have, my question is how to do this easily
- 15:39 eg0: no, the default is to skip it, but i installed drracket through apt-get and it wont update from 5 3 3 to 5 3 4
- 15:39 if i dont install the links over the old ones
- 15:39 i just dont know where the old ones are
- 15:39 im gonna try usr/bin
- 15:40 asumu: mithos28: ?? or ?@ from syntax/parse/experimental/template might help, but it's experimental.
- 15:41 mithos28: asumu: Thanks i'll take a look. TR already has tons of deps on unstable so this shouldn't be an issue
- 15:41 soegaard: I would use http://pre.racket-lang.org/installers/ instead. The installer is very good.
- 15:42 eg0: it skipped them all, it says that non-links exist
- 15:42 i might have to remove drracket from apt get, ill do that some other time, i cant use that much data or my internet will get turned off
- 15:45 ok
- 15:45 i was able to start drracket from the new install directory
- 15:45 and that cake example still does not work
- 15:45 no #lang file
- 15:45 line*
- 15:49 soegaard: eg0: Can you make a screenshot and put it on imgur ?
- 15:49 asumu got struct's #:guard clause working in TR, but wonders how bad it is for the top-level typecheck pass to local-expand more stuff...
- 15:50 eg0: link inbound
- 15:51 http://imgur.com/m8zZMPs
- 15:53 asumu: Oh, ugh. That happens to me too. The difference is if you save the file somewhere.
- 15:53 eg0: it is saved
- 15:53 asumu: I wonder if that's a regression.
- 15:54 mithos28: Asumu, we should sync up as that is exactly what I'm working on
- 15:54 soegaard: eg0: I can't see you are doing anything wrong. Here is what I see on 5.3.4. http://imgur.com/OeC6FRC
- 15:56 asumu: eg0: if you do (require "cake.rkt") it should work. That is pretty annoying though.
- 15:57 mithos28: Oh, sorry I should've coordinated with you then. I'll put it up as a branch somewhere.
- 15:57 eg0: asumu, that works
- 15:58 mithos28: asumu: https://github.com/shekari/racket/tree/struct-properties, but literally a work in progress
- 15:58 Don't worry about it, I didn't tell anyone
- 16:00 eg0: the guide says that the example works in the repl because its not associated with a file name
- 16:01 so (require 'cake) and (require "cake.rkt") are two fundamentally different happenings
- 16:01 asumu: eg0: it should at least say something like "if you save it to a file, you need to use <blah>".
- 16:02 eg0: well
- 16:02 asumu: mithos28: https://github.com/takikawa/racket/commit/b6e7dfea1b3b1233210432760e19815b91fcdcd9
- 16:02 rudybot: http://tinyurl.com/czlwe7n
- 16:02 eg0: my mental gears are moving
- 16:03 you cant do (require 'cake) in a repl because racket doesnt know what cake is, only cake.rkt knows what cake is
- 16:03 right?
- 16:04 asumu: mithos28: ah, you handle struct properties though, that's nice. How do you type-check the self struct argument? (to say custom-write)
- 16:05 mithos28: By using the type name I know from the struct: form
- 16:06 Were you trying to support guards that change the arguments?
- 16:06 asumu: mithos28: no, are there such guards that ought to type-check?
- 16:06 mithos28: It would change the constructor type, which I thought was too complicated to support
- 16:07 asumu: I agree.
- 16:07 mithos28: Oh, I think I misread your original question. I changed struct: from ignore to ignore-some
- 16:07 which means that you can annotate experessions within its form to be typechecked
- 16:08 Thus no change from the typechecking standpoint
- 16:08 asumu: Actually you answered it, but I did want to know the answer to that question too. That would eliminate the need to do the local expansion I do.
- 16:09 mithos28: https://github.com/shekari/racket/commit/99203197e4805e27fe74b24b4e3a7068a5b2db07#L13R547
- 16:09 rudybot: http://tinyurl.com/cmc6d8m
- 16:09 asumu: I asked my question because I was thinking it'd be useful to have a (Struct-Property (Self) ...) type that bound a 'self'-type so you could support user-defined properties.
- 16:10 mithos28: Thats something I didn't even try to handle, I'm only handling the three cases I saw in the core code base
- 16:10 equal+hash, custom-write, and custom-print-quotable
- 16:11 asumu: Fair enough. The general extension could be done later anyway.
- 16:17 mithos28: yeah, the way you're doing the guard type-checking makes more sense. Less invasive.
- 17:27 eg0: so im trying to write to a file that does not exist and racket is giving me a hassle
- 17:28 jk was writing to path string and not the port, nvm
- 17:33 iceking: Does anyone know of an IRC like this where I can get some help with assembly? (sorry, googling didnt do me any good so I figure Id just ask)
- 17:34 offby1: iceking: not offhand, but you might try typing /list to get a list of channels on freenode. Maybe one of 'em will be about assembly.
- 17:34 eg0: try #asm
- 17:34 offby1: You might also try looking for the _specific_ assembly language you're interested in -- x86, or ARM, or whatever.
- 17:34 or what eg0 said :)
- 17:34 iceking: thanks :]
- 17:34 eg0: im an irc wizard
- 17:34 its the one thing im good at
- 17:35 offby1: follow your bliss!
- 17:35 eg0: i am
- 17:35 rich: iceking: what level of assembly?
- 17:35 eg0: i am designing and building a successor to irc
- 17:36 rich, #asm handles all arches
- 17:36 they are quite friendly
- 17:37 rich: cool.
- 17:37 if it was is basic x86 assembly i might have been able to help him
- 17:37 eg0: oh
- 17:37 rich: s/was//
- 17:37 eg0: well hop in #asm, he's in there right now
- 17:38 rich: but either way, he's defniitely better asking the #asm guys
- 17:38 eg0: he has homework apparently
- 17:38 well yeah, its offtopic here
- 17:38 not unwelcome, just offtopic
- 17:38 rich: yeh
- 17:38 eg0: so how about those parens
- 17:39 rich: i assume read-line uses 'linefeed instead of 'any to remain compatible for old scripts ?
- 17:41 i had a list of numbers in a text file - apparently `man sum` is not what i thought it was :) anyway, i whipped up a racket script using in-lines, number->string and apply + - fantastic
- 17:43 eg0: why didnt you just store the list?
- 17:43 and then get the file's contents, and read-from-string
- 17:44 and then you have a lisp/scheme compatible list to use apply on
- 17:44 rich: the numbers were from an existing text file which i had to `cut` from
- 17:45 eg0: oh
- 17:45 rich: i don't know awk - and i'm trying to learn racket
- 17:45 eg0: sorry i misunderstood
- 17:45 i dont know either
- 17:45 i just pretend and hope nobody asks me to do anything
- 17:46 rich: eg0: do you know any lisp-like ?
- 17:46 eg0: i worked my way through most of gentle intro to symbolic computation before i switched to racket
- 17:47 and im currently working through chapter 8 of the racket guide
- 17:47 rich: if you like pattern matching, have you seen formica for use in racket?
- 17:48 eg0: ive heard of it, but havent tried it
- 17:48 rich: match is cool
- 17:48 eg0: and i have to go also :(
- 17:48 rich: match is racket
- 20:10 technomancy: is box-cas! new since 5.2.1?
- 20:11 the docs don't mention needing to require it first
- 20:31 zRecursive: rudybot: where is git repo of racket ?
- 20:31 rudybot: zRecursive: because I was free to commit & push to the work repo without worrying about having to keep a clean branch for merge.
- 20:32 asumu: zRecursive: https://github.com/plt/racket
- 20:33 technomancy: 5.3, see https://github.com/plt/racket/blob/master/doc/release-notes/racket/HISTORY.txt
- 20:33 rudybot: http://tinyurl.com/btonomq
- 20:35 zRecursive: asumu: thx
- 20:35 zRecursive cloning now ...
- 20:36 offby1: .oO("box-cas!"?)
- 20:37 bremner: next version has thai-kick-box-cas!
- 20:38 offby1: Hobos from Bahstan ride Bahx Cahs
- 20:56 zRecursive: build error: ../../../racket/gc2/../src/string.c:41:21: error: iconv.h: No such file or directory
- 21:06 offby1: zRecursive: you probably need to install "development libraries" for libiconv
- 21:06 if you're on Debian or Ubuntu, "sudo apt-get build-dep racket" might get you everything you need
- 21:06 zRecursive: offby1: i am using freebsd
- 21:07 offby1: alas, I don't know the formula for FreeBSD, but I bet it's roughly similar.
- 21:07 zRecursive: yeah, i am installing libiconv now
- 21:08 technomancy: asumu: gotcha; thanks
- 21:11 huh, I assumed that meant boxes themselves are fairly recent, but it sounds like that's not the case
- 21:12 I guess cas semantics aren't as important without OS-level threads, which are fairly new
- 21:13 oh huh; JIT on ARM is fairly new too; I guess I should upgrade
- 21:15 zRecursive: Anybody uses ARM desktop ?
- 21:16 offby1: *crickets*
- 21:16 zRecursive: rudybot: crickets
- 21:16 rudybot: zRecursive: error: crickets: undefined; <NEWLINE> cannot reference an identifier before its definition <NEWLINE> in module: 'program
- 21:18 zRecursive: that'll teach ya!
- 21:19 zRecursive: :)
- 21:19 zRecursive raco setup now ...
- 21:33 zRecursive: `raco setup ...` is so slow even i have `configure --with-doc=no ...` ?!
- 21:37 eg0: is there anything like multiple-values-list in racket? i have several values, and i would like to collect all of them in a list
- 21:38 bremner: I'm not sure I understand the question.
- 21:39 eg0: if i have a function that returns two values, how do I interact with both of them and not just the first one?
- 21:40 bremner: e.g. with let-values?
- 21:40 eg0: oh
- 21:40 oh no
- 21:40 thats assignment
- 21:41 like, say I had (values 4 5)
- 21:41 what can I use to get a list (4 5)?
- 21:41 (list (values 4 5)) doesnt work, and there doesnt seem to be a multiple-values-list like there is in CL
- 21:43 bremner: I see. I never use multiple values, but at least I understand the question now.
- 21:43 I guess you could make something with call-with-values
- 21:45 zRecursive: rudybot: (values 4 5)
- 21:45 rudybot: zRecursive: ; Value: 4
- 21:45 zRecursive: ; Value#2: 5
- 21:45 bremner: rudybot: (call-with-values (lambda () (values 1 2)) list)
- 21:45 rudybot: bremner: your sandbox is ready
- 21:45 bremner: ; Value: '(1 2)
- 21:45 eg0: yeah
- 21:45 thats what I just tried
- 21:45 ok, that will be perfect
- 21:45 thanks bremner, i appreciate the help
- 21:45 bremner: today I learned ;)
- 21:46 eg0: me too
- 21:46 knowledge is power
- 21:51 Nisstyre: eg0: you can also do the reverse, ie..
- 21:51 rudybot: (apply values (list 1 2))
- 21:51 rudybot: Nisstyre: your sandbox is ready
- 21:51 Nisstyre: ; Value: 1
- 21:51 Nisstyre: ; Value#2: 2
- 21:51 eg0: i did know that one
- 21:51 apply is sweet
- 21:51 Nisstyre: apply takes a procedure and a list and applies the procedure to each element in the list as the arguments
- 21:51 yeah
- 21:52 eg0: rudybot: (apply values (call-with-values (lambda () (values 4 5)) list))
- 21:52 rudybot: eg0: your sandbox is ready
- 21:52 eg0: ; Value: 4
- 21:52 eg0: ; Value#2: 5
- 21:52 eg0: undoing
- 21:52 trollolo
- 21:52 Nisstyre: yeah
- 21:52 eg0: if i worked IT, id drop snippets like that all over the place
- 21:53 Nisstyre: that's generally considered bad form :P
- 21:53 eg0: my dad wrote cobol for 30 years and he says he did shit like that all the time so that he could secure his position
- 21:53 but thats only IT
- 21:53 Nisstyre: hahaha
- 21:53 eg0: youd get fired or slapped if you did that somewhere else
- 21:53 Nisstyre: eg0: http://thc.org/root/phun/unmaintain.html
- 21:54 eg0: omg this is gold
- 21:54 Nisstyre: that one is a classic
- 21:55 eg0: when I saw that go demo where they did hello world in japanese i thought about writing complete projects with foreign keyboards
- 21:57 this is the best thing ever, there's so many of these
- 22:19 asumu: technomancy: boxes are ancient. CAS was added primarily because it's useful for a concurrency library that's under development.
- 22:19 (ancient in that they've always been there, not that they're outdated or anything)
Advertisement
Add Comment
Please, Sign In to add comment