IRC channel logs
2018-07-15.log
back to list of logs
<brendyn>Is it possible to do the picture language stuff from SICP in guile? <brettgilio>If any standard is going to be compliant to SICP, it is going to be Racket, Guile, or MIT Scheme <brendyn>brettgilio: it requires being able to print images to the screen <brettgilio>It's been awhile since I touched SICP, but I have it on my computer. Can you give me a page number for reference? <brendyn>It seems to just assume that I already have this picture language and functions like beside <brettgilio>brendyn: Page 176, Chapter 2, page top reads "takes a tag and contents..." <brendyn>That's page 273 for me. I've got a revamped PDF version of SICP <brendyn>I wouldn't mind doing it in racket but I installed racket in Guix and sicp language doesn't exist in it <brettgilio>Dr. Racket should have a scheme standard under "older languages" or something <brettgilio>Yeah, I don't see any reason why you couldn't be able to do such manipulation in Guile. You should be able to define the picture directly from its file path. <brettgilio>brendyn: What environment are you working in for Scheme? <EuAndreh[m]>What's the go-to/recommended static site builder in Guile? <stis>rain1: not much slacking today resting after some heavy codeing of a python port ty guile <mwette>stis: nice. So I'm practicing lang ports using javascript. How do you handle strings for your nearly-Python? Python interns strings so do you have some internning method, just use Guile strings, or something else? <stis>i'm sloppy and use guile strings <stis>modelling it using symbols could be done but i fear that you will get pollution when e.g. string analysing <mwette>What about associative arrays? Do you index by string also? <rain1>so guile can run python scripts? <mwette>where associative arrays == Python dictionary objects == Guile hash-tables, I assume <mwette>rain1: stis is working on it. Guile has ecmascript (aka javascript) in the distribution, and elisp also. The reference manual describes how to generate your own extension language to host in Guile. <rain1>how did you write the parser? <stis>mwette: yes you can idex by strings. faster to index by interned stuff though <stis>rain1: ideomatic python works fine now, if you want the batteries you need to wait. <stis>re module os sys pickle string is implemented though, more to come <ArneBab>stis: won, I did not see that — need to play with it and maybe get some of my python tools compatible! <mwette>I'm having issue with guile running my javascript. If I type, essentially, `var a = 1', then `print(a)' in the interactive interpreter, I get expected result. But, if I put those statements in a file and run `guile --language=javascript' file.js, I get failure: the compiler can't find the top-level symbol "a". <daviid>mwette: can you load the script, run (main ...) and then ,bt ? <mwette>I will try something ... that's weird. <mwette>in scheme mode "load" is a procedure, but after I ",L javascript", "load" is a syntax-transformer. <mwette>You can duplicate with ",L ecmascript". <daviid>yeah, I as suspecting this, maybe gdb or strace gives more info ... I don't know <mwette>I tried primitive-load from javascript but then i have unresolved symbols from the file. <daviid>how about turning the file into a script, then after #!/bin/bash you'd do exec guile --lang ... ? <daviid>anyway, you know ths javascript 'module' needs love <daviid>i don't think it is maintained (or maybe just 'stalled') <mwette>This is my own javascript implentation. It lives in the example/ subdir of my nyacc distribution. <mwette>The ecmascript one is 2k lines of code w/ zero comments. But it does give me a place to look for hints. Hence, my javascript is a learning tool. <daviid>i thought it was ijp implentation ... <mwette>To work interactively one needs to generate a parser (or reader) that will parse one top-level construct and return. Many parsers will parse to EOF, which does not work. Also, I found that the Guile language system expects readers to return the eof-object on EOF. <mwette>My reader outputs SXML. I then use Andy's foldts*-values to convert to tree-il. <mwette> ArneBab: Thanks. I don't see a need to do that. I fixed my parser so that once the top-level production is reduced it returns. Here is the new interactive parser: http://paste.debian.net/1033820/ <ArneBab>(though I must admit that I don’t understand directly from reading what it does) <mwette>ArneBab: It implements a pushdown automata. The parser genenator generates a state machine. Either a lookahead token is absorbed and generates a state transition (shift), or the lookahead token signals a completion of a production rule (a reduction). <jralls>Converting the string to an SCM beforehand and using scm_eval_string() doesn't help.