Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Who uses GUILE?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dr. Nikolaus Klepp  
View profile  
 More options Mar 6 2009, 5:17 am
Newsgroups: comp.lang.scheme
From: "Dr. Nikolaus Klepp" <dr.kl...@gmx.at>
Date: Fri, 06 Mar 2009 11:17:17 +0100
Local: Fri, Mar 6 2009 5:17 am
Subject: Who uses GUILE?
Hi all!

I just wonder who uses GUILE and for what.

Nik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
yuridichesky  
View profile  
 More options Mar 7 2009, 8:02 am
Newsgroups: comp.lang.scheme
From: yuridichesky <yuridiche...@gmail.com>
Date: Sat, 7 Mar 2009 05:02:37 -0800 (PST)
Local: Sat, Mar 7 2009 8:02 am
Subject: Re: Who uses GUILE?
On Mar 6, 1:17 pm, "Dr. Nikolaus Klepp" <dr.kl...@gmx.at> wrote:

> I just wonder who uses GUILE and for what.

SICP, Project Euler, algorithms testing and prototyping, some math.

Regards,

Yuri


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
KenD  
View profile  
 More options Mar 7 2009, 11:12 am
Newsgroups: comp.lang.scheme
From: KenD <Ken.Dic...@whidbey.com>
Date: Sat, 7 Mar 2009 08:12:39 -0800 (PST)
Local: Sat, Mar 7 2009 11:12 am
Subject: Re: Who uses GUILE?
On Mar 6, 2:17 am, "Dr. Nikolaus Klepp" <dr.kl...@gmx.at> wrote:

> I just wonder who uses GUILE and for what.

I randomly reset the hostname and MAC address of my laptop at boot-up
to make wireless access a bit safer.   This includes editing /etc/
hosts [e.g. OpenBSD script below].

For quick reliable scripts, I'd rather do it in Scheme!

Cheers,
-KenD
===================================================================

#!/usr/local/bin/guile -s
!#

;; Set hostname to a random dictionary word

(set! *random-state* (seed->random-state (current-time)))

(define wordsfile "/usr/share/dict/words")
(define hostfile  "/etc/hosts")
(define backfile  "/etc/hosts.bak")
(define tmpfile   "/tmp/hosts.new")
(define hprefix   "127.0.1.1 ")

(define (gen-random-position fname)
;; Return a random position in fname or #f
  (and (file-exists? fname)
       (random (stat:size (stat fname))))
)

(define (get-line port)
  ;; return text or #f for EOF
  (let loop ( (chars '()) (next-char (read-char port)) )
     (cond
      ((eof-object? next-char) #f)
      ((eq? next-char #\newline) (list->string (reverse chars)))
      (else (loop (cons next-char chars) (read-char port))))
) )

(define (random-line-from-file fname)
  (let loop ( (start-pos (gen-random-position fname)) )
    (if (not start-pos)
        "bogus" ;; not found
        (let ( (port (open-input-file fname)) )
          (file-set-position port start-pos)
          ;; get partial word, then whole word [next line]
          (let ( (line (and (get-line port) (get-line port))) )
            (close-input-port port)
            ;; if random line near/at EOF, get another
            (if (and line (> (string-length line) 0))
                line
                (loop (gen-random-position fname)))
) ) ) ) )

(define (match-prefix? prefix text)
  (let ( (prefix-len (string-length prefix)) )
    (and (<= prefix-len (string-length text))
         (equal? prefix (substring text 0 prefix-len)))
) )

;; Return a random dictionary word as new hostname
(let* ( (newhost    (random-line-from-file wordsfile))
        (cmd-str (string-append "hostname " newhost))
      )
;  (display (string-append "  " cmd-str " --> "))
;  (display (system cmd-str))
;  (newline)
;;; Reset hostname
  (delete-file "/etc/myname")
  (with-output-to-file "/etc/myname"
    (lambda () (display newhost) (newline)))
;;; Edit /etc/hosts for new hostname
  (if (file-exists? tmpfile)
      (delete-file tmpfile))
  (call-with-input-file hostfile
    (lambda (inport)
      (call-with-output-file tmpfile
        (lambda (outport)
          (let loop ( (line (get-line inport)) )
            (if line ;; not yet EOF
                (begin
                  ;; filter for line w hostname
                  (if (match-prefix? hprefix line)
                      (begin
                        (display hprefix outport)
                        (display newhost outport))
                      (display line outport))
                  (newline outport)
                  (loop (get-line inport)))
                'done))
   ) ) ) )
   (if (file-exists? backfile)
       (delete-file backfile))
   (rename-file hostfile backfile)
   (copy-file tmpfile hostfile)
)

;;  --- E O F ---  ;;


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vend  
View profile  
 More options Mar 8 2009, 5:21 pm
Newsgroups: comp.lang.scheme
From: Vend <ven...@virgilio.it>
Date: Sun, 8 Mar 2009 14:21:09 -0700 (PDT)
Local: Sun, Mar 8 2009 5:21 pm
Subject: Re: Who uses GUILE?
On 6 Mar, 11:17, "Dr. Nikolaus Klepp" <dr.kl...@gmx.at> wrote:

> Hi all!

> I just wonder who uses GUILE and for what.

> Nik

I used it a few years ago for evolutionary programming.
Probably not the ideal solution, but I chose it because it interacts
with C/C++ easly, and the fitness evaluation speed was limited on the C
++ side, so the speed of the Scheme implementation was not an issue.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jose A. Ortega Ruiz  
View profile  
 More options Mar 8 2009, 8:53 pm
Newsgroups: comp.lang.scheme
From: "Jose A. Ortega Ruiz" <j...@gnu.org>
Date: Mon, 09 Mar 2009 01:53:43 +0100
Local: Sun, Mar 8 2009 8:53 pm
Subject: Re: Who uses GUILE?
"Dr. Nikolaus Klepp" <dr.kl...@gmx.at> writes:

> Hi all!

> I just wonder who uses GUILE and for what.

i use it as the extension language for GNU MDK (an environment emulating
Knuth's MIX/MIXAL), for quick hacks and scripts, and for interfacing
with some in-house C-libraries at work using a pleasant REPL.

jao


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »