<div dir="ltr"><div><div><div>Thanks for reply. <br></div></div></div><div><br></div><div>Regarding to the module is there any way to change the reader macro to instead of write (namespace#fun1 2 4 5) it be (namespace/fun1 2 4 5). Is it possible to list the functions and symbols in the namespace ???<br></div><div><br></div><div>Regarding Gambit readtable: Is it possible to implement the transformation of square brackets delimiters into vectors like Clojure without quotes in this way:<br><br>user=> <br>user=> [(+ 3 4 5) 1 2 3 :x :y]<br>[12 1 2 3 :x :y]<br>user=><br></div><div><div><br>user=> '[(+ 3 4 5) 1 2 3 :x :y]<br>[(+ 3 4 5) 1 2 3 :x :y]<br>user=> <br><br><br></div><div>When I try in this way I got:<br></div><div><br>> (macro-readtable-r6rs-compatible-read?-set! (current-readtable) #f)<br>
> '[1 2 3]<br>
#(1 2 3)<br><br>[(+ 3 4 5) 1 2 3 x: y:]<br>*** ERROR IN (console)@50.1 -- Ill-formed expression<br>> <br><br>> <br>'[(+ 3 4 5) 1 2 3 x: y:]<br>#((+ 3 4 5) 1 2 3 x: y:)<br>> <br><br></div><div>Is it possible to change the way the Gambit repl displays the output for vectors and hash table?? I mean instead of display <b>#(1 2 3 4)</b> for vectors, display <b>[1 2 3 4]</b> and for hash table.<br><br>> (list->table '((x 10) (y 200) ("sym" "test")))<br>#<table #5><br>>  <br><br> Instead of display: <b>#<table #5></b>, it displays <b>{x 10 y 200 "sym" "test"}</b><br><br><br></div><div>Thanks in advance.<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 7 January 2016 at 00:27, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes Gambit’s readtable can be modified to do what you want:<br>
<br>
> '[1 2 3]<br>
(1 2 3)<br>
> (include "~~lib/_gambit#.scm")<br>
> (macro-readtable-r6rs-compatible-read?-set! (current-readtable) #f)<br>
> '[1 2 3]<br>
#(1 2 3)<br>
> '{a: 11 b: 22 c: 33}<br>
(a: 11 b: 22 c: 33)<br>
> (macro-readtable-brace-keyword-set! (current-readtable) 'create-hashtable)<br>
> (define (create-hashtable . rest)<br>
    (let loop ((lst rest) (alist '()))<br>
      (if (pair? lst)<br>
          (loop (cddr lst)<br>
                (cons (cons (keyword->string (car lst)) (cadr lst)) alist))<br>
          (list->table alist))))<br>
> (define t {a: 11 b: 22 c: 33})<br>
> (table-ref t "b")<br>
22<br>
<br>
Gambit also has namespaces, so you can do:<br>
<br>
----------------------------------------------------------------<br>
;; file: "namespace.scm"<br>
<br>
(namespace ("namespace#") ("" include))<br>
(include "~~lib/gambit#.scm")<br>
<br>
(define (fun1 x y z) (+ x y z))<br>
----------------------------------------------------------------<br>
<br>
and at the REPL:<br>
<br>
> (load "namespace.scm")<br>
"/Users/feeley/namespace.scm"<br>
> (namespace#fun1 2 4 5)<br>
11<br>
<br>
Marc<br>
<div><div class="h5"><br>
> On Jan 6, 2016, at 6:50 PM, caio rodrigues <<a href="mailto:caiorss.rodrigues@gmail.com">caiorss.rodrigues@gmail.com</a>> wrote:<br>
><br>
> Hi list. Is there any way to make Gambit repl read for instance [1 2 3 4 5] and turn it into a vector #(1 2 3 4 5) and also everything into brackets {x: 2 y: 4} into a hash table ?<br>
><br>
> Another question: Is there any module system implementation for gambit that can import packages like Python, import sys or a clojure-like module system ?<br>
><br>
> Example Clojure-like module system:<br>
><br>
> file: namespace.ss<br>
><br>
> ---------------------------------<br>
><br>
> (ns namespace)<br>
><br>
> (define (fun1 ....)<br>
><br>
> (define (fun2 x y z) ...)<br>
><br>
> ---------------------------------<br>
><br>
> and then in the repl:<br>
><br>
> (require 'namespace)<br>
><br>
> (namespace/fun1 2 4 5)<br>
><br>
> Thanks in advance.<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Gambit-list mailing list<br>
> <a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
> <a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br>
</blockquote></div><br></div>