Search found 30 matches

by kinghajj
Fri Mar 14, 2008 4:40 am
Forum: newLISP newS
Topic: newLISP and an SCM?
Replies: 8
Views: 5096

http://repo.or.cz/w/newlisp.git Homepage of the newLISP development Git mirror. If you have Git installed, use this to get the a clone of the repo: git clone git://repo.or.cz/newlisp.git Then use this in the repo directory to receive updates: git pull I'll update this whenever Lutz releases a new d...
by kinghajj
Thu Mar 13, 2008 5:30 pm
Forum: newLISP newS
Topic: newLISP and an SCM?
Replies: 8
Views: 5096

newLISP and an SCM?

Lutz, do you think that you could start using an SCM (preferably Git) to track changes to newLISP, and hosting a public repo? I'd like to have access to the latest, cutting-edge version of newLISP to help change the code in any way I can, and I think many others would like that, too.
by kinghajj
Fri Feb 15, 2008 7:15 pm
Forum: newLISP newS
Topic: "Autocurrying?"
Replies: 2
Views: 2636

"Autocurrying?"

I've started to learn F# (a OCaml-like language for .NET), and one feature that really struck me is automatic currying. Here's a newLISP-syntax example of what I mean (it is not valid newLISP code): (define (add-nums a b) (+ a b) (setq add10 (add-nums 10)) (add10 3) ; => 13 Basically, when you "call...
by kinghajj
Mon Dec 24, 2007 7:51 pm
Forum: newLISP newS
Topic: RC4 Encryption for newLISP
Replies: 3
Views: 2906

Those are hash functions, not encryption algorithms, but they are still useful.
by kinghajj
Mon Dec 24, 2007 8:38 am
Forum: newLISP newS
Topic: RC4 Encryption for newLISP
Replies: 3
Views: 2906

RC4 Encryption for newLISP

http://kinghajj.ath.cx/rc4-nl.tar.bz2 ; example usage (rc4-encrypt (rc4-encrypt "Hello!" "World")) ; => "Hello!" RC4 is much better than a one-time pad for practical applications. I would have implemented this is a primitive, builtin function, but the documentation doesn't cover that. It'd be much ...
by kinghajj
Sun Nov 11, 2007 12:14 am
Forum: newLISP newS
Topic: A simple minimal OO system for newLISP
Replies: 47
Views: 31429

I made some improvements to my define-class module.
  • -The functions documented with newlispdoc.
    -Instead of "inherits", the keyword is now "mixin" or "mixins".
    -Each class can now mixin more than one other class.
http://kinghajj.home.comcast.net/define-class.tar.bz2
by kinghajj
Fri Nov 09, 2007 5:01 am
Forum: newLISP newS
Topic: A simple minimal OO system for newLISP
Replies: 47
Views: 31429

OK, Here's the code to my "define-class" macro. There's one little issue with the attribute setters, in that they do not modify the original data, but rather make a new object with the changed attribute. However, because newLISP encourages this sort of style, maybe it will stay this way. ;;;;;;;;;;;...
by kinghajj
Thu Nov 08, 2007 7:36 am
Forum: newLISP newS
Topic: A simple minimal OO system for newLISP
Replies: 47
Views: 31429

Looking at Michael's code, I noticed that there are many redundancies with making classes. How about a macro to define classes? ;; D I S P L A Y A B L E (define-class (displayable) (define (string) (string self)) (define (print) (println (:string self)))) ;; P O I N T (define-class (point (x 0) (y 0...
by kinghajj
Sun Sep 16, 2007 8:01 am
Forum: newLISP newS
Topic: development release newLISP v.9.2.1
Replies: 13
Views: 8826

newBert wrote:
kinghajj wrote:I got a segmentation dump when trying dostring.

Code: Select all

> (dostring (c "hello") c)
Segmentation fault (core dumped)
Maybe :

Code: Select all

> (dostring (c "hello") (println c))
works better !
;)
But the point is that the code I wrote, while useless, should not crash the program.
by kinghajj
Sun Sep 16, 2007 6:53 am
Forum: newLISP newS
Topic: development release newLISP v.9.2.1
Replies: 13
Views: 8826

I got a segmentation dump when trying dostring.

Code: Select all

> (dostring (c "hello") c)
Segmentation fault (core dumped)
by kinghajj
Sat Sep 15, 2007 9:02 pm
Forum: newLISP newS
Topic: Idea to increase numeric accuracy in newLISP
Replies: 3
Views: 2981

64-bit OSes are usually near-100% compatible with their 32-bit counterparts. The 64-bit versions of Windows, for example, have a special library that re-implements 32-bit Windows on 64-bit Windows, allowing you to run any 32-bit program. I'm sure that Mac OS X will be no different. The main advantag...
by kinghajj
Sat Sep 15, 2007 6:49 am
Forum: newLISP newS
Topic: Idea to increase numeric accuracy in newLISP
Replies: 3
Views: 2981

Idea to increase numeric accuracy in newLISP

I use a 64-bit Linux distro, so this suggestion might not apply to all versions of newLISP. I've written a very simple Reverse Polish Notation calculator in C. To store numbers, the data type I chose was "long double." With this, I am able to calculate large numbers such as 2^2048 (*). In newLISP, h...
by kinghajj
Fri Sep 14, 2007 5:27 pm
Forum: newLISP newS
Topic: define-struct
Replies: 4
Views: 3418

Thanks, Lutz. I was wondering this morning how to do that, and using a macro did come to mind, but I was too busy to work on that.
by kinghajj
Fri Sep 14, 2007 4:04 pm
Forum: newLISP newS
Topic: define-struct
Replies: 4
Views: 3418

define-struct

Somebody mentioned wanting a defstruct macro in newLISP, so here's my attempt at implementing one. (define (truncate lst size) (let ((len (length lst))) (if (<= len size) (append lst (dup nil (- size len))) (chop lst (- len size))))) (define-macro (define-struct params) (let ((items (args)) (struct-...
by kinghajj
Thu Sep 13, 2007 9:06 am
Forum: newLISP newS
Topic: newLISP Database
Replies: 4
Views: 3627

Wow, that is a much cleaner version of truncate! Here's a more concise version.

Code: Select all

(define (truncate lst size)
  (let ((len (length lst)))
    (if (<= len size)
      (append lst (dup nil (- size len)))
      (chop lst (- len size)))))
I'll use this in the next release. Thanks.
by kinghajj
Wed Sep 12, 2007 11:32 pm
Forum: newLISP newS
Topic: newLISP Database
Replies: 4
Views: 3627

newLISP Database

I wrote this up quickly last night and this afternoon. It's a database library written completely in newLISP. It's very simple, but I'll make it more capable in later releases. I wrote this because I didn't want to deal with SQL. I suppose I could have written a wrapper around the sqlite3 library fo...
by kinghajj
Wed Sep 12, 2007 10:22 pm
Forum: newLISP newS
Topic: Contexts as Objects
Replies: 42
Views: 33334

Re: Contexts as Objects

I wrote a post at http://kinghajj.blogspot.com/2007/09/contexts-as-objects-in-newlisp.html detailing how to use contexts to implement classes and objects in newLISP. Nice entry -- short and sweet. BTW, there is an error (really, a typo causing an error) in your code: (context 'Point) (define (Point...
by kinghajj
Mon Sep 10, 2007 10:57 pm
Forum: newLISP newS
Topic: newLISP unit tests
Replies: 1
Views: 2162

newLISP unit tests

I was reading the book Practical Common Lisp, and found a great implementation of unit tests in Common Lisp. So, I thought I'd re-make them (in my own way, of course,) in newLISP. nltests.lsp ;; nltests.lsp -- testing macros ;; Copyright (C) 2007 Samuel Fredrickson. (context 'nltests) ; used to repo...
by kinghajj
Sun Sep 09, 2007 9:09 am
Forum: newLISP newS
Topic: Contexts as Objects
Replies: 42
Views: 33334

I thought that you might have found this already. Is there a link to where you describe it?
by kinghajj
Sun Sep 09, 2007 7:25 am
Forum: newLISP newS
Topic: Contexts as Objects
Replies: 42
Views: 33334

Contexts as Objects

I wrote a post at http://kinghajj.blogspot.com/2007/09/contexts-as-objects-in-newlisp.html detailing how to use contexts to implement classes and objects in newLISP. I've just discovered this--though I'm probably not the first--so I haven't found out all that you can do with this. Hope you enjoy it.
by kinghajj
Sat Sep 08, 2007 7:20 am
Forum: newLISP newS
Topic: (apply case) doesn't work as expected
Replies: 3
Views: 2935

I wrote a simple macro that will work like apply, but works correctly with case.

Code: Select all

(define-macro (myapply func arglist)
  (eval (cons func (eval arglist))))
by kinghajj
Sat Sep 08, 2007 7:03 am
Forum: newLISP newS
Topic: (apply case) doesn't work as expected
Replies: 3
Views: 2935

(apply case) doesn't work as expected

These two pieces of code should be equivalent, correct? But they are not. (apply case ...) doesn't work.

Code: Select all

(apply case '(1 (1 2)))

(case 1 (1 2))
by kinghajj
Wed Sep 05, 2007 10:16 pm
Forum: newLISP newS
Topic: problem with tabs in newlisp-edit/newlisp-gs
Replies: 4
Views: 3692

I use the font DejaVu Sans Mono at 16pt, and for me having the tab at 20pt looks perfect. Thanks for the tip, Lutz.
by kinghajj
Wed Sep 05, 2007 6:40 am
Forum: newLISP newS
Topic: problem with tabs in newlisp-edit/newlisp-gs
Replies: 4
Views: 3692

problem with tabs in newlisp-edit/newlisp-gs

the newlisp-gs editor does not interpret tabs well. instead of defining a tab to look like 1, 2, 3 or 4 spaces, it seems to use a number above 1.5 but below 2. This is not very aesthetic, and I think that this number should be user-specified in the settings file. The first function uses tabs, while ...
by kinghajj
Thu Aug 30, 2007 3:09 am
Forum: newLISP newS
Topic: Should there be a backquote in newLISP?
Replies: 3
Views: 3042

I saw in a search of the forums that Lutz doesn't like backquotes, so I've come up with a possible solution. I've implemented a backquote-like feature with a macro. ; takes an item from the template and decides whether to evaluate it or not. ; if the item starts with an "@" and is a symbol, then ret...