02:40 (quit) jonrafkind: Ping timeout: 252 seconds 03:51 (join) masm 04:06 (join) spidermario 08:02 (join) tony_ 08:03 (join) mceier 08:03 (quit) tony_: Client Quit 08:21 (quit) clklein: Ping timeout: 252 seconds 09:07 (join) hanDerPeder 09:17 (quit) hanDerPeder: Quit: hanDerPeder 09:21 (join) hanDerPeder 09:28 tonyg: Hi all 09:29 tonyg: why does (expand '+) => #, but (expand 'other) => # ? Shouldn't they both be #%top? 09:43 Lajla: tonyg, I guess because + is bound to and other is not 09:43 mao_: because '+ is builtin? 09:43 mao_: or what Lajla said 09:43 Lajla: tonyg, try it with (define other +) and see what happens 09:47 (join) anRch 09:51 tonyg: Well, after (define other +), the results are still the same. 09:51 mao_: Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. 09:51 mao_: > (expand '+) 09:51 mao_: # 09:51 mao_: > (expand 'crap) 09:51 mao_: # 09:51 mao_: > 09:51 mao_: maybe that's because I have plt 09:51 tonyg: But after (define + 3), (expand '+) => # 09:51 tonyg: mao_: try syntax->datum 09:52 tonyg: so it's looking like it's because + is builtin somehow. Maybe because it's bound to a primitive or something. Interesting. 09:52 mao_: reference to undefined identifier: synax->datum 09:52 mao_: i have old version prob 09:52 mao_: w/e 09:53 tonyg: "synax->datum" -> "syntax->datum" ? :-) 09:54 tonyg: Hm, it's interesting: it's like, when +'s binding is original, expand treats it like a *local* variable! 10:06 mao_: tru 10:08 Lajla: Using syntax-case for me is kind of like 'Okay, it works, but I still don't really know what I'm exactly doing' 10:08 Lajla: And the specs are soooo vague and hard to get what they understand 10:08 tonyg: yes, agreed. I found reading the original papers helped -- which suggests, for me, that the only real way to grok the system is to understand the whole mechanism of it. 10:09 tonyg: It seems that surface understanding is insufficient, for me, in that it leads to occasional wtf moments 10:09 tonyg: and I have to remind myself of the full algorithm to straighten out what's happening 10:10 Lajla: tonyg, you understand syntax-case? 10:10 tonyg: heh 10:10 tonyg: occasionally 10:10 Lajla: I understand continuations and monads though 10:11 tonyg: yeah - something about syntax-case feels non-local. 10:11 tonyg: Not sure. 10:11 Lajla: Let's see what I can boast with ehh, references, pointers, continuations, monads, and last but not least.... the entire mechanism and rules behind what sigil you should use in perl 4. \o/ 10:11 tonyg: Whereas continuations and monads are amenable to local reasoning 10:12 tonyg: hahaha 10:12 tonyg: yeah :) 10:12 Lajla: Those sigils have no logic behind them whatsoever 10:12 tonyg: have you looked at the original syntax-case papers? 10:13 Lajla: tonyg, what is the original? 10:13 tonyg: # R. Kent Dybvig. "Writing Hygenic Macros in Scheme with Syntax-Case". Computer Science Department, Indiana University. TR-356. June 1992. Available online: ps. 10:13 Lajla: The one pdf that is circling around? 10:13 tonyg: # Robert Hieb, R. Kent Dybvig and Carl Bruggeman. "Syntactic Abstraction in Scheme". Computer Science Department, Indiana University. TR-355. June 1992. Available online: ps. 10:13 Lajla: Yeah, that one 10:13 tonyg: ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/iucstr356.ps.gz 10:13 tonyg: ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/iucstr355.ps.gz 10:13 tonyg: those two 10:13 Lajla: Yeah, I read them. 10:13 tonyg: ok 10:14 Lajla: Also, I think that this supposed 'syntax object' goes against the idea of homo-iconicity. 10:14 tonyg: yeah, i find myself at times laboriously reminding myself of how my syntax is transformed all the way down to lambdas and back, in order to get where the binders come from 10:14 Lajla: Surely syntax should just be manipulated by the same functions that manipulate any list? 10:14 tonyg: hmm 10:14 tonyg: no, i disagree 10:14 tonyg: code is a kind of data, but it's not as simple as a list 10:15 Lajla: Hmm, well, I'd praefer it that it is. 10:15 tonyg: you recover homoiconicity via syntax-quote and syntax-quasiquote (whatever they're called) 10:15 Lajla: You mean #' 10:15 Lajla: ? 10:15 tonyg: you then have quote/quasiquote for lists, and the syntax-* variants for syntax 10:15 (quit) spidermario: Read error: Connection reset by peer 10:15 tonyg: yeah 10:15 Lajla: That's just synrax 10:15 tonyg: well, so is everything ;-) 10:16 Lajla: #'bla <-> (syntax bla) 10:16 tonyg: Yes, right 10:16 Lajla: No, I mean that 10:16 tonyg: sorry when I meant syntax-quote before I should have said "syntax" 10:16 tonyg: as you say 10:16 tonyg: It does the same job 10:16 tonyg: it's notionally a syntax-quote kind of thing :) 10:16 Lajla: Well, I'd find it more elegant if syntax truly just were lists like any other. 10:17 Lajla: Basically, your compiler then becomes a function that takes in a scheme datum and writes assembly to a port as a side effect or something 10:17 Lajla: Like (compile datum port) 10:17 tonyg: Mmm, but that's what is going on already. Just replace ' with #' 10:17 Lajla: Well, except that it doesn't take a normal datum as you enter it, but 'syntax' objects. 10:17 tonyg: Your compiler would be typed compile : Syntax Port -> Void 10:17 tonyg: that's data like any other 10:18 tonyg: cons cells aren't magic 10:18 tonyg: frinst I'd balk at representing numbers using them 10:18 tonyg: in real programs 10:18 Lajla: Like, I want (compile (list 'if #t (list 'display "hello world"))) to work, basically 10:18 tonyg: (compile #`(if #t (display "hello world")) my-port) 10:18 Lajla: Yes, and that is my problem. 10:19 Lajla: THat compile does not accept ordinary lists 10:19 Lajla: But 'syntax objects' 10:19 tonyg: (compile (datum->syntax-object '(if #t (display "hello world"))) my-port) 10:19 Lajla: Yap, and thatis my problem 10:19 Lajla: this supposed 'syntax object' 10:19 tonyg: the reason is that ordinary lists are not sufficiently expressive to cover everything that needs representing about syntax 10:19 Lajla: Exactly 10:19 tonyg: namely, the structure of the bindings involved 10:20 Lajla: Well, you can actually solve this. 10:21 Lajla: Say you have a function (macro-transform datum macros ...) 10:21 Lajla: Where you have 'macro objects' 10:21 Lajla: Which are pieces of data which describe what keywords they match, how, and how they treat bindings. 10:21 Lajla: You just have to transform it all at once. 10:21 Lajla: You can't just do it recursively. 10:21 Lajla: You have to feed it the top level datum 10:22 (quit) hanDerPeder: Quit: hanDerPeder 10:22 tonyg: That sounds awfully similar to what expand does, except that it uses the current global environment instead of an explicitly-given environment. 10:23 Lajla: Yap 10:23 Lajla: But then you can circumvent the use of 'syntax objects' and can use macro transformers like functions on any list. 10:24 tonyg: You still need syntax-objects *or similar* internally, to represent bindings. For example, define-syntax needs to hold the transformer in such a way that bindings are preserved hygienically. 10:24 tonyg: The API can take lists, sure 10:24 tonyg: but the macro transformers themselves can't. 10:24 Lajla: tonyg, sure, but this is done internally in the transform function 10:24 tonyg: After all, the reader does just read sexprs to begin with 10:25 tonyg: I'm not sure what you're asking for, then: did you want an API in terms of sexprs (in which case there already is one), or an implementation in terms of sexprs (in which case you can't have one ;-) )? 10:25 (join) hanDerPeder 10:25 Lajla: What basically bugs me is in racket is this. I can actually use (define foo :random-syntax-case-expression) and then do (define-syntax keyword foo) 10:26 Lajla: But I can't then use (foo :arbitrary-list:) to achieve the same transform at runtime 10:26 Lajla: It then outputs a syntax object, not a list 10:27 tonyg: which is what datum->syntax and syntax->datum are for, right? the transformer needs syntax-objects to maintain hygiene, so you can transform sexps into syntax at the API layer 10:27 tonyg: if you want to drop hygiene, you can write simple sexp transformations using match and quasiquote pretty easily 10:28 tonyg: it's just not syntax anymore is all 10:28 tonyg: it only *looks* like syntax ;-) 10:57 (quit) anRch: Quit: anRch 11:41 (join) aaSSaa 11:42 aaSSaa: Hi 11:45 (quit) aaSSaa: Client Quit 12:18 (quit) adlaius: Quit: Leaving 12:40 Lajla: tonyg, but it's stil not required if you transform the entire source code at once. 12:40 Lajla: It just means that the expand function cannot be recursive and call itself. 12:40 Lajla: Or how about this: 12:40 Lajla: (expand datum some-datum-carrying-all-info-of-bindings transformer-information ...) 12:40 Lajla: That could work 12:41 Lajla: It could call itself recursively with an updated version of that binding info 14:05 (join) Madars 14:07 Madars: I have a simple program '#lang racket\n(require some-lib)\n(define (somefunc) (...))'. however if somefunc is already defined in some-lib, then I get "identifier is already imported" error. is there a way I could redefine somefunc? 14:10 (join) b-man_ 14:20 Lajla: Madars, you can use set! 14:20 Lajla: (set! somefunc (lambda () ...)) 14:24 Madars: oh, that could do 14:25 Madars: thanks! 14:46 Lajla: Madars, you could also use (define Lajla 'awesome) and hope that the lib does not already bind a symbol 'lajla'. 14:50 Madars: Lajla, I didn't specify it before, but I want to redefine a function from some-lib, so that other functions from some-lib would call my redefined function. therefore I am actually hoping that lib does bind a symbol with the same name :-) 14:50 Lajla: Madars, I guess then your best shot is to define the lib 14:51 Lajla: If you for instance define cdr, the the length function will not fail for instance 14:51 Lajla: re-define cdr 15:54 (join) offby1` 15:56 (quit) offby1: Ping timeout: 272 seconds 16:33 (nick) offby1` -> offby1 16:33 (quit) offby1: Changing host 16:33 (join) offby1 16:46 (quit) eli: Remote host closed the connection 16:46 (join) eli 17:37 (join) jao 18:01 (join) Karl 18:02 (quit) Karl: Client Quit 18:39 (quit) masm: Quit: Leaving. 18:47 (quit) b-man_: Remote host closed the connection