Search found 604 matches

by Jeff
Sat Jan 05, 2013 10:57 pm
Forum: newLISP newS
Topic: libevent2
Replies: 6
Views: 8668

Re: libevent2

Here is an example of how a simple echo server might look: (load "libevent2.lsp") (setf listen (net-listen 8000)) (unless listen (throw-error (net-error))) (libevent:init) (libevent:watch listen libevent:READ (lambda (fd e id , client) ; accept a new connection (setf client (net-accept listen)) ; wa...
by Jeff
Sat Jan 05, 2013 10:02 pm
Forum: newLISP newS
Topic: libevent2
Replies: 6
Views: 8668

Re: libevent2

Actually, that is not exactly true. That is more how signals work, although not in libevent. In libevent, the application is controlled by the loop. Before starting the loop, you register at least one socket or timer to run in it. It is an error to run a loop with no events registered. For example, ...
by Jeff
Fri Jan 04, 2013 8:01 pm
Forum: newLISP newS
Topic: libevent2
Replies: 6
Views: 8668

libevent2

Howdy folks. Haven't been around in a while. Wanted to let you know that I put together a wrapper for libevent2 using the new FFI features. Made it very easy. You can find it on github here - https://github.com/jsober/nl-event.
by Jeff
Tue Dec 15, 2009 11:51 am
Forum: newLISP newS
Topic: libmemcached api
Replies: 6
Views: 4925

Re: libmemcached api

Without checking the code again, it looks like you are doing things right. Unfortunately, I do not have a lot of time for personal projects at the moment. If you can find the bug and fix it, I would be happy to update the sources on my site and google projects.
by Jeff
Tue Oct 13, 2009 2:43 pm
Forum: newLISP in the real world
Topic: Mapping with two arguments
Replies: 7
Views: 2812

Le pido perdon. Hablo solamente ingles y espanol. Y lisp ;)
by Jeff
Tue Oct 13, 2009 2:41 pm
Forum: newLISP in the real world
Topic: Mapping with two arguments
Replies: 7
Views: 2812

Was he trying to append "-Schwanz" or "-Schwanz-Schwanz-Schwanz"?
by Jeff
Tue Oct 13, 2009 2:30 pm
Forum: Whither newLISP?
Topic: Few questions ...
Replies: 24
Views: 13228

In fact, I think *I* may have written that :)
by Jeff
Tue Oct 13, 2009 2:21 pm
Forum: newLISP in the real world
Topic: Mapping with two arguments
Replies: 7
Views: 2812

You need to pass map a function. You can do that with curry:

Code: Select all

(map (curry add-tail (dup "-Schwanz" 3 true)) '("Hund" "Katze" "Pinguin"))
by Jeff
Tue Oct 13, 2009 1:39 pm
Forum: Whither newLISP?
Topic: Few questions ...
Replies: 24
Views: 13228

Thank you, Lutz. This is exactly the hook we need to extend the language. This is a good thing for the language. Will reader-event be hooked into run-time compilation as well? That is, when I call read-expr, will the expression be first run through reader-event? I believe it should, so that translat...
by Jeff
Tue Oct 13, 2009 12:25 pm
Forum: Whither newLISP?
Topic: Few questions ...
Replies: 24
Views: 13228

Lutz, one other thing. Shouldn't this be reader-event, not read-event?

Code: Select all

(define (resume)
  (read-event rewrite))
Neither is documented in the manual.
by Jeff
Tue Oct 13, 2009 12:11 pm
Forum: Whither newLISP?
Topic: Few questions ...
Replies: 24
Views: 13228

That's not what I meant. I meant that it would be nice to have the type of compile-time expansion you built using read-expr but in the context of a non-defining expression. More like letex than define, in other words. That way we could use them as part of a regular newlisp macro. Like the backtick i...
by Jeff
Tue Oct 13, 2009 1:08 am
Forum: Whither newLISP?
Topic: Few questions ...
Replies: 24
Views: 13228

You know, Lutz, it would be nice if there were an operator that expanded at compile-time, rather than the entire function definition. That way, it could be evaluated inside a macro and provide the full power of both f-expressions and compile-time syntax transformations.
by Jeff
Mon Oct 12, 2009 7:17 pm
Forum: Whither newLISP?
Topic: Evaluating Clojure
Replies: 10
Views: 5849

newlisp's new send/receive functions to communicate between processes are very nice. They let you write coroutines between processes.

Also check out the news forum. I just wrote a module wrapping eventlib, which adds event-based processing for sockets.
by Jeff
Mon Oct 12, 2009 6:00 pm
Forum: Whither newLISP?
Topic: Few questions ...
Replies: 24
Views: 13228

This nice thing about these macros is that you are actually performing a compile-time transformation on the code. You can use them to easily define destructive setters on OOP classes, for example, because they would translate into the actual code that returns a reference. Perhaps something like this...
by Jeff
Mon Oct 12, 2009 2:18 pm
Forum: Whither newLISP?
Topic: Asynchronous I/O with libevent
Replies: 1
Views: 2521

Asynchronous I/O with libevent

Hey folks, I am in the process of polishing up the interface to a wrapper module around libevent, an asynchronous I/O library for Windows, Linux, Unix, and OSX. What is asynchronous I/O? Threading and multiprocessing are expensive ways to take advantage of multi-core systems. They add complexity to ...
by Jeff
Fri Oct 09, 2009 3:27 pm
Forum: Whither newLISP?
Topic: GeSHi plugin
Replies: 6
Views: 4516

Thanks. That will make my life easier every time the wordpress geshi plugin gets an update :)

And I am no giant. I am under 6 foot. I don't even know what, "fee fie foe fum," means!
by Jeff
Wed Oct 07, 2009 10:14 pm
Forum: newLISP in the real world
Topic: How to take one byte from a string
Replies: 11
Views: 3377

dostring processes a string one char at a time...
by Jeff
Wed Oct 07, 2009 1:37 pm
Forum: Whither newLISP?
Topic: Contexts and macros
Replies: 1
Views: 2358

Contexts and macros

If the preferred method to avoid variable capture is to use lexically scoped macros, why not make all macros lexically scoped by default? Why not have the reader implicitly read local variables in a macro as if the macro were written: (context 'my-macro) (define-macro (my-macro ...) ...) (context 'p...
by Jeff
Tue Oct 06, 2009 7:39 pm
Forum: newLISP in the real world
Topic: net-receive and wait-string
Replies: 2
Views: 1336

Thanks!
by Jeff
Tue Oct 06, 2009 7:05 pm
Forum: newLISP in the real world
Topic: net-receive and wait-string
Replies: 2
Views: 1336

net-receive and wait-string

Does net-receive block while waiting on wait-string if:

1) it is not found before int-max-bytes are read
2) it is not found in the bytes immediately available from the remote socket

If it does block for situation 2, is there any way to evade that behavior while still using the built-in buffer?
by Jeff
Mon Oct 05, 2009 5:52 pm
Forum: Whither newLISP?
Topic: newLISP compiler
Replies: 9
Views: 6453

I think an extension api with the following components would let us do whatever is necessary: 1) an include with the major types - nil, cell, symbol, etc 2) a shared library would have an "init" function that calls a macro or function that registers a function with newlisp; it would also have a "clo...
by Jeff
Mon Oct 05, 2009 1:41 pm
Forum: newLISP in the real world
Topic: Timing question
Replies: 11
Views: 3265

Code: Select all

(define (triple n)
  (expand (* 3 n) n))
Or use 'eval'.
by Jeff
Mon Oct 05, 2009 12:58 pm
Forum: Whither newLISP?
Topic: newLISP compiler
Replies: 9
Views: 6453

It would be nice to have a more robust API to extend newlisp from C, though. The "extend rather than embed" philosophy of Python is equally applicable to newlisp. I write a lot of C libraries and end up spending a lot of time gluing the code together with newlisp. A few glue functions in a shared li...
by Jeff
Mon Oct 05, 2009 12:55 pm
Forum: newLISP in the real world
Topic: Timing question
Replies: 11
Views: 3265

Remember that function arguments are passed by value - that is, they are copied on every call. You can avoid this by assigning a large value to a symbol and passing the symbol itself to the function instead.
by Jeff
Fri Oct 02, 2009 12:05 pm
Forum: newLISP in the real world
Topic: Searching in nested list
Replies: 3
Views: 1588

Here is a tutorial on drilling down into xml content in newlisp:

http://www.artfulcode.net/articles/working-xml-newlisp/

Here is a tutorial on using find-all with xml (among others) in newlisp:

http://www.artfulcode.net/articles/usin ... -find-all/