00:02 (join) jao 00:04 (join) espringe 00:04 espringe: In racket repl (or dr racket) is there a way to refer to the result of the last expression? 00:06 espringe: Ah sweet, found it in xrepl 00:07 asumu: espringe: Was just about to direct you there. :) 00:07 espringe: asumu: Is it possible to get this in drracket? 00:08 asumu: espringe: Not as far as I know, but maybe try (require xrepl) in the definitions area. 00:08 espringe: Doesn't work :( 00:11 asumu: Yeah, I can't get it to work either. You could try asking eli if it's possible. 00:11 espringe: Having a ^ in drracket would be nice. But I'll see if I can get xrepl to do indenting and paren highlighting, and then i could use that 00:12 asumu: espringe: If you run the Racket REPL in emacs you could probably get that "for free" 00:13 espringe: I've only got enough room in my brain for vi hotkeys. I tried the emacs tutorial once, but I couldn't get anything to stick 00:14 asumu: Also, readline can do some basic paren matching (e.g. "set blink-matching-paren on" in .inputrc) 00:14 mithos28: I cannot see a (good) reason why xrepl shouldn't work in the drracket repl 00:14 asumu: espringe: I'm actually a vim user too. I get by using this mode in emacs https://gitorious.org/evil/pages/Home 00:29 (quit) jao: Ping timeout: 248 seconds 00:41 RackN00b: Can anyone maybe help me determine why this is failing? (define (remove-col polyomino) (cond [(empty? polyomino) empty] [else (apply remove-first polyomino)])) (define (remove-first list) (rest list)) 00:41 RackN00b: eek.. maybe I'll pastebin that! 00:42 RackN00b: http://pastebin.com/gf6GmLAx 00:42 offby1: what does "fail" mean? 00:42 RackN00b: I'm trying to remove the first first element of each nested list... remove-first: expects only 1 argument, received 2 00:43 espringe: Try removing the apply? 00:43 espringe: like: 00:43 espringe: (remove-first polymonin) 00:43 espringe: ? 00:43 offby1: yep 00:43 RackN00b: I was hoping to avoid recursing... If I take out the apply, I'll only be removing the first sublist... 00:43 RackN00b: I need to remove the first element in each sublist. 00:44 espringe: is polyomino a list of lists? 00:44 RackN00b: yes. 00:44 espringe: Then the problem is with your definition of remove-first 00:44 RackN00b: hmmm 00:44 espringe: I don't know enough lisp to help you, :( 00:44 espringe: so maybe someone else can 00:44 RackN00b: No worries... good place to start looking :D 00:44 espringe: (i'm a super noob) 00:45 RackN00b: <------ ridiculous Noob 00:45 Pauan: I would but I'm busy in-game 00:45 RackN00b: hey no worries... 00:45 espringe: does: 00:45 espringe: (define (remove-first list)   (apply rest list)) 00:45 espringe: does that work? 00:45 espringe: and remove the "apply" from remove-col 00:46 RackN00b: nope 00:46 espringe: http://pastebin.com/4gJQw4E5 00:46 espringe: That's my totally uneducated guess 00:47 RackN00b: rest: expects only 1 argument but receive 2... 00:47 RackN00b: odd 00:47 RackN00b: Maybe I have to curry rest... I'll give that a shot 00:47 espringe: Pastebin all the code, that you're using to test 00:48 espringe: and i'll see if i can get it to work 00:48 espringe: good learning for me 00:48 RackN00b: Cool cool. 00:48 RackN00b: There's no code aside from what I put up.... I'll toss a check-expect on it and repost for you 00:50 RackN00b: http://pastebin.com/etZxfDQp 00:54 RackN00b: Got it... (map rest polyomino) 00:58 RackN00b: Is there a straightforward way to apply a given function n number of times as opposed to writing an accumulator that counts from 0 to n? 00:58 (join) offby1_ 00:59 espringe: RackN00b: Ah, I see you've solved it. Here was my version: http://pastebin.com/K8Q8Trd5 00:59 espringe: but yeah, same solution really 01:00 espringe: There might already be a version of "safe-rest" in the standard functions, i have no idea :D 01:00 RackN00b: I don't know if there is or not, but I managed to get rid of one extra helper so yay! 01:01 (quit) dnolen: Quit: dnolen 01:02 Pauan: RackN00b: If you want to apply a function n number of times, I guess you could use build-list, but there may be a better way in Racket. 01:02 Pauan: unfortunately that has the effect of returning a list 01:03 jonrafkind: rudybot, (for ([i (in-range 0 5)]) (printf "x")) 01:03 rudybot: jonrafkind: ; stdout: "xxxxx" 01:03 Pauan: oh, nice 01:04 Pauan: (I don't use for stuff in Racket, in case you couldn't tell) 01:04 jonrafkind: you're a map kind of guy eh 01:04 Pauan: I'm an Arc kinda guy 01:05 Pauan: you'd use (repeat 5 (pr "x")) in Arc 01:05 RackN00b: Sorry Pauan - should have been clearer... I need to apply a function to a list n number of times... So given my list of lists (all of length n) to add a column, I add an empty character at the front of each nested list while adding a row amounts to adding a new list of length n to the front of the outer list... I just need to take in a value as to how many times I need to do this in both cases... 01:06 (quit) jeapostrophe: Ping timeout: 260 seconds 01:06 Pauan: (in case you're wondering what I'm doing on the Racket IRC, well... Arc is implemented in Racket, and I'm writing my own Arc compiler in Racket, and was having some issues so I wound up here) 01:07 Pauan: (so I ended up learning a bunch of stuff about Racket as a means to an end) 01:07 espringe: Pauan: I actually just heard about arc today. Is it significantly different than racket? 01:07 Pauan: yes 01:07 jonrafkind: whats interesting about arc? it looks like it enjoys being terse 01:07 espringe: What do you think is a better choice for someone new to lisp? 01:08 Pauan: it really does depend on what you want to get out of it 01:08 espringe: I'm trying to implement some really old genetic algos in lisp 01:08 espringe: like the original papers 01:08 Pauan: jonrafkind: I like it because it's very short and convenient, and I think it made an awful lot of right choices for a lisp 01:09 jonrafkind: I am not impressed with arc's default choice for spelling behavior. 'def', 'fn', 'mac' 01:09 Pauan: but that's the best part :D 01:10 Pauan: I can barely stand a Lisp that uses "lambda" anymore 01:10 jonrafkind: oh boy.. we are on opposite ends of the spectrum 01:10 Pauan: apparently so 01:10 Pauan: Racket is significantly different from Arc, so that doesn't surprise me 01:10 jonrafkind: 'fn' is to 'lambda' as aol speak is to english 01:11 jonrafkind: i dont understand why engineers despise grammatical and spelling errors but are ok with doing it in code 01:12 asumu: I prefer λ 01:12 espringe: RackN00b: is this what you were after? http://pastebin.com/T8ajB0r8 01:13 Pauan: asumu: that's nice, yeah, but keyword support is pretty poor 01:13 Pauan: so you end up needing a keyboard shortcut 01:13 espringe: Like apply a function over and over? 01:13 espringe: Or have an editor that coverts \ to it 01:14 Pauan: right, or that 01:14 espringe: i don't mind haskell style 01:14 jonrafkind: Pauan, you would hate my language, honu, instead of 'lambda' I use 'function' ! 01:14 espringe: which is that backslash, that editors can normally optionally render as a lambda sign 01:14 Pauan: jonrafkind: I've done enough JavaScript, thanks 01:14 RacketCommitBot: [racket] plt pushed 2 new commits to master: http://git.io/Txic9w 01:14 RacketCommitBot: [racket/master] update the mac os x icons to use the newer, higher-resolution images - Robby Findler 01:14 RacketCommitBot: [racket/master] fix bugs in the way the Racket|Disable Tests menu item worked - Robby Findler 01:15 jonrafkind: but of course since you are in racket you can redefine/import any name you wish 01:15 Pauan: sure 01:15 Pauan: but I think defaults matter 01:16 jonrafkind: ok aside from that "trivial" issue it looks like arc uses non-hygenic by default macros? 01:16 Pauan: yeah 01:17 jonrafkind: strange design choice 01:17 Pauan: I guess you could see Arc as being like a blend of Scheme and CL 01:18 Pauan: nil/t for #f/#t for instance 01:18 jonrafkind: some people just can't let the 1960's die 01:37 (quit) freakazoid: Quit: Computer has gone to sleep. 01:54 asumu: BTW: I'm glad SICP's alternative never caught on: "It would be clearer and less intimidating to people learning Lisp if a name more obvious than lambda, such as make-procedure, were used." 01:54 asumu: Though I agree with the lambda bit (which I didn't remember being there, but I haven't read this in a while). 01:56 jonrafkind: did they say the same thing about car/cdr? 02:05 asumu: No, but it does mention in a footnote what they stand for. 02:09 Pauan: where are the unit tests for Racket located? 02:13 jonrafkind: collets/tests/racket 02:13 Pauan: thank you 02:15 (quit) EmmanuelOga: Ping timeout: 244 seconds 02:18 Pauan: also, what's the preferred way to get a change into Racket? 02:18 Pauan: fork the project on github and send a pull request, or something else? 02:18 jonrafkind: I think pull requests work 02:19 mithos28: Pauan: github pull requests usually work well, thats what I use 02:19 Pauan: okay, cool 02:22 (quit) realitygrill: Quit: realitygrill 03:03 Pauan: okay, it's officially Gmail that is mangling my e-mails 03:03 Pauan: at least this time the mangling is still readable for the most part 03:10 (quit) jonrafkind: Read error: Operation timed out 03:17 RackN00b: How would you guys go about counting the number of times a given number turns up in a nested list? 03:18 Pauan: hm 03:18 Pauan: does "count" work in a nested list? 03:19 RackN00b: I don't have "count" at my disposal... Might be limited to recursing through each sublist and adding to a running tally. 03:19 Pauan: nope it doesn't 03:19 Pauan: though you could flatten the list first :P 03:19 RackN00b: True... 03:24 Pauan: ozzloy: got the basic escapes working, but they seem to only work in pregexp mode. 03:27 (quit) noam: Read error: Connection timed out 03:28 (join) noam 03:31 (join) Blkt 03:44 Pauan: Also, I'm not entirely sure how to go about adding in \x and \u escapes. 03:44 Pauan: (let alone \X) 03:59 (join) Shvillr 04:02 (quit) 16SABNLGU: Ping timeout: 260 seconds 04:04 (quit) SidH_: Remote host closed the connection 04:04 (join) SidH_ 04:28 (join) ahinki 04:43 (quit) mithos28: Quit: mithos28 05:04 (quit) SidH_: Remote host closed the connection 05:04 (join) SidH_ 05:10 Blkt: good morning everyone 05:15 (join) tim-brown 05:28 ohwow: hi 05:32 (quit) ahinki: Remote host closed the connection 05:43 (quit) RackN00b: Quit: Page closed 05:59 (join) leandrosansilva 06:13 (join) Lajla 06:18 (join) noisetonepause 06:19 noisetonepause: hello 06:20 noisetonepause: if i've got a struct with ten fields and a list with the fields in the right order, is there a quick way to convert the list to the instance of the struct? 06:39 (join) epsil 06:40 epsil: if I want to add an element to the beginning of a list, I can do (cons element list) 06:40 epsil: but if I want to add it at the end, do I have to do (append list (list element)) ? 06:40 epsil: or is there an easier way 06:42 tim-brown: is there a standard scheme/racket indenting scheme (you know... the kind that is embraced by all users without complaint or controversy) 06:42 tim-brown: ? 06:49 epsil: tim-brown: I wasn't aware there was controversy 06:49 epsil: I let emacs indent the code for me 06:51 tim-brown: i ask for a standard, i expect controversy 06:57 epsil: I think the general idea in any lisp is that you should never attempt to indent it manually 06:57 epsil: always let the auto-indentation to the job for you (and do not fight it, even if you think you know better) 06:57 tim-brown: so where are the automatic rules described? 06:58 (part) noisetonepause 06:58 epsil: hm ... good question 06:58 epsil: the basic approach is very simple (line up parenthetical expressions with each other), but there are some exceptions, like define 07:05 epsil: *parenthetical expressions -> S-expressions 07:05 epsil: I know that in some lisps, you can define custom indentation rules for any form, overriding the standard rule 07:06 epsil: i.e., you would specify the indentation for a macro inside the macro definition 07:08 epsil: the code itself describes how it is to be indented 07:09 epsil: however, I doubt emacs goes to the trouble of looking up the indentation rules for basic things like define 07:10 epsil: that is likely hard-coded 07:10 tim-brown thought that emacs was even capable of psychoanalysing itself 07:11 (join) fridim_ 07:12 epsil: well, elisp macros have indentation specifications 07:12 epsil: but I don't know if scheme macros have them 07:14 (quit) loz`: Read error: Connection reset by peer 07:15 (join) loz` 07:22 (quit) loz`: Read error: Connection reset by peer 07:22 (join) loz` 07:28 (join) jeapostrophe 07:30 (quit) loz`: Read error: Connection reset by peer 07:33 (join) loz` 07:39 (quit) loz`: Read error: Connection reset by peer 07:40 (join) loz` 07:58 (join) veer 08:11 (quit) leandrosansilva: Remote host closed the connection 08:18 (join) ahinki 08:20 (quit) epsil: Quit: WeeChat 0.3.5 08:34 (quit) veer: Quit: Leaving 08:52 (quit) noam: Read error: Connection reset by peer 08:52 (join) noam 09:32 (join) dnolen 09:39 (join) epsil 09:39 (quit) jeapostrophe: Ping timeout: 252 seconds 09:43 asumu: tim-brown: At least in Racket, generally how DrRacket indents is "correct" but that's also not universally preferred. 09:43 asumu: Taylor Campbell has a style guide that talks about indentation http://mumble.net/~campbell/scheme/style.txt 09:44 tim-brown: will peruse that 09:44 tim-brown: asumu: thx 09:53 (join) jeapostrophe 09:59 (join) kenjin_ 09:59 (quit) jeapostrophe: Read error: Connection reset by peer 09:59 (nick) samth_away -> samth 09:59 kenjin_: ... 10:00 kenjin_: Hello, I have a question about placeholder in db library 10:01 kenjin_: (query-exec c "drop table if exists $1" 'foo) doesn't work 10:02 kenjin_: query-exec: SQL syntax error in "drop table if exists $1" 10:03 (quit) dnolen: Quit: dnolen 10:24 (part) shofetim: "ERC Version 5.3 (IRC client for Emacs)" 10:38 (join) freakazoid 10:46 (join) realitygrill 10:47 samth: kenjin_: i don't know much about sql, but might that be a syntax that's not supported by your particular db? 10:49 kenjin_: Now I understand why. It's because placeholders can only be placed where "values" are 10:50 kenjin_: BTW, I don't know whether you remember me, but I've succeeded in writing the syntactic sugar. 10:51 kenjin_: Now I realize syntax-case is easy to use really. 10:53 (quit) realitygrill: Ping timeout: 248 seconds 10:59 (quit) ahinki: Quit: ChatZilla 0.9.87 [Firefox 9.0/20111122192043] 11:23 (join) dnolen 11:32 (join) keenbug 11:38 (quit) freakazoid: Quit: Computer has gone to sleep. 11:38 (join) gumbo_ 11:39 gumbo_: is there any plan to support html5 in racket's standard libraries? 11:45 (quit) gumbo_: Remote host closed the connection 11:46 (join) gumbo 11:46 samth: gumbo: what do you mean by "support html5" 11:46 samth: you can already write html5 web pages using the xml library, for example 11:47 gumbo: Thanks, I'm new to racket(not lisp), and when looking through the tutorials I wondered this :) 11:51 samth: gumbo: the real question is what you mean by "html5" 12:01 gumbo: HTML5+CSS3+JS 12:02 samth: so, racket provides quite nice support for constructing html documents 12:03 samth: racket doesn't have a standard library for constructing css files 12:16 (quit) epsil: Quit: WeeChat 0.3.5 12:23 (quit) Blkt: Quit: ERC Version 5.3 (IRC client for Emacs) 12:25 (join) jonrafkind 12:25 (join) masm 12:38 (join) MayDaniel 12:39 (join) mithos28 12:41 (quit) tim-brown: Quit: Leaving 12:54 (quit) mithos28: Quit: mithos28 13:02 (join) Guthur 13:02 Guthur: will DrRacket run on an ARM based linux distro? 13:05 jonrafkind: yea but theres no jit 13:05 (join) freakazoid 13:12 freakazoid: Has anyone built a SchMUSE clone with Racket? 13:17 samth: what is schmuse? 13:17 (join) carleastlund 13:27 Guthur: jonrafkind: and what is the up shot of no JIT? 13:28 jonrafkind: it will run but slowly 13:29 Guthur: ok, that shouldn't be a problem, it's for educational purposes 13:29 Guthur: jonrafkind: cheers 13:30 jonrafkind: ok, let us know if you have any problems. im not sure how well tested the arm version is 13:31 Guthur: ok will do, the project is still in the incubation stage so will be at least a month before a proper test 13:32 freakazoid: samth: Scheme MUSE 13:33 Guthur: looking at running it on this when the hardware is available -> http://www.raspberrypi.org/ 13:33 Guthur: hopefully will be available next month, I'll pick one up then to test things 13:33 jonrafkind: with 256mb of ram it should work ok 13:47 (join) ed-k 14:22 (join) awest 14:23 awest: Have there been any reports of 5.2 bugs in the Mac version of DrRacket, regarding the prefixing of identifiers provided by a module? 14:25 (part) ed-k: "ERC Version 5.3 (IRC client for Emacs)" 14:28 jonrafkind: awest, not that I know of. whats the bug? 14:29 (quit) freakazoid: Quit: Computer has gone to sleep. 14:30 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/hjSTiw 14:30 RacketCommitBot: [racket/master] adjust drracket to clean up the code that sets the initial value of - Robby Findler 14:31 (join) freakazoid 14:32 (quit) keenbug: Ping timeout: 245 seconds 14:36 awest: jonrafkind: let me reproduce it a third time and then I'll describe/report it today or tomorrow. 14:49 (quit) kenjin_: Ping timeout: 252 seconds 14:50 (join) EmmanuelOga 14:51 (join) ahinki 14:52 (join) mithos28 14:58 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/iI7biQ 14:58 RacketCommitBot: [racket/master] set the current-load-relative-directory to #f (initially) in drracket - Robby Findler 15:25 (quit) awest: Quit: leaving 15:36 RacketCommitBot: [racket] plt pushed 2 new commits to master: http://git.io/rGpkMg 15:36 RacketCommitBot: [racket/master] add the ability to pass a bitmap directly for the splash screen - Robby Findler 15:36 RacketCommitBot: [racket/master] adjust the dock icon (under mac os x) to change on the weekends - Robby Findler 15:40 (join) epsil 15:57 (quit) ahinki: Remote host closed the connection 15:59 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/efDu4Q 15:59 RacketCommitBot: [racket/master] make `in-sequences' and `in-cycle' accept 0 sequences - Matthew Flatt 15:59 RacketCommitBot: [racket/master] raco setup: one more path simplifcation point - Matthew Flatt 15:59 RacketCommitBot: [racket/master] ffi/unsafe/objc: at least load on platforms without libobjc - Matthew Flatt 16:19 (join) keenbug 16:22 (quit) keenbug: Read error: Operation timed out 16:34 (join) keenbug 16:55 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/p6ILMA 16:55 RacketCommitBot: [racket/master] Adjusting the weekend-bitmap-swapping code so it changes dynamically - Robby Findler 16:55 RacketCommitBot: [racket/master] adjust the autosave error code to print the stacktrace - Robby Findler 16:55 RacketCommitBot: [racket/master] change file-creator-and-type so that it raises exn:fail:filesystem? - Robby Findler 17:00 (quit) epsil: Quit: WeeChat 0.3.5 17:00 (nick) Guest12546 -> cipher 17:00 (quit) cipher: Changing host 17:00 (join) cipher 17:14 (quit) freakazoid: Quit: Computer has gone to sleep. 17:14 (join) jao 17:21 (quit) noam: Read error: Connection reset by peer 17:21 (join) noam 17:33 (nick) samth -> samth_away 17:43 (quit) keenbug: Ping timeout: 244 seconds 17:43 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/VOxWHA 17:43 RacketCommitBot: [racket/master] on-receive does not have to exist for a world to be a part of a universe, weird but feasible; Closes PR12401 - Matthias Felleisen 17:49 (quit) gumbo: Read error: Connection reset by peer 18:02 (quit) dnolen: Quit: Page closed 18:03 (join) freakazoid 18:49 (quit) MayDaniel: Read error: Connection reset by peer 18:57 (quit) asumu: Quit: leaving 19:08 (quit) fridim_: Ping timeout: 248 seconds 19:23 (quit) carleastlund: Read error: Connection reset by peer 19:23 (join) carleastlund_ 19:40 (quit) Guthur: Remote host closed the connection 19:44 espringe: This is what i'd consider to be the ultimate web programming, if i could do something like this: 19:44 espringe: http://pastebin.com/mXnDrSyd 19:44 espringe: And the output of that, would be an HTML page -- with a version of "make-bg-red" compiled into some javascript 19:44 espringe: Is anything like that, remotely possible? 20:05 jonrafkind: I suppose thats possible, you could make a pass over the code and convert racket code into javascript 20:06 jonrafkind: but you would have to take care to preserve the semantics of javascript 20:06 (join) realitygrill 20:20 Pauan: espringe: As jonrafkind said, that would require a Racket->JS compiler, which already exists: http://hashcollision.org/whalesong/ 20:20 (join) asumu 20:20 jonrafkind: well thats for client side stuff 20:20 jonrafkind: i think.. 20:20 Pauan: I'm assuming they wanted to run the JS on the client side 20:21 Pauan: so unless whalesong has some limitation, I don't see why you couldn't do the Racket->JS compilation on the server 20:21 Pauan: and then send it to the client 20:21 jonrafkind: i mean espringe wants to write a single piece of code that is automatically split between server side code and client side code 20:21 espringe: Yup 20:21 jonrafkind: I got the feeling that whalesong was purely lcient side 20:21 espringe: I want the server to compile the js, and send it to the client 20:21 jonrafkind: as in convert an entire racket program to js 20:21 espringe: I only want to convert a few functions to js 20:21 jonrafkind: with some restrictions then what espringe want's to do should be pretty easy 20:22 jonrafkind: it gets hard as you scale it up to the full racket language 20:22 Pauan: of course 20:22 espringe: I shouldn't need stuff like an FFI and what not 20:22 Pauan: because of limitations in JS or whalesong 20:22 espringe: But it should be reasonably complete 20:22 espringe: I might have a stab at it, it'd be pretty awesome 20:22 Pauan: but as long as you stick to stuff that's a reasonable mapping between JS and Racket, it should be easy 20:22 Pauan: (i.e. don't try anything crazy) 20:23 espringe: I'd really like totally arbitrary functions to work. E.g. if i wrote/used a (purely functional) md5 function, it should just work in both 20:23 espringe: and i can reuse the same code, from the client and server 20:23 espringe: It's a bit useless if i have to make special versions for js and special versions for the server 20:23 espringe: Like one cool thing would be form validation, and using the exact same methods on the client and server to validate 20:24 espringe: (client for convience, server for security) 20:24 Pauan: that'll depend on what the code does and whether whalesong can handle it 20:24 Pauan: no way to know for sure unless you try it 20:25 (join) RackN00b 20:26 espringe: The other thing it would be really cool for, is making "desktop" applications with browser-based frontend. That way you'd get really great portability between different OS's (including mobile ones) as well as running on an actual web server 20:26 Pauan: like with say Adobe AIR? 20:27 espringe: Sure, i guess. I've never used adobe air. 20:27 espringe: Does it compile down to just html? 20:27 espringe: (and js) 20:27 freakazoid: espringe: it has its own runtime 20:27 Pauan: Adobe AIR is a runtime for executing Flash, Flex, HTML, and Ajax on the desktop 20:27 freakazoid: which constantly uses 5% CPU whenever it's running 20:27 Pauan: Mozilla Prism is an alternative 20:27 freakazoid: so don't run it on a laptop 20:28 Pauan: http://en.wikipedia.org/wiki/Mozilla_Prism 20:28 espringe: The one thing I'd be missing is proper sockets. I like writing networked code :( 20:28 Pauan: (though it seems Prism has been discontinued...) 20:29 (join) francisl 20:32 (quit) jonrafkind: Ping timeout: 258 seconds 20:39 RackN00b: Hey guys - http://pastebin.com/eeE1PJVB 20:39 RackN00b: I was wondering if someone could help me troubleshoot this.... 20:39 Pauan: can you give an example? 20:39 Pauan: for instance 20:39 Pauan: the input, and expected output? 20:40 RackN00b: Specifically, I am having trouble with a part of the code where I am trying to add a character to the front of each sublist.... Sure... 20:41 RackN00b: (check-expect (superimpose '((#\. #\. #\.)(#\X #\X #\X)) '((#\T #\T #\T)(#\T #\. #\T)) (make-pos 1 1)) '((#\. #\. #\.)(#\T #\T #\T))) 20:41 RackN00b: Does that make any sense ? 20:42 Pauan: yeah 20:42 RackN00b: I'll try and give you an example for just the blank-cols 20:42 Pauan: wait, where's make-pos? 20:45 (join) dnolen 20:51 RackN00b: Ah.. sorry , it's defined previously as (define-struct pos (x y)) 20:51 Pauan: kay 20:51 Pauan: ah yes, the infamous build-2dlist 20:52 RackN00b: Would this involve currying the function blank-char? 20:52 RackN00b: Haha... yep Do you want me to post that code as well ? I know that part works so I can also comment it out... 20:52 Pauan: well it'd save me the trouble of digging through the logs, yeah 20:53 RackN00b: ok.. two secs and I'll pastebin it. 20:57 RackN00b: http://pastebin.com/1DAeLMpu 20:58 RackN00b: Now the rest of the function isn't yet written.. for the actual superposition of the top onto the bottom - I had a clunky function for it but I'd like to rewrite it more succintly with nice locals. 20:58 Pauan: by the way 20:58 Pauan: my suggestion would be to use "let" rather than "locals" 20:58 Pauan: local* 20:59 RackN00b: I haven't let before so I'll have to read up on it. 20:59 Pauan: (let ([a 5]) a) 20:59 Pauan: binds the local variable "a" to 5 21:00 Pauan: so (let ([a 5] [b 10]) ...) binds the local variable a to 5 and b to 10 21:00 RackN00b: Can the local variable be bound to a function? 21:00 Pauan: sure 21:00 Pauan: but in that case you can just use "define" 21:00 Pauan: as in... 21:00 Pauan: (lambda () (define foo ...) ...) 21:00 Pauan: a define inside a function is bound locally 21:00 Pauan: no need for local 21:01 Pauan: works for ordinary vars too, I believe 21:01 Pauan: not just local functions 21:01 RackN00b: Neat 21:01 Pauan: then there's the "let loop" form 21:01 Pauan: (let loop ((x 0)) ...) 21:01 Pauan: which creates a local function called "loop" and immediately executes it 21:01 Pauan: with x defaulting to 0 21:02 Pauan: this is convenient for writing recursive functions 21:02 Pauan: oh, in this case you want let* though 21:03 Pauan: In the code (let ([a 5] [b a]) ...) the variable "b" refers to the *global* value of "a" 21:03 RackN00b: Oh, that's nice. 21:03 Pauan: but in (let* ([a 5] [b a]) ...) the variable "b" refers to the local variable "a" 21:03 Pauan: and thus is 5 21:03 Pauan: in other words, let* is sequential 21:03 RackN00b: I can see how that'd be handy 21:03 Pauan: local variables can refer to previous local variables 21:03 Pauan: okay, first issue 21:04 Pauan: procedure blank-char: expects 1 argument, given 3: '((#\.)) '(#\T #\T) '(#\T #\.) 21:04 Pauan: you're *applying* blank-char to a list 21:04 Pauan: so first off, remove the apply 21:04 Pauan: and now I got '(#\. ((#\.)) (#\T #\T) (#\T #\.)) 21:04 RackN00b: right 21:05 Pauan: hm... 21:05 Pauan: what is blank-rows supposed to be? 21:05 Pauan: it's ((.)) for me 21:05 RackN00b: Hmmm I'm getting something different.... Is that using the newest paste - i edited the definitions for top and bottom 21:06 Pauan: it's using this: 21:06 Pauan: http://pastebin.com/1DAeLMpu 21:06 Pauan: lemme try it with your version of superimpose 21:06 Pauan: same thing 21:06 RackN00b: I'm getting this: (list (list #\. (list #\.)) (list #\. #\T #\T) (list #\. #\T #\.)) 21:07 RackN00b: Oh, and replaces apply with map, should have mentioned that... 21:07 Pauan: ah 21:07 Pauan: yeah, now I get the same thing 21:08 Pauan: why does top have only 2x2 elements, while bottom has 2x3? 21:08 RackN00b: I don't know... This is strange - it was working when I only had blank-rows - i fear I might have changed something small without knowing :O 21:09 Pauan: hm... 21:10 Pauan: okay, hold on, you're trying to superimpose bottom on top of top? 21:10 Pauan: so that the end result is that any "blank" characters in bottom end up replaced with those in top? 21:11 RackN00b: Yes but also non-blank characters... I am superimposing top onto bottom 21:11 RackN00b: or trying to at least :P 21:11 Pauan: oh 21:11 Pauan: hm... 21:11 (join) didi 21:12 Pauan: I'm not understanding the desired result in check-expect then 21:12 RackN00b: The reason I am writing this portion is to "pad" the top such that it is the same size as the bottom and I can overlay one onto the other with a simple function.... 21:12 Pauan: Imposing top onto bottom, I'd expect this: ((#\T #\T #\B) (#\T #\. #\B)) 21:13 Pauan: and imposing bottom onto top, I'd expect this: ((#\B #\B #\B) (#\T #\. #\B)) 21:13 RackN00b: Sorry, the first is correct... 21:13 Pauan: okay, then 21:13 Pauan: so... 21:13 Pauan: first off, why do you have to pad it? 21:14 Pauan: why not just have top be 2x3? 21:14 RackN00b: Because the function I had to overlay the top onto the bottom consumes both lists stepwise so they have to be the same size.. I couldn't figure out how to do it without padding... Also, I coudln't figure out how to reference where to begin the overlay given the offset. 21:15 Pauan: well, why not change it so when it reaches the end of the list, it assumes a blank character? 21:15 Pauan: that way, if one list is shorter than the other, it's automatically padded? 21:16 RackN00b: But the padding also serves the purpose of establishing the correct placement given the offset... The first of the first of each list is (0 0) so if my offset is (1 1) I have to start one down and one over for my overlay... Can I accomplish that without padding? 21:17 RackN00b: brb... daughter wnat a bedtime snack! two mins... sorry! 21:17 Pauan: let's first get superimposition working, then we'll worry about offsets 21:22 RackN00b: sorry... kid tucked in :D 21:23 Pauan: okay 21:23 Pauan: got superimpose working 21:23 Pauan: it's kinda long, though 21:24 RackN00b: This is my overlay function I wrote...http://pastebin.com/Rgc9iiKq 21:24 Pauan: right, see, that'd be perfect for a let loop 21:25 RackN00b: I wish i could use them :( I mean it'd not horrible on something like this but I can certainly imagine it would be a lot more readable using let loops 21:25 Pauan: http://pastebin.com/YsRd7ENj 21:25 Pauan: expires in an hour 21:26 Pauan: see what I mean about being kinda long? 21:26 Pauan: it works properly with shorter lists, though 21:26 Pauan: as in, if top is shorter than bottom, it'll get padded automatically 21:26 Pauan: now to test it the other way around... 21:26 Pauan: ah, yeah, that breaks 21:26 RackN00b: I don't think I will ever have that situation though... 21:27 RackN00b: The bottom represents a partially solved puzzle while the top is simply a piece. 21:27 Pauan: so the bottom can never be smaller than the top? 21:28 RackN00b: Well if I pad the top to get the proper offsets then yes, but without padding, no. 21:28 Pauan: then my function should work 21:28 Pauan: okay then 21:28 RackN00b: But even in the case of padding, I can always "trim" the top to match the size of the bottom... 21:28 Pauan: you said you wanted to offset it, right? 21:28 RackN00b: that's the goal, yep 21:28 Pauan: I think that should be a separate function 21:29 Pauan: hm... 21:29 Pauan: first thing, though 21:29 Pauan: with this: ((#\T #\T) (#\T #\.)) 21:29 Pauan: which is the X axis? 21:29 Pauan: the (#\T #\T) part? 21:29 Pauan: or both sublists? 21:29 RackN00b: Each sublist has an x and a y component... 21:30 Pauan: okay 21:30 Pauan: hm... 21:30 Pauan: but that doesn't explain this: ((#\B #\B #\B) (#\. #\. #\B)) 21:30 RackN00b: So that could be though of as a square with four smaller squares where there are all T but the bottom right one. 21:30 Pauan: which part of that is x and which is y? 21:30 RackN00b: That one would be an L-tetromino 21:30 Pauan: okay, so #\. is the empty one 21:30 Pauan: hm 21:30 RackN00b: yes... 21:30 Pauan: L-shaped 21:30 Pauan: okay, gotcha 21:31 Pauan: that means each sublist is Y 21:31 Pauan: and the entire list is X 21:31 RackN00b: I guess the coordinates are implied in the representation... does that make sense? 21:31 RackN00b: OK... I follow... nice 21:31 Pauan: okay then 21:32 Pauan: so that means if you want to offset it by 1 value to the X 21:32 (quit) masm: Quit: Leaving. 21:32 Pauan: that involves adding a #\. to each sublist 21:32 RackN00b: You're adding a #\. to the ... beat me to it! 21:32 RackN00b: yes 21:32 Pauan: and if you want to offset it by Y 21:32 Pauan: then that involves adding a new list 21:32 Pauan: to the front of the list 21:32 RackN00b: add a list of #\. the same length 21:32 Pauan: well 21:32 Pauan: I don't think it strictly needs to be the same length 21:32 Pauan: if our automatic-padding code works 21:32 Pauan: point is it just needs to be something that's recognized as an offset 21:32 Pauan: okay then 21:33 Pauan: I'll whip up an offset function 21:33 RackN00b: ok... 21:33 Pauan: so rather than passing the offset to superimpose 21:33 Pauan: you'd first call the offset function on the list 21:33 Pauan: and then pass the offset list to superimpose 21:33 Pauan: two separate functions 21:33 Pauan: will that work? 21:34 RackN00b: It will as long as the offset is less than the difference between the width of the base and the top... otherwise, we'd be superimposing larger onto smaller... 21:34 Pauan: in other words, rather than (superimpose bottom top (make-pos 1 1)) 21:34 Pauan: you'd say this: 21:34 Pauan: (superimpose bottom (offset top 1 1)) 21:34 Pauan: well, we could put in checks for that 21:34 Pauan: or define behavior: cutting off the excess 21:34 RackN00b: Sure... ok 21:34 Pauan: or growing the matrix to fit the larger 21:34 Pauan: etc. 21:34 Pauan: I'm not worried about that: let's get it working first 21:36 RackN00b: ok 21:38 Pauan: okay 21:38 Pauan: offset code works 21:38 Pauan: now let's try offsetting top by 1 and superimposing it onto bottom 21:40 Pauan: by the way 21:40 Pauan: personally, I would swap the args to superimpose 21:40 Pauan: so it's (superimpose top bottom) 21:40 Pauan: 'cause you're superimposing top onto bottom 21:41 RackN00b: agreed- it's misleading isn't it.. 21:42 (quit) mithos28: Quit: mithos28 21:42 Pauan: okay 21:42 Pauan: so when you offset 21:43 Pauan: top might potentially be outside the range of bottom 21:43 RackN00b: Right, but we can trim it 21:43 Pauan: for instance, bottom only has two X coordinates 21:43 Pauan: okay 21:43 Pauan: so you want to trim it? 21:43 Pauan: to always be the size of bottom? 21:43 Pauan: an alternative would be to return a matrix that's the combination of both 21:43 RackN00b: I would think... we know that the offset is from (0 0)...... a matrix eh? 21:43 Pauan: well I'm thinking of them as matrixes 21:44 Pauan: easier to say than "list of lists of chars" 21:44 RackN00b: true 21:44 Pauan: anyways, I'm just asking about what the desired property is 21:44 Pauan: should it grow the matrix to fit both top and bottom inside? 21:44 Pauan: or cut it to the size of bottom? 21:45 RackN00b: Well the bottom is of constant size for a given puzzle so it wouldn't change during the execution of the solver so I would say it would be easier to cut it to size... 21:45 Pauan: okay then 21:45 Pauan: I'll make it cut it to the size of bottom 21:45 Pauan: that means that... 21:45 Pauan: offsetting top by 1x1 21:46 Pauan: and then superimposing it onto bottom... 21:46 Pauan: should be '((#\B #\B #\B) (#\. #\T #\T)) 21:46 RackN00b: correct. 21:56 (quit) acarrico: Ping timeout: 255 seconds 21:56 Pauan: and it works 21:57 Pauan: it's big, hairy, clunky, but it works 21:57 RackN00b: wow.. you are good! 21:57 Pauan: now to pastebin it... 21:58 Pauan: http://pastebin.com/NBQQ5kHS 21:58 Pauan: expires in an hour, as usual 21:58 Pauan: oh, wait 21:58 Pauan: there's tons of unnecessary whitespace 21:58 Pauan: gimme a sec 21:58 RackN00b: That's ok... 21:59 Pauan: http://pastebin.com/Kybks35a 21:59 Pauan: done 21:59 Pauan: I really do think superimpose is too clunky, though 21:59 RackN00b: quick question regarding your use of currying... (curry cons #\.) ==> Am i correct in thinking that this adds the #\. to each sublist? 21:59 Pauan: but I'm not entirely sure how to make it better 21:59 Pauan: yes 22:00 RacketCommitBot: [racket] plt pushed 2 new commits to master: http://git.io/3IEOuw 22:00 RacketCommitBot: [racket/master] allow strings and symbols for name clause in world; Closes PR12403 - Matthias Felleisen 22:00 RacketCommitBot: [racket/master] doc bugs fixed; Closes PR12404 - Matthias Felleisen 22:00 Pauan: it's the equivalent of (lambda (x) (cons #\. x)) 22:00 RackN00b: Cool.. 22:00 Pauan: by the way 22:00 Pauan: to shift along the Y axis 22:00 Pauan: I just added the empty list 22:00 RackN00b: oh ok... 22:00 Pauan: so (offset top 1 1) returns '(() (#\. #\T #\T) (#\. #\T #\.)) 22:00 Pauan: but the superimpose code can handle that okay 22:01 Pauan: hrm... I really don't like that superimpose code, though 22:03 RackN00b: I think it's pretty sweet. In any case, I have to run - all-nighter last night and am I barely managing to stay awake tonight. I'll have to study the functions tomorrow morning and see what I can learn from them... Thanks so much Pauan - you've been a huge help in helping me understand. 22:03 Pauan: sure 22:04 RackN00b: Hopefully one day when I get to be mroe of a guru I can pay it forward! Cheers for now! 22:04 (part) RackN00b 22:08 (join) acarrico 22:16 (join) delleps 22:17 RacketCommitBot: [racket] plt pushed 2 new commits to master: http://git.io/lUPFIA 22:17 RacketCommitBot: [racket/master] disable file in drdr - Robby Findler 22:17 RacketCommitBot: [racket/master] fix a bug in the module lexer; it was returning the wrong length for the tokens - Robby Findler 22:17 (quit) didi: Quit: ERC Version 5.3 (IRC client for Emacs) 22:21 (quit) delleps: Ping timeout: 265 seconds 22:46 (join) mithos28 22:47 (quit) freakazoid: Quit: Computer has gone to sleep. 22:54 ozzloy: Pauan, i expected the section would be pregexp and not regexp 22:54 ozzloy: Pauan, cool that you made some progress though. 22:54 Pauan: any ideas about how to handle \u and \x though? 22:55 ozzloy: Pauan, i am torn. i'd like to work on that, but i also want to go through the ai-class.com homework before wednesday 22:55 ozzloy: Pauan, also consider that adding to regexp is more likely to break someone's code somewhere that relies on \\n actually matching "n" 22:56 ozzloy: whereas pregexp throws a handy error 23:05 (quit) carleastlund_: Quit: carleastlund_ 23:05 Pauan: yeah, I know 23:05 ozzloy: Pauan, i'd start by looking at how different other parts of regexpes are handled 23:05 Pauan: I'm okay with it being for pregexps 23:05 Pauan: it's just annoying because regexp-match (and friends) make a regexp if you give them a string 23:05 Pauan: rather than a pregexp 23:05 ozzloy: like stuff between the (? and the : and stuff between a [ and a ] 23:06 ozzloy: how [:alnum:] is handled 23:06 ozzloy: to see how the code currently consumes a token 23:06 Pauan: right, I figured I'd need to look at strings.c too 23:06 Pauan: to see how Unicode is handled 23:06 ozzloy: oh good call 23:07 ozzloy: pun intended 23:15 (join) freakazoid 23:26 (join) jonrafkind 23:27 (quit) dnolen: Quit: dnolen 23:48 (join) dnolen