Search found 7 matches

by gatesphere
Fri Dec 07, 2012 5:13 pm
Forum: newLISP in the real world
Topic: Is there an equivalent to flet or labels?
Replies: 7
Views: 3486

Re: Is there an equivalent to flet or labels?

Thanks for all of those links, but I've read them already! :) I'm aware that it's not CLISP or Scheme. That's why I'm attracted to it. I can't stand CLISP's bloat. I was able to define an anaphoric if like this: (define-macro (aif) (let ((it (eval (args 0)))) (if it (eval (args 1)) (eval (args 2))))...
by gatesphere
Fri Dec 07, 2012 4:18 pm
Forum: newLISP in the real world
Topic: Is there an equivalent to flet or labels?
Replies: 7
Views: 3486

Re: Is there an equivalent to flet or labels?

That's some nice code. However, I'm failing when trying to use it to write another macro based on it: (define-macro (alambda) (labels ((self (args 0) (1 args))) self)) (setf 'a (alambda (n) (if (= n 0) 1 (* n (self (- n 1)))))) (println (a 5)) I'm getting these errors: ERR: symbol is protected in fu...
by gatesphere
Thu Dec 06, 2012 5:12 pm
Forum: newLISP in the real world
Topic: Is there an equivalent to flet or labels?
Replies: 7
Views: 3486

Is there an equivalent to flet or labels?

Hi all,

Wondering if there's an equivalent to flet or labels in newLISP. I don't see any in the docs. There might be a way to hack it together with letex and lambda, but I'm not sure.

Any help?

Thanks.
by gatesphere
Tue Nov 13, 2012 8:25 pm
Forum: So, what can you actually DO with newLISP?
Topic: A small GPIO library for the Raspberry Pi
Replies: 0
Views: 4887

A small GPIO library for the Raspberry Pi

Hello all,

I've been playing around with newLISP on my Raspberry Pi, and I whipped up a quick library to interface with the GPIO pins.

It's available here in case anyone's interested: https://github.com/gatesphere/raspi-gpio-newlisp

Man this language is sexy.
by gatesphere
Fri Nov 09, 2012 12:28 am
Forum: newLISP in the real world
Topic: How does (define (sum (x 0)) (inc 0 x)) work?
Replies: 8
Views: 3905

Re: How does (define (sum (x 0)) (inc 0 x)) work?

Thanks so much for this! It makes a lot of sense. And it seems to be correct, based on the following experiment:

Code: Select all

newLISP v.10.4.4 on Linux IPv4/6 UTF-8, execute 'newlisp -h' for more info.

> (setf a '(inc 0 1))
(inc 0 1)
> a
(inc 0 1)
> (eval a)
1
> a
(inc 1 1)
> (eval a)
2
> a
(inc 2 1)
by gatesphere
Thu Nov 08, 2012 1:27 pm
Forum: newLISP in the real world
Topic: How does (define (sum (x 0)) (inc 0 x)) work?
Replies: 8
Views: 3905

Re: How does (define (sum (x 0)) (inc 0 x)) work?

Thanks cormullion. I had found Kazimir's example prior to the (sum) example. I understand Kazimir's function. I'm having a hard time understanding either (sum) or the (changeme) that you introduced... Is there any way you could walk me through what happens? Thanks. EDIT: Okay, I understand (changeme...
by gatesphere
Wed Nov 07, 2012 4:26 pm
Forum: newLISP in the real world
Topic: How does (define (sum (x 0)) (inc 0 x)) work?
Replies: 8
Views: 3905

How does (define (sum (x 0)) (inc 0 x)) work?

Hello all... So I came across this example function in the Code Patterns guide. I'm new to newlisp, so this code is confusing me. How does this function have memory? (define (sum (x 0)) (inc 0 x)) I understand that (x 0) means that 0 is a default value for x, what I'm not understanding is why does s...