Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - bairui

#1
newLISP newS / Re: newLISP stable release 10.6.2
January 27, 2015, 04:37:17 PM
Excellent, Lutz. Kudos for the quick announcement.
#2
newLISP in the real world / Re: (newbie) Listiness
October 25, 2014, 05:15:12 AM
Hi, Mark,



The dolist iterates the list one element at a time. Because you're not printing in that loop, the interpreter is silently throwing away each internal result. Finally the result of the whole loop (its final evaluation) is shown by the interpreter, which is (() 5), as you would expect.



For your stated goal of (() 1 2 3 4 5) you could merely do (cons bar foo)



-- bairui
#3
Not as veratile as cormullion's match solution, but works for the given example:


(map (curry map int) '(("1" "2" "3") ("4")))
#4
Ah, that makes sense. Thanks, Lutz.
#5
With:


(map (apply max) '((0 1 2) (3 4 5)))

we see the expected error:



ERR: missing argument in function max



I don't know why we don't see this with the + function, but the solution to both cases is to use curry:


(map (curry apply +) '((0 1 2) (3 4 5)))
#6
newLISP in the real world / Re: regex \\d{n} problem
March 22, 2014, 03:50:32 AM
Heh... I see, Cormullion. I felt that way about Perl before leaving her for Ruby (before newLISP and I met). Perl had a way of making you feel like a mad genius one day, and the village idiot the next.



Jeffrey Friedl's Mastering Regular Expressions is a *really* good read. I highly recommend it.



@hds1: you're welcome. Finally something on these forums I can actually answer! o/
#7
newLISP in the real world / Re: regex \\d{n} problem
March 21, 2014, 03:45:45 PM
Aw, come now, Cormullion... Regular Expressions are beautiful and powerful.
#8
newLISP in the real world / Re: regex \\d{n} problem
March 20, 2014, 04:09:03 PM
As with all regex engines, use anchors (like ^ and $) to restrict the match to start/end boundaries:


> (regex {d{3}} "12343243242")
("123" 0 3)
> (regex {^d{3}} "12343243242")
("123" 0 3)
> (regex {d{3}$} "12343243242")
("242" 8 3)
> (regex {^d{3}$} "12343243242")
nil
> (regex {^d{3}$} "123")
("123" 0 3)
#9
Whither newLISP? / Re: fexpr issues
March 08, 2014, 12:53:06 AM
Hi, Lutz,



In the last example box for (macro ...):


(define-macro (fexpr-double X) i

Trailing i a vim oopsie? :-)
#10
Whither newLISP? / Re: fexpr issues
March 04, 2014, 11:48:25 PM
Lutz, re: the manual entry for (macro ...)



1. The signature still has 'define' instead of 'macro'.

2. "But macro definitions cannot be repeated for the same symbol during the sane newLISP session." (sane)
#11
Whither newLISP? / Re: Ethereum
February 14, 2014, 08:12:19 PM
Excellent. That should sort things out, one way or another.
#12
Whither newLISP? / Re: Ethereum
February 13, 2014, 10:58:19 PM
@TedWalther: I'm honestly not sure *what* Ethereum _wants_ from newLISP. Perhaps that's something @janeTA can clarify. I had assumed though they they were happy with their VM/API and were looking for others to ratify their party.
#13
Whither newLISP? / Re: Ethereum
February 11, 2014, 07:23:24 PM
Interesting observation, Lutz. That has helped me make a tech decision I've been pondering for a week or so now; thanks! :-)



But I must admit I am still confused about newLISP's possible Ethereum interface. Surely if there was a newLISP interface, it would be... newLISP... right? The causal non-programmer newLISP *users* of the newLISP Ethereum interface would be using newLISP. It's only the newLISP-Ethereum API/library designer who has to know & understand the Ethereum forth api and care about stack stability... no?
#14
Whither newLISP? / Re: Ethereum
February 11, 2014, 12:29:44 AM
I was forced to experience Forth in uni by my most excellent computer architecture lecturer, Terry Anstey. I was too young and naive to value the experience at the time, but I have just recently decided to remedy that failing.



newLISP needs a killer-app; I don't know if this can be it or not.



Sadly, I am not agile enough with either lisp or maths to lead the newLISP + Ethereum charge. I will, however, be watching with interest those who do.



Lutz, do you have anything else to offer here? Anyone else with an opinion?
#15
Hi, newlispers,



I wrote a PEG (Parsing Expression Grammar) parser for Vim (https://github.com/dahu/Vimpeg">https://github.com/dahu/Vimpeg) a while ago and recently ported it to newLISP (https://github.com/dahu/nlpeg">https://github.com/dahu/nlpeg). I would love for you guys to review my work. I am new to lisp and expect that I have made some boo-boos along the way.



NOTE: the nlpeg-peg-parser.lsp is UNFINISHED, however the nlpeg.lsp is ready for review. Examples of using nlpeg.lsp can be seen in the test files and calc.lsp.



When nlpeg-peg-parser.lsp is finished, grammars can be specified using standard PEG grammar format in [text] strings, if preferred over the explicit API approach available through nlpeg.lsp currently.